protected void grid_HtmlEditFormCreated(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewEditFormEventArgs e) { if (this.grid.EditingRowVisibleIndex > -1) { ASPxPageControl pageControl = this.grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox partyName = pageControl.FindControl("txt_PartyName") as ASPxTextBox; ASPxTextBox whName = pageControl.FindControl("txt_WhName") as ASPxTextBox; ASPxDateEdit txt_Date = pageControl.FindControl("txt_Date") as ASPxDateEdit; txt_Date.Enabled = false; partyName.Text = EzshipHelper.GetPartyName(this.grid.GetRowValues(this.grid.EditingRowVisibleIndex, new string[] { "PartyId" })); whName.Text = EzshipHelper.GetWarehouse(this.grid.GetRowValues(this.grid.EditingRowVisibleIndex, new string[] { "WhCode" })); string oid = SafeValue.SafeString(this.grid.GetRowValues(this.grid.EditingRowVisibleIndex, new string[] { "Id" })); if (oid.Length > 0) { string sql = string.Format("select StatusCode from wh_Contract where Id='{0}'", oid); string closeInd = SafeValue.SafeString(C2.Manager.ORManager.ExecuteScalar(sql), "USE");// ASPxButton btn = this.grid.FindEditFormTemplateControl("btn_CloseJob") as ASPxButton; ASPxButton btn_VoidMaster = this.grid.FindEditFormTemplateControl("btn_Void") as ASPxButton; if (closeInd == "CLS") { btn.Text = "Open Job"; } if (closeInd == "CNL") { btn_VoidMaster.Text = "Unvoid"; } else { btn.Text = "Close"; } } } }
protected void grdNames_HtmlRowCreated(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableRowEventArgs e) { if (e.RowType == DevExpress.Web.ASPxGridView.GridViewRowType.Detail) { string code = e.GetValue("Code").ToString(); clsDetail det = currentDetails.GetDetails(code); ASPxPageControl cntrl = ((ASPxGridView)sender).FindDetailRowTemplateControl(e.VisibleIndex, "ASPxPageControl1") as ASPxPageControl; ASPxLabel genLab = cntrl.FindControl("ASPxLabel1") as ASPxLabel; if (genLab != null) { genLab.Text = det.Gender; } ASPxLabel courtLab = cntrl.FindControl("ASPxLabel2") as ASPxLabel; if (courtLab != null) { courtLab.Text = det.TitleOfCourt; } ASPxLabel addrLab = cntrl.FindControl("ASPxLabel3") as ASPxLabel; if (addrLab != null) { addrLab.Text = det.Address; } } }
protected void BUCallBackPanel_Callback(object sender, CallbackEventArgsBase e) { ASPxPageControl pageControl = BUDeptListGrid.FindEditFormTemplateControl("BUHeadPageControl") as ASPxPageControl; ASPxComboBox entCode = pageControl.FindControl("EntityCode") as ASPxComboBox; ASPxCallbackPanel callBackPanel = pageControl.FindControl("BUCallBackPanel") as ASPxCallbackPanel; ASPxComboBox buCode = callBackPanel.FindControl("BUCode") as ASPxComboBox; buCode.Value = ""; buCode.Text = ""; DataTable dtRecord = GlobalClass.EntBUSSUTable(entCode.Value.ToString()); buCode.DataSource = dtRecord; //ListBoxColumn l_value = new ListBoxColumn(); //l_value.FieldName = "ID"; //l_value.Caption = "ID"; //buCode.Columns.Add(l_value); //ListBoxColumn l_text = new ListBoxColumn(); //l_text.FieldName = "NAME"; //l_text.Caption = "Name"; //buCode.Columns.Add(l_text); buCode.TextField = "NAME"; buCode.ValueField = "ID"; buCode.TextFormatString = "{1}"; buCode.DataBind(); }
protected void grid_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e) { if (this.grid.EditingRowVisibleIndex > -1) { ASPxPageControl pageControl = this.grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox txt_PartyId = pageControl.FindControl("txtPartyId") as ASPxTextBox; txt_PartyId.Enabled = false; string partyId = SafeValue.SafeString(this.grid.GetRowValues(this.grid.EditingRowVisibleIndex, new string[] { "PartyId" })); string sql = "select Salesman from XXPartySales where PartyId='" + partyId + "' and DefaultInd='Y'"; string salesMan = SafeValue.SafeString(C2.Manager.ORManager.ExecuteScalar(sql)); ASPxTextBox txt_DefaultSale = pageControl.FindControl("txt_DefaultSale") as ASPxTextBox; txt_DefaultSale.Text = salesMan; ASPxButton btn_Block = this.grid.FindEditFormTemplateControl("btn_Block") as ASPxButton; ASPxLabel status = pageControl.FindControl("lblStatus") as ASPxLabel; if (partyId.Length > 0) { sql = string.Format("select Status from XXParty where PartyId='{0}'", partyId); string closeInd = SafeValue.SafeString(C2.Manager.ORManager.ExecuteScalar(sql));// closeIndStr.Text if (closeInd == "InActive") { status.Text = "InActive"; btn_Block.Text = "UnLock"; } else { status.Text = "USE"; btn_Block.Text = "Lock"; } dsRefContact.FilterExpression = "PartyId='" + partyId + "'"; } } }
private void SubGuardarPlantilla() { int lintIndice = Convert.ToInt32(Session["ID"]); int lintDYR_ID = Convert.ToInt32(Session["DYR_ID"]); string lStrCuencas = string.Empty; string lStrSecciones = string.Empty; ASPxPageControl lObjPageControl = (ASPxPageControl)ASPxGridViewPlantillaEncabezado.FindDetailRowTemplateControl(lintIndice, "ASPxPageControlPlantilla"); ASPxGridView lObjGridViewCuenca = (ASPxGridView)lObjPageControl.FindControl("ASPxGridViewCuenca"); ASPxGridView lObjGridViewSeccion = (ASPxGridView)lObjPageControl.FindControl("ASPxGridViewSeccion"); List <object> lObjCuencas = lObjGridViewCuenca.GetSelectedFieldValues("SubCuencaRio_ID"); List <object> lObjSecciones = lObjGridViewSeccion.GetSelectedFieldValues("SubSeccion_ID"); foreach (object lObjCuenca in lObjCuencas) { lStrCuencas += lObjCuenca.ToString() + ","; } foreach (object lObjSeccion in lObjSecciones) { lStrSecciones += lObjSeccion.ToString() + ","; } if (lStrCuencas.Length > 0) { lStrCuencas = lStrCuencas.Substring(0, lStrCuencas.Length - 1); } if (lStrSecciones.Length > 0) { lStrSecciones = lStrSecciones.Substring(0, lStrSecciones.Length - 1); } using (ICCEntities lObjEntidad = new ICCEntities()) { lObjEntidad.xSpCrearPlantilla(lintDYR_ID, lStrCuencas, lStrSecciones); lObjEntidad.SaveChanges(); } }
protected void grid_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e) { ASPxPageControl pageControl = this.grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl; Panel divStatus1 = pageControl.FindControl("divStatus1") as Panel; Panel divStatus2 = pageControl.FindControl("divStatus2") as Panel; Panel divPersonDet = pageControl.FindControl("divPersonDet") as Panel; if (txt_Status.Text.ToLower() == "candidate") { divStatus1.Visible = false; divStatus2.Visible = false; divPersonDet.Visible = false; pageControl.TabPages[1].ClientVisible = false; pageControl.TabPages[3].ClientVisible = false; pageControl.TabPages[4].ClientVisible = false; pageControl.TabPages[5].ClientVisible = false; pageControl.TabPages[6].ClientVisible = false; pageControl.TabPages[7].ClientVisible = false; pageControl.TabPages[8].ClientVisible = false; } if (this.grid.EditingRowVisibleIndex > -1) { } }
protected void BUDeptListGrid_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { ASPxGridView grid = sender as ASPxGridView; ASPxPageControl pageControl = grid.FindEditFormTemplateControl("BUHeadPageControl") as ASPxPageControl; ASPxDateEdit effectDate = pageControl.FindControl("EffectDate") as ASPxDateEdit; ASPxComboBox entCode = pageControl.FindControl("EntityCode") as ASPxComboBox; ASPxCallbackPanel callBackPanel = pageControl.FindControl("BUCallBackPanel") as ASPxCallbackPanel; ASPxComboBox buCode = callBackPanel.FindControl("BUCode") as ASPxComboBox; ASPxComboBox buHead = pageControl.FindControl("BUHead") as ASPxComboBox; ASPxComboBox buHeadStatus = pageControl.FindControl("BUHeadStatus") as ASPxComboBox; SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString()); conn.Open(); string sCtrlNum = GlobalClass.GetControl_DocNum("BU_Dept_Head", Convert.ToDateTime(effectDate.Value.ToString())); string sLastModified = DateTime.Now.ToString(); string sbuCode = ""; if (buCode.Value != null) { sbuCode = buCode.Value.ToString(); } string insert = "INSERT INTO tbl_System_BUDeptHead ([Ctrl], [EffectDate], [EntityCode], [BUDeptCode], [UserKey], [StatusKey], [LastModified]) VALUES (@Ctrl, @EffectDate, @EntityCode, @BUDeptCode, @UserKey, @StatusKey, @LastModified)"; SqlCommand cmd = new SqlCommand(insert, conn); cmd.Parameters.AddWithValue("@Ctrl", sCtrlNum); cmd.Parameters.AddWithValue("@EffectDate", effectDate.Value.ToString()); cmd.Parameters.AddWithValue("@EntityCode", entCode.Value.ToString()); cmd.Parameters.AddWithValue("@BUDeptCode", sbuCode.ToString()); cmd.Parameters.AddWithValue("@UserKey", buHead.Value.ToString()); cmd.Parameters.AddWithValue("@StatusKey", buHeadStatus.Value.ToString()); cmd.Parameters.AddWithValue("@LastModified", sLastModified); cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery(); e.Cancel = true; grid.CancelEdit(); BindUserList(); int pk_latest = 0; string query_pk = "SELECT TOP 1 [PK] FROM tbl_System_BUDeptHead ORDER BY [PK] DESC"; SqlCommand comm = new SqlCommand(query_pk, conn); SqlDataReader r = comm.ExecuteReader(); while (r.Read()) { pk_latest = Convert.ToInt32(r[0].ToString()); } conn.Close(); if (pk_latest > 0) { FocusThisRowGrid(grid, pk_latest); } }
protected void grid_address_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { ASPxPageControl pageControl = this.grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox txtPartyId = pageControl.FindControl("txtPartyId") as ASPxTextBox; ASPxTextBox txtName = pageControl.FindControl("txtName") as ASPxTextBox; e.NewValues["PartyId"] = txtPartyId.Text; e.NewValues["PartyName"] = txtName.Text; }
protected void ASPxGridView1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { ASPxPageControl pg = ((ASPxGridView)sender).FindEditFormTemplateControl("ASPxPageControl1") as ASPxPageControl; ASPxTextBox txt1 = pg.FindControl("ASPxTextBox1") as ASPxTextBox; e.NewValues["CategoryName"] = txt1.Text; ASPxTextBox txt2 = pg.FindControl("ASPxTextBox2") as ASPxTextBox; e.NewValues["Description"] = txt2.Text; }
protected void grid_det_InitNewRow(object sender, DevExpress.Web.Data.ASPxDataInitNewRowEventArgs e) { ASPxPageControl pageControl = this.grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox txt_id = pageControl.FindControl("txt_Id") as ASPxTextBox; e.NewValues["LineTNo"] = SafeValue.SafeInt(txt_id.Text, 0); ASPxTextBox txt_InventoryNo = pageControl.FindControl("txt_InventoryNo") as ASPxTextBox; e.NewValues["InventoryNo"] = SafeValue.SafeInt(txt_InventoryNo.Text, 0); }
protected void grid_contact_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { ASPxPageControl pageControl = this.grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox txtPartyId = pageControl.FindControl("txtPartyId") as ASPxTextBox; ASPxTextBox txtName = pageControl.FindControl("txtName") as ASPxTextBox; e.NewValues["PartyId"] = txtPartyId.Text; e.NewValues["PartyName"] = txtName.Text; e.NewValues["IsDefault"] = SafeValue.SafeBool(e.NewValues["IsDefault"], true); e.NewValues["Department"] = SafeValue.SafeString(e.NewValues["Department"]); }
protected void UserList_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { ASPxGridView grid = sender as ASPxGridView; ASPxPageControl pageControl = grid.FindEditFormTemplateControl("UserPageControl") as ASPxPageControl; //ASPxTextBox entCode = pageControl.FindControl("EntityValue") as ASPxTextBox; ASPxComboBox entCode = pageControl.FindControl("EntityCode") as ASPxComboBox; ASPxTextBox buCode = pageControl.FindControl("BUValue") as ASPxTextBox; ASPxTextBox domainAcc = pageControl.FindControl("DomainAccount") as ASPxTextBox; ASPxTextBox userLevel = pageControl.FindControl("UserLevelValue") as ASPxTextBox; ASPxTextBox userStatus = pageControl.FindControl("UserStatusValue") as ASPxTextBox; SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString()); conn.Open(); string PK = e.Keys[0].ToString(); string sEntCode = entCode.Value.ToString(); string sBUCode = buCode.Value.ToString(); string sDomainAcc = ""; if (domainAcc.Value != null) { sDomainAcc = EncryptionClass.Encrypt(domainAcc.Value.ToString()); } int sUserLevel = Convert.ToInt32(userLevel.Value.ToString()); int sUserStatus = Convert.ToInt32(userStatus.Value.ToString()); string update_User = "******" + " SET [EntityCode] = @EntCode, " + " [BUCode] = @BUCode, " + " [DomainAccount] = @DomainAccount, " + " [UserLevelKey] = @UserLevelKey, " + " [Active] = @Active " + " WHERE [PK] = @PK"; SqlCommand cmd = new SqlCommand(update_User, conn); cmd.Parameters.AddWithValue("@PK", PK); cmd.Parameters.AddWithValue("@EntCode", sEntCode); cmd.Parameters.AddWithValue("@BUCode", sBUCode); cmd.Parameters.AddWithValue("@DomainAccount", sDomainAcc); cmd.Parameters.AddWithValue("@UserLevelKey", sUserLevel); cmd.Parameters.AddWithValue("@Active", sUserStatus); cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery(); conn.Close(); BindUserList(); e.Cancel = true; grid.CancelEdit(); }
private void Save() { try { ASPxPageControl pageControl = this.grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox txtId = pageControl.FindControl("txt_Id") as ASPxTextBox; string id = SafeValue.SafeString(txtId.Text, ""); Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(WhContract), "Id='" + id + "'"); WhContract contract = C2.Manager.ORManager.GetObject(query) as WhContract; bool isNew = false; string contractNo = ""; if (contract == null) { contract = new WhContract(); isNew = true; contractNo = C2Setup.GetNextNo("Contract"); } ASPxButtonEdit txt_PartyId = pageControl.FindControl("txt_PartyId") as ASPxButtonEdit; contract.PartyId = txt_PartyId.Text; ASPxDateEdit txt_Date = pageControl.FindControl("txt_Date") as ASPxDateEdit; contract.ContractDate = txt_Date.Date; ASPxDateEdit txt_StartDate = pageControl.FindControl("txt_StartDate") as ASPxDateEdit; contract.StartDate = txt_StartDate.Date; ASPxDateEdit txt_ExpireDate = pageControl.FindControl("txt_ExpireDate") as ASPxDateEdit; contract.ExpireDate = txt_ExpireDate.Date; ASPxButtonEdit txt_WarehouseId = pageControl.FindControl("txt_WarehouseId") as ASPxButtonEdit; contract.WhCode = txt_WarehouseId.Text; ASPxButtonEdit txt_SalesmanId = pageControl.FindControl("txt_SalesmanId") as ASPxButtonEdit; ASPxComboBox cmb_Type = pageControl.FindControl("cmb_Type") as ASPxComboBox; contract.StorageType = cmb_Type.Text; ASPxMemo txt_Remark = pageControl.FindControl("txt_Remark") as ASPxMemo; contract.Remark = txt_Remark.Text; string userId = HttpContext.Current.User.Identity.Name; if (isNew) { contract.CreateBy = userId; contract.CreateDateTime = DateTime.Now; contract.ContractNo = contractNo.ToString(); contract.StatusCode = "USE"; Manager.ORManager.StartTracking(contract, Wilson.ORMapper.InitialState.Inserted); Manager.ORManager.PersistChanges(contract); C2Setup.SetNextNo("Contract", contractNo); } else { contract.UpdateBy = userId; contract.UpdateDateTime = DateTime.Now; Manager.ORManager.StartTracking(contract, Wilson.ORMapper.InitialState.Updated); Manager.ORManager.PersistChanges(contract); } Session["ContractWhere"] = "ContractNo='" + contract.ContractNo + "'"; this.dsWhContract.FilterExpression = Session["ContractWhere"].ToString(); if (this.grid.GetRow(0) != null) { this.grid.StartEdit(0); } } catch { } }
protected void grid_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e) { if (this.grid.EditingRowVisibleIndex > -1) { ASPxPageControl pageControl = this.grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox txt_PartyId = pageControl.FindControl("txtPartyId") as ASPxTextBox; txt_PartyId.Enabled = false; ASPxTextBox txtICNo = pageControl.FindControl("txtICNo") as ASPxTextBox; ASPxTextBox txt_CustomerName = pageControl.FindControl("txt_CustomerName") as ASPxTextBox; txt_CustomerName.Text = EzshipHelper.GetPartyName(this.grid.GetRowValues(this.grid.EditingRowVisibleIndex, new string[] { "RelationId" })); } }
protected void AddOrUpdate() { ASPxPageControl pageControl = this.grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox txt_pId = pageControl.FindControl("txt_Id") as ASPxTextBox; string pId = SafeValue.SafeString(txt_pId.Text, ""); Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(WhInventory), "Id='" + pId + "'"); WhInventory obj = C2.Manager.ORManager.GetObject(query) as WhInventory; bool action = false; string inventoryNo = ""; if (obj == null) { action = true; obj = new WhInventory(); inventoryNo = C2Setup.GetNextNo("Inventory"); } ASPxTextBox txt_InventoryNo = pageControl.FindControl("txt_InventoryNo") as ASPxTextBox; obj.InventoryNo = txt_InventoryNo.Text.Trim(); ASPxDateEdit date_InventoryDate = pageControl.FindControl("date_InventoryDate") as ASPxDateEdit; obj.InventoryDate = date_InventoryDate.Date; ASPxTextBox txt_InventoryUser = pageControl.FindControl("txt_InventoryUser") as ASPxTextBox; obj.InventoryUser = txt_InventoryUser.Text; if (action) { obj.InventoryNo = inventoryNo; obj.CreateBy = HttpContext.Current.User.Identity.Name; obj.CreateDateTime = DateTime.Now; C2Setup.SetNextNo("Inventory", inventoryNo); Manager.ORManager.StartTracking(obj, Wilson.ORMapper.InitialState.Inserted); Manager.ORManager.PersistChanges(obj); Session["NameWhere"] = "InventoryNo='" + inventoryNo + "'"; this.dsWhInventory.FilterExpression = Session["NameWhere"].ToString(); if (this.grid.GetRow(0) != null) { this.grid.StartEdit(0); } } else { obj.UpdateBy = HttpContext.Current.User.Identity.Name; obj.UpdateDateTime = DateTime.Now; Manager.ORManager.StartTracking(obj, Wilson.ORMapper.InitialState.Updated); Manager.ORManager.PersistChanges(obj); } }
protected void grid_det_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { ASPxPageControl pageControl = this.grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox pid = pageControl.FindControl("txt_Id") as ASPxTextBox; ASPxTextBox txt_InventoryNo = pageControl.FindControl("txt_InventoryNo") as ASPxTextBox; e.NewValues["Qty"] = SafeValue.SafeInt(e.NewValues["Qty"], 0); e.NewValues["AdjustQty"] = SafeValue.SafeInt(e.NewValues["AdjustQty"], 0); e.NewValues["LineINo"] = SafeValue.SafeInt(pid.Text, 0); e.NewValues["InventoryNo"] = txt_InventoryNo.Text; e.NewValues["CreatedBy"] = EzshipHelper.GetUserName(); e.NewValues["CreateDateTime"] = DateTime.Now; }
protected void grid_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e) { string s = e.Parameters; ASPxPageControl pageControl = this.grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox txtPartyId = pageControl.FindControl("txtPartyId") as ASPxTextBox; if (s == "Block") { #region block ASPxLabel lblStatus = pageControl.FindControl("lblStatus") as ASPxLabel; string sql = "select Status from XXParty where PartyId='" + txtPartyId.Text + "'"; string user = HttpContext.Current.User.Identity.Name; string role = EzshipHelper.GetUseRole(); if (role == "Admin" || role == "AccountManager" || role == "AccountStaff") { string closeInd = SafeValue.SafeString(C2.Manager.ORManager.ExecuteScalar(sql), "USE");// closeIndStr.Text; if (closeInd == "USE") { sql = string.Format("update XXParty set Status='InActive' where PartyId='{0}'", txtPartyId.Text); int res = Manager.ORManager.ExecuteCommand(sql); if (res > 0) { e.Result = "Success"; } else { e.Result = "Fail"; } } else { sql = string.Format("update XXParty set Status='USE' where PartyId='{0}'", txtPartyId.Text); int res = Manager.ORManager.ExecuteCommand(sql); if (res > 0) { e.Result = "Success"; } else { e.Result = "Fail"; } } } else { e.Result = ""; } #endregion } }
protected void grid_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e) { if (this.grid.EditingRowVisibleIndex > -1) { ASPxPageControl pageControl = this.grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox txt_PartyId = pageControl.FindControl("txtPartyId") as ASPxTextBox; txt_PartyId.Enabled = false; string partyId = SafeValue.SafeString(this.grid.GetRowValues(this.grid.EditingRowVisibleIndex, new string[] { "PartyId" })); string sql = "select Salesman from XXPartySales where PartyId='" + partyId + "' and DefaultInd='Y'"; string salesMan = SafeValue.SafeString(C2.Manager.ORManager.ExecuteScalar(sql)); ASPxTextBox txt_DefaultSale = pageControl.FindControl("txt_DefaultSale") as ASPxTextBox; txt_DefaultSale.Text = salesMan; } }
protected void grid_Cost_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { ASPxPageControl pageControl = this.grid_ref.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox sequenceID = pageControl.FindControl("txt_SequenceId") as ASPxTextBox; ASPxTextBox refNo = pageControl.FindControl("txt_RefN") as ASPxTextBox; e.NewValues["JobType"] = "SE"; e.NewValues["RefNo"] = refNo.Text; e.NewValues["SaleDocAmt"] = SafeValue.ChinaRound(SafeValue.SafeDecimal(e.NewValues["SaleQty"], 0) * SafeValue.SafeDecimal(e.NewValues["SalePrice"], 0), 2); e.NewValues["SaleLocAmt"] = SafeValue.ChinaRound(SafeValue.SafeDecimal(e.NewValues["SaleDocAmt"], 0) * SafeValue.SafeDecimal(e.NewValues["SaleExRate"], 0), 2); e.NewValues["CostDocAmt"] = SafeValue.ChinaRound(SafeValue.SafeDecimal(e.NewValues["CostQty"], 0) * SafeValue.SafeDecimal(e.NewValues["CostPrice"], 0), 2); e.NewValues["CostLocAmt"] = SafeValue.ChinaRound(SafeValue.SafeDecimal(e.NewValues["CostDocAmt"], 0) * SafeValue.SafeDecimal(e.NewValues["CostExRate"], 0), 2); }
protected void BUDeptListGrid_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { ASPxGridView grid = sender as ASPxGridView; ASPxPageControl pageControl = grid.FindEditFormTemplateControl("BUHeadPageControl") as ASPxPageControl; ASPxDateEdit effectDate = pageControl.FindControl("EffectDate") as ASPxDateEdit; ASPxComboBox entCode = pageControl.FindControl("EntityCode") as ASPxComboBox; ASPxCallbackPanel callBackPanel = pageControl.FindControl("BUCallBackPanel") as ASPxCallbackPanel; ASPxComboBox buCode = callBackPanel.FindControl("BUCode") as ASPxComboBox; ASPxComboBox buHead = pageControl.FindControl("BUHead") as ASPxComboBox; ASPxComboBox buHeadStatus = pageControl.FindControl("BUHeadStatus") as ASPxComboBox; SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString()); conn.Open(); string PK = e.Keys[0].ToString(); string sLastModified = DateTime.Now.ToString(); string sbuCode = ""; if (buCode.Value != null) { sbuCode = buCode.Value.ToString(); } string update_MRP = "UPDATE tbl_System_BUDeptHead " + " SET [EffectDate] = @EffectDate, " + " [EntityCode] = @EntCode, " + " [BUDeptCode] = @BUCode, " + " [UserKey]= @BUHead, " + " [StatusKey] = @StatusKey, " + " [LastModified] = @LastModified " + " WHERE [PK] = @PK"; SqlCommand cmd = new SqlCommand(update_MRP, conn); cmd.Parameters.AddWithValue("@PK", PK); cmd.Parameters.AddWithValue("@EffectDate", effectDate.Value.ToString()); cmd.Parameters.AddWithValue("@EntCode", entCode.Value.ToString()); cmd.Parameters.AddWithValue("@BUCode", sbuCode.ToString()); cmd.Parameters.AddWithValue("@BUHead", buHead.Value.ToString()); cmd.Parameters.AddWithValue("@StatusKey", buHeadStatus.Value.ToString()); cmd.Parameters.AddWithValue("@LastModified", sLastModified); cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery(); conn.Close(); BindUserList(); e.Cancel = true; grid.CancelEdit(); }
protected void grid_Location_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e) { ASPxGridView grid = (sender as ASPxGridView) as ASPxGridView; if (grid.EditingRowVisibleIndex > -1) { ASPxPageControl pageControl = grid.FindEditFormTemplateControl("pageControl_Location") as ASPxPageControl; ASPxTextBox txt_PartyName = pageControl.FindControl("txt_PartyName") as ASPxTextBox; ASPxTextBox txt_WarehouseName = pageControl.FindControl("txt_WarehouseName") as ASPxTextBox; ASPxTextBox txt_Location_Code = pageControl.FindControl("txt_Location_Code") as ASPxTextBox; txt_Location_Code.Enabled = false; txt_PartyName.Text = EzshipHelper.GetPartyName(grid.GetRowValues(this.grid.EditingRowVisibleIndex, new string[] { "PartyId" })); } }
protected void grid_ref_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e) { if (this.grid_ref.EditingRowVisibleIndex > -1) { ASPxPageControl pageControl = this.grid_ref.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox txt_AgentName = this.grid_ref.FindEditFormTemplateControl("txt_AgentName") as ASPxTextBox; ASPxTextBox txt_CrAgentName = this.grid_ref.FindEditFormTemplateControl("txt_CrAgentName") as ASPxTextBox; ASPxTextBox txt_NvoccAgentName = pageControl.FindControl("txt_NvoccAgentName") as ASPxTextBox; ASPxTextBox txt_LocalCustName = this.grid_ref.FindEditFormTemplateControl("txt_LocalCustName") as ASPxTextBox; ASPxTextBox txt_WhName = pageControl.FindControl("txt_WhName") as ASPxTextBox; ASPxDateEdit refDate = this.grid_ref.FindEditFormTemplateControl("date_RefDate") as ASPxDateEdit; refDate.ReadOnly = true; refDate.BackColor = ((DevExpress.Web.ASPxEditors.ASPxTextBox)(this.grid_ref.FindEditFormTemplateControl("txt_RefN"))).BackColor; txt_LocalCustName.Text = EzshipHelper.GetPartyName(this.grid_ref.GetRowValues(this.grid_ref.EditingRowVisibleIndex, new string[] { "LocalCust" })); txt_AgentName.Text = EzshipHelper.GetPartyName(this.grid_ref.GetRowValues(this.grid_ref.EditingRowVisibleIndex, new string[] { "AgentId" })); txt_CrAgentName.Text = EzshipHelper.GetPartyName(this.grid_ref.GetRowValues(this.grid_ref.EditingRowVisibleIndex, new string[] { "CarrierAgentId" })); txt_NvoccAgentName.Text = EzshipHelper.GetPartyName(this.grid_ref.GetRowValues(this.grid_ref.EditingRowVisibleIndex, new string[] { "NvoccAgentId" })); txt_WhName.Text = EzshipHelper.GetPartyName(this.grid_ref.GetRowValues(this.grid_ref.EditingRowVisibleIndex, new string[] { "WareHouseId" })); int oid = SafeValue.SafeInt(this.grid_ref.GetRowValues(this.grid_ref.EditingRowVisibleIndex, new string[] { "Id" }), 0); if (oid > 0) { string userId = HttpContext.Current.User.Identity.Name; ASPxLabel lab_StatusCode = pageControl.FindControl("lb_JobStatus") as ASPxLabel; string sql = string.Format("select StatusCode from air_ref where Id={0}", oid); DataTable dt = ConnectSql.GetTab(sql); string closeInd = SafeValue.SafeString(Manager.ORManager.ExecuteScalar(sql)); ASPxButton btn_VoidMaster = this.grid_ref.FindEditFormTemplateControl("btn_VoidMaster") as ASPxButton; ASPxButton btn_CloseJob = this.grid_ref.FindEditFormTemplateControl("btn_CloseJob") as ASPxButton; if (closeInd == "CLS") { btn_CloseJob.Text = "Open Job"; lab_StatusCode.Text = "Close"; } else if (closeInd == "CNL") { btn_VoidMaster.Text = "Unvoid"; lab_StatusCode.Text = "Void"; } else { btn_CloseJob.Text = "Close Job"; lab_StatusCode.Text = "USE"; btn_VoidMaster.Text = "Void"; } } } }
protected void grdWorkflowMaster_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { ASPxGridView grid = sender as ASPxGridView; ASPxPageControl pageControl = grid.FindEditFormTemplateControl("WorkflowMasterPageControl") as ASPxPageControl; ASPxDateEdit effectDate = pageControl.FindControl("EffectDate") as ASPxDateEdit; ASPxComboBox entCode = pageControl.FindControl("EntCode") as ASPxComboBox; ASPxComboBox buCode = pageControl.FindControl("BUCode") as ASPxComboBox; ASPxComboBox buHead = pageControl.FindControl("BUHead") as ASPxComboBox; SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString()); conn.Open(); string sCtrlNum = "", sLastModified = DateTime.Now.ToString(); string insert = "INSERT INTO tbl_System_Workflow ([Ctrl], [EffectDate], [EntCode], [BUCode], [BUHead], [LastModified]) " + " VALUES (@Ctrl, @EffectDate, @EntCode, @BUCode, @BUHead, @LastModified)"; SqlCommand cmd = new SqlCommand(insert, conn); cmd.Parameters.AddWithValue("@Ctrl", sCtrlNum); cmd.Parameters.AddWithValue("@EffectDate", effectDate.Value.ToString()); cmd.Parameters.AddWithValue("@EntCode", entCode.Value.ToString()); cmd.Parameters.AddWithValue("@BUCode", buCode.Value.ToString()); cmd.Parameters.AddWithValue("@BUHead", buHead.Value.ToString()); cmd.Parameters.AddWithValue("@LastModified", sLastModified); cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery(); e.Cancel = true; grid.CancelEdit(); BindWorkflow(); int pk_latest = 0; string query_pk = "SELECT TOP 1 [PK] FROM tbl_System_Workflow ORDER BY [PK] DESC"; SqlCommand comm = new SqlCommand(query_pk, conn); SqlDataReader r = comm.ExecuteReader(); while (r.Read()) { pk_latest = Convert.ToInt32(r[0].ToString()); } if (pk_latest > 0) { FocusThisRowGrid(grid, pk_latest); } }
protected void grd_Photo_BeforePerformDataSelect(object sender, EventArgs e) { ASPxPageControl pageControl = this.grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox txtRefNo = pageControl.FindControl("txt_SoNo") as ASPxTextBox; this.dsAttachment.FilterExpression = "RefNo='" + SafeValue.SafeString(txtRefNo.Text, "") + "'"; }
protected void grid_det_RowUpdated(object sender, DevExpress.Web.Data.ASPxDataUpdatedEventArgs e) { ASPxPageControl pageControl = this.grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox oidCtr = pageControl.FindControl("txt_SoNo") as ASPxTextBox; UpdateMaster(oidCtr.Text); }
protected void grid_Location_BeforePerformDataSelect(object sender, EventArgs e) { ASPxPageControl pageControl = this.grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox txt_Code = pageControl.FindControl("txt_Code") as ASPxTextBox; this.dsRefLocation.FilterExpression = "LocLevel='Unit' and WarehouseCode='" + txt_Code.Text + "'"; }
protected void grid_Store_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { ASPxPageControl pageControl = this.grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox txt_Code = pageControl.FindControl("txt_Code") as ASPxTextBox; if (SafeValue.SafeString(e.NewValues["Code"], "").Length < 1) { e.Cancel = true; throw new Exception("The Code not null"); } string sql = "select Code from ref_location where LocLevel='Store' and WareHouseCode='" + txt_Code.Text + "'"; DataTable dt = C2.Manager.ORManager.GetDataSet(sql).Tables[0]; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { string oldCode = dt.Rows[i]["Code"].ToString(); string code = SafeValue.SafeString(e.NewValues["Code"]); if (code == oldCode) { throw new Exception("Please enter another value of the Code again!"); return; } } } e.NewValues["WarehouseCode"] = txt_Code.Text; e.NewValues["CreateBy"] = EzshipHelper.GetUserName(); e.NewValues["CreateDateTime"] = DateTime.Now; e.NewValues["Loclevel"] = "Store"; }
protected void grid_Zone_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { ASPxPageControl pageControl = this.grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox txt_Code = pageControl.FindControl("txt_Code") as ASPxTextBox; e.NewValues["Name"] = SafeValue.SafeString(e.NewValues["Name"]); }
protected void grid_Export_CustomCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e) { string s = e.Parameters; if (s == "Photo") { if (this.dsJobPhoto.FilterExpression == "1=0") { ASPxGridView grd = sender as ASPxGridView; ASPxPageControl pageControl = grd.FindEditFormTemplateControl("pageControl_Hbl") as ASPxPageControl; ASPxTextBox HNo = pageControl.FindControl("txtHouseId") as ASPxTextBox; //this.dsJobPhoto.FilterExpression = "JobClass='I' and RefNo='" + refNo.Text + "'"; string sql = "select RefNo,JobNo from air_job where Id='" + HNo.Text + "'"; DataTable tab = C2.Manager.ORManager.GetDataSet(sql).Tables[0]; if (tab.Rows.Count > 0) { string refNo = tab.Rows[0]["RefNo"].ToString(); string jobNo = tab.Rows[0]["JobNo"].ToString(); this.dsJobPhoto.FilterExpression = string.Format("JobType='AE' and RefNo='{0}' and JobNo='{1}'", refNo, jobNo); } } } if (s == "Save") { SaveJob(); } }
public void cargarBarrio() { ASPxPageControl tabs = (ASPxPageControl)ASPxGridView1.FindEditFormTemplateControl("pageControl"); ASPxFormLayout form = (ASPxFormLayout)tabs.FindControl("formLayoutUbicacion"); /* PROVINCIA */ ASPxComboBox comboProvincia = (ASPxComboBox)form.FindControl("cmbProvincia"); /* CANTON */ ASPxComboBox comboCanton = (ASPxComboBox)form.FindControl("cmbCanton"); /* DISTRITO */ ASPxComboBox comboDistrito = (ASPxComboBox)form.FindControl("cmbDistrito"); /* BARRIO */ ASPxComboBox comboBarrio = (ASPxComboBox)form.FindControl("cmbBarrio"); comboBarrio.Items.Clear(); if (comboProvincia.Value != null && comboCanton.Value != null && comboDistrito.Value != null) { using (var conexion = new DataModelFE()) { foreach (var item in conexion.Ubicacion. Where(x => x.codProvincia == comboProvincia.Value.ToString()). Where(x => x.codCanton == comboCanton.Value.ToString()). Where(x => x.codDistrito == comboDistrito.Value.ToString()). Select(x => new { x.codBarrio, x.nombreBarrio }).Distinct()) { comboBarrio.Items.Add(item.nombreBarrio, item.codBarrio); } comboBarrio.IncrementalFilteringMode = IncrementalFilteringMode.Contains; comboBarrio.SelectedIndex = 0; } } }