• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# WebControls.FormViewUpdateEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Web.UI.WebControls.FormViewUpdateEventArgs的典型用法代码示例。如果您正苦于以下问题:C# FormViewUpdateEventArgs类的具体用法?C# FormViewUpdateEventArgs怎么用?C# FormViewUpdateEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FormViewUpdateEventArgs类属于System.Web.UI.WebControls命名空间,在下文中一共展示了FormViewUpdateEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: FormView1_ItemUpdating

        protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e)
        {
            e.NewValues["logtime"] = DateTime.Now.ToString();

            e.NewValues["clerkid"] = Convert.ToInt32(Session["UserId"]);
            e.NewValues["repairsheetid"] = Convert.ToInt32(e.OldValues["repairsheetid"]);
        }
开发者ID:CSSource,项目名称:WebServiceSystem,代码行数:7,代码来源:SheetLog.aspx.cs


示例2: fv_ItemUpdating

        protected void fv_ItemUpdating(object sender, FormViewUpdateEventArgs e)
        {
            if (this.fv.CurrentMode == FormViewMode.Edit)
            {
                var employeesListControl = this.fv.FindControl("employeesList") as CheckBoxList;

                if (employeesListControl != null)
                {
                    var ctx = new PubsEntities();
                    var jobID = Convert.ToInt16(this.fv.DataKey["job_id"]);
                    var currentJob = ctx.jobs.First(x => x.job_id == jobID);

                    foreach (var item in employeesListControl.Items.OfType<ListItem>())
                    {
                        var employee = ctx.employees.First(x => x.emp_id == item.Value);

                        if (item.Selected)
                        {
                            employee.job_id = jobID;
                        }
                    }

                    ctx.SaveChanges();
                }
            }
        }
开发者ID:gabla5,项目名称:LearningProjects,代码行数:26,代码来源:WorkingWithTheFormViewControl.aspx.cs


示例3: FormView1_ItemUpdating

 protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e)
 {
     DropDownList title = (DropDownList)FormView1.FindControl("EditTitle");
       if (title != null)
       {
     e.NewValues.Add("TitleOfCourtesy", title.Text);
       }
 }
开发者ID:bq-wang,项目名称:aspnet,代码行数:8,代码来源:DetailsView_FormView_Form.aspx.cs


示例4: FormView1_ItemUpdating

        protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e)
        {
            int tariffId = int.Parse(((DropDownList)FormView1.FindControl("TariffIdDropDownList")).SelectedValue);
            e.NewValues.Add("TariffId", tariffId);

            TextBox balanceTextBox = ((TextBox)FormView1.FindControl("BalanceTextBox"));
            if (balanceTextBox.Text == "")
                e.NewValues["Balance"] = (decimal?)0;
        }
开发者ID:OldFreelance,项目名称:BillingSystem,代码行数:9,代码来源:EditUser.aspx.cs


示例5: frmCampoPlantilla_ItemUpdating

 protected void frmCampoPlantilla_ItemUpdating(object sender, FormViewUpdateEventArgs e)
 {
     if (e.NewValues["CMP_LONGITUD_CABECERA"].ToString() == string.Empty)
     {
         e.NewValues["CMP_LONGITUD_CABECERA"] = null;
     }
     if (e.NewValues["CMP_POSICION_RELATIVA"].ToString() == string.Empty)
     {
         e.NewValues["CMP_POSICION_RELATIVA"] = null;
     }
 }
开发者ID:jmptrader,项目名称:Switch-Transaccional,代码行数:11,代码来源:ModificarCampoPlantilla.aspx.cs


示例6: FormView1_ItemUpdating

        protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e)
        {
            XmlDocument xdoc = XmlDataSource1.GetXmlDocument();
            XmlElement feed = xdoc.SelectSingleNode("feed/link[@name='" + e.OldValues[0].ToString() + "'][@url='" + e.OldValues[1].ToString() + "']") as XmlElement;
            feed.Attributes["url"].Value = e.NewValues["url"].ToString();

            XmlDataSource1.Save();
            XmlDataSource1.DataBind();

            e.Cancel = true;
            FormView1.ChangeMode(FormViewMode.ReadOnly);
        }
开发者ID:bsilvr,项目名称:EDC2015-Trabalho4,代码行数:12,代码来源:manageFeed.aspx.cs


示例7: FormViewSheetInfo_ItemUpdating

        protected void FormViewSheetInfo_ItemUpdating(object sender, FormViewUpdateEventArgs e)
        {
            int state = Convert.ToInt32(e.NewValues["repairstateid"]);

            if (state >= 2 && state <= 4)
            { }
            else
            {
                Response.Write("<script language='javascript'>alert('没有权限修改此项内容!')</script>");
                //ClientScript.RegisterStartupScript(this.GetType(), "JS", "请阅读并勾选条款!");
                e.Cancel = true;
            }
        }
开发者ID:CSSource,项目名称:WebServiceSystem,代码行数:13,代码来源:SheetDetail.aspx.cs


示例8: PGFV_ItemUpdating

        /**
         * We are in "edit" mode, and the "Update" button was pressed
         * */
        protected void PGFV_ItemUpdating(Object sender, FormViewUpdateEventArgs e)
        {
            String id = ((TextBox)this.PGFV.FindControl("albumIdTextBox")).Text;
            String albumName = ((TextBox)this.PGFV.FindControl("albumNameTextBox")).Text;
            String albumDescription = ((TextBox)this.PGFV.FindControl("albumDescTextBox")).Text;

            //Update table
            controller.updateAlbum(Int32.Parse(id), albumName, albumDescription);

            //update the grid
            rebind(); //rebind the grid

            //Change the form view mode
            this.PGFV.ChangeMode(FormViewMode.ReadOnly);
            rebindForm(-1);
        }
开发者ID:jovinoribeiro,项目名称:EBFRW,代码行数:19,代码来源:PhotoGalleryEditor.aspx.cs


示例9: frmProtocolo_ItemUpdating

        protected void frmProtocolo_ItemUpdating(object sender, FormViewUpdateEventArgs e)
        {
            if (e.NewValues["PTR_PUERTO"].ToString() == string.Empty)
            {
                e.NewValues["PTR_PUERTO"] = null;
            }
            if (e.NewValues["PTR_TIMEOUT_REQUEST"].ToString() == string.Empty)
            {
                e.NewValues["PTR_TIMEOUT_REQUEST"] = null;
            }

            if (e.NewValues["PTR_TIMEOUT_RESPONSE"].ToString() == string.Empty)
            {
                e.NewValues["PTR_TIMEOUT_RESPONSE"] = null;
            }
        }
开发者ID:jmptrader,项目名称:Switch-Transaccional,代码行数:16,代码来源:ModificarProtocolo.aspx.cs


示例10: fvCompleteBackAdd_ItemUpdating

 protected void fvCompleteBackAdd_ItemUpdating(object sender, FormViewUpdateEventArgs e)
 {
     //取消请求执行自定义的方法
     e.Cancel = true;
     //检测是否含有session
     if (Session.Count < 5)
     {
         //跳转
         Response.Redirect("/Account/Login", true);
         //停止加载后续内容
         Response.End();
         //直接返回
         return;
     }
     //当前用户所在部门
     string procName = Session["proc_name"].ToString();
     //当前角色id
     Int16 roleId = Convert.ToInt16(Session["role_id"]);
     //检测是否有权限
     if (procName != mustProcName || roleId < 0 || roleId > 4)
     {
         throw new Exception("您没有修改记录权限!");
     }
     //用户输入不合法不执行添加操作
     if (!CheckUserInput())
     {
         return;
     }
     //设置录入员姓名和时间
     e.NewValues["add_person"] = Session["user_name"].ToString();
     e.NewValues["last_change_time"] = DateTime.Now;
     //当前单号
     string billNum = Convert.ToString(e.Keys[0]);
     //根据参数执行更新数据
     if (UpdateData(e))
     {
         //调用过程执行跳转
         JumpToUrlByBillNum(billNum);
     }
 }
开发者ID:yangdan8,项目名称:ydERPGJ,代码行数:40,代码来源:CompleteBackAdd.aspx.cs


示例11: DoOnItemUpdating

			public void DoOnItemUpdating (FormViewUpdateEventArgs e)
			{
				OnItemUpdating (e); 
			}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:4,代码来源:FormViewTest.cs


示例12: fv_ItemUpdating

		private void fv_ItemUpdating (object sender, FormViewUpdateEventArgs e)
		{
			itemUpdating = true;
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:4,代码来源:FormViewTest.cs


示例13: fvProductNoticeAdd_ItemUpdating

 protected void fvProductNoticeAdd_ItemUpdating(object sender, FormViewUpdateEventArgs e)
 {
     //默认取消请求
     e.Cancel = true;
     //检测是否含有session
     if (Session.Count < 5)
     {
         //跳转
         Response.Redirect("/Account/Login", true);
         //停止加载后续内容
         Response.End();
         //直接返回
         return;
     }
     //当前用户所在部门
     string procName = Session["proc_name"].ToString();
     //当前角色id
     Int16 roleId = Convert.ToInt16(Session["role_id"]);
     //检测是否有权限
     if (!(new string[] { "PMC", mustProcName }).Contains(procName) || roleId < 0 || roleId > 4)
     {
         throw new Exception("您没有修改记录权限!");
     }
     //检测是否需要保存表头
     if (canEditHeadRow)
     {
         //设置录入员姓名和时间
         e.NewValues["add_person"] = Session["user_name"].ToString();
         e.NewValues["last_change_time"] = DateTime.Now;
     }
     //当前单号
     var billNum = Convert.ToString(e.Keys[0]);
     //根据参数执行更新数据
     if (UpdateData(e))
     {
         //调用过程执行跳转
         JumpToUrlByBillNum(billNum);
     }
 }
开发者ID:yangdan8,项目名称:ydERPGJ,代码行数:39,代码来源:ProductNoticeAdd.aspx.cs


示例14: UpdateData

        /// <summary>
        /// 根据输入的参数保存到数据库
        /// </summary>
        /// <param name="e">传入的带有数据的事件参数</param>
        /// <returns></returns>
        private bool UpdateData(FormViewUpdateEventArgs e)
        {
            //数据适配器
            //当前添加语句对象
            //当前数据库连接
            using (var da = new t_proc_lot_card_balanceTableAdapter())
            using (var daChange = new t_proc_lot_card_balance_changeTableAdapter())
            using (var cmd = da.Adapter.InsertCommand)
            using (var conn = cmd.Connection)
            {
                //打开数据库连接
                conn.Open();
                //设置数据库连接
                da.Connection = daChange.Connection = cmd.Connection = conn;
                //开启事务
                using (var tran = conn.BeginTransaction())
                {
                    //设置事务
                    da.Transaction = daChange.Transaction = cmd.Transaction = tran;
                    //试运行
                    try
                    {
                        //执行保存数据
                        if (da.UpdateData(
                            e.NewValues["prev_proc_name"].ToString(),
                            e.NewValues["proc_name"].ToString(),
                            e.NewValues["lot_id"].ToString(),
                            e.NewValues["product_num"].ToString(),
                            Convert.ToInt32(e.NewValues["pnl_qty"]),
                            Convert.ToInt32(e.NewValues["pcs_qty"]),
                            e.NewValues["remark"] == null ? null : e.NewValues["remark"].ToString(),
                            e.NewValues["add_person"].ToString(),
                            Convert.ToDateTime(e.NewValues["add_time"]),
                            Convert.ToDateTime(e.NewValues["last_change_time"]),
                            e.NewValues["accept_person"] == null ? null : e.NewValues["accept_person"].ToString(),
                            e.NewValues["accept_time"] == null ? null : (DateTime?)e.NewValues["accept_time"],
                            Convert.ToBoolean(e.NewValues["is_complete_wenzi"]),
                            Convert.ToInt64(e.Keys[0])
                        ) <= 0)
                        {
                            //抛出错误
                            throw new Exception("修改部门批量卡结存发生错误!");
                        }
                        //取得一个相关guid
                        var guid = Guid.NewGuid().ToString();
                        //保存到修改记录表
                        if (daChange.InsertData(
                            e.OldValues["prev_proc_name"].ToString(),
                            e.OldValues["proc_name"].ToString(),
                            e.OldValues["lot_id"].ToString(),
                            e.OldValues["product_num"].ToString(),
                            Convert.ToInt32(e.OldValues["pnl_qty"]),
                            Convert.ToInt32(e.OldValues["pcs_qty"]),
                            e.OldValues["remark"] == null ? null : e.OldValues["remark"].ToString(),
                            e.OldValues["add_person"].ToString(),
                            e.OldValues["accept_person"] == null ? null : e.OldValues["accept_person"].ToString(),
                            e.OldValues["accept_time"] == null ? null : (DateTime?)e.OldValues["accept_time"],
                            Convert.ToBoolean(e.OldValues["is_complete_wenzi"]),
                            false,
                            guid
                        ) <= 0)
                        {
                            //抛出错误
                            throw new Exception("添加修改批量卡结存旧数据日志记录发生错误!");
                        }
                        //保存到修改记录表
                        if (daChange.InsertData(
                            e.NewValues["prev_proc_name"].ToString(),
                            e.NewValues["proc_name"].ToString(),
                            e.NewValues["lot_id"].ToString(),
                            e.NewValues["product_num"].ToString(),
                            Convert.ToInt32(e.NewValues["pnl_qty"]),
                            Convert.ToInt32(e.NewValues["pcs_qty"]),
                            e.NewValues["remark"] == null ? null : e.NewValues["remark"].ToString(),
                            e.NewValues["add_person"].ToString(),
                            e.NewValues["accept_person"] == null ? null : e.NewValues["accept_person"].ToString(),
                            e.NewValues["accept_time"] == null ? null : (DateTime?)e.NewValues["accept_time"],
                            Convert.ToBoolean(e.NewValues["is_complete_wenzi"]),
                            true,
                            guid
                        ) <= 0)
                        {
                            //抛出错误
                            throw new Exception("添加修改批量卡结存新数据日志记录发生错误!");
                        }

                        //提交事务
                        tran.Commit();
                        //返回成功
                        return true;
                    }
                    catch (Exception ex)
                    {
                        //回滚事务
                        tran.Rollback();
//.........这里部分代码省略.........
开发者ID:yangdan8,项目名称:ydERPGJ,代码行数:101,代码来源:ProcLotCardMgrAdd.aspx.cs


示例15: fvReport_ItemUpdating

        protected void fvReport_ItemUpdating(object sender, FormViewUpdateEventArgs e)
        {
            if (IsValid)
            {
                int id = Convert.ToInt32(((Label)fvReport.FindControl("lblRecordId")).Text);

                Tingle_WebForms.Models.MustIncludeForm myForm = ctx.MustIncludeForms.FirstOrDefault(eof => eof.RecordId == id);

                RadDropDownList ddlCompanyEdit = (RadDropDownList)fvReport.FindControl("ddlCompanyEdit");
                TextBox txtPO = (TextBox)fvReport.FindControl("txtPOEdit");
                TextBox txtArmstrongReference = (TextBox)fvReport.FindControl("txtArmstrongReferenceEdit");
                TextBox txtPattern = (TextBox)fvReport.FindControl("txtPatternEdit");
                TextBox txtLine = (TextBox)fvReport.FindControl("txtLineEdit");
                TextBox txtOrderNumber = (TextBox)fvReport.FindControl("txtOrderNumberEdit");
                TextBox txtCustomer = (TextBox)fvReport.FindControl("txtCustomerEdit");
                RadDropDownList ddlWarehouse = (RadDropDownList)fvReport.FindControl("ddlWarehouseEdit");
                HtmlInputText txtDueByDate = (HtmlInputText)fvReport.FindControl("txtDueByDateEdit");
                RadDropDownList ddlStatus = (RadDropDownList)fvReport.FindControl("ddlStatusEdit");
                int statusId = Convert.ToInt32(ddlStatus.SelectedValue);
                RadComboBox ddlRequestedByEdit = (RadComboBox)fvReport.FindControl("ddlRequestedByEdit");
                int requestedById = Convert.ToInt32(ddlRequestedByEdit.SelectedValue);
                RadComboBox ddlAssignedToEdit = (RadComboBox)fvReport.FindControl("ddlAssignedToEdit");
                int assignedToId = 0;
                if (ddlAssignedToEdit.SelectedIndex != -1)
                {
                    assignedToId = Convert.ToInt32(ddlAssignedToEdit.SelectedValue);
                }
                RadDropDownList ddlPriorityEdit = (RadDropDownList)fvReport.FindControl("ddlPriorityEdit");
                int priorityId = Convert.ToInt32(ddlPriorityEdit.SelectedValue);
                CheckBox cbSendComments = (CheckBox)fvReport.FindControl("cbSendComments");
                CheckBox cbShowSystemComments = (CheckBox)fvReport.FindControl("cbShowSystemComments");
                CheckBox cbNotifyStandard = (CheckBox)fvReport.FindControl("cbNotifyStandard");
                CheckBox cbNotifyAssignee = (CheckBox)fvReport.FindControl("cbNotifyAssignee");
                CheckBox cbNotifyOther = (CheckBox)fvReport.FindControl("cbNotifyOther");
                CheckBox cbNotifyRequester = (CheckBox)fvReport.FindControl("cbNotifyRequester");
                RadComboBox ddlNotifyOther = (RadComboBox)fvReport.FindControl("ddlNotifyOther");

                Label lblEmailsSentTo = (Label)fvReport.FindControl("lblEmailsSentTo");
                Label lblFVMessage = (Label)fvReport.FindControl("lblFVMessage");

                DateTime tryDateDue;
                Nullable<DateTime> dateDue = null;

                try
                {
                    if (myForm.RequestedUser.SystemUserID.ToString() != ddlRequestedByEdit.SelectedValue)
                    {
                        Comments newRequesterComment = new Comments
                        {
                            Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Must Include"),
                            Note = "Requester Changed To: " + ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == requestedById).DisplayName,
                            RelatedFormId = myForm.RecordId,
                            SystemComment = true,
                            Timestamp = DateTime.Now
                        };

                        ctx.Comments.Add(newRequesterComment);
                    }

                    if (myForm.AssignedUser == null && ddlAssignedToEdit.SelectedIndex != -1) // (myForm.AssignedUser != null && ddlAssignedToEdit.SelectedIndex != -1 && Convert.ToString(myForm.AssignedUser.SystemUserID) != ddlAssignedToEdit.SelectedValue))
                    {
                        Comments newAssignedComment = new Comments
                        {
                            Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Must Include"),
                            Note = "Request Assigned To: " + ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == assignedToId).DisplayName,
                            RelatedFormId = myForm.RecordId,
                            SystemComment = true,
                            Timestamp = DateTime.Now
                        };

                        ctx.Comments.Add(newAssignedComment);
                    }
                    else if (myForm.AssignedUser != null && ddlAssignedToEdit.SelectedIndex != -1)
                    {
                        if (myForm.AssignedUser.SystemUserID.ToString() != ddlAssignedToEdit.SelectedValue)
                        {
                            Comments newAssignedComment = new Comments
                            {
                                Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Must Include"),
                                Note = "Request Assignee Changed To: " + ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == assignedToId).DisplayName,
                                RelatedFormId = myForm.RecordId,
                                SystemComment = true,
                                Timestamp = DateTime.Now
                            };

                            ctx.Comments.Add(newAssignedComment);
                        }
                    }
                    else if (myForm.AssignedUser != null && ddlAssignedToEdit.SelectedIndex == -1)
                    {
                        Comments newAssignedComment = new Comments
                        {
                            Form = ctx.TForms.FirstOrDefault(x => x.FormName == "Must Include"),
                            Note = "Request Assignment Removed From: " + ctx.SystemUsers.FirstOrDefault(x => x.SystemUserID == myForm.AssignedUser.SystemUserID).DisplayName,
                            RelatedFormId = myForm.RecordId,
                            SystemComment = true,
                            Timestamp = DateTime.Now
                        };

                        ctx.Comments.Add(newAssignedComment);
//.........这里部分代码省略.........
开发者ID:WCTingle,项目名称:InfoShare_Public,代码行数:101,代码来源:ReportMustInclude.aspx.cs


示例16: UpdateData

 /// <summary>
 /// 根据输入的参数值来执行更新数据
 /// </summary>
 /// <param name="e">传入的带有数据的事件参数</param>
 /// <returns></returns>
 private bool UpdateData(FormViewUpdateEventArgs e)
 {
     //数据适配器
     //当前添加语句对象
     //当前数据库连接
     using (var da = new t_use_waterTableAdapter())
     using (var cmd = da.Adapter.UpdateCommand)
     using (var conn = cmd.Connection)
     {
         //打开数据库连接
         conn.Open();
         //开启事务
         using (var tran = conn.BeginTransaction())
         {
             //设置事务
             da.Transaction = tran;
             //试运行
             try
             {
                 //当前行id号
                 Int64 id = Convert.ToInt64(e.Keys["id"]);
                 //获取数据
                 using (var tab = da.GetDataById(id))
                 {
                     //检查是否获取到行
                     if (tab.Rows.Count == 0)
                     {
                         //显示失败
                         throw new Exception("当前生产记录已经被其他用户删除!");
                     }
                     else
                     {
                         //直接保存
                         e.Cancel = false;
                     }
                 }
                 //提交事务
                 tran.Commit();
                 //返回成功
                 return true;
             }
             catch (Exception ex)
             {
                 //回滚事务
                 tran.Rollback();
                 //非数字返回失败
                 throw new Exception(ex.Message);
             }
         }
     }
 }
开发者ID:yangdan8,项目名称:ydERPTY,代码行数:56,代码来源:UseWaterAdd.aspx.cs


示例17: fvSampleLotCardMgrAdd_ItemUpdating

 protected void fvSampleLotCardMgrAdd_ItemUpdating(object sender, FormViewUpdateEventArgs e)
 {
     //默认取消请求
     e.Cancel = true;
     //检测是否含有session
     if (Session.Count < 5)
     {
         //跳转
         Response.Redirect("/Account/Login", true);
         //停止加载后续内容
         Response.End();
         //直接返回
         return;
     }
     //当前用户所在部门
     string deptName = Session["dept_name"].ToString();
     //当前角色id
     Int16 roleId = Convert.ToInt16(Session["role_id"]);
     //检测是否有权限
     if (deptName != mustDeptName || roleId < 0 || (roleId > 4 && roleId != 6))
     {
         throw new Exception("您没有修改记录权限!");
     }
     //之前的lot卡号
     string oldLotId = e.OldValues["lot_id"].ToString().Trim();
     //当前要添加的lot卡号
     string newLotId = e.NewValues["lot_id"].ToString().Trim();
     //检测lot卡号是否存在
     if (newLotId != oldLotId && ydOperateSampleLotCard.IsExistSampleLotId(newLotId))
     {
         //报告失败
         return;
     }
     //设置录入员姓名和时间
     e.NewValues["add_person"] = Session["user_name"].ToString();
     e.NewValues["last_change_time"] = DateTime.Now;
     //允许添加
     e.Cancel = false;
 }
开发者ID:yangdan8,项目名称:ydERPTY,代码行数:39,代码来源:SampleLotCardMgrAdd.aspx.cs


示例18: UpdateData

        /// <summary>
        /// 根据输入的参数值来执行更新数据
        /// </summary>
        /// <param name="e">传入的带有数据的事件参数</param>
        /// <returns></returns>
        private bool UpdateData(FormViewUpdateEventArgs e)
        {
            //数据适配器
            //当前添加语句对象
            //当前数据库连接
            using (var da = new v_material_outTableAdapter())
            using (var conn = da.Connection)
            {
                //打开数据库连接
                conn.Open();
                //开启事务
                using (var tran = conn.BeginTransaction())
                {
                    //设置事务
                    da.Transaction = tran;
                    //试运行
                    try
                    {
                        //当前行单号
                        string billNum = Convert.ToString(e.Keys[0]);
                        //获取数据
                        using (var tab = da.GetDataByBillNum(billNum))
                        {
                            //检查是否获取到行
                            if (tab.Rows.Count == 0)
                            {
                                //显示失败
                                throw new Exception("当前记录已经被其他用户删除!");
                            }
                            //数据适配器
                            using (var daHead = new t_material_out_headTableAdapter())
                            using (var daContent = new t_material_out_contentTableAdapter())
                            using (var daBalance = new t_material_balanceTableAdapter())
                            {
                                //设置数据库连接
                                daHead.Connection = daContent.Connection = daBalance.Connection = conn;
                                //设置事务
                                daHead.Transaction = daContent.Transaction = daBalance.Transaction = tran;
                                //遍历行执行添加到结存记录
                                foreach (DataSetMaterialOut.v_material_outRow row in tab.Rows)
                                {
                                    //执行添加结存
                                    if (!ydOperateMaterial.AddMaterialBalance(
                                        tran,
                                        BillType.Out,
                                        row.bill_num,
                                        row.row_id
                                    ))
                                    {
                                        return false;
                                    }
                                }
                                //从单据内容中删除
                                if (daContent.DeleteByBillNum(billNum) <= 0)
                                {
                                    throw new Exception("从单据内容中删除失败!");
                                }
                                //从单据表头中删除
                                if (daHead.Delete(billNum) <= 0)
                                {
                                    throw new Exception("从单据表头中删除失败!");
                                }

                                //日期
                                DateTime billDate = Convert.ToDateTime(e.NewValues["bill_date"]);
                                //部门序号
                                byte procId = Convert.ToByte(e.NewValues["proc_id"]);
                                //部门名称
                                string procName = Convert.ToString(e.NewValues["proc_name"]);
                                //单据备注
                                string billRemark = Convert.ToString(e.NewValues["remark"]);
                                //录入员
                                string addPerson = e.NewValues["add_person"].ToString();
                                //录入时间
                                DateTime addTime = Convert.ToDateTime(e.NewValues["add_time"]);
                                //最后修改时间
                                DateTime lastChangeTime = Convert.ToDateTime(e.NewValues["last_change_time"]);
                                //含有数据的行数
                                int iCountContent = 0;
                                //遍历子表执行保存
                                for (int iRow = 0; iRow < 10; iRow++)
                                {
                                    //子表各控件
                                    var tr = tabDataListSon.Rows[iRow + 1];
                                    var litRowId = (Literal)tr.Cells[0].Controls[0];
                                    var txtSupplierCode = (TextBox)tr.Cells[1].Controls[0];
                                    var txtSupplierName = (TextBox)tr.Cells[2].Controls[0];
                                    var txtMaterialCode = (TextBox)tr.Cells[3].Controls[0];
                                    var txtMaterialName = (TextBox)tr.Cells[4].Controls[0];
                                    var txtMaterialSize = (TextBox)tr.Cells[5].Controls[0];
                                    var txtQty = (TextBox)tr.Cells[6].Controls[0];
                                    var txtMaterialUnit = (TextBox)tr.Cells[7].Controls[0];
                                    var hfPrice = (HiddenField)tr.Cells[8].Controls[0];
                                    var txtRemark = (TextBox)tr.Cells[9].Controls[0];
                                    //取得数据
//.........这里部分代码省略.........
开发者ID:yangdan8,项目名称:ydERPGJ,代码行数:101,代码来源:MaterialOutAdd.aspx.cs


示例19: fvProcLotCardMgrAdd_ItemUpdating

 protected void fvProcLotCardMgrAdd_ItemUpdating(object sender, FormViewUpdateEventArgs e)
 {
     //默认取消请求
     e.Cancel = true;
     //检测是否含有session
     if (Session.Count < 5)
     {
         //跳转
         Response.Redirect("/Account/Login", true);
         //停止加载后续内容
         Response.End();
         //直接返回
         return;
     }
     //当前用户所在部门
     string procName = Session["proc_name"].ToString().ToUpper();
     //当前角色id
     Int16 roleId = Convert.ToInt16(Session["role_id"]);
     //检测是否有权限
     if ((procName != mustProcName && procName != "样板") || roleId < 0 || roleId > 1)
     {
         throw new Exception("您没有修改记录权限!");
     }
     //之前的批量卡序号
     string lotIdOld = e.OldValues["lot_id"].ToString().Trim();
     //当前要添加的批量卡序号
     string lotIdNew = e.NewValues["lot_id"].ToString().Trim();
     //不能从样板批量卡修改为生产板批量卡,反之亦然
     if (lotIdNew.Contains("S") != lotIdOld.Contains("S"))
     {
         throw new Exception("不能从样板批量卡修改为生产板批量卡,反之亦然!");
     }
     //检测lot卡类型
     if (lotIdOld.Contains("S") && procName != "样板")
     {
         throw new Exception("当前只能修改样板批量卡!");
     }
     //检测lot卡类型
     if (!lotIdOld.Contains("S") && procName != "PMC")
     {
         throw new Exception("当前只能修改生产板批量卡!");
     }
     //检测是否正确批量卡号
     if (!ydOperateLotCard.IsLotCardId(ref lotIdNew) && !ydOperateSampleLotCard.IsSampleLotCardId(ref lotIdNew))
     {
         //非数字返回失败
         throw new Exception("您输入了一个不合格的批量卡号 " + lotIdNew + " !");
     }
     //检测批量卡序号是否存在
     if (lotIdNew != lotIdOld &&
         (ydOperateLotCard.IsExistLotId(lotIdNew) || ydOperateSampleLotCard.IsExistSampleLotId(lotIdNew))
     )
     {
         //报告失败
         throw new Exception("当前批量卡号 " + lotIdNew + " 已经存在!");
     }
     //重新设置批量卡号(可能有添加上年份)
     e.NewValues["lot_id"] = lotIdNew;
     //设置录入员姓名和时间
     e.NewValues["add_person"] = Session["user_name"].ToString();
     e.NewValues["last_change_time"] = DateTime.Now;
     //根据输入的批量卡id执行添加数据
     if (UpdateData(e))
     {
         //调用过程执行跳转
         fvProcLotCardMgrAdd_ItemInserted(null, null);
     }
 }
开发者ID:yangdan8,项目名称:ydERPGJ,代码行数:68,代码来源:ProcLotCardMgrAdd.aspx.cs


示例20: formviewAccount_OnItemUpdating

 protected void formviewAccount_OnItemUpdating(object sender, FormViewUpdateEventArgs e)
 {
     var frmAccount = sender as FormView;
     if (frmAccount == null)
         return;
     var cancelSubscriptionOption = frmAccount.FindControl("CancelSubscriptionRadioButton") as RadioButton;
     if (cancelSubscriptionOption != null && cancelSubscriptionOption.Checked)
     {
         //the cancel subscription process is done right here, we mustn't update anything
         return;
     }
     var subscriptionSelected = frmAccount.FindControl("SubscriptionLevelHiddenField") as HiddenField;
     int subscriptionLevelId;
     if (subscriptionSelected != null && int.TryParse(subscriptionSelected.Value, out subscriptionLevelId))
     {
         var oldSubscriptionLevelId = e.OldValues["SubscriptionLevelId"] as int?;
         //Only if the new subscripton is greater than before
         if (oldSubscriptionLevelId.HasValue && oldSubscriptionLevelId.Value > subscriptionLevelId)
         {
             var promocode = frmAccount.FindControl("PromotionCodeTextBox") as TextBox;
             e.NewValues["SubscriptionLevelId"] = subscriptionLevelId;
             if (promocode != null && promocode.Text.Length > 0)
             {
                 var promoCodeStatus = PromoCodeManager.Validate(promocode.Text, subscriptionLevelId, IdAccount);
                 if (promoCodeStatus.StatusCode != StatusCode.Found)
                 {
                     e.Cancel = true;
                     return;
                 }
             }
         }
     }
     var dropdownlistCompanyCountry = frmAccount.FindControl("DropDownListCompanyCountry") as DropDownList;
     if (dropdownlistCompanyCountry == null || dropdownlistCompanyCountry.SelectedValue == "-1")
         return;
     e.NewValues["CompanyIdCountry"] = dropdownlistCompanyCountry.SelectedValue;
     var frmBilling = sender as FormView;
     if (frmBilling == null)
         return;
     var dropdownlistCreditCardCountry =
         frmBilling.FindControl("DropDownListCreditCardIdCountry") as DropDownList;
     if (dropdownlistCreditCardCountry != null && dropdownlistCreditCardCountry.SelectedValue != "-1")
     {
         e.NewValues["CreditCardIdCountry"] = dropdownlistCreditCardCountry.SelectedValue;
     }
     var dropDownListCreditCardType = frmBilling.FindControl("dropDownListCreditCardType") as DropDownList;
     if (dropDownListCreditCardType != null && dropDownListCreditCardType.SelectedValue != "-1")
     {
         e.NewValues["CreditCardType"] =
             AccountManager.GetCreditCardTypeById(dropDownListCreditCardType.SelectedValue);
     }
     var creditCardNumberTextBox = frmBilling.FindControl("TextBoxCreditCardNumber") as TextBox;
     if (creditCardNumberTextBox != null && !string.IsNullOrEmpty(creditCardNumberTextBox.Text))
     {
         e.NewValues["CreditCardNumber"] = new string('x', creditCardNumberTextBox.Text.Length - 4) +
                                           creditCardNumberTextBox.Te 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# WebControls.FormViewUpdatedEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# WebControls.FormViewInsertedEventArgs类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap