public void WhenItsNotFoundObjectValueShouldReturnNull() { var safe = new SafeValue<int>(42, false); safe.Value.Should().Be(42); safe.ObjectValue.Should().Be.Null(); }
public void CanUseObjectMethodsOnItWhenItsNotFound() { var safe = new SafeValue<int>(42, false); safe.Equals(42).Should().Be(true); safe.Equals("42").Should().Be(false); safe.GetHashCode().Should().Be.EqualTo(42.GetHashCode()); }
public void CanUseBasicStaticOperatorsOnIt() { var safe = new SafeValue<int>(42, false); (safe == 42).Should().Be.True(); (safe == 43).Should().Be.False(); (safe != 42).Should().Be.False(); (safe != 43).Should().Be.True(); (safe > 41).Should().Be.True(); (safe < 43).Should().Be.True(); }
public void Crane_JobEdit_Save(string info) { JObject job = (JObject)JsonConvert.DeserializeObject(HttpUtility.UrlDecode(Server.UrlDecode(info))); List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>(); ConnectSql_mb.cmdParameters cpar = null; string status = "0"; string context = Common.StringToJson(""); string ByUser = job["ByUser"].ToString(); decimal OtHourType = SafeValue.SafeDecimal(job["OverTime"]); string sql = string.Format(@"update CTM_JobDet2 set TowheadCode=@TowheadCode,Remark1=@Remark1,ToCode=@ToCode,DriverCode=@DriverCode,UpdateUser=@ByUser,UpdateTime=GetDate(),OtHour=@OtHour where Id=@Id"); #region params cpar = new ConnectSql_mb.cmdParameters("@Id", job["Id"], SqlDbType.Int); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@Remark1", job["Remark1"], SqlDbType.NVarChar, 100); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@TowheadCode", job["TowheadCode"], SqlDbType.NVarChar, 100); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@DriverCode", job["DriverCode"], SqlDbType.NVarChar, 100); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@ToCode", job["ToCode"], SqlDbType.NVarChar, 300); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@ByUser", ByUser, SqlDbType.NVarChar, 20); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@OtHour", SafeValue.SafeDecimal(job["OtHour"]), SqlDbType.Decimal); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@OtHourType", OtHourType, SqlDbType.Decimal); list.Add(cpar); #endregion if (ConnectSql_mb.ExecuteNonQuery(sql, list).status) { status = "1"; Dictionary <string, decimal> d = new Dictionary <string, decimal>(); //d.Add("Trip", SafeValue.SafeDecimal(job["Trip"], 0)); d.Add("OverTime", SafeValue.SafeDecimal(job["OverTime"], 0)); //d.Add("Standby", SafeValue.SafeDecimal(job["Standby"], 0)); //d.Add("PSA", SafeValue.SafeDecimal(job["PSA"], 0)); //d.Add("OverTime", (OtHourType.Length > 0 ? 1 : 0)); C2.CtmJobDet2.Incentive_Save(SafeValue.SafeInt(job["Id"], 0), d); d = new Dictionary <string, decimal>(); d.Add("EXPENSE", SafeValue.SafeDecimal(job["EXPENSE"], 0)); //d.Add("DHC", SafeValue.SafeDecimal(job["DHC"], 0)); //d.Add("WEIGHING", SafeValue.SafeDecimal(job["WEIGHING"], 0)); //d.Add("WASHING", SafeValue.SafeDecimal(job["WASHING"], 0)); //d.Add("REPAIR", SafeValue.SafeDecimal(job["REPAIR"], 0)); //d.Add("DETENTION", SafeValue.SafeDecimal(job["DETENTION"], 0)); //d.Add("DEMURRAGE", SafeValue.SafeDecimal(job["DEMURRAGE"], 0)); //d.Add("LIFT_ON_OFF", SafeValue.SafeDecimal(job["LIFT_ON_OFF"], 0)); //d.Add("C_SHIPMENT", SafeValue.SafeDecimal(job["C_SHIPMENT"], 0)); //d.Add("EMF", SafeValue.SafeDecimal(job["EMF"], 0)); //d.Add("OTHER", SafeValue.SafeDecimal(job["OTHER"], 0)); C2.CtmJobDet2.Claims_Save(SafeValue.SafeInt(job["Id"], 0), d); //===========log C2.CtmJobEventLog lg = new C2.CtmJobEventLog(); lg.Platform_isMobile(); lg.Controller = SafeValue.SafeString(job["user"]); lg.Lat = SafeValue.SafeString(job["Lat"]); lg.Lng = SafeValue.SafeString(job["Lng"]); //lg.ActionLevel_isTRIP(SafeValue.SafeInt(job["Id"], 0)); //lg.Remark = "Trip update"; lg.setActionLevel(SafeValue.SafeInt(job["Id"], 0), CtmJobEventLogRemark.Level.Trip, 3); lg.log(); } Common.WriteJsonP(status, context); }
protected void grid_SKULine_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { if (e.NewValues["ProductCode"] == null || e.NewValues["ProductCode"].ToString().Trim() == "") { throw new Exception("Sku not be null !!!"); return; } ASPxTextBox refN = this.grid_Price.FindEditFormTemplateControl("txt_DoNo") as ASPxTextBox; e.NewValues["DoNo"] = refN.Text; e.NewValues["DoType"] = "SQ"; e.NewValues["Price"] = SafeValue.SafeDecimal(e.NewValues["Price"], 0); e.NewValues["Des1"] = SafeValue.SafeString(e.NewValues["Des1"]); e.NewValues["ProductCode"] = SafeValue.SafeString(e.NewValues["ProductCode"]); e.NewValues["Qty"] = SafeValue.SafeInt(e.NewValues["Qty"], 0); ASPxGridView grid = (sender as ASPxGridView) as ASPxGridView; ASPxButtonEdit txt_Currency = grid.FindEditRowCellTemplateControl(null, "txt_Currency") as ASPxButtonEdit; ASPxComboBox cb_Att1 = grid.FindEditRowCellTemplateControl(null, "cb_Att1") as ASPxComboBox; ASPxComboBox cb_Att2 = grid.FindEditRowCellTemplateControl(null, "cb_Att2") as ASPxComboBox; ASPxComboBox cb_Att3 = grid.FindEditRowCellTemplateControl(null, "cb_Att3") as ASPxComboBox; ASPxComboBox cb_Att4 = grid.FindEditRowCellTemplateControl(null, "cb_Att4") as ASPxComboBox; ASPxComboBox cb_Att5 = grid.FindEditRowCellTemplateControl(null, "cb_Att5") as ASPxComboBox; ASPxComboBox cb_Att6 = grid.FindEditRowCellTemplateControl(null, "cb_Att6") as ASPxComboBox; e.NewValues["Currency"] = SafeValue.SafeString(txt_Currency.Text); e.NewValues["Att1"] = SafeValue.SafeString(cb_Att1.Text); e.NewValues["Att2"] = SafeValue.SafeString(cb_Att2.Text); e.NewValues["Att3"] = SafeValue.SafeString(cb_Att3.Text); e.NewValues["Att4"] = SafeValue.SafeString(cb_Att4.Text); e.NewValues["Att5"] = SafeValue.SafeString(cb_Att5.Text); e.NewValues["Att6"] = SafeValue.SafeString(cb_Att6.Text); decimal amt = SafeValue.ChinaRound(SafeValue.SafeDecimal(e.NewValues["Qty1"], 0) * SafeValue.SafeDecimal(e.NewValues["Price"], 0), 2); decimal gstAmt = SafeValue.ChinaRound((amt * SafeValue.SafeDecimal(e.NewValues["Gst"], 0)), 2); decimal docAmt = amt + gstAmt; decimal locAmt = SafeValue.ChinaRound(docAmt * SafeValue.SafeDecimal(e.NewValues["ExRate"], 1), 2); e.NewValues["GstAmt"] = gstAmt; e.NewValues["DocAmt"] = docAmt; }
protected void btn_CreateInv_Click(object sender, EventArgs e) { string invNo = ""; string mastType = "WH"; DateTime dt = DateTime.Today; bool isNew = false; int docId = 0; if (list.Count > 0) { XAArInvoice iv = null; for (int i = 0; i < list.Count; i++) { string counterType = "AR-IV"; string partyId = list[i].partyId; string product = list[i].doNo; string doNo = list[i].doNo; int qty = list[i].qty; decimal surcharge = list[i].surcharge; string sql_cost = string.Format(@"select * from(select mast.DoNo,CONVERT(VARCHAR(10),mast.DoDate,110) as DoDate,cost.ChgCode as ChargeCode, ChgCodeDes as Description,CONVERT(int,CostQty) as Qty,CostPrice as Price,StatusCode, isnull(((CostQty)*(isnull((CostPrice),0) )),0) as TotalAmt,dbo.fun_GetPartyName(mast.PartyId) AS PartyName,mast.PartyId, 0 as Surcharge,0 as SurchageAmt,JobType as DoType,CONVERT(decimal(10,6),(isnull((CostQty*CostPrice),0)*CostGst)) as GstAmt, ISNULL((select count(SequenceId) from XAArInvoiceDet det where det.ChgCode=cost.ChgCode and det.MastRefNo=RefNo),0) as CostCnt, isnull((select count(Id) from Wh_Costing where RefNo=mast.DoNo and JobType=mast.DoType),0) as CostDoCnt from Wh_Costing cost left join Wh_DO mast on RefNo=mast.DoNo and JobType=mast.DoType and StatusCode='CLS' ) as tab where CostCnt=0 and CostDoCnt>0 and TotalAmt>0 and DoNo='{0}'", doNo); string sql = string.Format(@"select top 1 det.DocNo from XAArInvoiceDet det inner join XAArInvoice mast on det.DocNo=mast.DocNo where det.MastRefNo='{0}' and InvType='HANDLING' and CancelInd='N' order by det.DocNo desc", doNo); invNo = SafeValue.SafeString(C2.Manager.ORManager.ExecuteScalar(sql)); if (invNo.Length == 0) { iv = new XAArInvoice(); invNo = C2Setup.GetNextNo("", counterType, dt); isNew = true; } else { Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(XAArInvoice), "DocNo='" + invNo + "'"); iv = C2.Manager.ORManager.GetObject(query) as XAArInvoice; isNew = false; } iv.DocType = "IV"; iv.DocDate = dt; iv.DocNo = invNo; iv.PartyTo = partyId; iv.CurrencyId = System.Configuration.ConfigurationManager.AppSettings["Currency"]; iv.ExRate = 1; iv.AcCode = EzshipHelper.GetAccApCode(iv.PartyTo, iv.CurrencyId); iv.AcSource = "DB"; iv.Description = ""; iv.Term = "CASH"; string[] currentPeriod = EzshipHelper.GetAccPeriod(iv.DocDate); iv.AcYear = SafeValue.SafeInt(currentPeriod[1], iv.DocDate.Year); iv.AcPeriod = SafeValue.SafeInt(currentPeriod[0], iv.DocDate.Month); iv.MastRefNo = ""; iv.JobRefNo = ""; iv.MastType = mastType; iv.DocAmt = 0; iv.LocAmt = 0; iv.BalanceAmt = 0; iv.CancelDate = new DateTime(1900, 1, 1); iv.CancelInd = "N"; iv.DocDueDate = dt; iv.ExportInd = "N"; iv.SpecialNote = ""; iv.UserId = EzshipHelper.GetUserName(); iv.EntryDate = DateTime.Now; iv.InvType = "HANDLING"; if (isNew) { C2.Manager.ORManager.StartTracking(iv, Wilson.ORMapper.InitialState.Inserted); C2.Manager.ORManager.PersistChanges(iv); C2Setup.SetNextNo(iv.DocType, counterType, invNo, iv.DocDate); } else { Manager.ORManager.StartTracking(iv, Wilson.ORMapper.InitialState.Updated); Manager.ORManager.PersistChanges(iv); } try { DataTable tab_Cost = ConnectSql.GetTab(sql_cost); for (int a = 0; a < tab_Cost.Rows.Count; a++) { C2.XAArInvoiceDet det = new C2.XAArInvoiceDet(); det.DocId = iv.SequenceId; det.DocLineNo = i + 1; det.DocNo = invNo; det.DocType = "IV"; det.AcCode = SafeValue.SafeString(ConnectSql.ExecuteScalar(string.Format("select ArCode from ref_product where Code='{0}'", product)), System.Configuration.ConfigurationManager.AppSettings["ItemArCode"]); det.AcSource = "CR"; det.MastRefNo = doNo; det.JobRefNo = ""; det.MastType = mastType; det.SplitType = ""; det.ChgCode = SafeValue.SafeString(tab_Cost.Rows[a]["ChargeCode"]);; det.ChgDes1 = SafeValue.SafeString(tab_Cost.Rows[a]["Description"]); det.ChgDes2 = ""; det.ChgDes3 = ""; det.Price = SafeValue.SafeDecimal(tab_Cost.Rows[a]["Price"]); det.Qty = SafeValue.SafeInt(tab_Cost.Rows[a]["Qty"], 0); det.Unit = ""; det.Currency = iv.CurrencyId; det.ExRate = 1; det.Gst = 0; if (det.ExRate == 0) { det.ExRate = 1; } if (det.Gst > 0) { det.GstType = "S"; } else if (det.Currency == System.Configuration.ConfigurationManager.AppSettings["Currency"]) { det.GstType = "E"; } else { det.GstType = "Z"; } decimal amt = SafeValue.ChinaRound(det.Qty * det.Price, 2); decimal gstAmt = SafeValue.ChinaRound((amt * det.Gst), 2); decimal docAmt = amt + gstAmt; decimal locAmt = SafeValue.ChinaRound(docAmt * det.ExRate, 2); det.GstAmt = gstAmt; det.DocAmt = docAmt; det.LocAmt = locAmt; det.OtherAmt = 0; C2.Manager.ORManager.StartTracking(det, Wilson.ORMapper.InitialState.Inserted); C2.Manager.ORManager.PersistChanges(det); if (surcharge != 0) { det.ChgCode = "HANDLE"; det.Qty = 1; det.Price = surcharge; sql = string.Format(@"select * from XXChgCode where ChgcodeId='{0}'", det.ChgCode); DataTable tab = ConnectSql.GetTab(sql); for (int j = 0; j < tab.Rows.Count; j++) { det.AcCode = SafeValue.SafeString(tab.Rows[j]["ArCode"]); det.ChgDes1 = SafeValue.SafeString(tab.Rows[j]["ChgcodeDes"]); det.GstType = SafeValue.SafeString(tab.Rows[j]["GstTypeId"]); det.Gst = SafeValue.SafeDecimal(tab.Rows[j]["GstP"]); } amt = SafeValue.ChinaRound(det.Qty * det.Price, 2); gstAmt = SafeValue.ChinaRound((amt * det.Gst), 2); docAmt = amt + gstAmt; locAmt = SafeValue.ChinaRound(docAmt * det.ExRate, 2); det.GstAmt = gstAmt; det.DocAmt = docAmt; det.LocAmt = locAmt; C2.Manager.ORManager.StartTracking(det, Wilson.ORMapper.InitialState.Inserted); C2.Manager.ORManager.PersistChanges(det); } docId = iv.SequenceId; } } catch { } UpdateMaster(docId); } // string script = string.Format('<script type="text/javascript" > parent.navTab.openTab("{0}","/opsAccount/ArInvoiceEdit.aspx?no="{0}"",{title:'', fresh:false, external:true});</script>", invNo); //string script = string.Format("<script type='text/javascript' >alert('{0}');</script>", refNo); //Response.Clear(); //Response.Write(script); //<a href='javascript: parent.navTab.openTab("<%# Eval("DoNo") %>","/Modules/WareHouse/Job/DoOutEdit.aspx?no=<%# Eval("DoNo") %>",{title:"<%# Eval("DoNo") %>", fresh:false, external:true});'><%# Eval("DoNo") %></a> Response.Redirect("/opsAccount/ArInvoiceEdit.aspx?no=" + invNo); } }
protected void grid_Cost_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { ASPxTextBox refNo = this.grid_ref.FindEditFormTemplateControl("txt_RefN") as ASPxTextBox; e.NewValues["JobType"] = "AE"; 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 grd_Photo_BeforePerformDataSelect(object sender, EventArgs e) { ASPxTextBox txtRefNo = this.grid_ref.FindEditFormTemplateControl("txt_RefN") as ASPxTextBox; this.dsJobPhoto.FilterExpression = "RefNo='" + SafeValue.SafeString(txtRefNo.Text, "") + "'"; }
public void Crane_AddNew(string info) { JObject job = (JObject)JsonConvert.DeserializeObject(HttpUtility.UrlDecode(Server.UrlDecode(info))); string JobNo = job["JobNo"].ToString(); string TowheadCode = job["TowheadCode"].ToString(); string BookingDate = job["BookingDate"].ToString(); string BookingTime = job["BookingTime"].ToString(); string BookingTime2 = job["BookingTime2"].ToString(); string DriverCode = job["DriverCode"].ToString(); string BookingRemark = job["BookingRemark"].ToString(); string ByUser = job["ByUser"].ToString(); string ToCode = ""; string Remark = ""; string sql = string.Format(@"select DeliveryTo,SpecialInstruction from ctm_job where JobNo=@JobNo"); List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>(); list.Add(new ConnectSql_mb.cmdParameters("@JobNo", JobNo, SqlDbType.NVarChar, 100)); DataTable dt = ConnectSql_mb.GetDataTable(sql, list); if (dt.Rows.Count == 1) { ToCode = dt.Rows[0]["DeliveryTo"].ToString(); Remark = dt.Rows[0]["SpecialInstruction"].ToString(); } sql = string.Format(@"insert into CTM_JobDet2 (JobNo,ContainerNo,DriverCode,TowheadCode,ChessisCode,FromCode,FromDate,FromTime,ToCode,ToDate,ToTime,Statuscode, BayCode,SubletFlag,StageCode,StageStatus,TripCode,Overtime,OverDistance,FromParkingLot,BookingDate,BookingTime,BookingTime2,BookingRemark, ByUser,CreateUser,UpdateUser,CreateTime,UpdateTime,Remark) values (@JobNo,'',@DriverCode,@TowheadCode,'',@FromCode,@FromDate,@FromTime,@ToCode,@FromDate,@FromTime,'P', '','N','','',@TripCode,'Normal','N',@FromParkingLot,@BookingDate,@BookingTime,@BookingTime2,@BookingRemark, @ByUser,@ByUser,@ByUser,getdate(),getdate(),@Remark) select @@Identity"); list.Add(new ConnectSql_mb.cmdParameters("@DriverCode", DriverCode, SqlDbType.NVarChar, 100)); list.Add(new ConnectSql_mb.cmdParameters("@TowheadCode", TowheadCode, SqlDbType.NVarChar, 100)); list.Add(new ConnectSql_mb.cmdParameters("@FromCode", "", SqlDbType.NVarChar, 300)); list.Add(new ConnectSql_mb.cmdParameters("@FromDate", "19000101", SqlDbType.NVarChar, 8)); list.Add(new ConnectSql_mb.cmdParameters("@FromTime", "00:00", SqlDbType.NVarChar, 10)); list.Add(new ConnectSql_mb.cmdParameters("@BookingDate", BookingDate, SqlDbType.NVarChar, 8)); list.Add(new ConnectSql_mb.cmdParameters("@BookingTime", BookingTime, SqlDbType.NVarChar, 10)); list.Add(new ConnectSql_mb.cmdParameters("@BookingTime2", BookingTime2, SqlDbType.NVarChar, 10)); list.Add(new ConnectSql_mb.cmdParameters("@ToCode", ToCode, SqlDbType.NVarChar, 300)); list.Add(new ConnectSql_mb.cmdParameters("@TripCode", "CRA", SqlDbType.NVarChar, 100)); list.Add(new ConnectSql_mb.cmdParameters("@FromParkingLot", "", SqlDbType.NVarChar, 100)); list.Add(new ConnectSql_mb.cmdParameters("@BookingRemark", BookingRemark, SqlDbType.NVarChar, 100)); list.Add(new ConnectSql_mb.cmdParameters("@ByUser", ByUser, SqlDbType.NVarChar, 20)); list.Add(new ConnectSql_mb.cmdParameters("@Remark", Remark, SqlDbType.NVarChar, 300)); ConnectSql_mb.sqlResult result = ConnectSql_mb.ExecuteScalar(sql, list); if (result.status) { //===========log C2.CtmJobEventLog lg = new C2.CtmJobEventLog(); lg.Platform_isMobile(); lg.Controller = SafeValue.SafeString(job["user"]); lg.Lat = SafeValue.SafeString(job["Lat"]); lg.Lng = SafeValue.SafeString(job["Lng"]); //lg.ActionLevel_isTRIP(SafeValue.SafeInt(result.context, 0)); //lg.Remark = "Trip Add New"; lg.setActionLevel(SafeValue.SafeInt(result.context, 0), CtmJobEventLogRemark.Level.Trip, 1); lg.log(); } Common.WriteJsonP(result.status, Common.StringToJson(result.context)); }
private void SaveJob() { try { ASPxPageControl pageControl = this.grid_ref.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox txtRefNo = this.grid_ref.FindEditFormTemplateControl("txt_RefN") as ASPxTextBox; ASPxDateEdit refDate = this.grid_ref.FindEditFormTemplateControl("date_RefDate") as ASPxDateEdit; string refNo = SafeValue.SafeString(txt_RefNo.Text, ""); Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(AirImportRef), "RefNo='" + refNo + "'"); AirImportRef airRef = C2.Manager.ORManager.GetObject(query) as AirImportRef; bool isNew = false; string userId = HttpContext.Current.User.Identity.Name; if (airRef == null) { airRef = new AirImportRef(); isNew = true; refNo = C2Setup.GetNextNo("AE", "AirExport", refDate.Date); AirImport air = new AirImport(); air.JobNo = C2Setup.GetSubNo(refNo, "AE"); air.CloseInd = "N"; air.CreateBy = userId; air.CreateDateTime = DateTime.Now; air.RefNo = refNo; air.Total = "0"; air.RefType = "AE"; air.StatusCode = "USE"; C2.Manager.ORManager.StartTracking(air, Wilson.ORMapper.InitialState.Inserted); C2.Manager.ORManager.PersistChanges(air); } ASPxButtonEdit txt_AgentId = this.grid_ref.FindEditFormTemplateControl("txt_AgentId") as ASPxButtonEdit; airRef.AgentId = txt_AgentId.Text; ASPxButtonEdit localCust = this.grid_ref.FindEditFormTemplateControl("txt_LocalCust") as ASPxButtonEdit; airRef.LocalCust = localCust.Text; ASPxMemo remarks = pageControl.FindControl("txt_Remarks") as ASPxMemo; airRef.Remarks = remarks.Text; ASPxButtonEdit tbxAirportCode0 = pageControl.FindControl("tbxAirportCode0") as ASPxButtonEdit; airRef.AirportCode0 = tbxAirportCode0.Text; ASPxTextBox tbxAirportName0 = pageControl.FindControl("tbxAirportName0") as ASPxTextBox; airRef.AirportName0 = tbxAirportName0.Text; ASPxDateEdit date_FlightDate0 = pageControl.FindControl("date_FlightDate0") as ASPxDateEdit; airRef.FlightDate0 = date_FlightDate0.Date; ASPxTextBox tbxFlightTime0 = pageControl.FindControl("tbxFlightTime0") as ASPxTextBox; airRef.FlightTime0 = tbxFlightTime0.Text; airRef.RefDate = refDate.Date; ASPxButtonEdit tbxAirportCode1 = pageControl.FindControl("txt_AirportCode1") as ASPxButtonEdit; airRef.AirportCode1 = tbxAirportCode1.Text; ASPxTextBox tbxAirportName1 = pageControl.FindControl("txt_AirportName1") as ASPxTextBox; airRef.AirportName1 = tbxAirportName1.Text; ASPxDateEdit spin_FlightDate1 = pageControl.FindControl("spin_FlightDate1") as ASPxDateEdit; airRef.FlightDate1 = spin_FlightDate1.Date; ASPxTextBox txt_FlightTime1 = pageControl.FindControl("txt_FlightTime1") as ASPxTextBox; airRef.FlightTime1 = txt_FlightTime1.Text; ASPxTextBox tbxAirlineCode1 = pageControl.FindControl("tbxAirlineCode1") as ASPxTextBox; airRef.AirlineCode1 = tbxAirlineCode1.Text; ASPxTextBox tbxAirlineName1 = pageControl.FindControl("tbxAirlineName1") as ASPxTextBox; airRef.AirlineName1 = tbxAirlineName1.Text; ASPxTextBox tbxFlightNo1 = pageControl.FindControl("tbxFlightNo1") as ASPxTextBox; airRef.FlightNo1 = tbxFlightNo1.Text; ASPxDateEdit tbxAirFlightDate1 = pageControl.FindControl("tbxAirFlightDate1") as ASPxDateEdit; airRef.AirFlightDate1 = tbxAirFlightDate1.Date; ASPxTextBox tbxAirFlightTime1 = pageControl.FindControl("tbxAirFlightTime1") as ASPxTextBox; airRef.AirFlightTime1 = tbxAirFlightTime1.Text; ASPxButtonEdit tbxAirLinePortCode1 = pageControl.FindControl("tbxAirLinePortCode1") as ASPxButtonEdit; airRef.AirLinePortCode1 = tbxAirLinePortCode1.Text; ASPxTextBox tbxAirLinePortName1 = pageControl.FindControl("tbxAirLinePortName1") as ASPxTextBox; airRef.AirLinePortName1 = tbxAirLinePortName1.Text; ASPxTextBox tbxAirlineCode2 = pageControl.FindControl("tbxAirlineCode2") as ASPxTextBox; airRef.AirlineCode2 = tbxAirlineCode2.Text; ASPxTextBox tbxAirlineName2 = pageControl.FindControl("tbxAirlineName2") as ASPxTextBox; airRef.AirlineName2 = tbxAirlineName2.Text; ASPxTextBox tbxFlightNo2 = pageControl.FindControl("tbxFlightNo2") as ASPxTextBox; airRef.FlightNo2 = tbxFlightNo2.Text; ASPxDateEdit tbxFlightDate2 = pageControl.FindControl("tbxFlightDate2") as ASPxDateEdit; airRef.FlightDate2 = tbxFlightDate2.Date; ASPxTextBox tbxFlightTime2 = pageControl.FindControl("tbxFlightTime2") as ASPxTextBox; airRef.FlightTime2 = tbxFlightTime2.Text; ASPxButtonEdit tbxAirportCode2 = pageControl.FindControl("tbxAirportCode2") as ASPxButtonEdit; airRef.AirportCode2 = tbxAirportCode2.Text; ASPxTextBox AirportName2 = pageControl.FindControl("tbxAirportName2") as ASPxTextBox; airRef.AirportName2 = AirportName2.Text; ASPxTextBox tbxAirlineCode3 = pageControl.FindControl("tbxAirlineCode3") as ASPxTextBox; airRef.AirlineCode3 = tbxAirlineCode3.Text; ASPxTextBox tbxAirlineName3 = pageControl.FindControl("tbxAirlineName3") as ASPxTextBox; airRef.AirlineName3 = tbxAirlineName3.Text; ASPxTextBox tbxFlightNo3 = pageControl.FindControl("tbxFlightNo3") as ASPxTextBox; airRef.FlightNo3 = tbxFlightNo3.Text; ASPxDateEdit tbxFlightDate3 = pageControl.FindControl("tbxFlightDate3") as ASPxDateEdit; airRef.FlightDate3 = tbxFlightDate3.Date; ASPxTextBox tbxFlightTime3 = pageControl.FindControl("tbxFlightTime3") as ASPxTextBox; airRef.FlightTime3 = tbxFlightTime3.Text; ASPxButtonEdit tbxAirportCode3 = pageControl.FindControl("tbxAirportCode3") as ASPxButtonEdit; airRef.AirportCode3 = tbxAirportCode3.Text; ASPxTextBox tbxAirportName3 = pageControl.FindControl("tbxAirportName3") as ASPxTextBox; airRef.AirportName3 = tbxAirportName3.Text; ASPxTextBox tbxAirlineCode4 = pageControl.FindControl("tbxAirlineCode4") as ASPxTextBox; airRef.AirlineCode4 = tbxAirlineCode4.Text; ASPxTextBox tbxAirlineName4 = pageControl.FindControl("tbxAirlineName4") as ASPxTextBox; airRef.AirlineName4 = tbxAirlineName4.Text; ASPxTextBox tbxFlightNo4 = pageControl.FindControl("tbxFlightNo4") as ASPxTextBox; airRef.FlightNo4 = tbxFlightNo4.Text; ASPxDateEdit tbxFlightDate4 = pageControl.FindControl("tbxFlightDate4") as ASPxDateEdit; airRef.FlightDate4 = tbxFlightDate4.Date; ASPxTextBox tbxFlightTime4 = pageControl.FindControl("tbxFlightTime4") as ASPxTextBox; airRef.FlightTime4 = tbxFlightTime4.Text; ASPxButtonEdit tbxAirportCode4 = pageControl.FindControl("tbxAirportCode4") as ASPxButtonEdit; airRef.AirportCode4 = tbxAirportCode4.Text; ASPxTextBox AirportName4 = pageControl.FindControl("tbxAirportName4") as ASPxTextBox; airRef.AirportName4 = AirportName4.Text; ASPxTextBox txtMAWB = this.grid_ref.FindEditFormTemplateControl("txt_MAWB") as ASPxTextBox; airRef.Mawb = txtMAWB.Text; ASPxButtonEdit txt_CrAgentId = this.grid_ref.FindEditFormTemplateControl("txt_CrAgentId") as ASPxButtonEdit; airRef.CarrierAgentId = txt_CrAgentId.Text; ASPxTextBox txt_CrBkgRefN = this.grid_ref.FindEditFormTemplateControl("txt_CrBkgRefN") as ASPxTextBox; airRef.CarrierBkgNo = txt_CrBkgRefN.Text; ASPxButtonEdit txt_NvoccAgentId = pageControl.FindControl("txt_NvoccAgentId") as ASPxButtonEdit; airRef.NvoccAgentId = txt_NvoccAgentId.Text; ASPxTextBox txt_NvoccBl = pageControl.FindControl("txt_NvoccBl") as ASPxTextBox; airRef.NvoccBlNO = txt_NvoccBl.Text; ASPxButtonEdit cbx_Currency = pageControl.FindControl("cbx_Currency") as ASPxButtonEdit; airRef.CurrencyId = cbx_Currency.Text; ASPxSpinEdit spin_CrExRate = pageControl.FindControl("spin_CrExRate") as ASPxSpinEdit; airRef.ExRate = SafeValue.SafeDecimal(spin_CrExRate.Value, 0); ASPxButtonEdit txt_WhId = pageControl.FindControl("txt_WhId") as ASPxButtonEdit; airRef.WareHouseId = txt_WhId.Text; ASPxMemo tbxShipperName = pageControl.FindControl("tbxShipperName") as ASPxMemo; airRef.ShipperName = tbxShipperName.Text; ASPxMemo tbxIssuedBy = pageControl.FindControl("tbxIssuedBy") as ASPxMemo; airRef.IssuedBy = tbxIssuedBy.Text; ASPxMemo tbxConsigneeName = pageControl.FindControl("tbxConsigneeName") as ASPxMemo; airRef.ConsigneeName = tbxConsigneeName.Text; ASPxMemo tbxCarrierAgent = pageControl.FindControl("tbxCarrierAgent") as ASPxMemo; airRef.CarrierAgent = tbxCarrierAgent.Text; ASPxMemo tbxAccountInfo = pageControl.FindControl("tbxAccountInfo") as ASPxMemo; airRef.AccountInfo = tbxAccountInfo.Text; ASPxTextBox tbxAgentIATACode = pageControl.FindControl("tbxAgentIATACode") as ASPxTextBox; airRef.AgentIATACode = tbxAgentIATACode.Text; ASPxTextBox tbxAgentAccountNo = pageControl.FindControl("tbxAgentAccountNo") as ASPxTextBox; airRef.AgentAccountNo = tbxAgentAccountNo.Text; ASPxTextBox tbxAirportDeparture = pageControl.FindControl("tbxAirportDeparture") as ASPxTextBox; airRef.AirportDeparture = tbxAirportDeparture.Text; ASPxTextBox tbxConnDest1 = pageControl.FindControl("tbxConnDest1") as ASPxTextBox; airRef.ConnDest1 = tbxConnDest1.Text; ASPxTextBox tbxConnCarrier1 = pageControl.FindControl("tbxConnCarrier1") as ASPxTextBox; airRef.ConnCarrier1 = tbxConnCarrier1.Text; ASPxTextBox tbxConnDest2 = pageControl.FindControl("tbxConnDest2") as ASPxTextBox; airRef.ConnDest2 = tbxConnDest2.Text; ASPxTextBox tbxConnCarrier2 = pageControl.FindControl("tbxConnCarrier2") as ASPxTextBox; airRef.ConnCarrier2 = tbxConnCarrier2.Text; ASPxTextBox tbxConnDest3 = pageControl.FindControl("tbxConnDest3") as ASPxTextBox; airRef.ConnDest3 = tbxConnDest3.Text; ASPxTextBox tbxConnCarrier3 = pageControl.FindControl("tbxConnCarrier3") as ASPxTextBox; airRef.ConnCarrier3 = tbxConnCarrier3.Text; ASPxTextBox tbxCurrency = pageControl.FindControl("tbxCurrency") as ASPxTextBox; airRef.Currency = tbxCurrency.Text; ASPxTextBox tbxChgsCode = pageControl.FindControl("tbxChgsCode") as ASPxTextBox; airRef.ChgsCode = tbxChgsCode.Text; ASPxTextBox tbxPPD1 = pageControl.FindControl("tbxPPD1") as ASPxTextBox; airRef.Ppd1 = tbxPPD1.Text; ASPxTextBox tbxCOLL1 = pageControl.FindControl("tbxCOLL1") as ASPxTextBox; airRef.Coll1 = tbxCOLL1.Text; ASPxTextBox tbxPPD2 = pageControl.FindControl("tbxPPD2") as ASPxTextBox; airRef.Ppd2 = tbxPPD2.Text; ASPxTextBox tbxCOLL2 = pageControl.FindControl("tbxCOLL2") as ASPxTextBox; airRef.Coll2 = tbxCOLL2.Text; ASPxTextBox tbxCarriageValue = pageControl.FindControl("tbxCarriageValue") as ASPxTextBox; airRef.CarriageValue = tbxCarriageValue.Text; ASPxTextBox tbxCustomValue = pageControl.FindControl("tbxCustomValue") as ASPxTextBox; airRef.CustomValue = tbxCustomValue.Text; ASPxTextBox tbxAirportDestination = pageControl.FindControl("tbxAirportDestination") as ASPxTextBox; airRef.AirportDestination = tbxAirportDestination.Text; ASPxTextBox tbxRequestedFlight = pageControl.FindControl("tbxRequestedFlight") as ASPxTextBox; airRef.RequestedFlight = tbxRequestedFlight.Text; ASPxTextBox tbxRequestedDate = pageControl.FindControl("tbxRequestedDate") as ASPxTextBox; airRef.RequestedDate = tbxRequestedDate.Text; ASPxTextBox tbxAmountInsurance = pageControl.FindControl("tbxAmountInsurance") as ASPxTextBox; airRef.AmountInsurance = tbxAmountInsurance.Text; ASPxMemo tbxHandlingInfo = pageControl.FindControl("tbxHandlingInfo") as ASPxMemo; airRef.HandlingInfo = tbxHandlingInfo.Text; ASPxTextBox tbxPiece = pageControl.FindControl("tbxPiece") as ASPxTextBox; airRef.Piece = tbxPiece.Text; ASPxSpinEdit tbxGrossWeight = pageControl.FindControl("tbxGrossWeight") as ASPxSpinEdit; airRef.GrossWeight = tbxGrossWeight.Text; ASPxSpinEdit tbxUnit = pageControl.FindControl("tbxUnit") as ASPxSpinEdit; airRef.Unit = tbxUnit.Text; ASPxTextBox tbxRateClass = pageControl.FindControl("tbxRateClass") as ASPxTextBox; airRef.RateClass = tbxRateClass.Text; ASPxTextBox tbxCommodityItemNo = pageControl.FindControl("tbxCommodityItemNo") as ASPxTextBox; airRef.CommodityItemNo = tbxCommodityItemNo.Text; ASPxSpinEdit tbxChargeableWeight = pageControl.FindControl("tbxChargeableWeight") as ASPxSpinEdit; airRef.ChargeableWeight = tbxChargeableWeight.Text; ASPxTextBox tbxRateCharge = pageControl.FindControl("tbxRateCharge") as ASPxTextBox; airRef.RateCharge = tbxRateCharge.Text; ASPxSpinEdit tbxTotal = pageControl.FindControl("tbxTotal") as ASPxSpinEdit; airRef.Total = tbxTotal.Text; ASPxMemo tbxGoodsNature = pageControl.FindControl("tbxGoodsNature") as ASPxMemo; airRef.GoodsNature = tbxGoodsNature.Text; ASPxMemo tbxContentRemark = pageControl.FindControl("tbxContentRemark") as ASPxMemo; airRef.ContentRemark = tbxContentRemark.Text; ASPxTextBox tbxWeightChargeP = pageControl.FindControl("tbxWeightChargeP") as ASPxTextBox; airRef.WeightChargeP = tbxWeightChargeP.Text; ASPxTextBox tbxWeightChargeC = pageControl.FindControl("tbxWeightChargeC") as ASPxTextBox; airRef.WeightChargeC = tbxWeightChargeC.Text; ASPxTextBox tbxValuationChargeP = pageControl.FindControl("tbxValuationChargeP") as ASPxTextBox; airRef.ValuationChargeP = tbxValuationChargeP.Text; ASPxTextBox tbxValuationChargeC = pageControl.FindControl("tbxValuationChargeC") as ASPxTextBox; airRef.ValuationChargeC = tbxValuationChargeC.Text; ASPxTextBox tbxTaxP = pageControl.FindControl("tbxTaxP") as ASPxTextBox; airRef.TaxP = tbxTaxP.Text; ASPxTextBox tbxTaxC = pageControl.FindControl("tbxTaxC") as ASPxTextBox; airRef.TaxC = tbxTaxC.Text; ASPxTextBox tbxOtherAgentChargeP = pageControl.FindControl("tbxOtherAgentChargeP") as ASPxTextBox; airRef.OtherAgentChargeP = tbxOtherAgentChargeP.Text; ASPxTextBox tbxOtherAgentChargeC = pageControl.FindControl("tbxOtherAgentChargeC") as ASPxTextBox; airRef.OtherAgentChargeC = tbxOtherAgentChargeC.Text; ASPxTextBox tbxOtherCarrierChargeP = pageControl.FindControl("tbxOtherCarrierChargeP") as ASPxTextBox; airRef.OtherCarrierChargeP = tbxOtherCarrierChargeP.Text; ASPxTextBox tbxOtherCarrierChargeC = pageControl.FindControl("tbxOtherCarrierChargeC") as ASPxTextBox; airRef.OtherCarrierChargeC = tbxOtherCarrierChargeC.Text; ASPxTextBox tbxTotalPrepaid = pageControl.FindControl("tbxTotalPrepaid") as ASPxTextBox; airRef.TotalPrepaid = tbxTotalPrepaid.Text; ASPxTextBox tbxTotalCollect = pageControl.FindControl("tbxTotalCollect") as ASPxTextBox; airRef.TotalCollect = tbxTotalCollect.Text; ASPxTextBox tbxCurrencyRate = pageControl.FindControl("tbxCurrencyRate") as ASPxTextBox; airRef.CurrencyRate = tbxCurrencyRate.Text; ASPxTextBox tbxChargeDestCurrency = pageControl.FindControl("tbxChargeDestCurrency") as ASPxTextBox; airRef.ChargeDestCurrency = tbxChargeDestCurrency.Text; ASPxTextBox tbxOtherCharge1 = pageControl.FindControl("tbxOtherCharge1") as ASPxTextBox; airRef.OtherCharge1 = tbxOtherCharge1.Text; ASPxTextBox tbxOtherCharge1Currency = pageControl.FindControl("tbxOtherCharge1Currency") as ASPxTextBox; airRef.OtherCharge1Currency = tbxOtherCharge1Currency.Text; ASPxSpinEdit tbxOtherCharge1Amount = pageControl.FindControl("tbxOtherCharge1Amount") as ASPxSpinEdit; airRef.OtherCharge1Amount = SafeValue.SafeDecimal(tbxOtherCharge1Amount.Text); ASPxTextBox tbxOtherCharge2 = pageControl.FindControl("tbxOtherCharge2") as ASPxTextBox; airRef.OtherCharge2 = tbxOtherCharge2.Text; ASPxTextBox tbxOtherCharge2Currency = pageControl.FindControl("tbxOtherCharge2Currency") as ASPxTextBox; airRef.OtherCharge2Currency = tbxOtherCharge2Currency.Text; ASPxSpinEdit tbxOtherCharge2Amount = pageControl.FindControl("tbxOtherCharge2Amount") as ASPxSpinEdit; airRef.OtherCharge2Amount = SafeValue.SafeDecimal(tbxOtherCharge2Amount.Text); ASPxTextBox tbxOtherCharge3 = pageControl.FindControl("tbxOtherCharge3") as ASPxTextBox; airRef.OtherCharge3 = tbxOtherCharge3.Text; ASPxTextBox tbxOtherCharge3Currency = pageControl.FindControl("tbxOtherCharge3Currency") as ASPxTextBox; airRef.OtherCharge3Currency = tbxOtherCharge3Currency.Text; ASPxSpinEdit tbxOtherCharge3Amount = pageControl.FindControl("tbxOtherCharge3Amount") as ASPxSpinEdit; airRef.OtherCharge3Amount = SafeValue.SafeDecimal(tbxOtherCharge3Amount.Text); ASPxTextBox tbxOtherCharge4 = pageControl.FindControl("tbxOtherCharge4") as ASPxTextBox; airRef.OtherCharge4 = tbxOtherCharge4.Text; ASPxTextBox tbxOtherCharge4Currency = pageControl.FindControl("tbxOtherCharge4Currency") as ASPxTextBox; airRef.OtherCharge4Currency = tbxOtherCharge4Currency.Text; ASPxSpinEdit tbxOtherCharge4Amount = pageControl.FindControl("tbxOtherCharge4Amount") as ASPxSpinEdit; airRef.OtherCharge4Amount = SafeValue.SafeDecimal(tbxOtherCharge4Amount.Text); ASPxTextBox tbxOtherCharge5 = pageControl.FindControl("tbxOtherCharge5") as ASPxTextBox; airRef.OtherCharge5 = tbxOtherCharge5.Text; ASPxTextBox tbxOtherCharge5Currency = pageControl.FindControl("tbxOtherCharge5Currency") as ASPxTextBox; airRef.OtherCharge5Currency = tbxOtherCharge5Currency.Text; ASPxSpinEdit tbxOtherCharge5Amount = pageControl.FindControl("tbxOtherCharge5Amount") as ASPxSpinEdit; airRef.OtherCharge5Amount = SafeValue.SafeDecimal(tbxOtherCharge5Amount.Text); ASPxTextBox tbxSignatureShipper = pageControl.FindControl("tbxSignatureShipper") as ASPxTextBox; airRef.SignatureShipper = tbxSignatureShipper.Text; ASPxTextBox tbxExecuteDate = pageControl.FindControl("tbxExecuteDate") as ASPxTextBox; airRef.ExecuteDate = tbxExecuteDate.Text; ASPxTextBox tbxExecutePlace = pageControl.FindControl("tbxExecutePlace") as ASPxTextBox; airRef.ExecutePlace = tbxExecutePlace.Text; ASPxTextBox tbxSignatureIssuing = pageControl.FindControl("tbxSignatureIssuing") as ASPxTextBox; airRef.SignatureIssuing = tbxSignatureIssuing.Text; if (isNew) { airRef.CloseInd = "N"; airRef.CreateBy = userId; airRef.CreateDateTime = DateTime.Now; airRef.RefNo = refNo.ToString(); airRef.RefType = "AE"; airRef.UpdateBy = userId; airRef.UpdateDateTime = DateTime.Now; airRef.StatusCode = "USE"; Manager.ORManager.StartTracking(airRef, Wilson.ORMapper.InitialState.Inserted); Manager.ORManager.PersistChanges(airRef); C2Setup.SetNextNo(airRef.RefType, "AirExport", refNo, airRef.RefDate); } else { airRef.UpdateBy = userId; airRef.UpdateDateTime = DateTime.Now; Manager.ORManager.StartTracking(airRef, Wilson.ORMapper.InitialState.Updated); Manager.ORManager.PersistChanges(airRef); } Session["AirExpMastWhere"] = "RefNo='" + refNo + "'"; this.dsImportRef.FilterExpression = Session["AirExpMastWhere"].ToString(); if (this.grid_ref.GetRow(0) != null) { this.grid_ref.StartEdit(0); } } catch { } }
protected void grid_Cont_RowUpdated(object sender, DevExpress.Web.Data.ASPxDataUpdatedEventArgs e) { ASPxGridView grd = (sender as ASPxGridView) as ASPxGridView; updateJob_By_Date(SafeValue.SafeString(grd.GetMasterRowKeyValue(), "0")); if (SafeValue.SafeString(e.NewValues["ContainerNo"]) != SafeValue.SafeString(e.OldValues["ContainerNo"])) { string sql = string.Format("Update ctm_JobDet2 set ContainerNo='{1}' where Det1Id='{0}'", e.Keys["Id"], SafeValue.SafeString(e.NewValues["ContainerNo"])); ConnectSql.ExecuteSql(sql); } }
protected void grid_Trip_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e) { ASPxGridView grd = (sender as ASPxGridView) as ASPxGridView; string sql = @"select det1.Id,det1.ContainerNo,det1.ContainerType from CTM_JobDet1 as det1 left outer join CTM_Job as job on det1.JobNo=job.JobNo where job.Id=" + SafeValue.SafeInt(grd.GetMasterRowKeyValue(), 0); ASPxPageControl pageControl = this.grid_job.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxGridView grid_Trip = pageControl.FindControl("grid_Trip") as ASPxGridView; ASPxDropDownEdit dde_contNo = grid_Trip.FindEditFormTemplateControl("dde_Trip_ContNo") as ASPxDropDownEdit; ASPxGridView gvlist = dde_contNo.FindControl("gridPopCont") as ASPxGridView; gvlist.DataSource = C2.Manager.ORManager.GetDataSet(sql); gvlist.DataBind(); }
protected void ASPxGridView1_CustomCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e) { ASPxTextBox invNCtr = this.ASPxGridView1.FindEditFormTemplateControl("txt_Oid") as ASPxTextBox; ASPxTextBox title = this.ASPxGridView1.FindEditFormTemplateControl("txt_Title") as ASPxTextBox; ASPxButtonEdit partyTo = this.ASPxGridView1.FindEditFormTemplateControl("txt_CustId") as ASPxButtonEdit; ASPxTextBox docN = this.ASPxGridView1.FindEditFormTemplateControl("txt_DocNo") as ASPxTextBox; ASPxDateEdit docDate = this.ASPxGridView1.FindEditFormTemplateControl("txt_DocDt") as ASPxDateEdit; ASPxMemo note = this.ASPxGridView1.FindEditFormTemplateControl("txt_Note") as ASPxMemo; ASPxMemo rmk = this.ASPxGridView1.FindEditFormTemplateControl("txt_Remarks1") as ASPxMemo; // ASPxComboBox termId = this.ASPxGridView1.FindEditFormTemplateControl("txt_TermId") as ASPxComboBox; ASPxDateEdit expireDt = this.ASPxGridView1.FindEditFormTemplateControl("txt_toDt") as ASPxDateEdit; ASPxButtonEdit docCurr = this.ASPxGridView1.FindEditFormTemplateControl("txt_Currency") as ASPxButtonEdit; ASPxButtonEdit pol = this.ASPxGridView1.FindEditFormTemplateControl("txt_Pol") as ASPxButtonEdit; ASPxButtonEdit pod = this.ASPxGridView1.FindEditFormTemplateControl("txt_Pod") as ASPxButtonEdit; ASPxButtonEdit viaPort = this.ASPxGridView1.FindEditFormTemplateControl("txt_ViaPort") as ASPxButtonEdit; ASPxTextBox frequency = this.ASPxGridView1.FindEditFormTemplateControl("txt_Frequency") as ASPxTextBox; ASPxTextBox attention = this.ASPxGridView1.FindEditFormTemplateControl("txt_Attention") as ASPxTextBox; ASPxTextBox tsDay = this.ASPxGridView1.FindEditFormTemplateControl("spin_TsDay") as ASPxTextBox; ASPxSpinEdit lclChg = this.ASPxGridView1.FindEditFormTemplateControl("spin_Gp20") as ASPxSpinEdit; ASPxSpinEdit exRate = this.ASPxGridView1.FindEditFormTemplateControl("spin_exRate") as ASPxSpinEdit; string invN = docN.Text; C2.SeaApQuote1 inv = Manager.ORManager.GetObject(typeof(SeaApQuote1), SafeValue.SafeInt(invNCtr.Text, 0)) as SeaApQuote1; if (inv == null)// first insert invoice { string counterType = "SeaLcl-ApQuotation"; inv = new SeaApQuote1(); invN = C2Setup.GetNextNo(counterType); inv.Title = title.Text; inv.PartyTo = SafeValue.SafeString(partyTo.Value, ""); inv.QuoteNo = invN.ToString(); inv.QuoteDate = docDate.Date; inv.ImpExpInd = "E"; inv.FclLclInd = "Lcl"; // inv.Term = termId.Text; //inv.DocFromDate =SafeValue.SafeDate(fromDt.Text, DateTime.Now); inv.ExpireDate = SafeValue.SafeDate(expireDt.Text, DateTime.Now); inv.Rmk = rmk.Text; inv.Note = note.Text; inv.CurrencyId = docCurr.Text.ToString(); inv.Frequency = frequency.Text; inv.ExRate = SafeValue.SafeDecimal(exRate.Value, 1); inv.Pol = pol.Text; inv.Pod = pod.Text; inv.ViaPort = viaPort.Text; inv.Attention = attention.Text; inv.TransmitDay = tsDay.Text; inv.LclChg = SafeValue.SafeDecimal(lclChg.Value, 0); inv.Gp20 = 0; inv.Gp40 = 0; inv.Hc40 = 0; inv.CreateUser = HttpContext.Current.User.Identity.Name; inv.CreateDate = DateTime.Now; try { C2.Manager.ORManager.StartTracking(inv, Wilson.ORMapper.InitialState.Inserted); C2.Manager.ORManager.PersistChanges(inv); C2Setup.SetNextNo(counterType, inv.QuoteNo); } catch { } } else { inv.Title = title.Text; inv.PartyTo = SafeValue.SafeString(partyTo.Value, ""); inv.ExpireDate = SafeValue.SafeDate(expireDt.Text, DateTime.Now); inv.Rmk = rmk.Text; inv.Note = note.Text; inv.CurrencyId = docCurr.Text.ToString(); inv.ExRate = SafeValue.SafeDecimal(exRate.Value, 1); inv.Pol = pol.Text; inv.Pod = pod.Text; inv.ViaPort = viaPort.Text; inv.Attention = attention.Text; inv.TransmitDay = tsDay.Text; inv.LclChg = SafeValue.SafeDecimal(lclChg.Value, 0); inv.Frequency = frequency.Text; inv.UpdateUser = HttpContext.Current.User.Identity.Name; inv.UpdateDate = DateTime.Now; try { Manager.ORManager.StartTracking(inv, InitialState.Updated); Manager.ORManager.PersistChanges(inv); } catch { } } Session["SeaExpLclQuoteEdit"] = "SequenceId=" + inv.SequenceId; this.dsApQuotation.FilterExpression = Session["SeaExpLclQuoteEdit"].ToString(); if (this.ASPxGridView1.GetRow(0) != null) { this.ASPxGridView1.StartEdit(0); } }
private void job_save() { try { ASPxPageControl pageControl = this.grid_job.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox txt_JobNo = pageControl.FindControl("txt_JobNo") as ASPxTextBox; string jobNo = SafeValue.SafeString(txt_JobNo.Text, ""); Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.CtmJob), "JobNo='" + jobNo + "'"); C2.CtmJob ctmJob = C2.Manager.ORManager.GetObject(query) as C2.CtmJob; ASPxDateEdit jobDate = pageControl.FindControl("txt_JobDate") as ASPxDateEdit; bool isNew = false; if (ctmJob == null) { isNew = true; ctmJob = new C2.CtmJob(); ctmJob.JobNo = C2Setup.GetNextNo("", "CTM_Job", jobDate.Date); } ASPxDateEdit jobEta = pageControl.FindControl("date_Eta") as ASPxDateEdit; ASPxDateEdit jobEtd = pageControl.FindControl("date_Etd") as ASPxDateEdit; //ASPxButtonEdit partyId = pageControl.FindControl("btn_PartyId") as ASPxButtonEdit; ASPxTextBox ves = pageControl.FindControl("txt_Ves") as ASPxTextBox; ASPxTextBox voy = pageControl.FindControl("txt_Voy") as ASPxTextBox; //ASPxButtonEdit carrier = pageControl.FindControl("btn_CarrierId") as ASPxButtonEdit; //ASPxTextBox CarrierBlNo = pageControl.FindControl("txt_CarrierBlNo") as ASPxTextBox; //ASPxTextBox CarrierBkgNo = pageControl.FindControl("txt_CarrierBkgNo") as ASPxTextBox; ASPxComboBox Terminal = pageControl.FindControl("cbb_Terminal") as ASPxComboBox; ASPxMemo PickupFrom = pageControl.FindControl("txt_PickupFrom") as ASPxMemo; ASPxMemo DeliveryTo = pageControl.FindControl("txt_DeliveryTo") as ASPxMemo; ASPxMemo Remark = pageControl.FindControl("txt_Remark") as ASPxMemo; ASPxMemo SpecialInstruction = pageControl.FindControl("txt_SpecialInstruction") as ASPxMemo; ASPxTextBox txt_Pol = pageControl.FindControl("txt_Pol") as ASPxTextBox; ASPxTextBox txt_Pod = pageControl.FindControl("txt_Pod") as ASPxTextBox; ASPxTextBox txt_EtaTime = pageControl.FindControl("txt_EtaTime") as ASPxTextBox; ASPxTextBox txt_EtdTime = pageControl.FindControl("txt_EtdTime") as ASPxTextBox; ASPxComboBox cbb_JobType = pageControl.FindControl("cbb_JobType") as ASPxComboBox; //ASPxButtonEdit btn_ClientId = pageControl.FindControl("btn_ClientId") as ASPxButtonEdit; ASPxTextBox txt_ClientRefNo = pageControl.FindControl("txt_ClientRefNo") as ASPxTextBox; //ASPxButtonEdit btn_HaulierId = pageControl.FindControl("btn_HaulierId") as ASPxButtonEdit; ctmJob.JobDate = SafeValue.SafeDate(jobDate.Date, new DateTime(1753, 1, 1)); ctmJob.EtaDate = SafeValue.SafeDate(jobEta.Date, new DateTime(1753, 1, 1)); ctmJob.EtdDate = SafeValue.SafeDate(jobEtd.Date, new DateTime(1753, 1, 1)); //ctmJob.PartyId = partyId.Text; ctmJob.Vessel = ves.Text; ctmJob.Voyage = voy.Text; ctmJob.CarrierId = ""; ctmJob.CarrierBlNo = ""; ctmJob.CarrierBkgNo = ""; ctmJob.Terminalcode = SafeValue.SafeString(Terminal.Value); ctmJob.PickupFrom = PickupFrom.Text; ctmJob.DeliveryTo = DeliveryTo.Text; ctmJob.Remark = Remark.Text; ctmJob.SpecialInstruction = SpecialInstruction.Text; ctmJob.Pol = txt_Pol.Text; ctmJob.Pod = txt_Pod.Text; ctmJob.EtaTime = txt_EtaTime.Text; ctmJob.EtdTime = txt_EtdTime.Text; ctmJob.JobType = cbb_JobType.Text; ctmJob.ClientId = ""; ctmJob.ClientRefNo = txt_ClientRefNo.Text; ctmJob.HaulierId = ""; string userId = HttpContext.Current.User.Identity.Name; if (isNew) { ctmJob.StatusCode = "USE"; ctmJob.CreateBy = userId; ctmJob.CreateDateTime = DateTime.Now; ctmJob.UpdateBy = userId; ctmJob.UpdateDateTime = DateTime.Now; C2.Manager.ORManager.StartTracking(ctmJob, Wilson.ORMapper.InitialState.Inserted); C2.Manager.ORManager.PersistChanges(ctmJob); } else { ctmJob.UpdateBy = userId; ctmJob.UpdateDateTime = DateTime.Now; C2.Manager.ORManager.StartTracking(ctmJob, Wilson.ORMapper.InitialState.Updated); C2.Manager.ORManager.PersistChanges(ctmJob); } if (isNew) { txt_JobNo.Text = ctmJob.JobNo; //txt_search_JobNo.Text = txt_JobNo.Text; C2Setup.SetNextNo("", "CTM_Job", ctmJob.JobNo, jobDate.Date); } Session["CTM_Job"] = "JobNo='" + ctmJob.JobNo + "'"; this.dsJob.FilterExpression = Session["CTM_Job"].ToString(); if (this.grid_job.GetRow(0) != null) { this.grid_job.StartEdit(0); } } catch { } }
protected void grid_InvDet_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { if (SafeValue.SafeString(e.NewValues["GstType"], "") == "S") { e.NewValues["Gst"] = (decimal)0.07; } else { e.NewValues["Gst"] = (decimal)0; } e.NewValues["Amt"] = SafeValue.SafeDecimal(e.NewValues["Price"], 0) * SafeValue.SafeDecimal(e.NewValues["Qty"], 1) * (1 + SafeValue.SafeDecimal(e.NewValues["Gst"], 0)); }
protected void grid_InvDet_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { ASPxGridView grd = sender as ASPxGridView; string sql_detCnt = "select max(QuoteLineNo) from SeaApQuoteDet1 where QuoteId='" + SafeValue.SafeInt(grd.GetMasterRowKeyValue(), 0) + "'"; int lineNo = SafeValue.SafeInt(Manager.ORManager.ExecuteScalar(sql_detCnt), 0) + 1; e.NewValues["QuoteId"] = SafeValue.SafeString(grd.GetMasterRowKeyValue(), ""); e.NewValues["QuoteLineNo"] = lineNo; if (SafeValue.SafeString(e.NewValues["GstType"], "") == "S") { e.NewValues["Gst"] = (decimal)0.07; } else { e.NewValues["Gst"] = (decimal)0; } e.NewValues["Amt"] = SafeValue.SafeDecimal(e.NewValues["Price"], 0) * SafeValue.SafeDecimal(e.NewValues["Qty"], 1) * (1 + SafeValue.SafeDecimal(e.NewValues["Gst"], 0)); }
protected void grid_InvDet_BeforePerformDataSelect(object sender, EventArgs e) { ASPxGridView grd = sender as ASPxGridView; this.dsApQuotationDet.FilterExpression = "QuoteId='" + SafeValue.SafeInt(grd.GetMasterRowKeyValue(), 0) + "'"; }
public void Crane_JobView_PODSave(string info) { JObject job = (JObject)JsonConvert.DeserializeObject(HttpUtility.UrlDecode(Server.UrlDecode(info))); int tripId = SafeValue.SafeInt(job["Id"], 0); string BillingRemark = job["BillingRemark"].ToString(); string DeliveryRemark = job["DeliveryRemark"].ToString(); string Satisfaction = job["Satisfaction"].ToString(); string FromDate = job["FromDate"].ToString(); string FromTime = job["FromTime"].ToString(); string ToDate = job["ToDate"].ToString(); string ToTime = job["ToTime"].ToString(); decimal OtHour = SafeValue.SafeDecimal(job["OtHour"], 0); int epodTrip = SafeValue.SafeInt(job["epodTrip"], 0); string epodCB1 = SafeValue.SafeString(job["epodCB1"], "No"); string epodCB2 = SafeValue.SafeString(job["epodCB2"], "No"); string epodCB3 = SafeValue.SafeString(job["epodCB3"], "No"); string epodCB4 = SafeValue.SafeString(job["epodCB4"], "No"); string epodCB5 = SafeValue.SafeString(job["epodCB5"], "No"); string epodCB6 = SafeValue.SafeString(job["epodCB6"], "No"); int ManPowerNo = SafeValue.SafeInt(job["ManPowerNo"], 0); string ExcludeLunch = SafeValue.SafeString(job["ExcludeLunch"]); string epodSignedBy = SafeValue.SafeString(job["epodSignedBy"]); string DeliveryResult = SafeValue.SafeString(job["DeliveryResult"]); string epodHardCopy = SafeValue.SafeString(job["epodHardCopy"]); string context = Common.StringToJson(""); string sql = string.Format(@"update CTM_JobDet2 set BillingRemark=@BillingRemark,DeliveryRemark=@DeliveryRemark,Satisfaction=@Satisfaction,PodType='C', FromDate=@FromDate,FromTime=@FromTime,ToDate=@ToDate,ToTime=@ToTime,OtHour=@OtHour,TotalHour=@epodTrip,epodSignedBy=@epodSignedBy, epodCB1=@epodCB1,epodCB2=@epodCB2,epodCB3=@epodCB3,epodCB4=@epodCB4,epodCB5=@epodCB5,epodCB6=@epodCB6,ManPowerNo=@ManPowerNo,ExcludeLunch=@ExcludeLunch,DeliveryResult=@DeliveryResult,epodHardCopy=@epodHardCopy where Id=@tripId"); List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>(); list.Add(new ConnectSql_mb.cmdParameters("@tripId", tripId, SqlDbType.Int)); list.Add(new ConnectSql_mb.cmdParameters("@BillingRemark", BillingRemark, SqlDbType.NVarChar, 300)); list.Add(new ConnectSql_mb.cmdParameters("@DeliveryRemark", DeliveryRemark, SqlDbType.NVarChar, 300)); list.Add(new ConnectSql_mb.cmdParameters("@Satisfaction", Satisfaction, SqlDbType.NVarChar, 30)); list.Add(new ConnectSql_mb.cmdParameters("@FromDate", FromDate, SqlDbType.NVarChar, 8)); list.Add(new ConnectSql_mb.cmdParameters("@FromTime", FromTime, SqlDbType.NVarChar, 5)); list.Add(new ConnectSql_mb.cmdParameters("@ToDate", ToDate, SqlDbType.NVarChar, 8)); list.Add(new ConnectSql_mb.cmdParameters("@ToTime", ToTime, SqlDbType.NVarChar, 5)); list.Add(new ConnectSql_mb.cmdParameters("@OtHour", OtHour, SqlDbType.Decimal)); list.Add(new ConnectSql_mb.cmdParameters("@epodTrip", epodTrip, SqlDbType.Int)); list.Add(new ConnectSql_mb.cmdParameters("@epodSignedBy", epodSignedBy, SqlDbType.NVarChar, 100)); list.Add(new ConnectSql_mb.cmdParameters("@epodCB1", epodCB1, SqlDbType.NVarChar, 10)); list.Add(new ConnectSql_mb.cmdParameters("@epodCB2", epodCB2, SqlDbType.NVarChar, 10)); list.Add(new ConnectSql_mb.cmdParameters("@epodCB3", epodCB3, SqlDbType.NVarChar, 10)); list.Add(new ConnectSql_mb.cmdParameters("@epodCB4", epodCB4, SqlDbType.NVarChar, 10)); list.Add(new ConnectSql_mb.cmdParameters("@epodCB5", epodCB5, SqlDbType.NVarChar, 10)); list.Add(new ConnectSql_mb.cmdParameters("@epodCB6", epodCB6, SqlDbType.NVarChar, 10)); list.Add(new ConnectSql_mb.cmdParameters("@ManPowerNo", ManPowerNo, SqlDbType.Int)); list.Add(new ConnectSql_mb.cmdParameters("@ExcludeLunch", ExcludeLunch, SqlDbType.NVarChar, 10)); list.Add(new ConnectSql_mb.cmdParameters("@DeliveryResult", DeliveryResult, SqlDbType.NVarChar, 300)); list.Add(new ConnectSql_mb.cmdParameters("@epodHardCopy", epodHardCopy, SqlDbType.NVarChar, 10)); ConnectSql_mb.sqlResult result = ConnectSql_mb.ExecuteNonQuery(sql, list); if (result.status) { C2.CtmJobEventLog lg = new C2.CtmJobEventLog(); lg.Platform_isMobile(); lg.Controller = SafeValue.SafeString(job["user"]); lg.Lat = SafeValue.SafeString(job["Lat"]); lg.Lng = SafeValue.SafeString(job["Lng"]); //lg.ActionLevel_isTRIP(tripId); //lg.Remark = "Submit e-POD"; lg.setActionLevel(tripId, CtmJobEventLogRemark.Level.Trip, 5); lg.log(); if (!ePOD_SendEmail(tripId)) { context = Common.StringToJson("Submit successful, but send false"); } } Common.WriteJsonP(result.status, context); }
protected void grid_Trip_RowUpdated(object sender, DevExpress.Web.Data.ASPxDataUpdatedEventArgs e) { ASPxGridView grd = (sender as ASPxGridView) as ASPxGridView; updateJob_By_Date(SafeValue.SafeString(grd.GetMasterRowKeyValue(), "0")); }
public void Attachment_AddMutiple(string info) { JObject job = (JObject)JsonConvert.DeserializeObject(HttpUtility.UrlDecode(Server.UrlDecode(info))); JArray jar = (JArray)JsonConvert.DeserializeObject(job["list"].ToString()); List <ConnectSql_mb.cmdParameters> list = null; ConnectSql_mb.cmdParameters cpar = null; string status = "1"; string context = Common.StringToJson(""); //string sql = string.Format(@"insert into job_photo (JobNo,ContNo,Name,Path,UploadType,EntryDate,DoNo,OrderType,Remark,ShowCust) values (@OrderNo,@ContNo,@FileName,@FilePath,@FileType,Getdate(),@DoNo,@OrderType,@FileNote,@ShowCust)"); string sql = string.Format(@"insert into CTM_Attachment(RefNo,ContainerNo,FileName,FilePath,FileType,CreateDateTime,JobNo,JobType,FileNote,TripId) values (@OrderNo,@ContNo,@FileName,@FilePath,@FileType,Getdate(),@CargoId,@OrderType,@FileNote,@TripId) select @@Identity"); string fileStart = System.Configuration.ConfigurationManager.AppSettings["MobileServerUrl"].ToString(); if (fileStart == null) { fileStart = ""; } string CreateBy = job["user"].ToString(); string JobNo = job["JobNo"].ToString(); string ContainerNo = job["ContainerNo"].ToString(); string TripId = job["TripId"].ToString(); string CargoId = SafeValue.SafeString(job["CargoId"]); string JobType = "CTM"; string FileNote = ""; bool ShowCust = true; for (int i = 0; i < jar.Count; i++) { string fileEnd = jar[i]["FP"].ToString(); fileEnd = fileEnd.Substring(0, fileEnd.LastIndexOf('/')) + "/500/" + fileEnd.Substring(fileEnd.LastIndexOf('/') + 1); fileEnd = fileStart + fileEnd; string FileType = jar[i]["FT"].ToString(); string FileName = jar[i]["FN"].ToString(); list = new List <ConnectSql_mb.cmdParameters>(); cpar = new ConnectSql_mb.cmdParameters("@OrderNo", JobNo, SqlDbType.NVarChar, 100); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@ContNo", ContainerNo, SqlDbType.NVarChar, 100); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@CargoId", CargoId, SqlDbType.NVarChar, 100); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@TripId", TripId, SqlDbType.NVarChar, 100); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@FileType", FileType, SqlDbType.NVarChar, 100); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@OrderType", JobType, SqlDbType.NVarChar, 100); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@FileName", FileName, SqlDbType.NVarChar, 100); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@FilePath", fileEnd, SqlDbType.NVarChar, 100); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@CreateBy", CreateBy, SqlDbType.NVarChar, 100); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@FileNote", FileNote, SqlDbType.NVarChar, 300); list.Add(cpar); list.Add(new ConnectSql_mb.cmdParameters("@ShowCust", ShowCust, SqlDbType.Bit)); ConnectSql_mb.sqlResult res = ConnectSql_mb.ExecuteScalar(sql, list); if (res.status) { //status = "1"; //===========log C2.CtmJobEventLog lg = new C2.CtmJobEventLog(); lg.Platform_isMobile(); lg.Controller = CreateBy; lg.Lat = SafeValue.SafeString(job["Lat"]); lg.Lng = SafeValue.SafeString(job["Lng"]); //lg.fixActionInfo_ByAttachmentId(SafeValue.SafeInt(res.context, 0)); //lg.Remark = "Attachment upload file:" + job["FileName"]; lg.setActionLevel(SafeValue.SafeInt(res.context, 0), CtmJobEventLogRemark.Level.Attachment, 1, ":" + FileType + "[" + FileName + "]"); lg.log(); } else { status = "0"; context = (context == "" ? "Save error:" : ",") + FileName; } } context = Common.StringToJson(context); Common.WriteJsonP(status, context); }
protected void Grid1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { e.NewValues["Remark"] = Helper.Safe.SafeString(e.NewValues["Remark"]).Trim(); e.NewValues["RowUpdateUser"] = HttpContext.Current.User.Identity.Name; e.NewValues["RowUpdateTime"] = DateTime.Now; e.NewValues["LineStatus"] = Helper.Safe.SafeString(e.NewValues["LineStatus"]).Trim(); e.NewValues["Unit"] = Helper.Safe.SafeString(e.NewValues["Unit"]).Trim(); e.NewValues["ContType"] = Helper.Safe.SafeString(e.NewValues["ContType"]).Trim(); if (Helper.Safe.SafeString(e.NewValues["ContType"]).Trim() != "") { e.NewValues["ContSize"] = Helper.Safe.SafeString(e.NewValues["ContType"]).Trim().Substring(0, 2); } else { e.NewValues["ContSize"] = Helper.Safe.SafeString(e.NewValues["ContSize"]).Trim(); } e.NewValues["Remark"] = Helper.Safe.SafeString(e.NewValues["Remark"]).Trim(); e.NewValues["BillScope"] = Helper.Safe.SafeString(e.NewValues["BillScope"]).Trim(); e.NewValues["BillType"] = Helper.Safe.SafeString(e.NewValues["BillType"]).Trim(); e.NewValues["BillClass"] = Helper.Safe.SafeString(e.NewValues["BillClass"]).Trim(); ASPxGridView grid = (sender as ASPxGridView) as ASPxGridView; ASPxButtonEdit txt_ChgCode = grid.FindEditRowCellTemplateControl(null, "txt_Line_ChgCode") as ASPxButtonEdit; string sql = string.Format(@"select ChgcodeDes from XXChgCode where ChgcodeId='{0}'", SafeValue.SafeString(txt_ChgCode.Value)); string chgcodeDes = SafeValue.SafeString(ConnectSql.ExecuteScalar(sql)); if (SafeValue.SafeString(e.NewValues["ChgCodeDe"]) == "") { e.NewValues["ChgCodeDe"] = chgcodeDes; } e.NewValues["ChgCode"] = SafeValue.SafeString(txt_ChgCode.Value); e.NewValues["ChgCodeDe"] = SafeValue.SafeString(e.NewValues["ChgCodeDe"]); e.NewValues["SkuClass"] = Helper.Safe.SafeString(e.NewValues["SkuClass"]).Trim(); e.NewValues["SkuUnit"] = Helper.Safe.SafeString(e.NewValues["SkuUnit"]).Trim(); e.NewValues["JobType"] = Helper.Safe.SafeString(e.NewValues["JobType"]).Trim(); e.NewValues["StorageType"] = Helper.Safe.SafeString(e.NewValues["StorageType"]).Trim(); e.NewValues["VehicleType"] = Helper.Safe.SafeString(e.NewValues["VehicleType"]).Trim(); e.NewValues["GstType"] = Helper.Safe.SafeString(e.NewValues["GstType"]).Trim(); btn_search_Click(null, null); }
protected void ASPxGridView1_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { e.Values["SequenceId"] = SafeValue.SafeString(e.Values["SequenceId"]); }
private void OnLoad(string r) { int start = 0; // this.ASPxGridView1.PageIndex * ASPxGridView1.SettingsPager.PageSize; int end = 10000; // (ASPxGridView1.PageIndex + 1) * ASPxGridView1.SettingsPager.PageSize; for (int i = start; i < end; i++) { ASPxTextBox docId = this.ASPxGridView1.FindRowTemplateControl(i, "txt_docId") as ASPxTextBox; ASPxSpinEdit payAmt = this.ASPxGridView1.FindRowTemplateControl(i, "spin_Amt") as ASPxSpinEdit; ASPxSpinEdit balanceAmt = this.ASPxGridView1.FindRowTemplateControl(i, "spin_BalanceAmt") as ASPxSpinEdit; ASPxCheckBox isPay = this.ASPxGridView1.FindRowTemplateControl(i, "ack_IsPay") as ASPxCheckBox; if (docId != null && payAmt != null && isPay != null && isPay.Checked) { if (SafeValue.SafeDecimal(payAmt.Value, 0) > 0 && SafeValue.SafeDecimal(payAmt.Value, 0) <= SafeValue.SafeDecimal(balanceAmt.Value, 0)) { totPayAmt += SafeValue.SafeDecimal(payAmt.Value, 0); list.Add(new Record(SafeValue.SafeInt(docId.Text, 0), SafeValue.SafeDecimal(payAmt.Value, 0) )); } } } }
protected void grid_ref_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e) { string s = e.Parameters; ASPxPageControl pageControl = this.grid_ref.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox masterId = this.grid_ref.FindEditFormTemplateControl("txt_Id") as ASPxTextBox; string userId = HttpContext.Current.User.Identity.Name; ASPxLabel closeIndStr = this.grid_ref.FindEditFormTemplateControl("lab_CloseInd") as ASPxLabel; ASPxTextBox txt_RefN = this.grid_ref.FindEditFormTemplateControl("txt_RefN") as ASPxTextBox; ASPxButton btn = this.grid_ref.FindControl("btn_CloseJob") as ASPxButton; string sql = string.Format("select StatusCode from air_ref where Id={0}", SafeValue.SafeInt(masterId.Text, 0)); string statusCode = SafeValue.SafeString(Manager.ORManager.ExecuteScalar(sql)); if (s == "VoidMaster") { #region void master string sql_cnt = string.Format("select count(SequenceId) from XAArInvoiceDet where MastType='AE' and MastRefNo='{0}' ", txt_RefN.Text); int cnt = SafeValue.SafeInt(C2.Manager.ORManager.ExecuteScalar(sql_cnt), 0); if (cnt > 0) { e.Result = "Billing"; return; } if (statusCode == "CNL") { sql = string.Format("update air_ref set StatusCode='USE' where RefNo='{0}'", txt_RefN.Text); string sql1 = string.Format("update air_job set StatusCode='USE' where RefNo='{0}'", txt_RefN.Text); int res = Manager.ORManager.ExecuteCommand(sql); int res1 = Manager.ORManager.ExecuteCommand(sql1); if (res > 0 && res1 > 0) { EzshipLog.Log(txt_RefN.Text, "", "AE", "Unvoid"); e.Result = "Success"; //btn.Text = "Close Job"; //closeIndStr.Text = "C"; } else { e.Result = "Fail"; } } else { string refType = "AE"; bool closeByEst = EzshipHelper.GetCloseEstInd(txt_RefN.Text, refType); if (closeByEst) { sql = string.Format("update air_ref set StatusCode='CNL' where RefNo='{0}'", txt_RefN.Text); string sql1 = string.Format("update air_job set StatusCode='CNL' where RefNo='{0}'", txt_RefN.Text); int res = Manager.ORManager.ExecuteCommand(sql); int res1 = Manager.ORManager.ExecuteCommand(sql1); if (res > 0 && res1 > 0) { EzshipLog.Log(txt_RefN.Text, "", "AE", "Void"); e.Result = "Success"; //btn.Text = "Close Job"; //closeIndStr.Text = "C"; } else { e.Result = "Fail"; } } else { e.Result = "NoMatch"; } } #endregion } if (s == "CloseJob") { #region close job if (statusCode == "CLS") { sql = string.Format("update air_ref set StatusCode='USE' where RefNo='{0}'", txt_RefN.Text); string sql1 = string.Format("update air_job set StatusCode='USE' where RefNo='{0}'", txt_RefN.Text); int res = Manager.ORManager.ExecuteCommand(sql); int res1 = Manager.ORManager.ExecuteCommand(sql1); if (res > 0 && res1 > 0) { EzshipLog.Log(txt_RefN.Text, "", "AE", "Open"); e.Result = "Success"; //btn.Text = "Close Job"; //closeIndStr.Text = "N"; } else { e.Result = "Fail"; } } else { string refType = "AE"; bool closeByEst = EzshipHelper.GetCloseEstInd(txt_RefN.Text, refType); if (closeByEst) { sql = string.Format("update air_ref set StatusCode='CLS', CloseDate='{0}' ,CloseUser='******' where RefNo='{2}'", DateTime.Today.ToString("yyyy-MM-dd"), userId, txt_RefN.Text); string sql1 = string.Format("update air_job set StatusCode='CLS' where RefNo='{0}'", txt_RefN.Text); int res = Manager.ORManager.ExecuteCommand(sql); int res1 = Manager.ORManager.ExecuteCommand(sql1); if (res > 0 && res1 > 0) { EzshipLog.Log(txt_RefN.Text, "", "AE", "Close"); e.Result = "Success"; //btn.Text = "Open Job"; //closeIndStr.Text = "Y"; } else { e.Result = "Fail"; } } else { e.Result = "NoMatch"; } } #endregion } }
protected void grid_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { e.NewValues["Name"] = SafeValue.SafeString(e.NewValues["Name"]); e.NewValues["CountryCode"] = SafeValue.SafeString(e.NewValues["CountryCode"]); }
protected void grid_Cost_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { 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); }
private void BindData() { if (Request.QueryString["id"] != null && Request.QueryString["typ"] != null) { string filter_ImpExpInd = ""; string filter_FclLclInd = ""; decimal qty = 0; int invId = SafeValue.SafeInt(Request.QueryString["id"], 0); string arAp = SafeValue.SafeString(Request.QueryString["typ"]).ToUpper(); string sql = ""; if (arAp == "AR") { sql = string.Format("select MastRefNo,JobRefNo,MastType from xaarinvoice where SequenceId='{0}'", invId); } else if (arAp == "AP") { sql = string.Format("select MastRefNo,JobRefNo,MastType from XaApPayable where SequenceId='{0}'", invId); } if (sql.Length > 0) { DataTable tab = ConnectSql.GetTab(sql); if (tab.Rows.Count == 1) { string mastRefNo = SafeValue.SafeString(tab.Rows[0]["MastRefNo"]); string jobRefNo = SafeValue.SafeString(tab.Rows[0]["JobRefNo"]); string mastType = SafeValue.SafeString(tab.Rows[0]["MastType"]); if (mastType.Length > 0 && mastRefNo.Length > 0) { string sql_ref = ""; string sql_job = ""; if (mastType == "SI") { filter_ImpExpInd = "SI"; sql_ref = string.Format("select Pol,Pod,JobType from SeaImportRef where RefNo='{0}'", mastRefNo); sql_job = string.Format("Select CustomerId,round(case when Weight/1000>volume then Weight/1000 else Volume end,3) as Qty FROM SeaImport where RefNo='{0}' and JobNo='{1}'", mastRefNo, jobRefNo); } else if (mastType == "SE") { filter_ImpExpInd = "SE"; sql_ref = string.Format("select Pol,Pod,JobType from SeaExportRef where RefNo='{0}'", mastRefNo); sql_job = string.Format("Select CustomerId,round(case when Weight/1000>volume then Weight/1000 else Volume end,3) as Qty FROM SeaExport where RefNo='{0}' and JobNo='{1}'", mastRefNo, jobRefNo); } //else if (mastType == "AI") //{ // filter_ImpExpInd = "AI"; // filter_FclLclInd = ""; // qty = SafeValue.SafeDecimal(C2.Manager.ORManager.ExecuteScalar(string.Format("Select round(case when Weight/1000>volume then Weight/1000 else Volume end,3) FROM air_job where RefNo='{0}' and JobNo='{1}'", mastRefNo, jobRefNo))); //} //else if (mastType == "AE"||mastType=="ACT") //{ // filter_ImpExpInd = "AE"; // filter_FclLclInd = ""; // qty = SafeValue.SafeDecimal(C2.Manager.ORManager.ExecuteScalar(string.Format("Select round(case when Weight/1000>volume then Weight/1000 else Volume end,3) FROM air_job where RefNo='{0}' and JobNo='{1}'", mastRefNo, jobRefNo))); //} //else if (mastType == "TPT") //{ // filter_ImpExpInd = "TPT"; // filter_FclLclInd = ""; // qty = SafeValue.SafeDecimal(C2.Manager.ORManager.ExecuteScalar(string.Format("Select round(case when wt/1000>m3 then wt/1000 else m3 end,3) FROM tpt_Job where JobNo='{0}'", mastRefNo))); //} if (sql_ref.Length > 0 && sql_job.Length > 0) { DataTable mast = ConnectSql.GetTab(sql_ref); DataTable det = ConnectSql.GetTab(sql_job); string pol = ""; string pod = ""; string partyTo = ""; if (mast.Rows.Count == 1) { pol = SafeValue.SafeString(mast.Rows[0]["Pol"]); pod = SafeValue.SafeString(mast.Rows[0]["Pod"]); filter_FclLclInd = SafeValue.SafeString(mast.Rows[0]["JobType"]); if (filter_FclLclInd == "CONSOL") { filter_FclLclInd = "Lcl"; } } if (det.Rows.Count == 1) { qty = SafeValue.SafeInt(det.Rows[0]["Qty"], 0); partyTo = SafeValue.SafeString(det.Rows[0]["CustomerId"]); } if (qty == 0) { qty = 1; } sql = string.Format(@"select Sequenceid, case when unit='set' or unit='SHPT' then 1 else (case when {4}*price> amt then {4} else 1 end) end as qty ,case when unit='set' or unit='SHPT' then (case when price> amt then Price else amt end) else (case when {4}*price> amt then Price else amt end) end as PRICE ,ChgCode,Currency,GstType,ExRate from seaquotedet1 where QuoteId='-1' and FclLclInd='{3}' and (isnull(PartyTo,'')='{0}' or isnull(PartyTo,'')='') and (isnull(Pol,'')='{1}' or isnull(Pol,'')='') and (isnull(Pod,'')='{2}' or isnull(Pod,'')='') and ImpExpInd='{5}'", partyTo, pol, pod, filter_FclLclInd, qty, filter_ImpExpInd); DataTable tab1 = ConnectSql.GetTab(sql); this.ASPxGridView1.DataSource = tab1; this.ASPxGridView1.DataBind(); } } } } } }
protected void grid_Price_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { e.Values["Id"] = SafeValue.SafeString(e.Values["Id"]); }
public void Attachment_Add(string info) { JObject job = (JObject)JsonConvert.DeserializeObject(HttpUtility.UrlDecode(Server.UrlDecode(info))); List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>(); ConnectSql_mb.cmdParameters cpar = null; string status = "0"; string context = Common.StringToJson(""); string sql = string.Format(@"insert into CTM_Attachment (JobType,RefNo,ContainerNo,TripId,FileType,FileName,FilePath,CreateBy,CreateDateTime,FileNote) values (@JobType,@RefNo,@ContainerNo,@TripId,@FileType,@FileName,@FilePath,@CreateBy,Getdate(),@FileNote) select @@Identity"); string fileStart = System.Configuration.ConfigurationManager.AppSettings["MobileServerUrl"].ToString(); if (fileStart == null) { fileStart = ""; } string fileEnd = job["FilePath"].ToString(); fileEnd = fileEnd.Substring(0, fileEnd.LastIndexOf('/')) + "/500/" + fileEnd.Substring(fileEnd.LastIndexOf('/') + 1); fileEnd = fileStart + fileEnd; cpar = new ConnectSql_mb.cmdParameters("@JobType", "CTM", SqlDbType.NVarChar, 100); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@RefNo", job["JobNo"], SqlDbType.NVarChar, 100); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@ContainerNo", job["ContainerNo"], SqlDbType.NVarChar, 100); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@TripId", job["TripId"], SqlDbType.NVarChar, 100); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@FileType", job["FileType"], SqlDbType.NVarChar, 100); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@FileName", job["FileName"], SqlDbType.NVarChar, 100); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@FilePath", fileEnd, SqlDbType.NVarChar, 100); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@CreateBy", job["CreateBy"], SqlDbType.NVarChar, 100); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@FileNote", job["FileNote"], SqlDbType.NVarChar, 100); list.Add(cpar); ConnectSql_mb.sqlResult result = ConnectSql_mb.ExecuteScalar(sql, list); if (result.status) { status = "1"; //===========log C2.CtmJobEventLog lg = new C2.CtmJobEventLog(); lg.Platform_isMobile(); lg.Controller = SafeValue.SafeString(job["user"]); lg.Lat = SafeValue.SafeString(job["Lat"]); lg.Lng = SafeValue.SafeString(job["Lng"]); //lg.fixActionInfo_ByAttachmentId(SafeValue.SafeInt(result.context, 0)); //lg.Remark = "Attachment upload file:" + job["FileName"]; lg.setActionLevel(SafeValue.SafeInt(result.context, 0), CtmJobEventLogRemark.Level.Attachment, 1, ":" + job["FileType"] + "[" + job["FileName"] + "]"); lg.log(); } Common.WriteJsonP(status, context); }
protected void ASPxGridView1_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e) { if (Request.QueryString["partyTo"] != null && Request.QueryString["no"] != null) { string payId = Request.QueryString["no"].ToString(); for (int i = 0; i < list.Count; i++) { try { int docId = list[i].docId; decimal payAmt = list[i].payAmt; string sql = string.Format("SELECT SequenceId,DocAmt,LocAmt,BalanceAmt,AcCode, AcSource, DocType,DocNo,DocDate,SupplierBillNo,SupplierBillDate,PartyTo, CurrencyId, ExRate FROM XAApPayable where SequenceId='{0}'", docId); DataTable tab = C2.Manager.ORManager.GetDataSet(sql).Tables[0]; if (tab.Rows.Count == 1) { string docNo = tab.Rows[0]["DocNo"].ToString(); string docType = tab.Rows[0]["DocType"].ToString(); string acCode = tab.Rows[0]["AcCode"].ToString(); string acSource = tab.Rows[0]["AcSource"].ToString(); string currency = tab.Rows[0]["CurrencyId"].ToString(); decimal exRate = SafeValue.SafeDecimal(tab.Rows[0]["ExRate"], 0); DateTime docDate = SafeValue.SafeDate(tab.Rows[0]["DocDate"], DateTime.Now); string partyTo = tab.Rows[0]["PartyTo"].ToString(); string supplierBillNo = tab.Rows[0]["SupplierBillNo"].ToString(); DateTime supplierBillDate = SafeValue.SafeDate(tab.Rows[0]["SupplierBillDate"], DateTime.Now); string oid = tab.Rows[0]["SequenceId"].ToString(); decimal billDocAmt = SafeValue.SafeDecimal(tab.Rows[0]["DocAmt"], 0); decimal billBalaceAmt = SafeValue.SafeDecimal(tab.Rows[0]["BalanceAmt"], 0); decimal billLocAmt = SafeValue.SafeDecimal(tab.Rows[0]["LocAmt"], 0); C2.XAApPaymentDet repDet = new XAApPaymentDet(); repDet.AcCode = acCode; if (acSource == "CR") { repDet.AcSource = "DB"; } else { repDet.AcSource = "CR"; } repDet.Currency = currency; repDet.DocAmt = payAmt; repDet.DocDate = docDate; repDet.DocId = docId; repDet.DocNo = docNo; repDet.DocType = docType; repDet.ExRate = exRate; if (exRate == 1) { repDet.LocAmt = SafeValue.ChinaRound(payAmt * exRate, 2); } else { if (payAmt == billDocAmt)// full payment { repDet.LocAmt = billLocAmt; } else if (payAmt == billBalaceAmt)//pay all outstanding amt { repDet.LocAmt = billLocAmt - PayLocAmt(oid); } else { repDet.LocAmt = SafeValue.ChinaRound(payAmt * exRate, 2);//partal payment } } repDet.PayLineNo = SafeValue.SafeInt(C2.Manager.ORManager.ExecuteScalar("select count(*) from XAApPaymentDet where PayId='" + payId + "'"), 0) + 1; repDet.PayId = SafeValue.SafeInt(payId, 0); repDet.PayNo = ""; repDet.PayType = ""; repDet.Remark1 = "Payment for SI-" + supplierBillNo; repDet.Remark2 = "Payment made for AcCode -" + acCode; repDet.Remark3 = " "; C2.Manager.ORManager.StartTracking(repDet, Wilson.ORMapper.InitialState.Inserted); C2.Manager.ORManager.PersistChanges(repDet); //update to doc int res = UpdateBalance(docId, docType); } } catch { } } } else { e.Result = "The amount must be match with the receipt amount!"; } }
protected void btn_search_Click(object sender, EventArgs e) { string From = txt_search_dateFrom.Date.ToString("yyyyMMdd"); string To = txt_search_dateTo.Date.AddDays(1).ToString("yyyyMMdd"); string ContNo = txt_search_ContNo.Text; //bool ContStatus_N = cb_ContStatus1.Checked; //bool ContStatus_I = cb_ContStatus2.Checked; //bool ContStatus_CL = cb_ContStatus3.Checked; //bool ContStatus_R = cb_ContStatus4.Checked; //bool ContStatus_E = cb_ContStatus5.Checked; //bool ContStatus_C = cb_ContStatus6.Checked; //bool ContStatus_UnC = cb_ContStatus7.Checked; bool cs_New = cb_cs_New.Checked; bool cs_Completed = cb_cs_Completed.Checked; bool cs_Uncomplete = false;// cb_cs_Uncomplete.Checked; bool cs_Import = cb_cs_Import.Checked; bool cs_Return = cb_cs_Return.Checked; bool cs_Collection = cb_cs_Collection.Checked; bool cs_Export = cb_cs_Export.Checked; bool cs_WHSMT = cb_cs_WHSMT.Checked; bool cs_WHSLD = cb_cs_WHSLD.Checked; bool cs_CustomerMT = cb_cs_CustomerMT.Checked; bool cs_CustomerLD = cb_cs_CustomerLD.Checked; string JobNo = txt_search_jobNo.Text; string JobType = search_JobType.Text; string Vessel = txt_Vessel.Text; string Client = btn_ClientId.Text; string NextTrip = SafeValue.SafeString(search_NextTrip.Value); string subContract = SafeValue.SafeString(cbb_subContract.Value, "ALL"); //string ClientName = info["ClientName"].ToString(); List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>(); list.Add(new ConnectSql_mb.cmdParameters("@DateFrom", From, SqlDbType.NVarChar, 8)); list.Add(new ConnectSql_mb.cmdParameters("@DateTo", To, SqlDbType.NVarChar, 8)); list.Add(new ConnectSql_mb.cmdParameters("@ContNo", "%" + ContNo, SqlDbType.NVarChar, 100)); list.Add(new ConnectSql_mb.cmdParameters("@JobNo", "%" + JobNo + "%", SqlDbType.NVarChar, 100)); list.Add(new ConnectSql_mb.cmdParameters("@JobType", JobType, SqlDbType.NVarChar, 10)); list.Add(new ConnectSql_mb.cmdParameters("@Vessel", Vessel, SqlDbType.NVarChar, 100)); list.Add(new ConnectSql_mb.cmdParameters("@Client", Client, SqlDbType.NVarChar, 100)); list.Add(new ConnectSql_mb.cmdParameters("@NextTrip", NextTrip, SqlDbType.NVarChar, 10)); list.Add(new ConnectSql_mb.cmdParameters("@subContract", subContract, SqlDbType.NVarChar, 10)); string sql = string.Format(@"select job.Id,det1.Id as ContId,job.JobNo,job.StatusCode as JobStatus,job.JobDate,det1.YardAddress as Depot,job.ClientRefNo, job.PermitNo,job.Remark,job.SpecialInstruction,det1.ContainerNo,det1.SealNo,det1.ContainerType,job.EtaDate,job.EtaTime,job.EtdDate, det1.UrgentInd,job.OperatorCode,job.CarrierBkgNo,det1.oogInd,det1.CfsStatus,det1.DischargeCell,IsTrucking,IsWarehouse, job.Pol,job.Pod,job.Vessel,job.Voyage,job.PickupFrom,job.DeliveryTo,det1.ScheduleDate,det1.StatusCode ,det1.F5Ind,det1.EmailInd,det1.WarehouseStatus, (select top 1 Code from XXParty where PartyId=job.ClientId) as client,(select top 1 code from XXParty where PartyId=job.HaulierId) as Haulier, job.Terminalcode,job.JobType,det1.PortnetStatus,det1.Permit,job.Contractor,job.ClientContact, (select '<span class='''+det2.Statuscode+'''>'+TripCode+'</span>' from CTM_JobDet2 as det2 where Det1Id=det1.Id for xml path('')) as trips, datediff(hour,isnull((select top 1 convert(nvarchar(8),det2.FromDate,112)+' '+det2.FromTime from ctm_jobdet2 as det2 where det2.Det1Id=det1.Id and (det2.Statuscode='S' or det2.Statuscode='C') order by det2.FromDate,det2.FromTime), convert(nvarchar(8),getdate(),112)+' '+convert(nvarchar(5),getdate(),114)), case when det1.StatusCode='Completed' then isnull((select top 1 convert(nvarchar(8),det2.ToDate,112)+' '+det2.ToTime from ctm_jobdet2 as det2 where det2.Det1Id=det1.Id and det2.Statuscode='C' order by det2.ToDate desc,det2.ToTime desc), convert(nvarchar(8),getdate(),112)+' '+convert(nvarchar(5),getdate(),114)) else getdate() end) as hr, isnull((select ','+det2.Statuscode+':'+TripCode from CTM_JobDet2 as det2 where Det1Id=det1.Id for xml path('')),'')+',' as str_trips, isnull((select top 1 det2.Statuscode+':'+TripCode from CTM_JobDet2 as det2 where det2.Det1Id=det1.Id order by det2.Id desc),'') as curTrip from CTM_Job as job left outer join CTM_JobDet1 as det1 on job.JobNo=det1.JobNo"); string sql_where = ""; if (ContNo.Length > 0) { sql_where = GetWhere(sql_where, "det1.ContainerNo like @ContNo"); } if (JobNo.Length > 0) { sql_where = GetWhere(sql_where, "job.JobNo like @JobNo"); } string sql_part1 = string.Format(@"select *,(case JobType when 'IMP' then (case when StatusCode='New' then 'IMP' when StatusCode='Import' and curTrip<>'C:IMP' then 'IMP' when StatusCode='WHS-MT' then 'RET' when StatusCode='Return' and curTrip<>'C:RET' then 'RET' else '' end) when 'EXP' then (case when StatusCode='New' then 'COL' when StatusCode='Collection' and curTrip<>'C:COL'then 'COL' when StatusCode='WHS-LD' then 'EXP' when StatusCode='Export' and curTrip<>'C:EXP' then 'EXP' else '' end) else '' end) as NextTrip from("); string sql_part2 = string.Format(@") as temp"); if (sql_where.Equals("")) { //sql_where = " datediff(d,@DateFrom,det1.ScheduleDate)>=0 and datediff(d,@DateTo,det1.ScheduleDate)<=0"; sql_where = " @DateFrom<=det1.ScheduleDate and @DateTo>det1.ScheduleDate"; if (!cs_Uncomplete) { string sql_where_ContStatus = ""; if (cs_New) { sql_where_ContStatus += (sql_where_ContStatus.Equals("") ? "" : " or ") + "det1.StatusCode='New'"; } if (cs_Completed) { sql_where_ContStatus += (sql_where_ContStatus.Equals("") ? "" : " or ") + "det1.StatusCode='Completed'"; } if (cs_Import) { sql_where_ContStatus += (sql_where_ContStatus.Equals("") ? "" : " or ") + "det1.StatusCode='Import'"; } if (cs_Return) { sql_where_ContStatus += (sql_where_ContStatus.Equals("") ? "" : " or ") + "det1.StatusCode='Return'"; } if (cs_Collection) { sql_where_ContStatus += (sql_where_ContStatus.Equals("") ? "" : " or ") + "det1.StatusCode='Collection'"; } if (cs_Export) { sql_where_ContStatus += (sql_where_ContStatus.Equals("") ? "" : " or ") + "det1.StatusCode='Export'"; } //================== warhouse if (cs_WHSMT) { sql_where_ContStatus += (sql_where_ContStatus.Equals("") ? "" : " or ") + "det1.StatusCode='WHS-MT'"; } if (cs_WHSLD) { sql_where_ContStatus += (sql_where_ContStatus.Equals("") ? "" : " or ") + "det1.StatusCode='WHS-LD'"; } if (cs_CustomerMT) { sql_where_ContStatus += (sql_where_ContStatus.Equals("") ? "" : " or ") + "det1.StatusCode='Customer-MT'"; } if (cs_CustomerLD) { sql_where_ContStatus += (sql_where_ContStatus.Equals("") ? "" : " or ") + "det1.StatusCode='Customer-LD'"; } //=================== if (!sql_where_ContStatus.Equals("")) { sql_where = GetWhere(sql_where, "(" + sql_where_ContStatus + ")"); } } if (Vessel.Length > 0) { sql_where = GetWhere(sql_where, "job.Vessel=@Vessel"); } if (JobType.Length > 0 && !JobType.Equals("ALL")) { sql_where = GetWhere(sql_where, "job.JobType=@JobType"); } if (Client.Length > 0) { sql_where = GetWhere(sql_where, "job.clientId=@Client"); } if (subContract.Length > 0 && subContract != "ALL") { sql_where = GetWhere(sql_where, "job.Contractor=@subContract"); } sql = sql_part1 + sql + " where job.JobType in ('IMP','EXP','LOC') and " + sql_where + sql_part2; if (NextTrip.Length > 0 && !NextTrip.Equals("ALL")) { sql = "select * from (" + sql + ") as temp where NextTrip=@NextTrip order by EtaDate,JobNo,Id,StatusCode desc, JobDate asc"; } else { if (cs_Uncomplete) { sql = "select * from (" + sql + ") as temp where StatusCode<>'Completed' and ((JobType='IMP' and CHARINDEX(',C:RET,',str_trips)>0) or (JobType='EXP' and CHARINDEX(',C:EXP,',str_trips)>0)) order by EtaDate,JobNo,Id,StatusCode desc, JobDate asc"; } else { sql += " order by EtaDate,JobNo,Id,StatusCode desc, JobDate asc"; } } } else { sql = sql_part1 + sql + " where job.JobType in ('IMP','EXP','LOC') and " + sql_where + sql_part2; sql += " order by EtaDate,JobNo,Id,StatusCode desc, JobDate asc"; } DataTable dt = ConnectSql_mb.GetDataTable(sql, list); //throw new Exception(sql.ToString()); this.grid_Transport.DataSource = dt; this.grid_Transport.DataBind(); }
public void Crane_ChangeStatus(string info) { JObject job = (JObject)JsonConvert.DeserializeObject(HttpUtility.UrlDecode(Server.UrlDecode(info))); List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>(); ConnectSql_mb.cmdParameters cpar = null; string status = "1"; string context = Common.StringToJson(""); string sql1 = ""; string sql = ""; string Statuscode = job["Statuscode"].ToString(); string ByUser = job["ByUser"].ToString(); if (Statuscode.Equals("S")) { sql = string.Format(@"select DoubleMounting,DriverCode from CTM_JobDet2 where Id=@Id"); list = new List <ConnectSql_mb.cmdParameters>(); cpar = new ConnectSql_mb.cmdParameters("@Id", job["Id"], SqlDbType.Int); list.Add(cpar); DataTable dt = ConnectSql_mb.GetDataTable(sql, list); string dbMounting = ""; string DriverCode = ""; if (dt.Rows.Count > 0) { dbMounting = SafeValue.SafeString(dt.Rows[0]["DoubleMounting"], ""); DriverCode = SafeValue.SafeString(dt.Rows[0]["DriverCode"], ""); } sql = string.Format(@"select Id,DoubleMounting from ctm_jobdet2 where Statuscode='S' and DriverCode=@DriverCode"); list = new List <ConnectSql_mb.cmdParameters>(); list.Add(new ConnectSql_mb.cmdParameters("@DriverCode", DriverCode, SqlDbType.NVarChar, 100)); dt = ConnectSql_mb.GetDataTable(sql, list); if (dt.Rows.Count > 0) { status = "0"; context = Common.StringToJson("Please end the other trip, then start this!"); } } //if (Statuscode.Equals("C")) //{ // sql = string.Format(@"select isnull(sum(isnull(Qty,1)*isnull(Price,0)),0) as s from job_cost where TripNo=@Id and LineType='DP'"); // list = new List<ConnectSql_mb.cmdParameters>(); // cpar = new ConnectSql_mb.cmdParameters("@Id", job["Id"], SqlDbType.Int); // list.Add(cpar); // if (SafeValue.SafeDecimal(ConnectSql_mb.ExecuteScalar(sql, list).context, 0) == 0) // { // status = "0"; // context = Common.StringToJson("Require Trip Incentive!"); // } //} if (status.Equals("1")) { if (Statuscode.Equals("S")) { sql1 = ",FromDate=@FromDate,FromTime=@FromTime"; } //if (Statuscode.Equals("C")) //{ // sql1 = ",ToDate=@ToDate,ToTime=@ToTime"; //} if (Statuscode.Equals("C")) { sql1 = ",ToDate=@ToDate,ToTime=@ToTime,FromDate=BookingDate,FromTime=BookingTime"; } DateTime dtime = DateTime.Now; string time = dtime.ToString("HH:mm"); sql = string.Format(@"update CTM_JobDet2 set Statuscode=@Statuscode{0} where Id=@Id", sql1); list = new List <ConnectSql_mb.cmdParameters>(); cpar = new ConnectSql_mb.cmdParameters("@Id", job["Id"], SqlDbType.Int); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@Statuscode", Statuscode, SqlDbType.NVarChar, 100); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@FromDate", dtime, SqlDbType.DateTime); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@FromTime", time, SqlDbType.NVarChar, 10); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@ToDate", dtime, SqlDbType.DateTime); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@ToTime", time, SqlDbType.NVarChar, 10); list.Add(cpar); cpar = new ConnectSql_mb.cmdParameters("@ByUser", ByUser, SqlDbType.NVarChar, 20); list.Add(cpar); if (ConnectSql_mb.ExecuteNonQuery(sql, list).status) { status = "1"; //EGL_JobTrip_AfterEndTrip(SafeValue.SafeString(job["Id"], "0")); //===========log C2.CtmJobEventLog lg = new C2.CtmJobEventLog(); lg.Platform_isMobile(); lg.Controller = SafeValue.SafeString(job["user"]); lg.Lat = SafeValue.SafeString(job["Lat"]); lg.Lng = SafeValue.SafeString(job["Lng"]); //lg.ActionLevel_isTRIP(SafeValue.SafeInt(job["Id"], 0)); //lg.Remark = "Trip change status:" + Statuscode; lg.setActionLevel(SafeValue.SafeInt(job["Id"], 0), CtmJobEventLogRemark.Level.Trip, 4, ":" + Statuscode); lg.log(); } else { status = "0"; } } Common.WriteJsonP(status, context); }
private void OnLoad() { int start = 0; // this.ASPxGridView1.PageIndex * ASPxGridView1.SettingsPager.PageSize; int end = 100; // (ASPxGridView1.PageIndex + 1) * ASPxGridView1.SettingsPager.PageSize; for (int i = start; i < end; i++) { ASPxTextBox docId = this.ASPxGridView1.FindRowTemplateControl(i, "txt_docId") as ASPxTextBox; ASPxSpinEdit qty = this.ASPxGridView1.FindRowTemplateControl(i, "spin_Qty") as ASPxSpinEdit; ASPxSpinEdit price = this.ASPxGridView1.FindRowTemplateControl(i, "spin_Price") as ASPxSpinEdit; ASPxSpinEdit exRate = this.ASPxGridView1.FindRowTemplateControl(i, "spin_ExRate") as ASPxSpinEdit; ASPxCheckBox isPay = this.ASPxGridView1.FindRowTemplateControl(i, "ack_IsPay") as ASPxCheckBox; if (docId != null && isPay != null && isPay.Checked && SafeValue.SafeDecimal(qty.Value, 0) > 0) { list.Add(new Record(SafeValue.SafeInt(docId.Text, 0), SafeValue.SafeDecimal(qty.Value, 0), SafeValue.SafeDecimal(price.Value, 0), SafeValue.SafeDecimal(exRate.Value, 0) )); } } }