protected void btn_Save_Click(object sender, EventArgs e) { string user = HttpContext.Current.User.Identity.Name; string sql = string.Format(@"select Id from Hr_PersonNews where Id='{0}'", SafeValue.SafeInt(txt_Id.Text, 0)); DataTable tab = C2.Manager.ORManager.GetDataSet(sql).Tables[0]; if (tab.Rows.Count == 1) { Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(HrPersonNews), "Id='" + txt_Id.Text + "'"); HrPersonNews news = C2.Manager.ORManager.GetObject(query) as HrPersonNews; news.Title = txt_Title.Text.Replace("'", "''"); news.Note = memo_Note.Text.Replace("'", "''"); news.UpdateBy = user; news.UpdateDateTime = DateTime.Now; news.ExpireDateTime = SafeValue.SafeDate(date_ExpireDateTime.Value, DateTime.Now); C2.Manager.ORManager.StartTracking(news, Wilson.ORMapper.InitialState.Updated); C2.Manager.ORManager.PersistChanges(news); } else { sql = string.Format(@"INSERT INTO dbo.Hr_PersonNews(Title,Note,CreateBy,CreateDateTime,ExpireDateTime) VALUES('{0}','{1}','{2}','{3}','{4}')", txt_Title.Text.Replace("'", "''"), memo_Note.Text.Replace("'", "''"), user, DateTime.Now, SafeValue.SafeDate(date_ExpireDateTime.Value, DateTime.Now)); C2.Manager.ORManager.ExecuteCommand(sql); sql = "select max(Id) from Hr_PersonNews"; txt_Id.Text = SafeValue.SafeString(C2.Manager.ORManager.ExecuteScalar(sql)); } }
protected void grid_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { int id = SafeValue.SafeInt(Request.QueryString["id"], 0); string jobNo = SafeValue.SafeString(Request.QueryString["no"]); e.NewValues["HouseId"] = id; e.NewValues["Qty"] = SafeValue.SafeDecimal(e.NewValues["Qty"]); e.NewValues["ProcessQty1"] = SafeValue.SafeDecimal(e.NewValues["ProcessQty1"]); e.NewValues["ProcessQty2"] = SafeValue.SafeDecimal(e.NewValues["ProcessQty2"]); e.NewValues["ProcessQty3"] = SafeValue.SafeDecimal(e.NewValues["ProcessQty3"]); e.NewValues["JobNo"] = jobNo; e.NewValues["DateEntry"] = SafeValue.SafeDate(e.NewValues["DateEntry"], DateTime.Now); e.NewValues["DatePlan"] = SafeValue.SafeDate(e.NewValues["DatePlan"], DateTime.Now); e.NewValues["DateInspect"] = SafeValue.SafeDate(e.NewValues["DateInspect"], DateTime.Now); e.NewValues["DateProcess"] = SafeValue.SafeDate(e.NewValues["DateProcess"], DateTime.Now); e.NewValues["ProcessType"] = SafeValue.SafeString(e.NewValues["ProcessType"]); e.NewValues["ProcessStatus"] = SafeValue.SafeString(e.NewValues["ProcessStatus"]); e.NewValues["LotNo"] = SafeValue.SafeString(e.NewValues["LotNo"]); e.NewValues["LocationCode"] = SafeValue.SafeString(e.NewValues["LocationCode"]); e.NewValues["Specs1"] = SafeValue.SafeString(e.NewValues["Specs1"]); e.NewValues["Specs2"] = SafeValue.SafeString(e.NewValues["Specs2"]); e.NewValues["Specs3"] = SafeValue.SafeString(e.NewValues["Specs3"]); e.NewValues["Specs4"] = SafeValue.SafeString(e.NewValues["Specs4"]); e.NewValues["Remark1"] = SafeValue.SafeString(e.NewValues["Remark1"]); e.NewValues["Remark2"] = SafeValue.SafeString(e.NewValues["Remark2"]); e.NewValues["RowUpdateUser"] = HttpContext.Current.User.Identity.Name; e.NewValues["RowUpdateTime"] = DateTime.Now; }
protected void grid_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { e.NewValues["DocOwner"] = "CLM"; e.NewValues["DoType"] = "OUT3"; e.NewValues["DocStatus"] = "Pending"; e.NewValues["DocDate"] = SafeValue.SafeDate(e.NewValues["DocDate"], DateTime.Now); e.NewValues["DocNo"] = S.Text(e.NewValues["DocNo"]); int n1 = S.Int(e.NewValues["RequisitionNew"]); int n2 = S.Int(e.NewValues["RequisitionUsed"]); int a1 = S.Int(e.NewValues["AdditionallNew"]); int a2 = S.Int(e.NewValues["AdditionalUsed"]); int r1 = S.Int(e.NewValues["ReturnedNew"]); int r2 = S.Int(e.NewValues["ReturnedUsed"]); int t1 = n1 + a1 - r1; int t2 = n2 + a2 - r2; e.NewValues["RequisitionNew"] = n1; e.NewValues["RequisitionUsed"] = n2; e.NewValues["AdditionalNew"] = a1; e.NewValues["AdditionalUsed"] = a2; e.NewValues["ReturnedNew"] = r1; e.NewValues["ReturnedUsed"] = r2; e.NewValues["TotalNew"] = t1; e.NewValues["TotalUsed"] = t2; }
protected void grid_Transport_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { e.NewValues["EventDate"] = SafeValue.SafeDate(e.NewValues["EventDate"], new DateTime(1753, 1, 1)); string eventType = SafeValue.SafeString(e.NewValues["EventType"], ""); e.NewValues["LineSource"] = "M"; e.NewValues["ChgCode"] = eventType; e.NewValues["ChgCodeDe"] = eventType; e.NewValues["EventType"] = eventType; e.NewValues["ExpiryDate"] = SafeValue.SafeDate(e.NewValues["ExpiryDate"], new DateTime(1753, 1, 1)); e.NewValues["DriverCode"] = SafeValue.SafeString(e.NewValues["DriverCode"], ""); decimal amt = SafeValue.SafeDecimal(e.NewValues["Price"], 0); e.NewValues["Price"] = amt; e.NewValues["LocAmt"] = SafeValue.ChinaRound(1 * SafeValue.SafeDecimal(e.NewValues["Price"], 0), 2); e.NewValues["VehicleNo"] = SafeValue.SafeString(e.NewValues["VehicleNo"], ""); e.NewValues["DocAmt"] = SafeValue.SafeDecimal(e.NewValues["DocAmt"], 0); e.NewValues["Remark"] = SafeValue.SafeString(e.NewValues["Remark"], ""); string jobNo = SafeValue.SafeString(e.NewValues["JobNo"], ""); string contNo = SafeValue.SafeString(e.NewValues["ContNo"], ""); e.NewValues["JobNo"] = jobNo; e.NewValues["ContNo"] = contNo; e.NewValues["TripNo"] = SafeValue.SafeString(e.NewValues["TripNo"], ""); e.NewValues["TripType"] = SafeValue.SafeString(e.NewValues["TripType"], ""); }
protected void grid_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { e.NewValues["DocOwner"] = "CLM"; e.NewValues["DoType"] = "IN3"; e.NewValues["DocStatus"] = "Pending"; e.NewValues["DocDate"] = SafeValue.SafeDate(e.NewValues["DocDate"], DateTime.Now); if (S.Text(e.NewValues["DoType"]) == "OUT3") { string refNo = C2Setup.GetNextNo("", "CLM", S.Date(e.NewValues["DocDate"])); //SafeValue.SafeString(e.NewValues["RefNo"]); e.NewValues["BillNo"] = refNo; e.NewValues["DocNo"] = refNo; C2Setup.SetNextNo("", "CLM", refNo, S.Date(e.NewValues["DocDate"])); } else { e.NewValues["BillNo"] = S.Text(e.NewValues["BillNo"]); e.NewValues["DocNo"] = S.Text(e.NewValues["DocNo"]); } int qty = S.Int(e.NewValues["TotalNew"]); e.NewValues["TotalNew"] = qty; e.NewValues["TotalUsed"] = 0; //e.NewValues["Qty"] = 0; //e.NewValues["Price"] = 0; //e.NewValues["GstAmt"] = 0; //e.NewValues["DocAmt"] = 0; }
protected void gv_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { e.NewValues["UpdateBy"] = SafeValue.SafeString(e.NewValues["CreateBy"]); e.NewValues["UpdateDateTime"] = SafeValue.SafeDate(e.NewValues["CreateDateTime"], DateTime.Today); e.NewValues["Code"] = SafeValue.SafeString(e.NewValues["Code"]); e.NewValues["Description"] = SafeValue.SafeString(e.NewValues["Description"]); }
protected void grid_Transport_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { ASPxTextBox Code = this.grid_Transport.FindEditFormTemplateControl("txt_Code") as ASPxTextBox; //e.NewValues["Remark"] = SafeValue.SafeString(e.NewValues["Remark"], ""); check_save(Code.Text); e.NewValues["Isstaff"] = SafeValue.SafeString(e.NewValues["Isstaff"], "N"); e.NewValues["ServiceLevel"] = SafeValue.SafeString(e.NewValues["ServiceLevel"], "Level1"); e.NewValues["StatusCode"] = SafeValue.SafeString(e.NewValues["StatusCode"], "Active"); e.NewValues["Code"] = SafeValue.SafeString(e.NewValues["Code"]); e.NewValues["Name"] = SafeValue.SafeString(e.NewValues["Name"]); e.NewValues["Tel"] = SafeValue.SafeString(e.NewValues["Tel"]); e.NewValues["ICNo"] = SafeValue.SafeString(e.NewValues["ICNo"]); e.NewValues["TowheaderCode"] = SafeValue.SafeString(e.NewValues["TowheaderCode"]); e.NewValues["LicenseNo"] = SafeValue.SafeString(e.NewValues["LicenseNo"]); e.NewValues["LicenseExpiry"] = SafeValue.SafeDate(e.NewValues["LicenseExpiry"], DateTime.Today); e.NewValues["BankAccount"] = SafeValue.SafeString(e.NewValues["BankAccount"]); e.NewValues["TeamNo"] = SafeValue.SafeString(e.NewValues["TeamNo"]); e.NewValues["SalaryBasic"] = SafeValue.SafeDecimal(e.NewValues["SalaryBasic"]); e.NewValues["SalaryAllowance"] = SafeValue.SafeDecimal(e.NewValues["SalaryAllowance"]); e.NewValues["SubContract_Ind"] = SafeValue.SafeString(e.NewValues["SubContract_Ind"]); e.NewValues["SalaryRemark"] = SafeValue.SafeString(e.NewValues["SalaryRemark"]); e.NewValues["Remark"] = SafeValue.SafeString(e.NewValues["Remark"]); }
protected void grid_Transport_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { if (e.DataColumn.FieldName == "Date1") { DateTime dtime = SafeValue.SafeDate(e.CellValue, new DateTime(1990, 1, 1)); DateTime dtime_now = DateTime.Now; if (dtime_now.AddDays(5).CompareTo(dtime) > 0) { e.Cell.BackColor = System.Drawing.Color.Red; } else { if (dtime_now.AddDays(30).CompareTo(dtime) > 0) { e.Cell.BackColor = System.Drawing.Color.Orange; } } } if (e.DataColumn.FieldName == "Date2") { DateTime dtime = SafeValue.SafeDate(e.CellValue, new DateTime(1990, 1, 1)); DateTime dtime_now = DateTime.Now; if (dtime_now.AddDays(5).CompareTo(dtime) > 0) { e.Cell.BackColor = System.Drawing.Color.Red; } else { if (dtime_now.AddDays(30).CompareTo(dtime) > 0) { e.Cell.BackColor = System.Drawing.Color.Orange; } } } }
private void OnLoad(string t) { 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++) { ASPxCheckBox isPay = this.grid_Transport.FindRowCellTemplateControl(i, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid_Transport.Columns[0], "ack_IsPay") as ASPxCheckBox; //ASPxButtonEdit driver = this.grid_Transport.FindRowCellTemplateControl(i, (DevExpress.Web.ASPxGridView.GridViewDataColumn)this.grid_Transport.Columns["Driver"], "btn_DriverCode") as ASPxButtonEdit; ASPxComboBox driver = this.grid_Transport.FindRowCellTemplateControl(i, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid_Transport.Columns["Driver"], "btn_DriverCode") as ASPxComboBox; //ASPxButtonEdit towhead = this.grid_Transport.FindRowCellTemplateControl(i, (DevExpress.Web.ASPxGridView.GridViewDataColumn)this.grid_Transport.Columns["VehicleNo"], "btn_vehicle") as ASPxButtonEdit; ASPxTextBox Id = this.grid_Transport.FindRowCellTemplateControl(i, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid_Transport.Columns["Driver"], "lb_Id") as ASPxTextBox; ASPxTextBox lb_progress = this.grid_Transport.FindRowCellTemplateControl(i, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid_Transport.Columns["Driver"], "lb_progress") as ASPxTextBox; ASPxComboBox cbb_JobProgress = this.grid_Transport.FindRowCellTemplateControl(i, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid_Transport.Columns["JobProgress"], "cbb_JobProgress") as ASPxComboBox; //ASPxTextEdit txt_DeliveryIndex = this.grid_Transport.FindRowCellTemplateControl(i, (DevExpress.Web.ASPxGridView.GridViewDataColumn)this.grid_Transport.Columns["DeliveryIndex"], "txt_DeliveryIndex") as ASPxTextEdit; ASPxTextBox txt_TptTime = this.grid_Transport.FindRowCellTemplateControl(i, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid_Transport.Columns["TptTime"], "txt_TptTime") as ASPxTextBox; ASPxDateEdit date_TptDate = this.grid_Transport.FindRowCellTemplateControl(i, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid_Transport.Columns["TptDate"], "date_TptDate") as ASPxDateEdit; if (Id != null && driver != null & lb_progress != null && isPay != null && isPay.Checked) { Record r = new Record(Id.Text, SafeValue.SafeString(driver.Value), lb_progress.Text, 0); r.TptTime = SafeValue.SafeString(txt_TptTime.Text, "00:00"); r.TptDate = SafeValue.SafeDate(date_TptDate.Date, new DateTime(1900, 1, 1)).ToString("yyyyMMdd"); r.progress_new = SafeValue.SafeString(cbb_JobProgress.Value); list.Add(r); } else { if (Id == null) { break; } } } }
protected void grid_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { e.NewValues["RefNo"] = SafeValue.SafeString(e.NewValues["RefNo"]); e.NewValues["OriginAdd"] = SafeValue.SafeString(e.NewValues["OriginAdd"]); e.NewValues["DestinationAdd"] = SafeValue.SafeString(e.NewValues["DestinationAdd"]); e.NewValues["CustomerName"] = SafeValue.SafeString(e.NewValues["CustomerName"]); e.NewValues["Contact"] = SafeValue.SafeString(e.NewValues["Contact"]); 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["MoveDate"] = 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["Note1"] = SafeValue.SafeString(e.NewValues["Note1"]); e.NewValues["Note2"] = SafeValue.SafeString(e.NewValues["Note2"]); DateTime jobDate = SafeValue.SafeDate(e.NewValues["JobDate"], DateTime.Now); ASPxTimeEdit date_Time = grid.FindEditRowCellTemplateControl(null, "date_Time") as ASPxTimeEdit; string jobTime = SafeValue.SafeDateStr(e.NewValues["JobDate"]); DateTime moveDate = DateTime.Parse(jobDate.ToString("yyyy-MM-dd") + " " + date_Time.Text); e.NewValues["MoveDate"] = SafeValue.SafeDate(moveDate, DateTime.Now); //e.NewValues["MoveDate"] = SafeValue.SafeDate(date_Time.Value, DateTime.Now); }
private string reGetDateFormat(string par, string file) { string res = "19000101"; if (file.ToLower().EndsWith(".csv") || file.ToLower().EndsWith(".xls")) { string[] ar = par.Split(' '); if (ar[0].Length > 0) { string[] ar_date = ar[0].Split('/'); if (ar_date.Length < 3) { return(res); } string ar_date_year = ar_date[2]; if (ar_date_year.Length == 2) { ar_date_year = DateTime.Now.ToString("yyyy").Substring(0, 2) + ar_date_year; } DateTime dt_t = new DateTime(SafeValue.SafeInt(ar_date_year, 1900), SafeValue.SafeInt(ar_date[1], 1), SafeValue.SafeInt(ar_date[0], 1)); res = dt_t.ToString("yyyyMMdd"); if (ar.Length > 1) { //res += " " + ar[1]; } } } else { res = SafeValue.SafeDate(par, new DateTime(1900, 1, 1)).ToString("yyyyMMdd HH:mm:ss"); } //throw new Exception("[" + par + "###" + res + "]"); return(res); }
protected void grid_CostDet_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { e.NewValues["ChgCode"] = SafeValue.SafeString(e.NewValues["ChgCode"]); e.NewValues["ChgCodeDes"] = SafeValue.SafeString(e.NewValues["ChgCodeDes"]); e.NewValues["Unit"] = SafeValue.SafeString(e.NewValues["Unit"]); e.NewValues["SaleQty"] = SafeValue.SafeDecimal(e.NewValues["SaleQty"], 1); e.NewValues["SalePrice"] = SafeValue.SafeDecimal(e.NewValues["SalePrice"], 0); e.NewValues["SaleCurrency"] = SafeValue.SafeString(e.NewValues["SaleCurrency"]); e.NewValues["SaleExRate"] = SafeValue.SafeDecimal(e.NewValues["SaleExRate"], 1); e.NewValues["Remark"] = SafeValue.SafeString(e.NewValues["Remark"]); e.NewValues["DocNo"] = SafeValue.SafeString(e.NewValues["DocNo"]); e.NewValues["Status2"] = SafeValue.SafeString(e.NewValues["Status2"]); e.NewValues["Status3"] = SafeValue.SafeString(e.NewValues["Status3"]); e.NewValues["Status4"] = SafeValue.SafeString(e.NewValues["Status4"]); e.NewValues["CostDate"] = SafeValue.SafeDate(e.NewValues["CostDate"], new DateTime(1753, 01, 01)); decimal amt = SafeValue.ChinaRound(SafeValue.SafeDecimal(e.NewValues["SaleQty"], 0) * SafeValue.SafeDecimal(e.NewValues["SalePrice"], 0), 2); decimal gstAmt = 0;//SafeValue.ChinaRound((amt * SafeValue.SafeDecimal(e.NewValues["Gst"], 0)), 2); decimal docAmt = amt + gstAmt; decimal locAmt = SafeValue.ChinaRound(docAmt * SafeValue.SafeDecimal(e.NewValues["SaleExRate"], 1), 2); e.NewValues["SaleDocAmt"] = locAmt; e.NewValues["RowUpdateUser"] = EzshipHelper.GetUserName(); e.NewValues["RowUpdateTime"] = DateTime.Now; }
protected void grid1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { e.NewValues["UpdateBy"] = HttpContext.Current.User.Identity.Name.ToUpper(); e.NewValues["UpdateDateTime"] = DateTime.Now; e.NewValues["BkgRefNo"] = SafeValue.SafeString(e.NewValues["BkgRefNo"]); e.NewValues["HblNo"] = SafeValue.SafeString(e.NewValues["HblNo"]); e.NewValues["CustomerId"] = SafeValue.SafeString(e.NewValues["CustomerId"]); e.NewValues["ShipperId"] = SafeValue.SafeString(e.NewValues["ShipperId"]); e.NewValues["ShipperName"] = SafeValue.SafeString(e.NewValues["ShipperName"]); e.NewValues["ShipperContact"] = SafeValue.SafeString(e.NewValues["ShipperContact"]); e.NewValues["ShipperFax"] = SafeValue.SafeString(e.NewValues["ShipperFax"]); e.NewValues["ShipperTel"] = SafeValue.SafeString(e.NewValues["ShipperTel"]); e.NewValues["ShipperEmail"] = SafeValue.SafeString(e.NewValues["ShipperEmail"]); e.NewValues["Pol"] = SafeValue.SafeString(e.NewValues["Pol"]); e.NewValues["PlaceLoadingName"] = SafeValue.SafeString(e.NewValues["PlaceLoadingName"]); e.NewValues["FrtTerm"] = SafeValue.SafeString(e.NewValues["FrtTerm"]); e.NewValues["Pod"] = SafeValue.SafeString(e.NewValues["Pod"]); e.NewValues["PlaceDischargeName"] = SafeValue.SafeString(e.NewValues["PlaceDischargeName"]); e.NewValues["PreCarriage"] = SafeValue.SafeString(e.NewValues["PreCarriage"]); e.NewValues["PlaceDeliveryId"] = SafeValue.SafeString(e.NewValues["PlaceDeliveryId"]); e.NewValues["PlaceDeliveryname"] = SafeValue.SafeString(e.NewValues["PlaceDeliveryname"]); e.NewValues["PlaceDeliveryTerm"] = SafeValue.SafeString(e.NewValues["PlaceDeliveryTerm"]); e.NewValues["PlaceReceiveId"] = SafeValue.SafeString(e.NewValues["PlaceReceiveId"]); e.NewValues["PlaceReceiveName"] = SafeValue.SafeString(e.NewValues["PlaceReceiveName"]); e.NewValues["PlaceReceiveTerm"] = SafeValue.SafeString(e.NewValues["PlaceReceiveTerm"]); e.NewValues["ShipOnBoardInd"] = SafeValue.SafeString(e.NewValues["ShipOnBoardInd"]); e.NewValues["ShipOnBoardDate"] = SafeValue.SafeDate(e.NewValues["ShipOnBoardDate"], new DateTime(1753, 01, 01)); e.NewValues["ExpressBl"] = SafeValue.SafeString(e.NewValues["ExpressBl"]); e.NewValues["CustRefNo"] = SafeValue.SafeString(e.NewValues["CustRefNo"]); e.NewValues["ServiceType"] = SafeValue.SafeString(e.NewValues["ServiceType"]); e.NewValues["SurrenderBl"] = SafeValue.SafeString(e.NewValues["SurrenderBl"]); e.NewValues["Note2"] = SafeValue.SafeString(e.NewValues["Note2"]); EzshipLog.Log(SafeValue.SafeString(e.NewValues["JobNo"]), SafeValue.SafeString(e.NewValues["JobNo"]), "Direct", "Update"); }
protected void ASPxGridView1_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { //string userId = HttpContext.Current.User.Identity.Name; e.NewValues["DoDateTime"] = SafeValue.SafeDate(e.NewValues["DoDateTime"], DateTime.Now); // e.NewValues["StatusCode"] = SafeValue.SafeString(e.NewValues["StatusCode"], "Pending"); //e.NewValues["SalesId"] = userId; }
protected void grid_Transport_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { if (SafeValue.SafeString(e.NewValues["VehicleCode"], "") == "") { throw new Exception("VehicleCode is request"); } e.NewValues["VehicleType"] = SafeValue.SafeString(e.NewValues["VehicleType"], ""); e.NewValues["VehicleStatus"] = SafeValue.SafeString(e.NewValues["VehicleStatus"], ""); e.NewValues["VeicleSize"] = SafeValue.SafeString(e.NewValues["VeicleSize"], ""); e.NewValues["VehicleUse"] = SafeValue.SafeString(e.NewValues["VehicleUse"], ""); e.NewValues["ContractNo"] = SafeValue.SafeString(e.NewValues["ContractNo"], ""); e.NewValues["ContractType"] = SafeValue.SafeString(e.NewValues["ContractType"], ""); e.NewValues["ContractDate"] = SafeValue.SafeDate(e.NewValues["ContractDate"], new DateTime(1753, 1, 1)); e.NewValues["ContractExpiryDate"] = SafeValue.SafeDate(e.NewValues["ContractExpiryDate"], new DateTime(1753, 1, 1)); e.NewValues["LicenseNo"] = SafeValue.SafeString(e.NewValues["LicenseNo"], ""); e.NewValues["LicenseExpiryDate"] = SafeValue.SafeDate(e.NewValues["LicenseExpiryDate"], new DateTime(1753, 1, 1)); e.NewValues["SupplierCode"] = SafeValue.SafeString(e.NewValues["SupplierCode"], ""); e.NewValues["Remark"] = SafeValue.SafeString(e.NewValues["Remark"], ""); e.NewValues["Date1"] = SafeValue.SafeDate(e.NewValues["Date1"], new DateTime(1990, 1, 1)); e.NewValues["Date2"] = SafeValue.SafeDate(e.NewValues["Date2"], new DateTime(1990, 1, 1)); e.NewValues["InsuranceExpiryDate"] = SafeValue.SafeDate(e.NewValues["InsuranceExpiryDate"], new DateTime(1753, 1, 1)); e.NewValues["RoadTaxExpiryDate"] = SafeValue.SafeDate(e.NewValues["RoadTaxExpiryDate"], new DateTime(1753, 1, 1)); e.NewValues["CraneLGCertExpiryDate"] = SafeValue.SafeDate(e.NewValues["CraneLGCertExpiryDate"], new DateTime(1753, 1, 1)); e.NewValues["CraneLHCertExpiryDate"] = SafeValue.SafeDate(e.NewValues["CraneLHCertExpiryDate"], new DateTime(1753, 1, 1)); e.NewValues["VpcExpiryDate"] = SafeValue.SafeDate(e.NewValues["VpcExpiryDate"], new DateTime(1753, 1, 1)); e.NewValues["LastInternalInspectionDate"] = SafeValue.SafeDate(e.NewValues["LastInternalInspectionDate"], new DateTime(1753, 1, 1)); }
protected void grid_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { e.NewValues["DocOwner"] = "CLM"; e.NewValues["DoType"] = "IN3"; e.NewValues["DocStatus"] = "Pending"; e.NewValues["DocDate"] = SafeValue.SafeDate(e.NewValues["DocDate"], DateTime.Now); if (S.Text(e.NewValues["DoType"]) == "OUT3") { string refNo = C2Setup.GetNextNo("", "CLM", S.Date(e.NewValues["DocDate"])); //SafeValue.SafeString(e.NewValues["RefNo"]); e.NewValues["BillNo"] = refNo; e.NewValues["DocNo"] = refNo; C2Setup.SetNextNo("", "CLM", refNo, S.Date(e.NewValues["DocDate"])); } else { e.NewValues["BillNo"] = S.Text(e.NewValues["BillNo"]); e.NewValues["DocNo"] = S.Text(e.NewValues["DocNo"]); } string gst = S.Text(e.NewValues["GstType"]); decimal qty = S.Decimal(e.NewValues["Qty"]); decimal price = S.Decimal(e.NewValues["Price"]); decimal tot = SafeValue.ChinaRound(qty * price, 2); decimal gstamt = 0; if (gst == "S") { gstamt = SafeValue.ChinaRound(tot * S.Decimal(0.07), 2); } tot += gstamt; e.NewValues["Qty"] = qty; e.NewValues["Price"] = price; e.NewValues["GstAmt"] = gstamt; e.NewValues["DocAmt"] = tot; }
protected void grid_Mcst_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { e.NewValues["UpdateBy"] = EzshipHelper.GetUserName(); e.NewValues["UpdateDateTime"] = DateTime.Now; e.NewValues["McstDate1"] = SafeValue.SafeDate(e.NewValues["McstDate1"], DateTime.Now); e.NewValues["McstDate2"] = SafeValue.SafeDate(e.NewValues["McstDate2"], DateTime.Now); e.NewValues["States"] = SafeValue.SafeString(e.NewValues["States"]); }
protected void grid_Log_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { e.NewValues["LogDate"] = SafeValue.SafeDate(e.NewValues["LogDate"], new DateTime(1753, 1, 1)); e.NewValues["LogTime"] = SafeValue.SafeString(e.NewValues["LogTime"], ""); e.NewValues["Remark"] = SafeValue.SafeString(e.NewValues["Remark"]); e.NewValues["UpdateBy"] = EzshipHelper.GetUserName(); e.NewValues["UpdateDateTime"] = DateTime.Now; }
protected void grid_Log_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { e.NewValues["LogDate"] = SafeValue.SafeDate(e.NewValues["LogDate"], new DateTime(1753, 1, 1)); e.NewValues["LogTime"] = SafeValue.SafeString(e.NewValues["LogTime"], ""); e.NewValues["CreateBy"] = HttpContext.Current.User.Identity.Name; e.NewValues["CreateDateTime"] = DateTime.Now; }
protected void grid_Transport_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { e.NewValues["VehicleNo"] = SafeValue.SafeString(e.NewValues["VehicleNo"], ""); e.NewValues["Note"] = SafeValue.SafeString(e.NewValues["Note"], ""); e.NewValues["CreateBy"] = SafeValue.SafeString(e.NewValues["CreateBy"], ""); e.NewValues["ReportDate"] = SafeValue.SafeDate(e.NewValues["ReportDate"], DateTime.Now); e.NewValues["Value"] = SafeValue.SafeDecimal(e.NewValues["Value"]); }
protected void btn_search_Click(object sender, EventArgs e) { DateTime dateFrom = SafeValue.SafeDate(search_dateFrom.Date, DateTime.Now); DateTime dateTo = SafeValue.SafeDate(search_dateTo.Date, DateTime.Now); string where = string.Format(@" datediff(day,FromDate,'{0}')<=0 and datediff(day,FromDate,'{1}')>=0", dateFrom, dateTo); if (search_jobNo.Text.Trim() != "") { string p0 = search_jobNo.Text.Trim(); string p1 = ""; string p2 = ""; foreach (char c in p0) { if (Char.IsLetter(c)) { p1 += c; } if (Char.IsNumber(c)) { p2 += c; } } where += string.Format(@" and JobNo like '{0}%{1}'", p1, p2); } if (search_containerNo.Text.Trim() != "") { where += string.Format(@" and ContainerNo like '{0}%'", search_containerNo.Text.Trim()); } string where_Status = ""; if (search_tripStatus1.Checked) { where_Status += (where_Status.Equals("") ? " " : " or ") + "Statuscode='P'"; } if (search_tripStatus2.Checked) { where_Status += (where_Status.Equals("") ? " " : " or ") + "Statuscode='S'"; } if (search_tripStatus3.Checked) { where_Status += (where_Status.Equals("") ? " " : " or ") + "Statuscode='C'"; } if (search_tripStatus4.Checked) { where_Status += (where_Status.Equals("") ? " " : " or ") + "Statuscode='X'"; } if (where_Status != "") { where_Status = " and (" + where_Status + ")"; where += where_Status; } string sql = string.Format(@"select * from ctm_jobdet2 where {0}", where); DataTable dt = ConnectSql.GetTab(sql); grid_Transport.DataSource = dt; grid_Transport.DataBind(); }
protected void grid_PayrollProcess_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { e.NewValues["ProcessModule"] = "HRS"; e.NewValues["ProcessType"] = "Payroll"; e.NewValues["ProcessDateTime"] = SafeValue.SafeDate(e.NewValues["ProcessDateTime"], DateTime.Now); e.NewValues["CreateBy"] = HttpContext.Current.User.Identity.Name; e.NewValues["CreateDateTime"] = DateTime.Now; }
protected void btn_Process_Command(object sender, CommandEventArgs e) { try { string sql = ""; string User = HttpContext.Current.User.Identity.Name; int id = SafeValue.SafeInt(e.CommandArgument, 0); DateTime processDate = new DateTime(1753, 1, 1); if (id > 0) { sql = string.Format("select ProcessDateTime from Ref_Process where Id='{0}'", id); processDate = SafeValue.SafeDate(C2.Manager.ORManager.ExecuteScalar(sql), new DateTime(1753, 1, 1)); } if (processDate.Year != 1753) { sql = "select count(id) from Hr_Person where Status='EMPLOYEE' and Id>0"; int total = SafeValue.SafeInt(C2.Manager.ORManager.ExecuteScalar(sql), 0); sql = string.Format(@" insert into Hr_Payroll(Person, FromDate, ToDate, StatusCode) select Id,CAST('{0}' AS DATETIME)-DAY(CAST('{0}' AS DATETIME))+1,DATEADD(MONTH, 1, CAST('{0}' AS DATETIME) - DAY(CAST('{0}' AS DATETIME)) + 1) - 1,'Draft' from Hr_Person WHERE Status='EMPLOYEE' AND Id>0", processDate); C2.Manager.ORManager.ExecuteCommand(sql); sql = string.Format(@"insert into Hr_PayrollDet(PayrollId, ChgCode, Amt) select PR.Id,QT.PayItem,QT.Amt from Hr_Person PS LEFT OUTER JOIN dbo.Hr_Quote QT ON QT.Person=PS.Id or QT.Person='0' LEFT OUTER JOIN dbo.Hr_Payroll PR ON PS.Id=PR.Person AND YEAR(PR.FromDate)=YEAR('{0}') AND MONTH(PR.FromDate)=MONTH('{0}') where PS.Status='EMPLOYEE' AND PS.Id>0", processDate); C2.Manager.ORManager.ExecuteCommand(sql); sql = string.Format(@" update Hr_Payroll SET Amt=det.Amt from (select SUM(Amt) AS Amt,PayrollId as id from Hr_PayrollDet group by PayrollId) as det where Hr_Payroll.Id=det.id AND YEAR(Hr_Payroll.FromDate)=YEAR('{0}') AND MONTH(Hr_Payroll.FromDate)=MONTH('{0}')", processDate); C2.Manager.ORManager.ExecuteCommand(sql); sql = string.Format("update Ref_Process set ProcessStatus='Closed',ProcessBy='{0}' where Id='{1}'", User, id); C2.Manager.ORManager.ExecuteCommand(sql); string script = string.Format("<script type='text/javascript' >alert('Success generates {0} employees payroll');</script>", total); Response.Clear(); Response.Write(script); btn_search_Click(null, null); } } catch (Exception) { //throw; string script = string.Format("<script type='text/javascript' >alert('Process failed ,please refresh and try again!');</script>"); Response.Clear(); Response.Write(script); } }
protected void gridPersonDet_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { e.NewValues["BeginDate"] = SafeValue.SafeDate(e.NewValues["BeginDate"], new DateTime(1753, 1, 1)); e.NewValues["ResignDate"] = SafeValue.SafeDate(e.NewValues["ResignDate"], new DateTime(1753, 1, 1)); e.NewValues["Remark"] = SafeValue.SafeString(e.NewValues["Remark"]); e.NewValues["UpdateBy"] = HttpContext.Current.User.Identity.Name; e.NewValues["UpdateDateTime"] = DateTime.Now; }
protected void grid_TripLog_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { e.NewValues["Driver"] = SafeValue.SafeString(e.NewValues["Driver"], ""); e.NewValues["Status"] = SafeValue.SafeString(e.NewValues["Status"], ""); e.NewValues["LogDate"] = SafeValue.SafeDate(e.NewValues["LogDate"], new DateTime(1753, 1, 1)); e.NewValues["LogTime"] = SafeValue.SafeString(e.NewValues["LogTime"], ""); e.NewValues["Remark"] = SafeValue.SafeString(e.NewValues["Remark"], ""); e.NewValues["UpdateBy"] = HttpContext.Current.User.Identity.Name; e.NewValues["UpdateDateTime"] = DateTime.Now; }
protected void grid_Comment_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { e.NewValues["Date"] = SafeValue.SafeDate(e.NewValues["Date"], DateTime.Now); ASPxTextBox id = this.grid.FindEditFormTemplateControl("txt_Id") as ASPxTextBox; e.NewValues["Person"] = SafeValue.SafeInt(id.Text, 0); e.NewValues["CreateBy"] = HttpContext.Current.User.Identity.Name; e.NewValues["CreateDateTime"] = DateTime.Now; }
protected void grid_Transport_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { e.NewValues["CreateDateTime"] = DateTime.Now; e.NewValues["ActionType"] = "Prime Mover Tyre"; e.NewValues["VehicleNo"] = SafeValue.SafeString(e.NewValues["VehicleNo"], ""); e.NewValues["Note"] = SafeValue.SafeString(e.NewValues["Note"], ""); e.NewValues["CreateBy"] = SafeValue.SafeString(e.NewValues["CreateBy"], ""); e.NewValues["ReportDate"] = SafeValue.SafeDate(e.NewValues["ReportDate"], DateTime.Now); e.NewValues["Description"] = SafeValue.SafeString(e.NewValues["Description"], ""); }
protected void grid_Trans_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { e.NewValues["Date1"] = SafeValue.SafeDate(e.NewValues["Date1"], DateTime.Now); e.NewValues["Date2"] = SafeValue.SafeDate(e.NewValues["Date2"], DateTime.Now); e.NewValues["Hrs"] = SafeValue.SafeString(e.NewValues["Hrs"]); e.NewValues["Pic"] = SafeValue.SafeString(e.NewValues["Pic"]); e.NewValues["Remark"] = SafeValue.SafeString(e.NewValues["Remark"]); e.NewValues["UpdateBy"] = HttpContext.Current.User.Identity.Name; e.NewValues["UpdateDateTime"] = DateTime.Now; }
protected void PayTab(int siId) { DevExpress.Web.ASPxTabControl.ASPxPageControl pageCtr = this.ASPxGridView1.FindEditFormTemplateControl("pageControl") as DevExpress.Web.ASPxTabControl.ASPxPageControl; ASPxGridView grd = pageCtr.FindControl("grid_PayDet") as ASPxGridView; DataTable tab_repDet = Helper.Sql.List(string.Format(@"SELECT mast.DocNo ,mast.DocDate, mast.DocType, det.LocAmt, det.DocAmt,mast.ExportInd FROM XAApPaymentDet AS det INNER JOIN XAApPayment AS mast ON det.PayId = mast.SequenceId WHERE (det.DocId = '{0}')and (det.DocType='PL' or det.DocType='SC' or det.DocType='SD')", siId)); DataTable tab = new DataTable(); tab.Columns.Add("SequenceId"); tab.Columns.Add("RepNo"); tab.Columns.Add("RepType"); tab.Columns.Add("RepDate"); tab.Columns.Add("DocAmt"); tab.Columns.Add("LocAmt"); tab.Columns.Add("PostInd"); for (int i = 0; i < tab_repDet.Rows.Count; i++) { DataRow row = tab.NewRow(); row["SequenceId"] = i; row["RepNo"] = tab_repDet.Rows[i]["DocNo"]; row["RepDate"] = SafeValue.SafeDate(tab_repDet.Rows[i]["DocDate"], new DateTime(1900, 1, 1)).ToString("dd/MM/yyyy"); row["RepType"] = tab_repDet.Rows[i]["DocType"]; row["DocAmt"] = tab_repDet.Rows[i]["DocAmt"]; row["LocAmt"] = tab_repDet.Rows[i]["LocAmt"]; //if (tab_repDet.Rows[i]["DocType"] == "SR") // row["LocAmt"] = tab_repDet.Rows[i]["mLocAmt"]; row["PostInd"] = tab_repDet.Rows[i]["ExportInd"]; tab.Rows.Add(row); } int cnt = tab.Rows.Count; //from receipt DataTable tab_repDet1 = Helper.Sql.List(string.Format(@"SELECT mast.DocNo, mast.DocType, mast.DocDate,det.DocAmt, det.LocAmt, mast.ExportInd FROM XAArReceiptDet AS det INNER JOIN XAArReceipt AS mast ON det.RepId = mast.SequenceId WHERE (det.DocId = '{0}')and (det.DocType='PL' or det.DocType='SC' or det.DocType='SD')", siId)); for (int i = 0; i < tab_repDet1.Rows.Count; i++) { DataRow row = tab.NewRow(); row["SequenceId"] = cnt + i; row["RepNo"] = tab_repDet1.Rows[i]["DocNo"]; row["RepDate"] = SafeValue.SafeDate(tab_repDet1.Rows[i]["DocDate"], new DateTime(1900, 1, 1)).ToString("dd/MM/yyyy"); row["RepType"] = tab_repDet1.Rows[i]["DocType"]; row["DocAmt"] = tab_repDet1.Rows[i]["DocAmt"]; row["LocAmt"] = tab_repDet1.Rows[i]["LocAmt"]; row["PostInd"] = tab_repDet1.Rows[i]["ExportInd"]; tab.Rows.Add(row); } grd.DataSource = tab; grd.DataBind(); }
protected void gv_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { e.NewValues["CreateBy"] = SafeValue.SafeString(e.NewValues["CreateBy"]); e.NewValues["CreateDateTime"] = SafeValue.SafeDate(e.NewValues["CreateDateTime"], DateTime.Today); e.NewValues["Price"] = SafeValue.SafeDecimal(e.NewValues["Price"]); e.NewValues["CustomerId"] = SafeValue.SafeString(e.NewValues["CustomerId"]); e.NewValues["CustomerName"] = SafeValue.SafeString(e.NewValues["CustomerName"]); e.NewValues["Code"] = SafeValue.SafeString(e.NewValues["Code"]); e.NewValues["Description"] = SafeValue.SafeString(e.NewValues["Description"]); e.NewValues["LoadedTime"] = SafeValue.SafeDate(e.NewValues["LoadedTime"], DateTime.Today); }