public void Review_Detail_Save(string info) { string info_ = HttpUtility.UrlDecode(Server.UrlDecode(info)); JObject job = (JObject)JsonConvert.DeserializeObject(info_); bool status = false; string context = Common.StringToJson(""); List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>(); list.Add(new ConnectSql_mb.cmdParameters("@Oid", SafeValue.SafeInt(job["Oid"], 0), SqlDbType.Int)); list.Add(new ConnectSql_mb.cmdParameters("@Qty", SafeValue.SafeInt(job["Qty"], 0), SqlDbType.Decimal)); list.Add(new ConnectSql_mb.cmdParameters("@Weight", SafeValue.SafeDecimal(job["Weight"]), SqlDbType.Decimal)); list.Add(new ConnectSql_mb.cmdParameters("@M3", SafeValue.SafeDecimal(job["M3"]), SqlDbType.Decimal)); list.Add(new ConnectSql_mb.cmdParameters("@PackType", job["PackType"], SqlDbType.NVarChar, 100)); list.Add(new ConnectSql_mb.cmdParameters("@Markings", job["Markings"], SqlDbType.NVarChar, 300)); list.Add(new ConnectSql_mb.cmdParameters("@Contents", job["Contents"], SqlDbType.NVarChar, 300)); //string sql = string.Format(@"update job_receipt set Qty=@Qty,Weight=@Weight,M3=@M3,PackType=@PackType,Markings=@Markings,Contents=@Contents where row_id=@Oid"); string sql = string.Format(@"update job_house set QtyOrig=@Qty,WeightOrig=@Weight,VolumeOrig=@M3,PackTypeOrig=@PackType,Marking1=@Markings,Remark1=@Contents where Id=@Oid"); ConnectSql_mb.sqlResult result = ConnectSql_mb.ExecuteNonQuery(sql, list); if (result.status) { status = true; context = Common.StringToJson(result.context); //===========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_isCARGO(SafeValue.SafeInt(job["Oid"], 0)); //lg.Remark = "Cargo update"; lg.setActionLevel(SafeValue.SafeInt(job["Oid"], 0), CtmJobEventLogRemark.Level.Cargo, 3); lg.log(); } Common.WriteJsonP(status, context); }
public static int getBalanceDays(int person, string leaveType, int year) { int balDays = 0; int leaveDays = 0; int year_n = 0; string sql = string.Format(@"select Days,ApproveStatus,LeaveType,ApplyDateTime from Hr_Leave where Person={0} and LeaveType='{1}' and year(Date1)={2}", person, leaveType, year - 1); DataTable dt_day = ConnectSql_mb.GetDataTable(sql); for (int i = 0; i < dt_day.Rows.Count; i++) { year_n = SafeValue.SafeDate(dt_day.Rows[i]["ApplyDateTime"], DateTime.Today).Year; string approveStatus = SafeValue.SafeString(dt_day.Rows[i]["ApproveStatus"]); if (approveStatus == "Approve") { leaveDays += SafeValue.SafeInt(dt_day.Rows[i]["Days"], 0); } } sql = string.Format(@"select Days from Hr_LeaveTmp where Person={0} and LeaveType='{1}' and Year='{2}'", person, leaveType, year - 1); int totalDays = SafeValue.SafeInt(ConnectSql_mb.ExecuteScalar(sql), 0); balDays = totalDays - leaveDays; leaveDays = 0; sql = string.Format(@"select Days,ApproveStatus,LeaveType,ApplyDateTime from Hr_Leave where Person={0} and LeaveType='{1}' and year(Date1)={2}", person, leaveType, year); dt_day = ConnectSql_mb.GetDataTable(sql); for (int i = 0; i < dt_day.Rows.Count; i++) { year_n = SafeValue.SafeDate(dt_day.Rows[i]["ApplyDateTime"], DateTime.Today).Year; string approveStatus = SafeValue.SafeString(dt_day.Rows[i]["ApproveStatus"]); if (approveStatus == "Approve") { leaveDays += SafeValue.SafeInt(dt_day.Rows[i]["Days"], 0); } } sql = string.Format(@"select Days from Hr_LeaveTmp where Person={0} and LeaveType='{1}' and Year='{2}'", person, leaveType, year); totalDays = SafeValue.SafeInt(ConnectSql_mb.ExecuteScalar(sql), 0) + balDays; balDays = totalDays - leaveDays; return(balDays); }
protected void grid_InvDet_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { if (SafeValue.SafeString(e.NewValues["AcCode"], "").Length < 1) { e.Cancel = true; throw new Exception("Pls select the charge code"); } ASPxGridView grd = sender as ASPxGridView; string sql_detCnt = "select count(DocId) from XAArInvoiceDet where DocId='" + SafeValue.SafeInt(grd.GetMasterRowKeyValue(), 0) + "'"; int lineNo = SafeValue.SafeInt(Manager.ORManager.ExecuteScalar(sql_detCnt), 0) + 1; e.NewValues["CostingId"] = ""; e.NewValues["DocId"] = SafeValue.SafeInt(grd.GetMasterRowKeyValue(), 0); e.NewValues["DocLineNo"] = lineNo; ASPxTextBox docN = this.ASPxGridView1.FindEditFormTemplateControl("txt_DocNo") as ASPxTextBox; ASPxComboBox docType = this.ASPxGridView1.FindEditFormTemplateControl("cbo_DocType") as ASPxComboBox; e.NewValues["DocNo"] = docN.Text; e.NewValues["DocType"] = docType.Text; if (!e.NewValues["Currency"].Equals("SGD")) { e.NewValues["GstType"] = "Z"; e.NewValues["Gst"] = new decimal(0); } if (SafeValue.SafeDecimal(e.NewValues["ExRate"], 1) == 0) { e.NewValues["ExRate"] = 1; } decimal amt = SafeValue.ChinaRound(SafeValue.SafeDecimal(e.NewValues["Qty"], 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; e.NewValues["LocAmt"] = locAmt; if (SafeValue.SafeString(e.NewValues["JobRefNo"]).Length > 1) { e.NewValues["SplitType"] = "SET"; } }
public void HR_Leave_detail_save(string info) { JObject job = (JObject)JsonConvert.DeserializeObject(HttpUtility.UrlDecode(Server.UrlDecode(info))); int jobId = SafeValue.SafeInt(job["Id"], 0); int applyBy = SafeValue.SafeInt(job["Person"], 0); string LeaveType = SafeValue.SafeString(job["LeaveType"]); string Date1 = SafeValue.SafeString(job["Date1"]); string Time1 = SafeValue.SafeString(job["Time1"]); string Date2 = SafeValue.SafeString(job["Date2"]); string Time2 = SafeValue.SafeString(job["Time2"]); string Remark = SafeValue.SafeString(job["Remark"]); if (Time1 == "") { Time1 = "AM"; } if (Time2 == "") { Time2 = "PM"; } List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>(); string sql = string.Format(@"update Hr_Leave set Person=@PersonBy,LeaveType=@LeaveType,Date1=@Date1,Time1=@Time1,Date2=@Date2,Time2=@Time2,Remark=@Remark, Days=datediff(day,@Date1,@Date2)+1+(case @Time1 when 'AM' then 0 else -0.5 end)+(case @Time2 when 'PM' then 0 else -0.5 end) where Id=@Id"); list.Add(new ConnectSql_mb.cmdParameters("@Id", jobId, SqlDbType.Int)); list.Add(new ConnectSql_mb.cmdParameters("@PersonBy", applyBy, SqlDbType.Int)); list.Add(new ConnectSql_mb.cmdParameters("@LeaveType", LeaveType, SqlDbType.NVarChar, 100)); list.Add(new ConnectSql_mb.cmdParameters("@Date1", Date1, SqlDbType.NVarChar, 10)); list.Add(new ConnectSql_mb.cmdParameters("@Time1", Time1, SqlDbType.NVarChar, 10)); list.Add(new ConnectSql_mb.cmdParameters("@Date2", Date2, SqlDbType.NVarChar, 10)); list.Add(new ConnectSql_mb.cmdParameters("@Time2", Time2, SqlDbType.NVarChar, 10)); list.Add(new ConnectSql_mb.cmdParameters("@Remark", Remark, SqlDbType.NVarChar, 300)); ConnectSql_mb.sqlResult result = ConnectSql_mb.ExecuteNonQuery(sql, list); Common.WriteJsonP(result.status, Common.StringToJson(result.context)); }
protected void grid_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e) { if (Request.QueryString["mId"] != null) { int mastId = SafeValue.SafeInt(Request.QueryString["mId"], 0); for (int i = 0; i < list.Count; i++) { try { int detId = list[i].detId; string des = list[i].des; decimal amt = list[i].amt; string sql = string.Format("SELECT PayItem FROM Hr_Quote where Id='{0}'", detId); DataTable tab = C2.Manager.ORManager.GetDataSet(sql).Tables[0]; if (tab.Rows.Count == 1) { HrPayrollDet rollDet = new HrPayrollDet(); string chgCode = SafeValue.SafeString(tab.Rows[0]["PayItem"], ""); rollDet.PayrollId = mastId; rollDet.ChgCode = chgCode; rollDet.Description = des; rollDet.Amt = amt; C2.Manager.ORManager.StartTracking(rollDet, Wilson.ORMapper.InitialState.Inserted); C2.Manager.ORManager.PersistChanges(rollDet); } UpdateMaster(mastId); } catch { } } } else { e.Result = "Error, Pls refresh your Interview and Recruitment"; } }
protected void grid_Mkgs_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { ASPxGridView g = sender as ASPxGridView; ASPxTextBox refN = grid1.FindEditFormTemplateControl("TXT0") as ASPxTextBox; e.NewValues["RefNo"] = refN.Text; e.NewValues["CreateBy"] = EzshipHelper.GetUserName(); e.NewValues["CreateDateTime"] = DateTime.Now; e.NewValues["UpdateBy"] = EzshipHelper.GetUserName(); e.NewValues["UpdateDateTime"] = DateTime.Now; string jobType = EzshipHelper.GetJobType("SE", refN.Text); if (jobType == "FCL") { e.NewValues["MkgType"] = "CONT"; } else { e.NewValues["MkgType"] = "BL"; } e.NewValues["ContainerType"] = SafeValue.SafeString(e.NewValues["ContainerType"]); e.NewValues["PackageType"] = SafeValue.SafeString(e.NewValues["PackageType"]); e.NewValues["PackageType1"] = SafeValue.SafeString(e.NewValues["PackageType"]); e.NewValues["Volume"] = SafeValue.SafeDecimal(e.NewValues["Volume"], 0); e.NewValues["Weight"] = SafeValue.SafeDecimal(e.NewValues["Weight"], 0); e.NewValues["Qty"] = SafeValue.SafeInt(e.NewValues["Qty"], 0); e.NewValues["GrossWt"] = SafeValue.SafeDecimal(e.NewValues["GrossWt"], 0); e.NewValues["NetWt"] = SafeValue.SafeDecimal(e.NewValues["NetWt"], 0); e.NewValues["Volume1"] = SafeValue.SafeDecimal(e.NewValues["Volume1"], 0); e.NewValues["Weight1"] = SafeValue.SafeDecimal(e.NewValues["Weight1"], 0); e.NewValues["Qty1"] = SafeValue.SafeInt(e.NewValues["Qty1"], 0); e.NewValues["L"] = SafeValue.SafeDecimal(e.NewValues["L"], 0); e.NewValues["W"] = SafeValue.SafeDecimal(e.NewValues["W"], 0); e.NewValues["H"] = SafeValue.SafeDecimal(e.NewValues["H"], 0); e.NewValues["L1"] = SafeValue.SafeDecimal(e.NewValues["L1"], 0); e.NewValues["W1"] = SafeValue.SafeDecimal(e.NewValues["W1"], 0); e.NewValues["H1"] = SafeValue.SafeDecimal(e.NewValues["H1"], 0); }
protected void gridPersonDet3_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { ASPxTextBox id = this.grid.FindEditFormTemplateControl("txt_Id") as ASPxTextBox; e.NewValues["Person"] = SafeValue.SafeInt(id.Text, 0); ASPxGridView grd = sender as ASPxGridView; ASPxCheckBox isPayroll = grd.FindControl("ckb_IsPayroll") as ASPxCheckBox; if (isPayroll.Checked) { e.NewValues["IsPayroll"] = true; } else { e.NewValues["IsPayroll"] = false; } e.NewValues["CreateBy"] = HttpContext.Current.User.Identity.Name; e.NewValues["CreateDateTime"] = DateTime.Now; }
protected void grd_Photo_CustomCallback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e) { string str = e.Parameter; string sql = ""; string jobNo = txt_JobNo.Text; if (str == "DeleteAll") { sql = "delete FROM CTM_Attachment WHERE RefNo='" + jobNo + "'"; } else { sql = "delete FROM CTM_Attachment WHERE Id='" + SafeValue.SafeInt(str, 0) + "'"; } if (sql.Length > 0) { C2.Manager.ORManager.ExecuteCommand(sql); this.dsJobPhoto.FilterExpression = "RefNo='" + jobNo + "'";// (sender as ASPxDataView).DataBind(); } }
protected void grid_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { string code = SafeValue.SafeString(e.NewValues["Code"]); int n = SafeValue.SafeInt(ConnectSql.ExecuteScalar(string.Format(@"select count(*) from sys_alert_rule where Code='{0}'", code)), 0); if (n > 0) { throw new Exception("Pls keyin the Code again"); } e.NewValues["Code"] = SafeValue.SafeString(e.NewValues["Code"], ""); e.NewValues["MasterId"] = SafeValue.SafeString(e.NewValues["MasterId"], ""); e.NewValues["AlertColumns"] = SafeValue.SafeString(e.NewValues["AlertColumns"], ""); e.NewValues["AlertSql"] = SafeValue.SafeString(e.NewValues["AlertSql"], ""); e.NewValues["AlertTo"] = SafeValue.SafeString(e.NewValues["AlertTo"], ""); e.NewValues["AlertCc"] = SafeValue.SafeString(e.NewValues["AlertCc"], ""); e.NewValues["AlertBcc"] = SafeValue.SafeString(e.NewValues["AlertBcc"], ""); e.NewValues["AlertMobile"] = SafeValue.SafeString(e.NewValues["AlertMobile"]); e.NewValues["AlertBody"] = SafeValue.SafeString(e.NewValues["AlertBody"]); e.NewValues["AlertSubject"] = SafeValue.SafeString(e.NewValues["AlertSubject"], ""); e.NewValues["AlertSms"] = SafeValue.SafeString(e.NewValues["AlertSms"]); }
protected void grid_Quote_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { if (SafeValue.SafeString(e.NewValues["PayItem"], "").Length < 1) { throw new Exception("Item not be null !!!"); } e.NewValues["Person"] = SafeValue.SafeInt(e.NewValues["Person"], 0); e.NewValues["Amt"] = SafeValue.SafeDecimal(e.NewValues["Amt"], 0); e.NewValues["Remark"] = SafeValue.SafeString(e.NewValues["Remark"]); e.NewValues["PayItem"] = SafeValue.SafeString(e.NewValues["PayItem"]).Replace(",", ""); string sql = string.Format(@"select count(*) from Hr_Quote where Person={0} and PayItem='{1}'", SafeValue.SafeInt(e.NewValues["Person"], 0), SafeValue.SafeString(e.NewValues["PayItem"])); int cnt = SafeValue.SafeInt(ConnectSql.ExecuteScalar(sql), 0); if (cnt > 0) { throw new Exception("This already exists !!!"); } e.NewValues["IsCal"] = SafeValue.SafeString(e.NewValues["IsCal"]); //e.NewValues["CreateBy"] = HttpContext.Current.User.Identity.Name; //e.NewValues["CreateDateTime"] = DateTime.Today; }
private bool is_created(string id, DateTime billDate) { bool action = true; string sql = string.Format(@"select count(*) from job_cost where RelaId=@RelaId and CONVERT(varchar(100), BillStartDate, 23)=@BillStartDate"); List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>(); list.Add(new ConnectSql_mb.cmdParameters("@RelaId", id, SqlDbType.NVarChar)); list.Add(new ConnectSql_mb.cmdParameters("@BillStartDate", billDate.Date.ToString("yyyy-MM-dd"), SqlDbType.DateTime)); ConnectSql_mb.sqlResult res = ConnectSql_mb.ExecuteScalar(sql, list); int n = 0; if (res.status) { n = SafeValue.SafeInt(res.context, 0); } if (n >= 1) { action = false; } return(action); }
private void OnLoad1() { int start = 0; int end = 100; for (int i = start; i < end; i++) { ASPxCheckBox isOk = this.grid_Cost.FindRowCellTemplateControl(i, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid_Cost.Columns["Id"], "ack_IsOk") as ASPxCheckBox; ASPxTextBox id = this.grid_Cost.FindRowCellTemplateControl(i, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid_Cost.Columns["Id"], "txt_wh_Id") as ASPxTextBox; ASPxLabel lbl_ChgCode = this.grid_Cost.FindRowCellTemplateControl(i, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid_Cost.Columns["ChgCodeDes"], "lbl_ChgCode") as ASPxLabel; if (id != null && isOk != null && isOk.Checked) { list1.Add(new Record1(SafeValue.SafeInt(id.Text, 0), lbl_ChgCode.Text)); } else if (id == null) { break; } } }
protected void grid_det_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { ASPxGridView grid = (sender as ASPxGridView) as ASPxGridView; ASPxPageControl pageControl = this.grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox txt_RefNo = pageControl.FindControl("txt_RefNo") as ASPxTextBox; e.NewValues["ContractNo"] = SafeValue.SafeString(txt_RefNo.Text); e.NewValues["IsFixed"] = SafeValue.SafeBool(e.NewValues["IsFixed"], false); e.NewValues["IsYearly"] = SafeValue.SafeBool(e.NewValues["IsYearly"], false); e.NewValues["IsMonthly"] = SafeValue.SafeBool(e.NewValues["IsMonthly"], false); e.NewValues["IsWeekly"] = SafeValue.SafeBool(e.NewValues["IsWeekly"], false); e.NewValues["IsDaily"] = SafeValue.SafeBool(e.NewValues["IsDaily"], false); e.NewValues["ProductCode"] = SafeValue.SafeString(e.NewValues["ProductCode"]); e.NewValues["ProductClass"] = SafeValue.SafeString(e.NewValues["ProductClass"]); e.NewValues["DailyNo"] = SafeValue.SafeInt(e.NewValues["DailyNo"], 1); //e.NewValues["Price1"] = SafeValue.SafeDecimal(e.NewValues["Price1"], 0); //e.NewValues["Price2"] = SafeValue.SafeDecimal(e.NewValues["Price2"], 0); //e.NewValues["Price3"] = SafeValue.SafeDecimal(e.NewValues["Price3"], 0); e.NewValues["HandlingFee"] = SafeValue.SafeDecimal(e.NewValues["HandlingFee"], 0); e.NewValues["StorageFee"] = SafeValue.SafeDecimal(e.NewValues["StorageFee"], 0); }
protected void grid_InvDet_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { ASPxTextBox oidCtr = this.ASPxGridView1.FindEditFormTemplateControl("txt_Oid") as ASPxTextBox; e.NewValues["PayId"] = SafeValue.SafeInt(oidCtr.Text, 0); string sql_detCnt = "select count(*) from XAApPaymentDet where PayId='" + oidCtr.Text + "'"; int lineNo = SafeValue.SafeInt(Manager.ORManager.ExecuteScalar(sql_detCnt), 0) + 1; e.NewValues["PayLineNo"] = lineNo; ASPxTextBox docN = this.ASPxGridView1.FindEditFormTemplateControl("txt_DocNo") as ASPxTextBox; ASPxComboBox docType = this.ASPxGridView1.FindEditFormTemplateControl("cbo_DocType") as ASPxComboBox; e.NewValues["PayNo"] = docN.Text; e.NewValues["PayType"] = docType.Text; if (SafeValue.SafeDecimal(e.NewValues["ExRate"], 1) == 0) { e.NewValues["ExRate"] = 1; } e.NewValues["LocAmt"] = SafeValue.ChinaRound(SafeValue.SafeDecimal(e.NewValues["DocAmt"], 0) * SafeValue.SafeDecimal(e.NewValues["ExRate"], 1), 2); }
protected void grid_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { e.NewValues["OriginAdd"] = SafeValue.SafeString(e.NewValues["OriginAdd"]); e.NewValues["DestinationAdd"] = SafeValue.SafeString(e.NewValues["DestinationAdd"]); e.NewValues["TruckNo"] = SafeValue.SafeString(e.NewValues["TruckNo"]); e.NewValues["Value1"] = SafeValue.SafeString(e.NewValues["Value1"]); e.NewValues["Value2"] = SafeValue.SafeString(e.NewValues["Value2"]); e.NewValues["Value3"] = SafeValue.SafeString(e.NewValues["Value3"]); e.NewValues["WorkStatus"] = SafeValue.SafeString(e.NewValues["WorkStatus"]); e.NewValues["JobDate"] = SafeValue.SafeDate(e.NewValues["JobDate"], DateTime.Now); e.NewValues["PackRmk"] = SafeValue.SafeString(e.NewValues["PackRmk"]); e.NewValues["MoveRmk"] = SafeValue.SafeString(e.NewValues["MoveRmk"]); e.NewValues["TruckNo"] = SafeValue.SafeString(e.NewValues["TruckNo"]); e.NewValues["VolumneRmk"] = SafeValue.SafeString(e.NewValues["VolumneRmk"]); e.NewValues["Volumne"] = SafeValue.SafeDecimal(e.NewValues["Volumne"]); e.NewValues["TripNo"] = SafeValue.SafeString(e.NewValues["TripNo"]); e.NewValues["HeadCount"] = SafeValue.SafeInt(e.NewValues["HeadCount"], 0); e.NewValues["ViaWh"] = SafeValue.SafeString(e.NewValues["ViaWh"]); e.NewValues["StorageFreeDays"] = SafeValue.SafeInt(e.NewValues["StorageFreeDays"], 0); e.NewValues["StorageStartDate"] = SafeValue.SafeDate(e.NewValues["StorageStartDate"], DateTime.Now); }
private void OnLoad() { int start = 0; int end = count; for (int i = start; i < end; i++) { ASPxCheckBox isPay = this.grid_Transport.FindRowCellTemplateControl(i, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid_Transport.Columns["Id"], "ack_IsPay") as ASPxCheckBox; ASPxLabel lb_Id = this.grid_Transport.FindRowCellTemplateControl(i, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid_Transport.Columns["Id"], "lb_Id") as ASPxLabel; ASPxDateEdit txt_search_dateFrom = this.grid_Transport.FindRowCellTemplateControl(i, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid_Transport.Columns["ScheduleStartDate"], "txt_search_dateFrom") as ASPxDateEdit; ASPxTextBox date_ScheduleStartTime = this.grid_Transport.FindRowCellTemplateControl(i, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid_Transport.Columns["ScheduleStartDate"], "date_ScheduleStartTime") as ASPxTextBox; if (lb_Id != null && isPay != null && isPay.Checked) { list.Add(new Record(SafeValue.SafeInt(lb_Id.Text, 0), txt_search_dateFrom.Date, date_ScheduleStartTime.Text)); } else if (lb_Id == null) { break; } } }
protected void grid_Transport_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { try { string Id = e.NewValues["Id"].ToString(); string ContainerNo = SafeValue.SafeString(e.NewValues["ContainerNo"]); string SealNo = SafeValue.SafeString(e.NewValues["SealNo"]); string ContainerType = SafeValue.SafeString(e.NewValues["ContainerType"]); DateTime ScheduleDate = SafeValue.SafeDate(e.NewValues["ScheduleDate"], new DateTime(1753, 1, 1)); DateTime RequestDate = SafeValue.SafeDate(e.NewValues["RequestDate"], new DateTime(1753, 1, 1)); DateTime CfsInDate = SafeValue.SafeDate(e.NewValues["CfsInDate"], new DateTime(1753, 1, 1)); DateTime CfsOutDate = SafeValue.SafeDate(e.NewValues["CfsOutDate"], new DateTime(1753, 1, 1)); DateTime YardPickupDate = SafeValue.SafeDate(e.NewValues["YardPickupDate"], new DateTime(1753, 1, 1)); DateTime YardReturnDate = SafeValue.SafeDate(e.NewValues["YardReturnDate"], new DateTime(1753, 1, 1)); decimal Weight = SafeValue.SafeDecimal(e.NewValues["Weight"], 0); decimal Volume = SafeValue.SafeDecimal(e.NewValues["Volume"], 0); int QTY = SafeValue.SafeInt(e.NewValues["QTY"], 0); string PackageType = SafeValue.SafeString(e.NewValues["PackageType"]); string DgClass = SafeValue.SafeString(e.NewValues["DgClass"]); string PortnetStatus = SafeValue.SafeString(e.NewValues["PortnetStatus"]); string F5Ind = SafeValue.SafeString(e.NewValues["F5Ind"]); string UrgentInd = SafeValue.SafeString(e.NewValues["UrgentInd"]); string Remark = SafeValue.SafeString(e.NewValues["Remark"]); string det1Id = SafeValue.SafeString(e.NewValues["Id"]); string contNo_old = SafeValue.SafeString(e.OldValues["ContainerNo"]); string sql = string.Format(@"update CTM_JobDet1 set ContainerNo='{0}',SealNo='{8}',ContainerType='{1}',ScheduleDate='{2}',RequestDate='{3}',CfsInDate='{4}',CfsOutDate='{5}',YardPickupDate='{6}',YardReturnDate='{7}',Weight='{9}',Volume='{10}',QTY='{11}',PackageType='{12}',DgClass='{13}',PortnetStatus='{14}',F5Ind='{15}',UrgentInd='{16}',Remark='{17}' where Id={18}", ContainerNo, ContainerType, ScheduleDate, RequestDate, CfsInDate, CfsOutDate, YardPickupDate, YardReturnDate, SealNo, Weight, Volume, QTY, PackageType, DgClass, PortnetStatus, F5Ind, UrgentInd, Remark, Id); if (ConnectSql.ExecuteSql(sql) > 0 && ContainerNo != contNo_old) { sql = string.Format("Update ctm_JobDet2 set ContainerNo='{1}' where Det1Id='{0}'", det1Id, ContainerNo); ConnectSql.ExecuteSql(sql); } } catch { } this.grid_Transport.CancelEdit(); e.Cancel = true; grid_Transport_DataBind(); }
protected void gridRecruitmentDet_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { ASPxGridView grd = sender as ASPxGridView; ASPxTextBox name = grd.FindEditFormTemplateControl("txt_Name") as ASPxTextBox; if (SafeValue.SafeString(name.Text).Length < 1) { throw new Exception("Name not be null !!!"); return; } ASPxRadioButton married = grd.FindEditFormTemplateControl("rbt_Married") as ASPxRadioButton; if (married.Checked) { e.NewValues["Married"] = "Y"; } else { e.NewValues["Married"] = "N"; } e.NewValues["InterviewId"] = SafeValue.SafeInt(e.NewValues["InterviewId"], 0); e.NewValues["RecruitId"] = SafeValue.SafeInt(e.NewValues["RecruitId"], 0); e.NewValues["Gender"] = SafeValue.SafeString(e.NewValues["Gender"]); e.NewValues["IcNo"] = SafeValue.SafeString(e.NewValues["IcNo"]); e.NewValues["BirthDay"] = SafeValue.SafeDate(e.NewValues["BirthDay"], new DateTime(1753, 1, 1)); e.NewValues["Country"] = SafeValue.SafeString(e.NewValues["Country"]); e.NewValues["Race"] = SafeValue.SafeString(e.NewValues["Race"]); e.NewValues["Religion"] = SafeValue.SafeString(e.NewValues["Religion"]); e.NewValues["Telephone"] = SafeValue.SafeString(e.NewValues["Telephone"]); e.NewValues["Email"] = SafeValue.SafeString(e.NewValues["Email"]); e.NewValues["Address"] = SafeValue.SafeString(e.NewValues["Address"]); e.NewValues["Remark"] = SafeValue.SafeString(e.NewValues["Remark"]); e.NewValues["Remark1"] = SafeValue.SafeString(e.NewValues["Remark1"]); e.NewValues["Remark2"] = SafeValue.SafeString(e.NewValues["Remark2"]); e.NewValues["Remark3"] = SafeValue.SafeString(e.NewValues["Remark3"]); e.NewValues["Remark4"] = SafeValue.SafeString(e.NewValues["Remark4"]); }
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 grid_InvDet_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { if (SafeValue.SafeDecimal(e.NewValues["ExRate"], 1) == 0) { e.NewValues["ExRate"] = 1; } e.NewValues["CurrencyCrAmt"] = SafeValue.ChinaRound(SafeValue.SafeDecimal(e.NewValues["CrAmt"], 0) * SafeValue.SafeDecimal(e.NewValues["ExRate"], 1), 2); e.NewValues["CurrencyDbAmt"] = SafeValue.ChinaRound(SafeValue.SafeDecimal(e.NewValues["DbAmt"], 0) * SafeValue.SafeDecimal(e.NewValues["ExRate"], 1), 2); if (SafeValue.SafeDecimal(e.NewValues["CurrencyCrAmt"], 0) > 0) { e.NewValues["AcSource"] = "CR"; } else { e.NewValues["AcSource"] = "DB"; } ASPxTextBox acYear = this.ASPxGridView1.FindEditFormTemplateControl("txt_AcYear") as ASPxTextBox; ASPxTextBox acPeriod = this.ASPxGridView1.FindEditFormTemplateControl("txt_AcPeriod") as ASPxTextBox; e.NewValues["AcYear"] = SafeValue.SafeInt(acYear.Text, 2010); e.NewValues["AcPeriod"] = SafeValue.SafeInt(acPeriod.Text, 1); }
protected void grd_Stock_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e) { string pars = e.Parameters; string[] ar = pars.Split('_'); if (ar.Length >= 2) { if (ar[0].Equals("UpdateInline")) { ASPxGridView grid = (sender as ASPxGridView) as ASPxGridView; int index = SafeValue.SafeInt(ar[1], 0); string Id = SafeValue.SafeString(grid.GetRowValues(index, "Id")); grid.UpdateEdit(); int id = SafeValue.SafeInt(Request.QueryString["id"], 0); string sql = string.Format(@"select sum(Price2) from job_house where OrderId={0}", id); decimal totalAmt = SafeValue.SafeDecimal(ConnectSql_mb.ExecuteScalar(sql)); e.Result = totalAmt; } } }
private bool VilaSetStock(string loc, int qty) { bool result = false; string sql = string.Format(@"select * from (select tab_hand.Qty1-isnull(tab_out.Qty1,0) as HandQty,tab_hand.Location from (select product ,LotNo,sum(Qty1) as Qty1,sum(Qty2) as Qty2,sum(Qty3) as Qty3,Location,max(mast.DoNo) DoNo,max(mast.DoDate) DoDate from wh_dodet2 det inner join wh_do mast on mast.DoNo=det.DoNo and mast.StatusCode='CLS' where det.DoType='IN' and len(det.DoNo)>0 group by product,LotNo,Location) as tab_hand left join (select Product,LotNo,sum(Qty1) as Qty1,sum(Qty2) as Qty2,sum(Qty3) as Qty3,Location from wh_dodet2 det inner join Wh_DO mast on det.DoNo=mast.DoNo and (mast.StatusCode='CLS' or mast.StatusCode='RETURN') where det.DoType='OUT' and len(det.DoNo)>0 group by Product,LotNo,Location) as tab_out on tab_out.Product=tab_hand.Product and tab_out.LotNo=tab_hand.LotNo and tab_out.Location=tab_hand.Location) as tab where Location='{0}'", loc); int HandQty = SafeValue.SafeInt(C2.Manager.ORManager.ExecuteScalar(sql), 0); sql = string.Format(@"select MaxCount from ref_location where Code='{0}' and Loclevel='Unit'", loc); int maxCount = SafeValue.SafeInt(C2.Manager.ORManager.ExecuteScalar(sql), 0); if (HandQty == maxCount) { result = true; } if ((HandQty + qty) - maxCount > 0) { result = true; } return(result); }
protected void grid_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e) { string para = e.Parameters; if (para == "AddLines") { int count = SafeValue.SafeInt(txt_Count.Text, 0); if (count > 0) { string userId = HttpContext.Current.User.Identity.Name; int id = SafeValue.SafeInt(Request.QueryString["id"], 0); string type = SafeValue.SafeString(Request.QueryString["type"]); if (type == "") { type = "MARUBENI"; } for (int i = 0; i < count; i++) { C2.Dimension d = new Dimension(); d.HouseId = id; d.HeatNo = " "; d.PipeNo = ""; d.TypeCode = type; d.RowCreateUser = userId; d.RowCreateTime = DateTime.Now; d.RowUpdateTime = DateTime.Now; d.RowUpdateUser = userId; C2.Manager.ORManager.StartTracking(d, Wilson.ORMapper.InitialState.Inserted); C2.Manager.ORManager.PersistChanges(d); } e.Result = "Success"; } else { e.Result = "Fail!Pls keyin the number"; } } }
protected void grid_det_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { ASPxGridView grd = sender as ASPxGridView; if (SafeValue.SafeString(e.NewValues["Product"], "").Length < 1) { e.Cancel = true; throw new Exception("Pls select the charge code"); } if (!e.NewValues["Currency"].Equals("SGD")) { e.NewValues["GstType"] = "Z"; e.NewValues["Gst"] = new decimal(0); } if (SafeValue.SafeDecimal(e.NewValues["ExRate"], 1) == 0) { e.NewValues["ExRate"] = 1; } if (e.NewValues["GstType"].Equals("S")) { e.NewValues["Gst"] = new decimal(0.07); } decimal amt = SafeValue.ChinaRound(SafeValue.SafeDecimal(e.NewValues["Qty"], 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; e.NewValues["LocAmt"] = locAmt; int qty = SafeValue.SafeInt(e.NewValues["Qty"], 0); int balQty = GetBalQty(grd); if (qty > balQty) { e.Cancel = true; throw new Exception("Pls write Qty again"); } }
protected void ASPxGridView1_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { if (SafeValue.SafeInt(e.NewValues["Person"], 0) == 0) { throw new Exception("Pls select Person!"); } e.NewValues["Person"] = SafeValue.SafeInt(e.NewValues["Person"], 0); e.NewValues["Date1"] = SafeValue.SafeDate(e.NewValues["Date1"], new DateTime(1753, 1, 1)); e.NewValues["Date2"] = SafeValue.SafeDate(e.NewValues["Date2"], new DateTime(1753, 1, 1)); e.NewValues["Time1"] = SafeValue.SafeString(e.NewValues["Time1"]); e.NewValues["Time2"] = SafeValue.SafeString(e.NewValues["Time2"]); e.NewValues["Days"] = SafeValue.SafeString(e.NewValues["Days"], "0"); e.NewValues["ApplyDateTime"] = SafeValue.SafeDate(e.NewValues["ApplyDateTime"], new DateTime(1753, 1, 1)); e.NewValues["ApproveBy"] = SafeValue.SafeInt(e.NewValues["ApproveBy"], 0); e.NewValues["ApproveDate"] = SafeValue.SafeDate(e.NewValues["ApproveDate"], new DateTime(1753, 1, 1)); e.NewValues["ApproveTime"] = SafeValue.SafeString(e.NewValues["ApproveTime"]); e.NewValues["ApproveStatus"] = SafeValue.SafeString(e.NewValues["ApproveStatus"]); e.NewValues["Remark"] = SafeValue.SafeString(e.NewValues["Remark"]); e.NewValues["ApproveRemark"] = SafeValue.SafeString(e.NewValues["ApproveRemark"]); string type = SafeValue.SafeString(e.NewValues["LeaveType"]); int year = SafeValue.SafeDate(e.NewValues["Date1"], new DateTime(1753, 1, 1)).Year; }
protected void grid_InvDet_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { ASPxGridView grd = sender as ASPxGridView; string sql_detCnt = "select max(QuoteLineNo) from SeaQuoteDet1 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; e.NewValues["ImpExpInd"] = this.txt_type.Text; e.NewValues["FclLclInd"] = "Fcl"; e.NewValues["Qty"] = (decimal)1; 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)); }
public void ContainerTrips_Save(string info) { JObject job = (JObject)JsonConvert.DeserializeObject(HttpUtility.UrlDecode(Server.UrlDecode(info))); string context = Common.StringToJson(""); string sql = string.Format(@"update ctm_jobdet1 set ContainerNo=@ContainerNo,SealNo=@SealNo where Id=@contId"); List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>(); list.Add(new ConnectSql_mb.cmdParameters("@contId", SafeValue.SafeInt(job["Id"], 0), SqlDbType.Int)); list.Add(new ConnectSql_mb.cmdParameters("@ContainerNo", job["ContainerNo"], SqlDbType.NVarChar, 100)); list.Add(new ConnectSql_mb.cmdParameters("@SealNo", job["SealNo"], SqlDbType.NVarChar, 100)); ConnectSql_mb.ExecuteNonQuery(sql, list); sql = string.Format(@"update ctm_job set PickupFrom=@PickupFrom,DeliveryTo=@DeliveryTo,YardRef=@YardRef, SpecialInstruction=@SpecialInstruction,Remark=@Remark,PermitNo=@PermitNo where JobNo=@JobNo"); list = new List <ConnectSql_mb.cmdParameters>(); list.Add(new ConnectSql_mb.cmdParameters("@JobNo", job["JobNo"], SqlDbType.NVarChar, 100)); list.Add(new ConnectSql_mb.cmdParameters("@PickupFrom", job["PickupFrom"], SqlDbType.NVarChar, 300)); list.Add(new ConnectSql_mb.cmdParameters("@DeliveryTo", job["DeliveryTo"], SqlDbType.NVarChar, 300)); list.Add(new ConnectSql_mb.cmdParameters("@YardRef", job["YardRef"], SqlDbType.NVarChar, 100)); list.Add(new ConnectSql_mb.cmdParameters("@SpecialInstruction", job["SpecialInstruction"], SqlDbType.NVarChar, 300)); list.Add(new ConnectSql_mb.cmdParameters("@Remark", job["Remark"], SqlDbType.NVarChar, 300)); list.Add(new ConnectSql_mb.cmdParameters("@PermitNo", job["PermitNo"], SqlDbType.NVarChar, 100)); bool status = ConnectSql_mb.ExecuteNonQuery(sql, list).status; if (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_isCONT(SafeValue.SafeInt(job["Id"], 0)); lg.Remark = "Container Update"; lg.log(); } Common.WriteJsonP(status, context); }
public void HR_Leave_view_changeStatus(string info) { JObject job = (JObject)JsonConvert.DeserializeObject(HttpUtility.UrlDecode(Server.UrlDecode(info))); int jobId = SafeValue.SafeInt(job["Id"], 0); string ApproveStatus = SafeValue.SafeString(job["status"]); string ApproveBy = SafeValue.SafeString(job["user"]); string ApproveRemark = SafeValue.SafeString(job["remark"]); List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>(); string sql = string.Format(@"update Hr_Leave set ApproveStatus=@ApproveStatus,ApproveDate=getdate(),ApproveTime=replace(convert(nvarchar(5),getdate(),114),':',''), ApproveBy=isnull((select top 1 Id from Hr_person where Name=@ApproveBy),0),ApproveRemark=@ApproveRemark where Id=@Id"); list.Add(new ConnectSql_mb.cmdParameters("@Id", jobId, SqlDbType.Int)); list.Add(new ConnectSql_mb.cmdParameters("@ApproveStatus", ApproveStatus, SqlDbType.NVarChar, 100)); list.Add(new ConnectSql_mb.cmdParameters("@ApproveBy", ApproveBy, SqlDbType.NVarChar, 100)); list.Add(new ConnectSql_mb.cmdParameters("@ApproveRemark", ApproveRemark, SqlDbType.NVarChar, 300)); ConnectSql_mb.sqlResult result = ConnectSql_mb.ExecuteNonQuery(sql, list); Common.WriteJsonP(result.status, Common.StringToJson(result.context)); }
protected void Page_Init() { if (!IsPostBack) { Session["SoWhere"] = null; if (Request.QueryString["no"] != null && Request.QueryString["no"] != "0") { Session["SoWhere"] = "JobNo='" + Request.QueryString["no"] + "'"; this.dsIssue.FilterExpression = Session["SoWhere"].ToString(); } else if (Request.QueryString["no"] == null || Request.QueryString["no"] == "0") { string sql = string.Format(@"select count(*) from JobInfo where JobType='LMTemp'"); int cnt = SafeValue.SafeInt(C2.Manager.ORManager.ExecuteScalar(sql), 0); if (cnt == 0) { this.grid_Issue.AddNewRow(); } else { Session["SoWhere"] = "JobType='LMTemp'"; dsIssue.FilterExpression = Session["SoWhere"].ToString(); } } else { this.dsIssue.FilterExpression = "1=0"; } } if (Session["SoWhere"] != null) { this.dsIssue.FilterExpression = Session["SoWhere"].ToString(); if (this.grid_Issue.GetRow(0) != null) { this.grid_Issue.StartEdit(0); } } }
private void Update_Det(XAApPayment inv, int index, decimal price, string code, string cntNo, string jobNo, string tripId) { try { string sql = string.Format(@"select SequenceId from XAApPaymentDet where Remark1='{0}'", code); int id = SafeValue.SafeInt(Helper.Sql.One(sql), 0); Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.XAApPaymentDet), "SequenceId=" + id + ""); C2.XAApPaymentDet det = C2.Manager.ORManager.GetObject(query) as C2.XAApPaymentDet; if (det != null) { det.DocDate = new DateTime(1900, 1, 1); det.PayId = inv.SequenceId; det.PayNo = inv.DocNo; det.DocType = inv.DocType; det.PayLineNo = index; det.AcCode = System.Configuration.ConfigurationManager.AppSettings["DefaultCash"]; det.AcSource = "DB"; det.Remark1 = code; det.Remark2 = ""; det.Remark3 = cntNo; det.MastRefNo = jobNo; det.JobRefNo = tripId; det.Currency = System.Configuration.ConfigurationManager.AppSettings["Currency"]; det.ExRate = 1; det.DocAmt += price; if (det.ExRate == 0) { det.ExRate = 1; } det.LocAmt = price; C2.Manager.ORManager.StartTracking(det, Wilson.ORMapper.InitialState.Updated); C2.Manager.ORManager.PersistChanges(det); } } catch { } }