protected void frmSupplierDetail_ItemCommand(object sender, FormViewCommandEventArgs e) { string supplierType; int? priority; DropDownList ddlStatusEdit = (DropDownList)frmSupplierDetail.FindControl("ddlStatusEdit"); DropDownList ddlSupplierType = (DropDownList)frmSupplierDetail.FindControl("ddlSupplierType"); DropDownList ddlPriorityEdit = (DropDownList)frmSupplierDetail.FindControl("ddlPriorityEdit"); TextBox txtNameSupplierEdit = (TextBox)frmSupplierDetail.FindControl("txtNameSupplierEdit"); TextBox txtCodeSupplierEdit = (TextBox)frmSupplierDetail.FindControl("txtCodeSupplierEdit"); CheckBox chkIsFullPull = (CheckBox)frmSupplierDetail.FindControl("chkIsFullPull"); MDMSVC.DC_Message _msg = new MDMSVC.DC_Message(); if (e.CommandName == "EditCommand") { if (ddlSupplierType.SelectedIndex == 0) { supplierType = string.Empty; } else { supplierType = ddlSupplierType.SelectedItem.Text; } if (ddlPriorityEdit.SelectedIndex == 0) { priority = null; } else { priority = Convert.ToInt32(ddlPriorityEdit.SelectedItem.Value); } _msg = _objMaster.AddUpdateSupplier(new MDMSVC.DC_Supplier() { Supplier_Id = Guid.Parse(Request.QueryString["Supplier_Id"]), Name = txtNameSupplierEdit.Text.Trim(), Code = txtCodeSupplierEdit.Text.Trim(), SupplierType = supplierType, StatusCode = ddlStatusEdit.SelectedItem.Text, Edit_Date = DateTime.Now, Edit_User = System.Web.HttpContext.Current.User.Identity.Name, Priority = priority, IsFullPull = chkIsFullPull.Checked }); if (Convert.ToInt32(_msg.StatusCode) == Convert.ToInt32(BootstrapAlertType.Success)) { frmSupplierDetail.ChangeMode(FormViewMode.Edit); frmSupplierDetail.DataBind(); BootstrapAlert.BootstrapAlertMessage(dvMsgUpdateSupplierDetails, _msg.StatusMessage, BootstrapAlertType.Success); FillPageData(Guid.Parse(Request.QueryString["Supplier_Id"])); } else { hdnFlag.Value = "false"; BootstrapAlert.BootstrapAlertMessage(dvMsgUpdateSupplierDetails, _msg.StatusMessage, (BootstrapAlertType)_msg.StatusCode); } } }
protected void frmSupplierdetail_ItemCommand(object sender, FormViewCommandEventArgs e) { MDMSVC.DC_Message _msg = new MDMSVC.DC_Message(); TextBox txtSupplierNameCreate = (TextBox)frmSupplierdetail.FindControl("txtSupplierNameCreate"); TextBox txtSupplierCodeCreate = (TextBox)frmSupplierdetail.FindControl("txtSupplierCodeCreate"); DropDownList ddlSupplierTypeCreate = (DropDownList)frmSupplierdetail.FindControl("ddlSupplierTypeCreate"); DropDownList ddlStatusCreate = (DropDownList)frmSupplierdetail.FindControl("ddlStatusCreate"); if (e.CommandName == "Add") { string strSupplierType = Convert.ToString(ddlSupplierTypeCreate.SelectedItem.Text.Trim()); string strStatus = Convert.ToString(ddlStatusCreate.SelectedItem.Text.Trim()); _msg = _objMaster.AddUpdateSupplier(new MDMSVC.DC_Supplier() { Name = txtSupplierNameCreate.Text.Trim(), Code = txtSupplierCodeCreate.Text.Trim(), SupplierType = strSupplierType, StatusCode = strStatus, Create_Date = DateTime.Now, Create_User = System.Web.HttpContext.Current.User.Identity.Name }); if (Convert.ToInt32(_msg.StatusCode) == Convert.ToInt32(BootstrapAlertType.Success)) { frmSupplierdetail.DataBind(); hdnFlag.Value = "true"; BootstrapAlert.BootstrapAlertMessage(dvMsg, _msg.StatusMessage, BootstrapAlertType.Success); } else { hdnFlag.Value = "false"; BootstrapAlert.BootstrapAlertMessage(dvMsg, _msg.StatusMessage, (BootstrapAlertType)_msg.StatusCode); } } }