protected void grvIA_OnHtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) { try { ASPxGridView grv = (sender as ASPxGridView); ASPxButton btnIAInfo = (ASPxButton)grv.FindRowCellTemplateControl(e.VisibleIndex, null, "btnIAInfo"); if (grv.GetRowValues(e.VisibleIndex, "Info") != null && grv.GetRowValues(e.VisibleIndex, "Info").ToString().Trim().Length > 0) { IA ia = IrregAltRepository.RetrieveIAHeadersById(Convert.ToInt32(btnIAInfo.CommandArgument)); btnIAInfo.Text = (grv.GetRowValues(e.VisibleIndex, "Info").ToString()) + System.Environment.NewLine + "(" + ia.InfoNumber + ")"; } ASPxLabel lblPart = (ASPxLabel)grv.FindRowCellTemplateControl(e.VisibleIndex, null, "lblPart"); if (lblPart != null) { int id = Convert.ToInt32(grv.GetRowValues(e.VisibleIndex, "Id")); lblPart.Text = IrregAltRepository.RetrieveIrregAlterationPartsById(id); } ASPxLabel lblModel = (ASPxLabel)grv.FindRowCellTemplateControl(e.VisibleIndex, null, "lblModelName"); if (lblModel != null) { string ModelName = ControlPlanRepository.RetrieveAssemblyModelNameById(Convert.ToInt32(hfDocControl["ModelId"])); lblModel.Text = ModelName; } } catch (Exception ex) { LoggerHelper.LogError(ex); } }
protected void EXJournalGridView_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridViewTableDataCellEventArgs e) { ASPxGridView gv = sender as ASPxGridView; Label hfStatus = gv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "hfNameLabel") as Label; //10/4/2013 NS added Label hfExTotal = gv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "hfExTotalLabel") as Label; string ExJournalThreshold = "1000"; try { ExJournalThreshold = VSWebBL.SettingBL.SettingsBL.Ins.Getvalue("ExJournal Threshold"); } catch (Exception ex) { Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); throw ex; } if (e.DataColumn.FieldName == "EXTotal" && ExJournalThreshold != "") { if (Convert.ToInt32(hfExTotal.Text.ToString()) > Convert.ToInt32(ExJournalThreshold)) { e.Cell.ForeColor = System.Drawing.Color.Red; } } if (e.DataColumn.FieldName == "Status" && (hfStatus.Text.ToString() == "OK" || hfStatus.Text.ToString() == "Scanning" || hfStatus.Text.ToString() == "Telnet")) { e.Cell.BackColor = System.Drawing.Color.LightGreen; } else if (e.DataColumn.FieldName == "Status" && hfStatus.Text.ToString() == "Not Responding") { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; } else if (e.DataColumn.FieldName == "Status" && hfStatus.Text.ToString() == "Not Scanned") { e.Cell.BackColor = System.Drawing.Color.FromName("#87CEEB"); e.Cell.ForeColor = System.Drawing.Color.Black; } else if (e.DataColumn.FieldName == "Status" && hfStatus.Text.ToString() == "Disabled") { e.Cell.BackColor = System.Drawing.Color.FromName("#D0D0D0"); } else if (e.DataColumn.FieldName == "Status" && hfStatus.Text.ToString() == "Maintenance") { e.Cell.BackColor = System.Drawing.Color.LightBlue; } else if (e.DataColumn.FieldName == "Status") { e.Cell.BackColor = System.Drawing.Color.Yellow; } }
protected void ASPxGridView1_HtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e) { if (e.RowType == GridViewRowType.Data) { ASPxGridView grid = sender as ASPxGridView; ASPxRadioButton discontinued = grid.FindRowCellTemplateControl(e.VisibleIndex, grid.Columns["Discontinued"] as GridViewDataColumn, "btnDiscontinued") as ASPxRadioButton; ASPxRadioButton inproduction = grid.FindRowCellTemplateControl(e.VisibleIndex, grid.Columns["InProduction"] as GridViewDataColumn, "btnInProduction") as ASPxRadioButton; discontinued.ClientInstanceName = "btnDiscontinued" + e.VisibleIndex; inproduction.ClientInstanceName = "btnInProduction" + e.VisibleIndex; inproduction.ClientSideEvents.CheckedChanged = String.Format("function (s,e) {{if(btnInProduction{0}.GetChecked()) {{btnDiscontinued{0}.SetChecked(false);}}}}", e.VisibleIndex); discontinued.ClientSideEvents.CheckedChanged = String.Format("function (s,e) {{if(btnDiscontinued{0}.GetChecked()) {{btnInProduction{0}.SetChecked(false);}}}}", e.VisibleIndex); } }
protected void gridArtifacts_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { ASPxGridView gridArtifacts = (ASPxGridView)sender; ASPxGridView gridRepository = (ASPxGridView)gridArtifacts.FindEditFormLayoutItemTemplateControl("gridRepository"); //Use class AttachmentList to create a list of artifacts to be attached AttachmentList xMultiAttachment = new AttachmentList(); //go through grid and create an unit for each selected item for (int i = 0; i <= gridRepository.VisibleRowCount; i = i + 1) { if (gridRepository.Selection.IsRowSelected(i) == true) { //get page ref from text box inside cell template ASPxTextBox txPage = (ASPxTextBox)gridRepository.FindRowCellTemplateControl(i, gridRepository.DataColumns[8], "txPage"); xMultiAttachment.Add(new Attachment() { ArtifactID = gridRepository.GetRowValues(i, "ArtifactID").ToString(), ProjectID = gridRepository.GetRowValues(i, "ProjectID").ToString(), PageReference = txPage.Text.ToString(), ItemID = Session["ItemKey"].ToString() }); } } //If any selected, call the function in rc_services to attach multiple artifacts if (xMultiAttachment.Count > 0) { string xMultiAttachResult = rc_services.AttachArtifact(xMultiAttachment); e.Cancel = true; gridArtifacts.CancelEdit(); gridArtifacts.DataBind(); gridRepository.Selection.UnselectAll(); } }
protected void ASPxGridView1_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) { string[] param = e.Parameters.Split('|'); if (param[0] == "oneRow") { int visibleIndex = int.Parse(param[1]); ASPxGridView grid = sender as ASPxGridView; ASPxTextBox tbCategoryName = grid.FindRowCellTemplateControl(visibleIndex, grid.Columns["CategoryName"] as GridViewDataColumn, "txtBox") as ASPxTextBox; ASPxTextBox tbDescription = grid.FindRowCellTemplateControl(visibleIndex, grid.Columns["Description"] as GridViewDataColumn, "txtBox") as ASPxTextBox; AccessDataSource1.UpdateParameters["CategoryName"].DefaultValue = tbCategoryName.Text; AccessDataSource1.UpdateParameters["Description"].DefaultValue = tbDescription.Text;; AccessDataSource1.UpdateParameters["CategoryID"].DefaultValue = grid.GetRowValues(visibleIndex, "CategoryID").ToString(); AccessDataSource1.Update(); } ASPxGridView1.DataBind(); }
protected void grid_HtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e) { if (e.RowType == GridViewRowType.Data) { ASPxGridView gridView = (ASPxGridView)sender; ASPxSpinEdit spin = (ASPxSpinEdit)gridView.FindRowCellTemplateControl(e.VisibleIndex, (GridViewDataColumn)gridView.Columns["UnitQty"], "QtySpin"); spin.Attributes.Add("rowIndex", e.VisibleIndex.ToString()); ASPxLabel lblPrice = (ASPxLabel)gridView.FindRowCellTemplateControl(e.VisibleIndex, (GridViewDataColumn)gridView.Columns["UnitPrice"], "lblPrice"); lblPrice.ClientInstanceName = "lblPrice_" + e.VisibleIndex.ToString(); ASPxLabel lbl = (ASPxLabel)gridView.FindRowCellTemplateControl(e.VisibleIndex, (GridViewDataColumn)gridView.Columns["Sum"], "lblSum"); lbl.ClientInstanceName = "lblSum_" + e.VisibleIndex.ToString(); } }
protected void ExchangeMailGridView_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { ASPxGridView gv = sender as ASPxGridView; Label hfStatus = gv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "hfExNameLabel") as Label; if (e.DataColumn.FieldName == "Status" && (hfStatus.Text.ToString() == "OK" || hfStatus.Text.ToString() == "Scanning" || hfStatus.Text.ToString() == "Telnet")) { e.Cell.BackColor = System.Drawing.Color.LightGreen; } else if (e.DataColumn.FieldName == "Status" && hfStatus.Text.ToString() == "Not Responding") { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; } else if (e.DataColumn.FieldName == "Status" && hfStatus.Text.ToString() == "Not Scanned") { e.Cell.BackColor = System.Drawing.Color.FromName("#87CEEB"); e.Cell.ForeColor = System.Drawing.Color.Black; } else if (e.DataColumn.FieldName == "Status" && hfStatus.Text.ToString() == "Disabled") { e.Cell.BackColor = System.Drawing.Color.FromName("#D0D0D0"); } else if (e.DataColumn.FieldName == "Status" && hfStatus.Text.ToString() == "Maintenance") { e.Cell.BackColor = System.Drawing.Color.LightBlue; } else if (e.DataColumn.FieldName == "Status") { e.Cell.BackColor = System.Drawing.Color.Yellow; } }
protected void grid_wh_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e) { string pars = e.Parameters; string[] ar = pars.Split('_'); if (ar.Length >= 2) { if (ar[0].Equals("Uploadline")) { ASPxGridView grid = sender as ASPxGridView; int rowIndex = SafeValue.SafeInt(ar[1], -1); ASPxTextBox txt_Id = grid.FindRowCellTemplateControl(rowIndex, null, "txt_Id") as ASPxTextBox; ASPxTextBox txt_ContNo = grid.FindRowCellTemplateControl(rowIndex, null, "txt_ContNo") as ASPxTextBox; e.Result = txt_Id.Text + "_" + txt_ContNo.Text; } } }
protected void grid_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) { e.Row.CssClass += String.Format(" dataRow{0}", e.VisibleIndex); ASPxGridView g = sender as ASPxGridView; ASPxCheckBox cb = g.FindRowCellTemplateControl(e.VisibleIndex, (GridViewDataColumn)g.Columns["Active"], "chk") as ASPxCheckBox; if (cb.Checked) { e.Row.CssClass += " rowChecked"; } }
protected void EstimateLicensesGrid_HtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e) { DataTable LicenseDataTable = new DataTable(); if ((Session["EstimateLicenses"] != null) && (Session["EstimateLicenses"] != "")) { LicenseDataTable = (DataTable)Session["EstimateLicenses"]; if (LicenseDataTable.Rows.Count > 0) { ASPxGridView EstimateLicensesGrid = (ASPxGridView)sender; GridViewDataColumn column3 = EstimateLicensesGrid.Columns["UnitCost"] as GridViewDataColumn; GridViewDataColumn column4 = EstimateLicensesGrid.Columns["noofservers"] as GridViewDataColumn; GridViewDataColumn column5 = EstimateLicensesGrid.Columns["totalunits"] as GridViewDataColumn; int startIndex = EstimateLicensesGrid.PageIndex * EstimateLicensesGrid.SettingsPager.PageSize; int endIndex = Math.Min(EstimateLicensesGrid.VisibleRowCount, startIndex + EstimateLicensesGrid.SettingsPager.PageSize); for (int i = startIndex; i < endIndex; i++) { int unitcost = Convert.ToInt32(LicenseDataTable.Rows[i]["UnitCost"].ToString()); ASPxTextBox noofservers = (ASPxTextBox)EstimateLicensesGrid.FindRowCellTemplateControl(i, column4, "noofservers"); ASPxTextBox totalunits = (ASPxTextBox)EstimateLicensesGrid.FindRowCellTemplateControl(i, column5, "totalunits"); if (noofservers != null) { noofservers.Text = (noofservers.Text == "" ? "0" : noofservers.Text); int noofsrvrs = int.Parse(noofservers.Text); if (unitcost != null) { //totalunits.Text = (unitcost * noofsrvrs).ToString(); //noofservers.Attributes["onChange"] = "javascript: return multiplication('" + Convert.ToInt32(unitcost) + "','" + Convert.ToInt32(noofservers.Text) + "','" + Convert.ToInt32(totalunits.Text) + "')"; noofservers.Attributes["onChange"] = "javascript: return multiplication('" + Convert.ToInt32(unitcost) + "',this,this,'" + endIndex + "')"; } } } } } }
protected void ASPxGridView1_HtmlRowPrepared(object sender, DevExpress.Web.ASPxGridViewTableRowEventArgs e) { if (e.RowType == GridViewRowType.Data) { int id = (int)e.KeyValue; ASPxGridView grid = (ASPxGridView)sender; GridViewDataColumn colAction = (GridViewDataColumn)grid.Columns["colAction"]; ASPxButton btnAction = (ASPxButton)grid.FindRowCellTemplateControl(e.VisibleIndex, colAction, "btnAction"); string state = GetSate(id); btnAction.ImageUrl = GetImagePath(state); btnAction.ClientSideEvents.Click = GetActionScript(id, state); } }
protected void HistoryGridView_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { ASPxGridView gv = sender as ASPxGridView; Label hfStatus = gv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "hfNameLabel2") as Label; if (e.DataColumn.FieldName == "NewStatus" || e.DataColumn.FieldName == "OldStatus") { if (hfStatus.Text.ToString() == "Not Responding") { //e.DataColumn.CellStyle.CssClass = "GridCss3"; e.Cell.CssClass = "GridCss3"; } //6/10/2013 NS modified - added Telnet status if (hfStatus.Text.ToString() == "OK" || hfStatus.Text.ToString() == "Scanning") { e.Cell.BackColor = System.Drawing.Color.LightGreen; } else if (hfStatus.Text.ToString() == "Not Responding") { e.Cell.BackColor = System.Drawing.Color.Red; e.Cell.ForeColor = System.Drawing.Color.White; //e.DataColumn.CellStyle.CssClass = "GridCss3"; } else if (hfStatus.Text.ToString() == "Not Scanned") { e.Cell.BackColor = System.Drawing.Color.FromName("#87CEEB"); e.Cell.ForeColor = System.Drawing.Color.Black; } //3/1/2013 NS modified the value of text below - lower case disabled did not match the returned status with capital D else if (hfStatus.Text.ToString() == "Disabled") { e.Cell.BackColor = System.Drawing.Color.FromName("#C8C8C8"); // e.Cell.ForeColor = System.Drawing.Color.White; } else if (hfStatus.Text.ToString() == "Maintenance") { e.Cell.BackColor = System.Drawing.Color.LightBlue; } else { e.Cell.BackColor = System.Drawing.Color.Yellow; // e.DataColumn.GroupFooterCellStyle.ForeColor = System.Drawing.Color.Yellow; } } }
protected void ASPxGridView1_HtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e) { ASPxGridView gridView = ((ASPxGridView)sender); if (e.RowType == GridViewRowType.Data) { ASPxHyperLink hyperlink = ((ASPxHyperLink)gridView.FindRowCellTemplateControl(e.VisibleIndex, null, "btnEdit")); hyperlink.Visible = true; hyperlink.NavigateUrl = string.Format("javascript:grid.StartEditRow('{0}');", e.VisibleIndex); } else if (e.RowType == GridViewRowType.InlineEdit) { GridViewDataColumn column = (GridViewDataColumn)gridView.Columns["#"]; ASPxHyperLink hyperlink = (ASPxHyperLink)gridView.FindEditRowCellTemplateControl(column, "btnUpdate"); hyperlink.ClientInstanceName = "btnUpdate_" + e.VisibleIndex.ToString(); } }
protected void grdData_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) { ASPxGridView grid = sender as ASPxGridView; int idx = Int16.Parse(e.Parameters.ToString()); //grdData.DataSource = // new[] { // new { key="123", code = "MAT001", name = "Mặt hàng 1", lot="123", date="25-5-2014", reciept = "HD001", // recieptamount="100", realamount="90", difamount="10", unit="Thùng", description = "Mặt hàng 1" // }, // new { key="1234", code = "MAT002", name = "Mặt hàng 2", lot="1234", date="25-7-2015",reciept = "HD001", // recieptamount="150", realamount="130", difamount="20", unit="Hộp", description = "Mặt hàng 2" // }, // }; //grdData.KeyFieldName = "key"; //grdData.DataBind(); ASPxTextBox txt_realamount = grid.FindRowCellTemplateControl(idx, grid.Columns["realamount"] as GridViewDataColumn, "txt_realamount") as ASPxTextBox; txt_realamount.Focus(); }
protected void grvDocControlDetail_OnHtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) { try { if (e.VisibleIndex == -1) { return; } ASPxGridView grv = (sender as ASPxGridView); ASPxButton btnDownload = (ASPxButton)grv.FindRowCellTemplateControl(e.VisibleIndex, null, "btnDownload"); if (grv.GetRowValues(e.VisibleIndex, "File") != null) //|| grv.GetRowValues(e.VisibleIndex, "FileLocation").ToString() != string.Empty) { btnDownload.Text = Path.GetFileName(grv.GetRowValues(e.VisibleIndex, "File").ToString()); } } catch (Exception ex) { LoggerHelper.LogError(ex); } }
protected void grid_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) { needToSelectAll = false; bool.TryParse(e.Parameters, out needToSelectAll); ASPxGridView gridView = (ASPxGridView)sender; int startIndex = gridView.PageIndex * gridView.SettingsPager.PageSize; int endIndex = Math.Min(gridView.VisibleRowCount, startIndex + gridView.SettingsPager.PageSize); for (int i = startIndex; i < endIndex; i++) { if (needToSelectAll) { ASPxCheckBox cb = (ASPxCheckBox)gridView.FindRowCellTemplateControl(i, (GridViewDataColumn)gridView.Columns["#"], "cbCheck"); DataRow row = gridView.GetDataRow(i); gridView.Selection.SetSelection(i, IsCheckBoxVisibleCriteria(row)); } else { gridView.Selection.SetSelection(i, needToSelectAll); } } }
private DataTable getCurrentGridData(ASPxGridView gv) { DataTable dt = new DataTable(); if (dt.Columns.Count == 0) { dt.Columns.Add("Seq"); dt.Columns.Add("Item"); } for (int i = 0; i < gv.VisibleRowCount; i++) { GridViewDataColumn colItem = (GridViewDataColumn)gv.Columns["Item"]; TextBox txtItem = (TextBox)gv.FindRowCellTemplateControl(i, colItem, "txtItem"); GridViewDataColumn colSeq = (GridViewDataColumn)gv.Columns["Seq"]; DevExpress.Web.ASPxEditors.ASPxLabel lblSeq = (DevExpress.Web.ASPxEditors.ASPxLabel)gv.FindRowCellTemplateControl(i, colSeq, "lblSeq"); DataRow dr = dt.NewRow(); dr["Seq"] = lblSeq.Text; dr["Item"] = txtItem.Text; dt.Rows.InsertAt(dr, dt.Rows.Count); } return dt; }
protected void grid_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e) { string pars = e.Parameters; string[] ar = pars.Split('_'); if (ar.Length >= 2) { if (ar[0].Equals("Uploadline")) { #region ASPxGridView grid = sender as ASPxGridView; int rowIndex = SafeValue.SafeInt(ar[1], -1); ASPxTextBox txt_Id = grid.FindRowCellTemplateControl(rowIndex, null, "txt_Id") as ASPxTextBox; ASPxTextBox txt_ContNo = grid.FindRowCellTemplateControl(rowIndex, null, "txt_ContNo") as ASPxTextBox; e.Result = txt_Id.Text + "_" + txt_ContNo.Text; #endregion } if (ar[0].Equals("UploadCargoline")) { #region ASPxGridView grid = sender as ASPxGridView; int rowIndex = SafeValue.SafeInt(ar[1], -1); ASPxTextBox txt_Id = grid.FindRowCellTemplateControl(rowIndex, null, "txt_Id") as ASPxTextBox; ASPxTextBox txt_ContNo = grid.FindRowCellTemplateControl(rowIndex, null, "txt_ContNo") as ASPxTextBox; e.Result = txt_Id.Text; #endregion } if (ar[0].Equals("CargoListline")) { #region ASPxGridView grid = sender as ASPxGridView; int rowIndex = SafeValue.SafeInt(ar[1], -1); ASPxTextBox txt_Id = grid.FindRowCellTemplateControl(rowIndex, null, "txt_Id") as ASPxTextBox; e.Result = txt_Id.Text; #endregion } if (ar[0].Equals("Confirmedline")) { #region ASPxGridView grid = sender as ASPxGridView; int rowIndex = SafeValue.SafeInt(ar[1], -1); ASPxLabel lbl_JobId = grid.FindRowCellTemplateControl(rowIndex, null, "lbl_JobId") as ASPxLabel; if (lbl_JobId != null) { string sql = string.Format(@"update ctm_job set JobStatus='{0}' where Id={1}", "Confirmed", SafeValue.SafeInt(lbl_JobId.Text, 0)); int n = ConnectSql_mb.ExecuteNonQuery(sql); if (n > 0) { e.Result = "Action Success!"; } } #endregion } } if (pars.Length >= 2 && (pars.Substring(0, 2) == "BR")) { #region Receive string docnos = pars.Substring(2); string[] docs = docnos.Split(new char[] { ',' }); int done = 0; int all = 0; string result = ""; if (docs.Length > 1) { for (int i = 0; i < docs.Length; i++) { string id = docs[i].Trim(); if (id != "") { all++; string sql = string.Format(@"update job_house set CargoStatus='C',QtyOrig=Qty,WeightOrig=Weight,VolumeOrig=Volume where Id=@Id"); List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>(); list.Add(new ConnectSql_mb.cmdParameters("@Id", id, SqlDbType.Int)); ConnectSql_mb.sqlResult res = ConnectSql_mb.ExecuteNonQuery(sql, list); if (res.status) { done++; } } } result = string.Format("Total received : {0} / {1}", done, all); } else { result = string.Format("Action Error ! Pls select at least one"); } e.Result = result; #endregion } }
private DataTable getCurrentGridData(ASPxGridView gv) { DataTable dt = new DataTable(); if (dt.Columns.Count == 0) { dt.Columns.Add("Seq"); dt.Columns.Add("PROJ_NAME"); dt.Columns.Add("PROJ_DESCRIPTION"); dt.Columns.Add("RECOMMENT"); dt.Columns.Add("PJTeamDT", typeof(DataTable)); dt.Columns.Add("DocDT", typeof(DataTable)); } for (int i = 0; i < gv.VisibleRowCount; i++) { GridViewDataColumn colItem = (GridViewDataColumn)gv.Columns["Project"]; DevExpress.Web.ASPxEditors.ASPxLabel lblSeq = (DevExpress.Web.ASPxEditors.ASPxLabel)gv.FindRowCellTemplateControl(i, colItem, "lblSeq"); TextBox txtProject_Name = (TextBox)gv.FindRowCellTemplateControl(i, colItem, "txtProject_Name"); TextBox txtProject_Desc = (TextBox)gv.FindRowCellTemplateControl(i, colItem, "txtProject_Desc"); TextBox txtProject_Recomment = (TextBox)gv.FindRowCellTemplateControl(i, colItem, "txtProject_Recomment"); DataRow dr = dt.NewRow(); dr["Seq"] = lblSeq.Text; dr["PROJ_NAME"] = txtProject_Name.Text; dr["PROJ_DESCRIPTION"] = txtProject_Desc.Text; dr["RECOMMENT"] = txtProject_Recomment.Text; usercontrol_ProjectTeamUserControl ProjectTeam = (usercontrol_ProjectTeamUserControl)gv.FindRowCellTemplateControl(i, colItem, "ProjectTeam"); DataTable PJDT = new DataTable(); PJDT = ProjectTeam.Description; dr["PJTeamDT"] = PJDT; dt.Rows.InsertAt(dr, dt.Rows.Count); } return dt; }
protected void grid_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { try { ASPxGridView grv = (sender as ASPxGridView); if (e.VisibleIndex > -1) { if (e.DataColumn.FieldName == "SendToMarketing") { DataRowView row = grv.GetRow(e.VisibleIndex) as DataRowView; string bpk = row["BPK"].ToString(); ASPxButton btnSend = grv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "btnSend") as ASPxButton; ASPxLabel lblSend = grv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lblSend") as ASPxLabel; string caption = e.CellValue.ToString();// Convert.ToString(e.CellValue); if (caption == string.Empty && !string.IsNullOrEmpty(bpk)) { btnSend.Visible = true; lblSend.Visible = false; } else { lblSend.Text = caption; btnSend.Visible = false; lblSend.Visible = true; } } if (e.DataColumn.FieldName == "PrintNik") { ASPxButton btnPrintNik = grv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "btnPrintNIK") as ASPxButton; ASPxLabel lblPrintNik = grv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lblPrintNIK") as ASPxLabel; string caption = e.CellValue.ToString("yyyy-MM-dd");// Convert.ToString(e.CellValue); if (caption != string.Empty) { lblPrintNik.Text = caption; btnPrintNik.Visible = false; lblPrintNik.Visible = true; } else { btnPrintNik.Visible = false; lblPrintNik.Visible = false; } } if (e.DataColumn.FieldName == "ReceivedByMarketing") { ASPxButton btnRCV = grv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "btnRCV") as ASPxButton; ASPxLabel lblRCV = grv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lblRCV") as ASPxLabel; string caption = e.CellValue.ToString();// Convert.ToString(e.CellValue); if (caption != string.Empty) { lblRCV.Text = caption; btnRCV.Visible = false; lblRCV.Visible = true; } else { btnRCV.Visible = false; lblRCV.Visible = false; } } if (e.DataColumn.FieldName == "BPK") { ASPxButton btnBPK = grv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "btnBPK") as ASPxButton; ASPxLabel lblBPK = grv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lblBPK") as ASPxLabel; string caption = e.CellValue.ToString();// Convert.ToString(e.CellValue); if (caption != string.Empty) { lblBPK.Text = caption; btnBPK.Visible = false; lblBPK.Visible = true; } else { btnBPK.Visible = false; lblBPK.Visible = false; } } } } catch (Exception ex) { AppLogger.LogError(ex); } }
protected void grid_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e) { string par = e.Parameters; string[] ar = par.Split('_'); if (par == "OK") { #region Create Inv try { if (list.Count > 0) { string invN = ""; for (int i = 0; i < list.Count; i++) { string jobNo = list[i].jobNo; string client = SafeValue.SafeString(ConnectSql.ExecuteScalar(string.Format(@"select PartyId from ctm_job where JobNo='{0}'", jobNo))); string user = HttpContext.Current.User.Identity.Name; string acCode = EzshipHelper.GetAccArCode("", "SGD"); DateTime dtime = txt_DocDt.Date; string currency = "SGD"; decimal exrate = 1; string termId = EzshipHelper.GetTerm(client); string term = EzshipHelper.GetTermCode(termId); string sql = string.Format(@"select SequenceId,DocNo from XAArInvoice where MastRefNo='{0}' and datediff(d,'{1}',DocDate)>=0 and PartyTo='{2}'", jobNo, dtime, client); DataTable tab = ConnectSql.GetTab(sql); string docId = ""; if (tab.Rows.Count == 0) { invN = C2Setup.GetNextNo("", "AR-IV", dtime); sql = string.Format(@"insert into XAArInvoice (DocType,DocDate,PartyTo,DocNo,AcYear,AcPeriod,Term,DocDueDate,Description, CurrencyId,MastType,ExRate,ExportInd,CancelDate,CancelInd,UserId,EntryDate,Eta,AcCode,AcSource,MastRefNo) values('IV','{5:yyyy-MM-dd}','{4}','{0}','{6}','{7}','{8}','{5:yyyy-MM-dd}','', 'SGD','CTM',1,'N','19000101','N','{1}',getdate(),'17530101','{2}','DB','{3}') select @@IDENTITY", invN, user, acCode, jobNo, client, dtime, dtime.Year, dtime.Month, term); docId = ConnectSql_mb.ExecuteScalar(sql); C2Setup.SetNextNo("", "AR-IV", invN, dtime); } else { invN = tab.Rows[0]["DocNo"].ToString(); docId = tab.Rows[0]["SequenceId"].ToString(); } int id = list[i].id; C2.ComMethod.CreateInv(invN, id, docId, 0, "", currency, exrate); } e.Result = invN; } else { e.Result = "Action Error!Please keyin select cost "; } } catch { } #endregion } if (par == "Update") { #region Update Inv if (Request.QueryString["no"] != null) { try { string no = SafeValue.SafeString(Request.QueryString["no"]); if (list.Count > 0) { string invN = lbl_DocNo.Text; string sql = string.Format(@"select SequenceId from XAArInvoice where DocNo='{0}'", invN); string docId = ConnectSql_mb.ExecuteScalar(sql); for (int i = 0; i < list.Count; i++) { int id = list[i].id; CreateInv(invN, id, docId); } e.Result = "Success"; } else { e.Result = "Please keyin select cost "; } } catch { } } #endregion } if (par == "Save") { #region Save All if (list.Count > 0) { for (int i = 0; i < list.Count; i++) { int id = list[i].id; string contNo = list[i].contNo; string contType = list[i].contType; decimal price = list[i].price; decimal qty = list[i].qty; string unit = list[i].unit; string groupBy = list[i].groupBy; decimal locAmt = SafeValue.ChinaRound(1 * SafeValue.SafeDecimal(price, 0), 2); string sql = string.Format(@"update job_cost set ContNo='{0}',ContType='{1}',Price={2},Qty={3},LocAmt={4},Unit='{6}',GroupBy='{7}' where Id={5}", contNo, contType, price, qty, locAmt, id, unit, groupBy); ConnectSql.ExecuteSql(sql); } e.Result = "Save Success"; } else { e.Result = "Please keyin select cost "; } #endregion } if (par == "Delete") { #region if (list.Count > 0) { string no = SafeValue.SafeString(Request.QueryString["no"]); string sql = string.Format(@"delete from job_cost where JobNo='{0}'", no); ConnectSql.ExecuteSql(sql); e.Result = "Action Success"; } else { e.Result = "Please keyin select cost "; } #endregion } if (par.Length >= 2) { if (ar[0].Equals("Tallysheet")) { ASPxGridView grid = sender as ASPxGridView; int rowIndex = SafeValue.SafeInt(ar[1], -1); ASPxTextBox txt_JobNo = grid.FindRowCellTemplateControl(rowIndex, null, "txt_JobNo") as ASPxTextBox; e.Result = txt_JobNo.Text + "_" + rowIndex; } } }
protected void grid_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e) { string paras = e.Parameters; string[] ar = paras.Split('_'); //if (paras == "OK") //{ // #region // e.Result = create_house(list.Count, -1); // #endregion //} if (paras == "NewOne") { #region e.Result = create_house("one"); #endregion } if (paras == "NewAll") { #region e.Result = create_house("all"); #endregion } if (paras == "SaveAll") { #region if (list.Count > 0) { for (int i = 0; i < list.Count; i++) { int id = list[i].id; DateTime deliveryDate = list[i].deliveryDate; object qty = (object)list[i].qty; object weight = (object)list[i].weight; object volume = (object)list[i].volume; object sendMode = (object)list[i].sendMode; e.Result = update_house(id, deliveryDate, qty, weight, volume, sendMode); } } else { e.Result = "Pls Select at least one"; } #endregion } if (ar.Length >= 2) { if (ar[0].Equals("CargoListline")) { #region ASPxGridView grid = sender as ASPxGridView; int rowIndex = SafeValue.SafeInt(ar[1], -1); ASPxTextBox txt_Id = grid.FindRowCellTemplateControl(rowIndex, null, "txt_Id") as ASPxTextBox; e.Result = txt_Id.Text; #endregion } if (ar[0].Equals("Saveline")) { #region ASPxGridView grid = sender as ASPxGridView; int rowIndex = SafeValue.SafeInt(ar[1], -1); ASPxLabel Id = this.grid.FindRowCellTemplateControl(rowIndex, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid.Columns["Id"], "lbl_Id") as ASPxLabel; ASPxDateEdit date_DeliveryDate = this.grid.FindRowCellTemplateControl(rowIndex, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid.Columns["DeliveryDate"], "date_DeliveryDate") as ASPxDateEdit; ASPxComboBox cbb_SendMode = this.grid.FindRowCellTemplateControl(rowIndex, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid.Columns["SendMode"], "cbb_SendMode") as ASPxComboBox; ASPxSpinEdit spin_Qty = this.grid.FindRowCellTemplateControl(rowIndex, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid.Columns["QtyOrig"], "spin_Qty") as ASPxSpinEdit; ASPxSpinEdit spin_Weight = this.grid.FindRowCellTemplateControl(rowIndex, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid.Columns["WeightOrig"], "spin_Weight") as ASPxSpinEdit; ASPxSpinEdit spin_Volume = this.grid.FindRowCellTemplateControl(rowIndex, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid.Columns["VolumeOrig"], "spin_Volume") as ASPxSpinEdit; e.Result = update_house(SafeValue.SafeInt(Id.Text, 0), date_DeliveryDate.Date, spin_Qty.Value, spin_Weight.Value, spin_Volume.Value, cbb_SendMode.Value); #endregion } } }
protected void grid_wh_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e) { string pars = e.Parameters; string[] ar = pars.Split('_'); if (Request.QueryString["no"] != null) { try { if (ar.Length >= 2) { if (ar[0].Equals("Dimensionline")) { ASPxGridView grid = sender as ASPxGridView; int rowIndex = SafeValue.SafeInt(ar[1], -1); ASPxTextBox txt_Id = grid.FindRowCellTemplateControl(rowIndex, null, "txt_Id") as ASPxTextBox; e.Result = txt_Id.Text; } } else { #region if (list.Count > 0) { string no = SafeValue.SafeString(Request.QueryString["no"]); string type = SafeValue.SafeString(Request.QueryString["type"]); string client = SafeValue.SafeString(Request.QueryString["client"]); bool action = false; for (int i = 0; i < list.Count; i++) { int id = list[i].id; decimal qty = list[i].qty; decimal weight = list[i].weight; decimal volume = list[i].volume; decimal sku_qty = list[i].sku_qty; decimal l = list[i].l; decimal h = list[i].h; decimal w = list[i].w; string refNo = list[i].refNo; if (qty > 0) { Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.JobHouse), "Id=" + id + ""); C2.JobHouse house = C2.Manager.ORManager.GetObject(query) as C2.JobHouse; house.CargoStatus = "C"; house.JobNo = no; house.ContNo = ""; house.QtyOrig = qty; house.PackQty = sku_qty; house.Weight = weight; house.Volume = volume; house.WeightOrig = weight; house.VolumeOrig = volume; house.LandStatus = "Normal"; house.DgClass = "Normal"; house.DamagedStatus = "Normal"; house.LengthPack = l; house.WidthPack = w; house.HeightPack = h; house.RefNo = refNo; house.ClientId = client; house.LineId = id; house.CargoType = type; house.StockDate = DateTime.Now; string jobType = ""; if (type == "IN") { jobType = "WGR"; } else if (type == "OUT") { jobType = "WDO"; } string res = Trip_New(jobType, house.TripId); string[] str = res.Split('_'); house.TripId = SafeValue.SafeInt(str[0], 0); house.TripIndex = str[1]; house.Qty = qty; house.OpsType = "Delivery"; C2.Manager.ORManager.StartTracking(house, Wilson.ORMapper.InitialState.Inserted); C2.Manager.ORManager.PersistChanges(house); action = true; } else { action = false; break; } } if (action) { e.Result = "Success"; } else { e.Result = "Pls keyin the Qty"; } } else { e.Result = "Pls Select at least one Cargo"; } #endregion } } catch { } } }
private DataTable getSelectGridData_R(ASPxGridView gv) { DataTable dt = new DataTable(); if (dt.Columns.Count == 0) { dt.Columns.Add("USER_CODE"); dt.Columns.Add("FULL_NAME"); dt.Columns.Add("ORG_NAME"); } int cnt = gv.VisibleRowCount; if (gv.VisibleRowCount > 20) { cnt = 20; } for (int i = 0; i < cnt; i++) { GridViewDataColumn colChk = (GridViewDataColumn)gv.Columns[0]; DevExpress.Web.ASPxEditors.ASPxCheckBox chkItem = (DevExpress.Web.ASPxEditors.ASPxCheckBox)gv.FindRowCellTemplateControl(i, colChk, "chkItem"); bool isSelected = chkItem.Checked;// Convert.ToBoolean(gv.Selection.IsRowSelected(i)); if (isSelected == true) { GridViewDataColumn colFULL_NAME = (GridViewDataColumn)gv.Columns["FULL_NAME"]; DevExpress.Web.ASPxEditors.ASPxLabel lblFULL_NAME = (DevExpress.Web.ASPxEditors.ASPxLabel)gv.FindRowCellTemplateControl(i, colFULL_NAME, "lblFULL_NAME_R"); DevExpress.Web.ASPxEditors.ASPxLabel lblUSER_CODE = (DevExpress.Web.ASPxEditors.ASPxLabel)gv.FindRowCellTemplateControl(i, colFULL_NAME, "lblUSER_CODE_R"); GridViewDataColumn colORG_NAME = (GridViewDataColumn)gv.Columns["ORG_NAME"]; DevExpress.Web.ASPxEditors.ASPxLabel lblORG_NAME = (DevExpress.Web.ASPxEditors.ASPxLabel)gv.FindRowCellTemplateControl(i, colORG_NAME, "lblORG_NAME_R"); DataRow dr = dt.NewRow(); dr["USER_CODE"] = lblUSER_CODE.Text; dr["FULL_NAME"] = lblFULL_NAME.Text; dr["ORG_NAME"] = lblORG_NAME.Text; dt.Rows.InsertAt(dr, dt.Rows.Count); } } return dt; }
private DataTable getCurrentGridDataDDL(ASPxGridView gv) { DataTable dt = new DataTable(); if (dt.Columns.Count == 0) { dt.Columns.Add("Seq"); dt.Columns.Add("Item"); dt.Columns.Add("DT", typeof(DataTable)); } for (int i = 0; i < gv.VisibleRowCount; i++) { GridViewDataColumn colSeq = (GridViewDataColumn)gv.Columns["Seq"]; DevExpress.Web.ASPxEditors.ASPxLabel lblSeq = (DevExpress.Web.ASPxEditors.ASPxLabel)gv.FindRowCellTemplateControl(i, colSeq, "lblSeq"); GridViewDataColumn colItem = (GridViewDataColumn)gv.Columns["Item"]; DevExpress.Web.ASPxEditors.ASPxComboBox ddlGroup4 = (DevExpress.Web.ASPxEditors.ASPxComboBox)gv.FindRowCellTemplateControl(i, colItem, "ddlGroup4"); DataRow dr = dt.NewRow(); dr["Seq"] = lblSeq.Text; dr["Item"] = ddlGroup4.Value; usercontrol_JDUserControl JDUserControl1 = (usercontrol_JDUserControl)gv.FindRowCellTemplateControl(i, colItem, "JDUserControl1"); DataTable JDDT = new DataTable(); JDDT = JDUserControl1.JDDescription; dr["DT"] = JDDT; dt.Rows.InsertAt(dr, dt.Rows.Count); } return dt; }
protected void grid_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e) { string paras = e.Parameters; string[] ar = paras.Split('_'); if (paras == "OK") { #region string jobNo = GetJobNo(); if (jobNo.Length > 0) { if (list.Count > 0) { e.Result = create_house(list.Count, -1, jobNo); } else { e.Result = "Action Error"; } } else { e.Result = "NO Export"; } #endregion } if (paras == "New") { #region DateTime now = date_Assign.Date; string jobNo = GetJobNo(); if (now != null && jobNo.Length == 0) { string userId = HttpContext.Current.User.Identity.Name; #region New Export Job C2.CtmJob job = new C2.CtmJob(); jobNo = C2Setup.GetNextNo("", "CTM_Job_EXP", now); job.JobNo = jobNo; job.JobDate = now; string client = System.Configuration.ConfigurationManager.AppSettings["EdiClient"]; job.ClientId = EzshipHelper.GetPartyId(client); job.DeliveryTo = ""; job.JobType = "EXP"; job.StatusCode = "USE"; job.Contractor = "YES"; job.HaulierId = job.ClientId; job.QuoteNo = jobNo; job.JobStatus = "Confirmed"; job.QuoteStatus = "None"; job.QuoteDate = DateTime.Today; job.Pol = txt_Pol.Text; job.Pod = "SGSIN"; C2.Manager.ORManager.StartTracking(job, Wilson.ORMapper.InitialState.Inserted); C2.Manager.ORManager.PersistChanges(job); C2Setup.SetNextNo("", "CTM_Job_EXP", jobNo, now); e.Result = " Job No is " + jobNo; #endregion } else { e.Result = "Create Error!Today had a export job"; } #endregion } if (paras == "Assign") { #region if (list.Count > 0) { for (int i = 0; i < list.Count; i++) { int id = list[i].id; int shipIndex = list[i].shipIndex; DateTime shipDate = date_Assign.Date; string postCode = list[i].postCode; string contIndex = list[i].contIndex; decimal qty = list[i].qty; decimal weight = list[i].weight; decimal volume = list[i].volume; update_house(id, shipDate, shipIndex.ToString(), postCode, contIndex, qty, weight, volume); e.Result = ""; } } else { e.Result = "Action Error"; } #endregion } if (ar.Length >= 2) { if (ar[0].Equals("Saveline")) { #region ASPxGridView grid = sender as ASPxGridView; int rowIndex = SafeValue.SafeInt(ar[1], -1); ASPxLabel lbl_Id = this.grid.FindRowCellTemplateControl(rowIndex, null, "lbl_Id") as ASPxLabel; ASPxDateEdit date_ShipDate = this.grid.FindRowCellTemplateControl(rowIndex, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid.Columns["ShipDate"], "date_ShipDate") as ASPxDateEdit; ASPxTextBox txt_ShipIndex = this.grid.FindRowCellTemplateControl(rowIndex, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid.Columns["ShipIndex"], "txt_ShipIndex") as ASPxTextBox; ASPxTextBox txt_ShipPortCode = this.grid.FindRowCellTemplateControl(rowIndex, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid.Columns["ShipPortCode"], "txt_ShipPortCode") as ASPxTextBox; ASPxComboBox cbb_ContIndex = this.grid.FindRowCellTemplateControl(rowIndex, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid.Columns["ContIndex"], "cbb_ContIndex") as ASPxComboBox; ASPxSpinEdit spin_Qty = this.grid.FindRowCellTemplateControl(rowIndex, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid.Columns["QtyOrig"], "spin_Qty") as ASPxSpinEdit; ASPxSpinEdit spin_Weight = this.grid.FindRowCellTemplateControl(rowIndex, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid.Columns["WeightOrig"], "spin_Weight") as ASPxSpinEdit; ASPxSpinEdit spin_Volume = this.grid.FindRowCellTemplateControl(rowIndex, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid.Columns["VolumeOrig"], "spin_Volume") as ASPxSpinEdit; e.Result = update_house(SafeValue.SafeInt(lbl_Id.Text, 0), date_ShipDate.Date, txt_ShipIndex.Text, txt_ShipPortCode.Text, cbb_ContIndex.Text, spin_Qty.Value, spin_Weight.Value, spin_Volume.Value); #endregion } if (ar[0].Equals("CargoListline")) { #region ASPxGridView grid = sender as ASPxGridView; int rowIndex = SafeValue.SafeInt(ar[1], -1); ASPxTextBox txt_Id = grid.FindRowCellTemplateControl(rowIndex, null, "txt_Id") as ASPxTextBox; e.Result = txt_Id.Text; #endregion } if (ar[0].Equals("Pickline")) { #region ASPxGridView grid = sender as ASPxGridView; int rowIndex = SafeValue.SafeInt(ar[1], -1); string jobNo = GetJobNo(); if (jobNo.Length > 0) { e.Result = create_house(0, rowIndex, jobNo); } else { e.Result = "NO Export"; } #endregion } } }
protected void grid_wh_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e) { string pars = e.Parameters; string[] ar = pars.Split('_'); if (ar.Length >= 2) { if (ar[0].Equals("Uploadline")) { ASPxGridView grid = sender as ASPxGridView; int rowIndex = SafeValue.SafeInt(ar[1], -1); ASPxTextBox txt_Id = grid.FindRowCellTemplateControl(rowIndex, null, "txt_Id") as ASPxTextBox; ASPxTextBox txt_ContNo = grid.FindRowCellTemplateControl(rowIndex, null, "txt_ContNo") as ASPxTextBox; e.Result = txt_Id.Text + "_" + txt_ContNo.Text; } if (ar[0].Equals("Dimensionline")) { ASPxGridView grid = sender as ASPxGridView; int rowIndex = SafeValue.SafeInt(ar[1], -1); ASPxTextBox txt_Id = grid.FindRowCellTemplateControl(rowIndex, null, "txt_Id") as ASPxTextBox; e.Result = txt_Id.Text; } if (ar[0].Equals("Copyonline")) { ASPxGridView grid = sender as ASPxGridView; int rowIndex = SafeValue.SafeInt(ar[1], -1); ASPxTextBox txt_Id = grid.FindRowCellTemplateControl(rowIndex, null, "txt_Id") as ASPxTextBox; Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.JobHouse), "Id='" + txt_Id.Text + "'"); C2.JobHouse job = C2.Manager.ORManager.GetObject(query) as C2.JobHouse; if (job != null) { job.SkuCode = job.BkgSKuCode; job.PackQty = job.BkgSkuQty; job.PackUom = job.BkgSkuUnit; job.WeightOrig = job.Weight; job.VolumeOrig = job.Volume; C2.Manager.ORManager.StartTracking(job, Wilson.ORMapper.InitialState.Updated); C2.Manager.ORManager.PersistChanges(job); e.Result = "Success"; } } if (ar[0].Equals("CopyonCargoline")) { ASPxGridView grid = sender as ASPxGridView; int rowIndex = SafeValue.SafeInt(ar[1], -1); ASPxTextBox txt_Id = grid.FindRowCellTemplateControl(rowIndex, null, "txt_Id") as ASPxTextBox; ASPxComboBox cbb_CargoCount = grid.FindRowCellTemplateControl(rowIndex, null, "cbb_CargoCount") as ASPxComboBox; Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.JobHouse), "Id='" + txt_Id.Text + "'"); C2.JobHouse job = C2.Manager.ORManager.GetObject(query) as C2.JobHouse; if (job != null) { int count = SafeValue.SafeInt(cbb_CargoCount.Value, 0); for (int i = 0; i < count; i++) { C2.Manager.ORManager.StartTracking(job, Wilson.ORMapper.InitialState.Inserted); C2.Manager.ORManager.PersistChanges(job); job.LineId = job.Id; C2.Manager.ORManager.StartTracking(job, Wilson.ORMapper.InitialState.Updated); C2.Manager.ORManager.PersistChanges(job); Wilson.ORMapper.OPathQuery query1 = new Wilson.ORMapper.OPathQuery(typeof(C2.Dimension), "HouseId='" + txt_Id.Text + "'"); ObjectSet objSet = C2.Manager.ORManager.GetObjectSet(query1); for (int j = 0; j < objSet.Count; j++) { C2.Dimension d = objSet[i] as C2.Dimension; d.HouseId = job.Id; C2.Manager.ORManager.StartTracking(d, Wilson.ORMapper.InitialState.Inserted); C2.Manager.ORManager.PersistChanges(d); } } e.Result = "Success"; } } } }