private void Event_Log(string jobNo, string level, int c, int id, string status) { string userId = HttpContext.Current.User.Identity.Name; C2.CtmJobEventLog elog = new C2.CtmJobEventLog(); elog.Platform_isWeb(); elog.Controller = userId; if (level == "JOB") { elog.ActionLevel_isJOB(id); elog.setActionLevel(id, CtmJobEventLogRemark.Level.Job, c, status); } if (level == "QUOTATION") { elog.ActionLevel_isJOB(id); elog.setActionLevel(id, CtmJobEventLogRemark.Level.Quotation, c, status); } if (level == "CONT") { elog.ActionLevel_isCONT(id); elog.setActionLevel(id, CtmJobEventLogRemark.Level.Container, c, status); } if (level == "TRIP") { elog.ActionLevel_isTRIP(id); elog.setActionLevel(id, CtmJobEventLogRemark.Level.Trip, c, status); } elog.log_edi(); }
public BizResult unVoidJob(string user) { BizResult res = new BizResult(); if (this.job != null && this.job.Id > 0) { this.job.StatusCode = "USE"; this.job.JobStatus = "Confirmed"; Manager.ORManager.StartTracking(this.job, Wilson.ORMapper.InitialState.Updated); Manager.ORManager.PersistChanges(this.job); C2.CtmJobEventLog elog = new C2.CtmJobEventLog(); elog.Platform_isWeb(); elog.Controller = user; elog.ActionLevel_isJOB(this.job.Id); elog.setActionLevel(this.job.Id, CtmJobEventLogRemark.Level.Job, 8); elog.log(); res.status = true; } else { res.context = "error: data empty"; } return(res); }
private void Job_New_Save(DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e) { DateTime date = DateTime.Now; string time4 = date.ToString("HHmm"); string jobType = SafeValue.SafeString(cbb_new_jobtype.Value, "IMP"); string jobStatus = SafeValue.SafeString(cbb_new_jobstatus.Text, "Quoted"); string jobType1 = jobType; string jobno = ""; string user = HttpContext.Current.User.Identity.Name; string quoteNo = ""; string billingType = "None"; if (jobType1 == "TPT") { billingType = "Job"; } if (jobStatus == "Quoted") { quoteNo = C2Setup.GetNextNo("", "CTM_Job_" + jobStatus, date); } else { jobno = C2Setup.GetNextNo("", "CTM_Job_" + jobType1, date); quoteNo = jobno; } string wh = System.Configuration.ConfigurationManager.AppSettings["Warehosue"]; string sql = string.Format(@"insert into CTM_Job (JobNo,JobDate,EtaDate,EtdDate,CodDate,StatusCode,CreateBy,CreateDatetime,UpdateBy,UpdateDatetime,EtaTime,EtdTime,JobType,ClientId,YardRef,PickupFrom,DeliveryTo,Remark,WarehouseAddress,JobStatus,QuoteNo,QuoteStatus,QuoteDate,WareHouseCode,BillingType) values ('{0}','{4}',getdate(),getdate(),getdate(),'USE','{1}',getdate(),'{1}',getdate(),'{2}','{2}','{3}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','Pending',getdate(),'{13}','{14}') select @@identity", jobno, user, time4, cbb_new_jobtype.Value, txt_new_JobDate.Date, btn_new_ClientId.Text, "", txt_FromAddress.Text, txt_ToAddress.Text, txt_new_remark.Text, "", jobStatus, quoteNo, wh, billingType); int jobId = SafeValue.SafeInt(ConnectSql_mb.ExecuteScalar(sql), 0); if (jobId > 0) { string userId = HttpContext.Current.User.Identity.Name; C2.CtmJobEventLog elog = new C2.CtmJobEventLog(); elog.Platform_isWeb(); elog.Controller = userId; if (jobStatus == "Quoted") { elog.setActionLevel(jobId, CtmJobEventLogRemark.Level.Quotation, 1); elog.ActionLevel_isQuoted(jobId); C2Setup.SetNextNo("", "CTM_Job_" + jobStatus, quoteNo, date); //GetJobRate(quoteNo, btn_new_ClientId.Text, SafeValue.SafeString(cbb_new_jobtype.Value)); e.Result = quoteNo; } else { elog.setActionLevel(jobId, CtmJobEventLogRemark.Level.Job, 1); elog.ActionLevel_isJOB(jobId); C2Setup.SetNextNo("", "CTM_Job_" + jobType1, jobno, date); e.Result = jobno; } elog.log(); } }
private void Event_Log(string jobNo, string status, string note) { ASPxLabel Id = this.grid_job.FindEditFormTemplateControl("lb_Id") as ASPxLabel; string userId = HttpContext.Current.User.Identity.Name; int jobId = SafeValue.SafeInt(Id.Text, 0); C2.CtmJobEventLog elog = new C2.CtmJobEventLog(); elog.Platform_isWeb(); elog.Controller = userId; elog.ActionLevel_isJOB(jobId); elog.Remark = note; elog.log(); }
private string Trip_New(string jobType, int tripId) { string no = SafeValue.SafeString(Request.QueryString["no"]); Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.CtmJobDet2), "Id='" + tripId + "'"); C2.CtmJobDet2 trip = C2.Manager.ORManager.GetObject(query) as C2.CtmJobDet2; string sql = string.Format(@"select max(TripIndex) from CTM_JobDet2 where JobType=@JobType and JobNo=@JobNo"); List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>(); list.Add(new ConnectSql_mb.cmdParameters("@JobNo", no, SqlDbType.NVarChar, 100)); list.Add(new ConnectSql_mb.cmdParameters("@JobType", jobType, SqlDbType.NVarChar, 100)); string maxIdex = SafeValue.SafeString(ConnectSql_mb.ExecuteScalar(sql, list).context, "//00"); int n = SafeValue.SafeInt(maxIdex.Substring(maxIdex.LastIndexOf("/") + 1), 0) + 1; string str = (100 + n).ToString().Substring(1); string fromCode = trip.ToCode; string toCode = trip.FromCode; trip.BookingDate = DateTime.Today; trip.TripIndex = no + "/" + jobType + "/" + str; trip.Self_Ind = "No"; trip.JobNo = no; //trip.FromDate = DateTime.Today; //trip.ToDate = DateTime.Today; trip.CreateUser = HttpContext.Current.User.Identity.Name; trip.CreateTime = DateTime.Now; trip.UpdateUser = HttpContext.Current.User.Identity.Name; trip.UpdateTime = DateTime.Now; trip.JobType = jobType; trip.TripCode = jobType; trip.ReturnType = "Y"; trip.ToCode = toCode; trip.FromCode = fromCode; trip.Statuscode = "P"; C2.Manager.ORManager.StartTracking(trip, Wilson.ORMapper.InitialState.Inserted); C2.Manager.ORManager.PersistChanges(trip); string userId = HttpContext.Current.User.Identity.Name; C2.CtmJobEventLog elog = new C2.CtmJobEventLog(); elog.Platform_isWeb(); elog.Controller = userId; elog.ActionLevel_isJOB(trip.Id); elog.setActionLevel(trip.Id, CtmJobEventLogRemark.Level.Trip, 1, ""); return(trip.Id + "_" + trip.TripIndex); }
private string job_void() { ASPxLabel Id = this.grid_job.FindEditFormTemplateControl("lb_Id") as ASPxLabel; string sql = "update CTM_Job set StatusCode=case when StatusCode='CNL' then 'USE' else 'CNL' end where Id=" + Id.Text; if (ConnectSql.ExecuteSql(sql) > 0) { string userId = HttpContext.Current.User.Identity.Name; int jobId = SafeValue.SafeInt(Id.Text, 0); C2.CtmJobEventLog elog = new C2.CtmJobEventLog(); elog.Platform_isWeb(); elog.Controller = userId; elog.ActionLevel_isJOB(jobId); elog.Remark = "Job Void"; elog.log(); return(""); } return("error"); }
private void Job_New_Save(DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e) { DateTime date = DateTime.Now; string time4 = date.ToString("HHmm"); string jobType = SafeValue.SafeString(cbb_new_jobtype.Value, "CONSOL"); string jobStatus = SafeValue.SafeString(cbb_new_jobstatus.Text, "Quoted"); //string jobType1 = "IMP"; //if (jobType.IndexOf("EXP") > -1) //{ // jobType1 = "EXP"; //} string jobType1 = jobType; string jobno = ""; string user = HttpContext.Current.User.Identity.Name; string quoteNo = ""; jobno = C2Setup.GetNextNo("I", "CI", date); string wh = txt_new_WareHouseId.Text;// System.Configuration.ConfigurationManager.AppSettings["Warehosue"]; string sql = string.Format(@"insert into CTM_Job (JobNo,JobDate,EtaDate,EtdDate,CodDate,StatusCode,CreateBy,CreateDatetime,UpdateBy,UpdateDatetime,EtaTime,EtdTime,OrderType,ClientId,YardRef,PickupFrom,DeliveryTo,Remark,WarehouseAddress,JobStatus,QuoteNo,QuoteStatus,QuoteDate,WareHouseCode,IsTrucking,IsWarehouse,JobType) values ('{0}','{4}',getdate(),getdate(),getdate(),'USE','{1}',getdate(),'{1}',getdate(),'{2}','{2}','{3}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','Pending',getdate(),'{13}','Yes','No','I') select @@identity", jobno, user, time4, cbb_new_jobtype.Value, txt_new_JobDate.Date, btn_new_ClientId.Text, txt_DepotAddress.Text, txt_FromAddress.Text, txt_ToAddress.Text, txt_new_remark.Text, txt_WarehouseAddress.Text, jobStatus, quoteNo, wh); int jobId = SafeValue.SafeInt(ConnectSql_mb.ExecuteScalar(sql), 0); if (jobId > 0) { string userId = HttpContext.Current.User.Identity.Name; C2.CtmJobEventLog elog = new C2.CtmJobEventLog(); elog.Platform_isWeb(); elog.Controller = userId; elog.setActionLevel(jobId, CtmJobEventLogRemark.Level.Job, 1); elog.ActionLevel_isJOB(jobId); C2Setup.SetNextNo("I", "CI", jobno, date); e.Result = jobno; elog.log(); } }
public BizResult jobBilling(string user) { BizResult res = new BizResult(); if (this.job != null && this.job.Id > 0) { string sql = string.Format(@"select * from CTM_JobDet2 as det2 left outer join ctm_job as job on det2.JobNo=job.JobNo where job.Id=@jobId and det2.Statuscode<>'C'"); List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>(); list.Add(new ConnectSql_mb.cmdParameters("@jobId", this.job.Id, SqlDbType.Int)); DataTable dt = ConnectSql_mb.GetDataTable(sql, list); if (dt.Rows.Count > 0) { res.context = "Have pending trips need to delivery"; } else { sql = "update CTM_Job set StatusCode='CLS',JobStatus='Completed' where Id=@jobId"; if (ConnectSql_mb.ExecuteNonQuery(sql, list).status) { res.status = true; C2.CtmJobEventLog elog = new C2.CtmJobEventLog(); elog.Platform_isWeb(); elog.Controller = user; elog.ActionLevel_isJOB(this.job.Id); elog.setActionLevel(this.job.Id, CtmJobEventLogRemark.Level.Job, 7); elog.log(); } } } else { res.context = "error: data empty"; } return(res); }
public BizResult voidJob(string user) { BizResult res = new BizResult(); if (this.job != null && this.job.Id > 0) { System.Collections.ObjectModel.Collection <C2.CtmJobDet1> det1 = C2.Manager.ORManager.GetCollection <C2.CtmJobDet1>("JobNo='" + this.job.JobNo + "'"); C2.CtmJobDet1Biz det1Bz = new CtmJobDet1Biz(0); foreach (C2.CtmJobDet1 temp in det1) { det1Bz.setData(temp); det1Bz.delete(user); } this.job.StatusCode = "CNL"; this.job.JobStatus = "Voided"; Manager.ORManager.StartTracking(this.job, Wilson.ORMapper.InitialState.Updated); Manager.ORManager.PersistChanges(this.job); C2.CtmJobEventLog elog = new C2.CtmJobEventLog(); elog.Platform_isWeb(); elog.Controller = user; elog.ActionLevel_isJOB(this.job.Id); elog.setActionLevel(this.job.Id, CtmJobEventLogRemark.Level.Job, 5); elog.log(); res.status = true; } else { res.context = "error: data empty"; } return(res); }
private void Job_New_Save(DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e) { DateTime date = DateTime.Now; string time4 = date.ToString("HHmm"); string jobType = SafeValue.SafeString(cbb_new_jobtype.Value, "IMP"); string jobStatus = SafeValue.SafeString(cbb_new_jobstatus.Text, "Quoted"); //string jobType1 = "IMP"; //if (jobType.IndexOf("EXP") > -1) //{ // jobType1 = "EXP"; //} string jobType1 = jobType; string isTrucking = SafeValue.SafeString(cmb_IsTrucking.Value); string isWarehouse = SafeValue.SafeString(cmb_IsWarehouse.Value); string subContract = SafeValue.SafeString(cbb_Contractor.Value); string warehouseCode = SafeValue.SafeString(txt_new_WareHouseId.Text); string jobno = ""; string user = HttpContext.Current.User.Identity.Name; string quoteNo = ""; string quoteStatus = "Pending"; if (jobStatus == "Quoted") { quoteNo = C2Setup.GetNextNo("", "CTM_Job_" + jobStatus, date); } else { quoteStatus = "None"; jobno = C2Setup.GetNextNo("", "CTM_Job_" + jobType1, date); quoteNo = jobno; } string sql = string.Format(@"insert into CTM_Job (JobNo,JobDate,EtaDate,EtdDate,CodDate,StatusCode,CreateBy,CreateDatetime,UpdateBy,UpdateDatetime,EtaTime,EtdTime,JobType,ClientId,YardRef,PickupFrom,DeliveryTo,Remark,WarehouseAddress,JobStatus,QuoteNo,QuoteStatus,QuoteDate,WareHouseCode,IsTrucking,IsWarehouse,Contractor) values ('{0}','{4}',getdate(),getdate(),getdate(),'USE','{1}',getdate(),'{1}',getdate(),'{2}','{2}','{3}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{14}',getdate(),'{13}','{15}','{16}','{17}') select @@identity", jobno, user, time4, cbb_new_jobtype.Value, txt_new_JobDate.Date, btn_new_ClientId.Text, txt_DepotAddress.Text, txt_FromAddress.Text, txt_ToAddress.Text, txt_new_remark.Text, txt_WarehouseAddress.Text, jobStatus, quoteNo, warehouseCode, quoteStatus, isTrucking, isWarehouse, subContract); int jobId = SafeValue.SafeInt(ConnectSql_mb.ExecuteScalar(sql), 0); if (jobId > 0) { string userId = HttpContext.Current.User.Identity.Name; C2.CtmJobEventLog elog = new C2.CtmJobEventLog(); elog.Platform_isWeb(); elog.Controller = userId; if (jobStatus == "Quoted") { elog.setActionLevel(jobId, CtmJobEventLogRemark.Level.Quotation, 1); elog.ActionLevel_isQuoted(jobId); C2Setup.SetNextNo("", "CTM_Job_" + jobStatus, quoteNo, date); //GetJobRate(quoteNo, btn_new_ClientId.Text, SafeValue.SafeString(cbb_new_jobtype.Value)); e.Result = quoteNo; } else { elog.setActionLevel(jobId, CtmJobEventLogRemark.Level.Job, 1); elog.ActionLevel_isJOB(jobId); C2Setup.SetNextNo("", "CTM_Job_" + jobType1, jobno, date); e.Result = jobno; } elog.log(); sql = string.Format(@"update CTM_Job set JobNo={0} where Id={0}", jobId); ConnectSql.ExecuteSql(sql); } }
private void Job_New_Save(DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e) { DateTime date = DateTime.Now; string time4 = date.ToString("HHmm"); string jobType = SafeValue.SafeString(cbb_new_jobtype.Value, "IMP"); string jobStatus = SafeValue.SafeString(cbb_new_jobstatus.Text, "Quoted"); //string jobType1 = "IMP"; //if (jobType.IndexOf("EXP") > -1) //{ // jobType1 = "EXP"; //} string jobType1 = jobType; string isTrucking = SafeValue.SafeString(cmb_IsTrucking.Value); string isWarehouse = SafeValue.SafeString(cmb_IsWarehouse.Value); string subContract = SafeValue.SafeString(cbb_Contractor.Value); subContract = (subContract == "YES" ? "YES" : "NO"); string warehouseCode = SafeValue.SafeString(txt_new_WareHouseId.Text); string jobno = ""; string user = HttpContext.Current.User.Identity.Name; string quoteNo = ""; string quoteStatus = "Pending"; if (jobStatus == "Quoted") { quoteNo = C2Setup.GetNextNo("", "CTM_Job_" + jobStatus, date); } else { quoteStatus = "None"; jobno = C2Setup.GetNextNo("", "CTM_Job_" + jobType1, date); quoteNo = jobno; } DateTime now = DateTime.Now; string sql = string.Format(@"insert into CTM_Job (JobNo,JobDate,EtaDate,EtdDate,CodDate,StatusCode,CreateBy,CreateDatetime,UpdateBy,UpdateDatetime,EtaTime,EtdTime,JobType,ClientId,YardRef,PickupFrom,DeliveryTo,Remark,WarehouseAddress,JobStatus,QuoteNo,QuoteStatus,QuoteDate,WareHouseCode,IsTrucking,IsWarehouse,Contractor,DepotCode) values (@JobNo,@JobDate,@EtaDate,@EtdDate,@CodDate,@StatusCode,@CreateBy,@CreateDatetime,@UpdateBy,@UpdateDatetime,@EtaTime,@EtdTime,@JobType,@ClientId,@YardRef,@PickupFrom,@DeliveryTo,@Remark,@WarehouseAddress,@JobStatus,@QuoteNo,@QuoteStatus,@QuoteDate,@WareHouseCode,@IsTrucking,@IsWarehouse,@Contractor,@DepotCode) select @@identity"); if (jobType1 == "WGR" || jobType1 == "WDO" || jobType1 == "TPT") { sql = string.Format(@"insert into CTM_Job (JobNo,JobDate,EtaDate,EtdDate,CodDate,StatusCode,CreateBy,CreateDatetime,UpdateBy,UpdateDatetime,EtaTime,EtdTime,JobType,ClientId,YardRef,PickupFrom,DeliveryTo,SpecialInstruction,WarehouseAddress,JobStatus,QuoteNo,QuoteStatus,QuoteDate,WareHouseCode,IsTrucking,IsWarehouse,Contractor,DepotCode) values (@JobNo,@JobDate,@EtaDate,@EtdDate,@CodDate,@StatusCode,@CreateBy,@CreateDatetime,@UpdateBy,@UpdateDatetime,@EtaTime,@EtdTime,@JobType,@ClientId,@YardRef,@PickupFrom,@DeliveryTo,@SpecialInstruction,@WarehouseAddress,@JobStatus,@QuoteNo,@QuoteStatus,@QuoteDate,@WareHouseCode,@IsTrucking,@IsWarehouse,@Contractor,@DepotCode) select @@identity"); } List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>(); list.Add(new ConnectSql_mb.cmdParameters("@JobNo", jobno, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@JobDate", txt_new_JobDate.Date, SqlDbType.DateTime)); list.Add(new ConnectSql_mb.cmdParameters("@EtaDate", now, SqlDbType.DateTime)); list.Add(new ConnectSql_mb.cmdParameters("@EtdDate", now, SqlDbType.DateTime)); list.Add(new ConnectSql_mb.cmdParameters("@CodDate", now, SqlDbType.DateTime)); list.Add(new ConnectSql_mb.cmdParameters("@StatusCode", "USE", SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@CreateBy", user, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@CreateDatetime", now, SqlDbType.DateTime)); list.Add(new ConnectSql_mb.cmdParameters("@UpdateBy", user, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@UpdateDatetime", now, SqlDbType.DateTime)); list.Add(new ConnectSql_mb.cmdParameters("@EtaTime", time4, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@EtdTime", time4, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@JobType", cbb_new_jobtype.Value, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@ClientId", btn_new_ClientId.Text, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@YardRef", txt_DepotAddress.Text, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@PickupFrom", txt_FromAddress.Text, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@DeliveryTo", txt_ToAddress.Text, SqlDbType.NVarChar)); if (jobType1 == "WGR" || jobType1 == "WDO" || jobType1 == "TPT") { list.Add(new ConnectSql_mb.cmdParameters("@SpecialInstruction", txt_new_remark.Text, SqlDbType.NVarChar)); } else { list.Add(new ConnectSql_mb.cmdParameters("@Remark", txt_new_remark.Text, SqlDbType.NVarChar)); } list.Add(new ConnectSql_mb.cmdParameters("@WarehouseAddress", txt_WarehouseAddress.Text, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@JobStatus", jobStatus, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@QuoteNo", quoteNo, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@QuoteStatus", quoteStatus, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@QuoteDate", now, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@WareHouseCode", warehouseCode, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@IsTrucking", isTrucking, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@IsWarehouse", isWarehouse, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@Contractor", cbb_Contractor.Value, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@DepotCode", btn_DepotCode.Text, SqlDbType.NVarChar)); ConnectSql_mb.sqlResult res = ConnectSql_mb.ExecuteScalar(sql, list); if (res.status) { int jobId = SafeValue.SafeInt(res.context, 0); string userId = HttpContext.Current.User.Identity.Name; C2.CtmJobEventLog elog = new C2.CtmJobEventLog(); elog.Platform_isWeb(); elog.Controller = userId; if (jobStatus == "Quoted") { elog.setActionLevel(jobId, CtmJobEventLogRemark.Level.Quotation, 1); elog.ActionLevel_isQuoted(jobId); C2Setup.SetNextNo("", "CTM_Job_" + jobStatus, quoteNo, date); auto_add_trailer_trip(quoteNo, jobType1); //GetJobRate(quoteNo, btn_new_ClientId.Text, SafeValue.SafeString(cbb_new_jobtype.Value)); e.Result = quoteNo; } else { elog.setActionLevel(jobId, CtmJobEventLogRemark.Level.Job, 1); elog.ActionLevel_isJOB(jobId); C2Setup.SetNextNo("", "CTM_Job_" + jobType1, jobno, date); auto_add_trailer_trip(jobno, jobType1); e.Result = jobno; } elog.log(); } }
private void Job_New_Save(DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e) { DateTime date = DateTime.Now; string time4 = date.ToString("HHmm"); string jobType = SafeValue.SafeString(cbb_new_jobtype.Value, "IMP"); string jobStatus = SafeValue.SafeString(cbb_new_jobstatus.Text, "Quoted"); //string jobType1 = "IMP"; //if (jobType.IndexOf("EXP") > -1) //{ // jobType1 = "EXP"; //} string jobType1 = jobType; string isTrucking = "No"; if (cb_Trucking.Checked) { isTrucking = "Yes"; } string isWarehouse = "No"; if (cb_Warehouse.Checked) { isWarehouse = "Yes"; } string isTransport = "No"; if (cb_Transport.Checked) { isTransport = "Yes"; } string isCrane = "No"; if (cb_Crane.Checked) { isCrane = "Yes"; } if (jobType == "IMP" || jobType == "EXP" || jobType == "LOC") { isTrucking = "Yes"; } else if (jobType == "WGR" || jobType == "WDO" || jobType == "TPT") { isTransport = "Yes"; } else if (jobType == "CRA") { isCrane = "Yes"; } string warehouseCode = SafeValue.SafeString(txt_new_WareHouseId.Text); string jobno = ""; string user = HttpContext.Current.User.Identity.Name; string quoteNo = ""; string quoteStatus = "Pending"; if (jobStatus == "Quoted") { quoteNo = C2Setup.GetNextNo("", "CTM_Job_" + jobStatus, txt_new_JobDate.Date); } else { quoteStatus = "None"; jobno = C2Setup.GetNextNo("", "CTM_Job_" + jobType1, txt_new_JobDate.Date); quoteNo = jobno; } DateTime now = DateTime.Now; string sql = string.Format(@"insert into CTM_Job (JobNo,JobDate,EtaDate,CodDate,StatusCode,CreateBy,CreateDatetime,UpdateBy,UpdateDatetime,EtaTime,EtdTime,JobType,JobStatus,QuoteNo,QuoteStatus,QuoteDate,WareHouseCode,IsTrucking,IsWarehouse,IsLocal,IsAdhoc) values (@JobNo,@JobDate,@EtaDate,@CodDate,@StatusCode,@CreateBy,@CreateDatetime,@UpdateBy,@UpdateDatetime,@EtaTime,@EtdTime,@JobType,@JobStatus,@QuoteNo,@QuoteStatus,@QuoteDate,@WareHouseCode,@IsTrucking,@IsWarehouse,@IsLocal,@IsAdhoc) select @@identity"); List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>(); list.Add(new ConnectSql_mb.cmdParameters("@JobNo", jobno, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@JobDate", txt_new_JobDate.Date, SqlDbType.DateTime)); list.Add(new ConnectSql_mb.cmdParameters("@EtaDate", now, SqlDbType.DateTime)); list.Add(new ConnectSql_mb.cmdParameters("@CodDate", now, SqlDbType.DateTime)); list.Add(new ConnectSql_mb.cmdParameters("@StatusCode", "USE", SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@CreateBy", user, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@CreateDatetime", now, SqlDbType.DateTime)); list.Add(new ConnectSql_mb.cmdParameters("@UpdateBy", user, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@UpdateDatetime", now, SqlDbType.DateTime)); list.Add(new ConnectSql_mb.cmdParameters("@EtaTime", time4, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@EtdTime", time4, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@JobType", cbb_new_jobtype.Value, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@JobStatus", jobStatus, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@QuoteNo", quoteNo, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@QuoteStatus", quoteStatus, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@QuoteDate", now, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@WareHouseCode", warehouseCode, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@IsTrucking", isTrucking, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@IsWarehouse", isWarehouse, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@IsLocal", isTransport, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@IsAdhoc", isCrane, SqlDbType.NVarChar)); ConnectSql_mb.sqlResult res = ConnectSql_mb.ExecuteScalar(sql, list); if (res.status) { int jobId = SafeValue.SafeInt(res.context, 0); string userId = HttpContext.Current.User.Identity.Name; C2.CtmJobEventLog elog = new C2.CtmJobEventLog(); elog.Platform_isWeb(); elog.Controller = userId; if (jobStatus == "Quoted") { elog.setActionLevel(jobId, CtmJobEventLogRemark.Level.Quotation, 1); elog.ActionLevel_isQuoted(jobId); C2Setup.SetNextNo("", "CTM_Job_" + jobStatus, quoteNo, date); //GetJobRate(quoteNo, btn_new_ClientId.Text, SafeValue.SafeString(cbb_new_jobtype.Value)); e.Result = quoteNo; } else { elog.setActionLevel(jobId, CtmJobEventLogRemark.Level.Job, 1); elog.ActionLevel_isJOB(jobId); C2Setup.SetNextNo("", "CTM_Job_" + jobType1, jobno, date); e.Result = jobno; } elog.log(); sql = string.Format(@"update CTM_Job set JobNo={0} where Id={0}", jobId); ConnectSql.ExecuteSql(sql); } }
private string job_save() { string res = ""; try { ASPxPageControl pageControl = this.grid_job.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox txt_JobNo = this.grid_job.FindEditFormTemplateControl("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 = this.grid_job.FindEditFormTemplateControl("txt_JobDate") as ASPxDateEdit; bool isNew = false; if (ctmJob == null) { isNew = true; ctmJob = new C2.CtmJob(); ctmJob.JobNo = C2Setup.GetNextNo("", "CTM_Job", jobDate.Date); } ASPxComboBox cbb_JobType = this.grid_job.FindEditFormTemplateControl("cbb_JobType") as ASPxComboBox; ASPxButtonEdit btn_ClientId = this.grid_job.FindEditFormTemplateControl("btn_ClientId") as ASPxButtonEdit; ASPxTextBox txt_ClientRefNo = this.grid_job.FindEditFormTemplateControl("txt_ClientRefNo") as ASPxTextBox; ASPxTextBox txt_notifiEmail = this.grid_job.FindEditFormTemplateControl("txt_notifiEmail") as ASPxTextBox; ASPxButtonEdit btn_SubClientId = this.grid_job.FindEditFormTemplateControl("btn_SubClientId") as ASPxButtonEdit; ASPxButtonEdit txt_WareHouseId = this.grid_job.FindEditFormTemplateControl("txt_WareHouseId") as ASPxButtonEdit; ASPxTextBox txt_ClientContact = this.grid_job.FindEditFormTemplateControl("txt_ClientContact") as ASPxTextBox; ctmJob.ClientContact = SafeValue.SafeString(txt_ClientContact.Text); ctmJob.JobDate = SafeValue.SafeDate(jobDate.Date, new DateTime(1753, 1, 1)); ctmJob.JobType = cbb_JobType.Text; ctmJob.ClientId = btn_ClientId.Text; ctmJob.ClientRefNo = txt_ClientRefNo.Text; ctmJob.EmailAddress = txt_notifiEmail.Text; ctmJob.SubClientId = btn_SubClientId.Text; if (txt_WareHouseId != null) { ctmJob.WareHouseCode = txt_WareHouseId.Text; } 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); C2.CtmJobEventLog elog = new C2.CtmJobEventLog(); elog.Platform_isWeb(); elog.Controller = userId; elog.ActionLevel_isJOB(ctmJob.Id); elog.Remark = "Job Update"; elog.log(); } if (isNew) { txt_JobNo.Text = ctmJob.JobNo; //txt_search_JobNo.Text = txt_JobNo.Text; C2Setup.SetNextNo("", "CTM_Job", ctmJob.JobNo, jobDate.Date); } //res = Job_Check_JobLevel(ctmJob.JobNo); Session["CTM_Job_" + txt_search_JobNo.Text] = "JobNo='" + ctmJob.JobNo + "'"; this.dsJob.FilterExpression = Session["CTM_Job_" + txt_search_JobNo.Text].ToString(); if (this.grid_job.GetRow(0) != null) { this.grid_job.StartEdit(0); } } catch { } return(res); }