private void Foreign() { HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory(); TrafficCondition = "([Traffic_T].[NumberPlate_nvc]= '" + NumberPlate + "') AND ([Traffic_T].[SerialPlate_nvc]=" + SerialPlate + ")"; List <HPS.BLL.TrafficBLL.BLLTraffic_T> TrafficList = TrafficFactory.GetAllByCondition(TrafficCondition); if (TrafficList != null && TrafficList.Count > 0 && TrafficList[TrafficList.Count - 1].In_bit == true) { this.TrafficFields(); } }
private void LoadWithoutDriverCardNumber() { HPS.BLL.DriverSpecificationBLL.BLLDriverSpecification_TFactory DriverSpecificationFactory = new HPS.BLL.DriverSpecificationBLL.BLLDriverSpecification_TFactory(); DataTable DriverFieldTable = new DataTable(); DriverSpecificationFactory.SelectByDriverField(_FirstName, _LastName, _NationalCode, ref DriverFieldTable); if (DriverFieldTable != null && DriverFieldTable.Rows.Count > 0) { _DriverSpecificationID = (Int32)DriverFieldTable.Rows[0]["DriverSpecificationID_int"]; Key = new HPS.BLL.DriverSpecificationBLL.BLLDriverSpecification_TKeys(); Key.DriverSpecificationID_int = _DriverSpecificationID; DriverCardNumber_nvcTextBox.Text = DriverFieldTable.Rows[0]["DriverCardNumber_nvc"].ToString(); FirstName_nvcTextBox.Text = DriverFieldTable.Rows[0]["FirstName_nvc"].ToString(); LastName_nvcTextBox.Text = DriverFieldTable.Rows[0]["LastName_nvc"].ToString(); NationalCode_intNumericTextBox.Text = DriverFieldTable.Rows[0]["NationalCode_int"].ToString(); licenceNumber_nvcTextBox.Text = DriverFieldTable.Rows[0]["licenceNumber_nvc"].ToString(); LicenceEnd_nvcTextBox.Text = DriverFieldTable.Rows[0]["LicenceEnd_nvc"].ToString(); CarExaminationEndDate_nvcTextBox.Text = DriverFieldTable.Rows[0]["CarExaminationEndDate_nvc"].ToString(); InsuranceEndDate_nvcTextBox.Text = DriverFieldTable.Rows[0]["InsuranceEndDate_nvc"].ToString(); ClassID_intComboBox.SelectedValue = DriverFieldTable.Rows[0]["ClassID_int"]; HealthCardEndDate_nvcTextBox.Text = DriverFieldTable.Rows[0]["HealthCardEndDate_nvc"].ToString(); DriverCardSharjeEndDate_nvcTextBox.Text = DriverFieldTable.Rows[0]["DriverCardSharjeEndDate_nvc"].ToString(); } else { HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory(); string Condition = "Traffic_T.FirstName_nvc=N'" + _FirstName + "' AND Traffic_T.LastName_nvc=N'" + _LastName + "' AND Traffic_T.NationalCode_int='" + _NationalCode + "'"; List <HPS.BLL.TrafficBLL.BLLTraffic_T> TrafficList = TrafficFactory.GetAllByCondition(Condition); if (TrafficList != null && TrafficList.Count > 0) { DriverCardNumber_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].DriverCardNumber_nvc; FirstName_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].FirstName_nvc; LastName_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].LastName_nvc; NationalCode_intNumericTextBox.Text = Convert.ToString(TrafficList[TrafficList.Count - 1].NationalCode_int); licenceNumber_nvcTextBox.Text = Convert.ToString(TrafficList[TrafficList.Count - 1].licenceNumber_int); } else { HPS.BLL.DriverBLL.BLLDriver_TFactory DriverFactory = new HPS.BLL.DriverBLL.BLLDriver_TFactory(); List <HPS.BLL.DriverBLL.BLLDriver_T> DriverList = DriverFactory.GetAllBy(HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.DriverCardNumber_nvc, _DriverCardNumber); if (DriverList != null && DriverList.Count > 0) { DriverCardNumber_nvcTextBox.Text = DriverList[0].DriverCardNumber_nvc; FirstName_nvcTextBox.Text = DriverList[0].FirstName_nvc; LastName_nvcTextBox.Text = DriverList[0].LastName_nvc; NationalCode_intNumericTextBox.Text = Convert.ToString(DriverList[0].NationalCode_int); licenceNumber_nvcTextBox.Text = Convert.ToString(DriverList[0].licenceNumber_nvc); } } } }
private void Iranian() { HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory(); if (PlateCityID == null || NumberPlate == null) { Hepsa.Core.Common.MessageBox.ErrorMessage("شماره پلاک یا محل شماره گذاری وارد نشده است"); } else { TrafficCondition = "([Traffic_T].[NumberPlate_nvc]= N'" + NumberPlate + "') AND ([Traffic_T].[PlateCityID_int]=" + (Int32?)PlateCityID + ")"; List <HPS.BLL.TrafficBLL.BLLTraffic_T> TrafficList = TrafficFactory.GetAllByCondition(TrafficCondition); if (TrafficList != null && TrafficList.Count > 0 && TrafficList[TrafficList.Count - 1].In_bit == true) { this.TrafficFields(); } } }
private void TrafficFields() { TrafficList = TrafficFactory.GetAllByCondition(TrafficCondition); if (TrafficList != null && TrafficList.Count > 0 && TrafficList[TrafficList.Count - 1].In_bit == true) { CarCardNumber_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].CarCardNumber_nvc; SavedCarCardDate_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].CarCardDate_nvc; SavedPlateType_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].PlateType_nvc; SavedNumberPlate_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].NumberPlate_nvc; SavedSerialPlate_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].SerialPlate_nvc; HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory PlateCityFactory = new HPS.BLL.PlateCityBLL.BLLPlateCity_TFactory(); string PlateCityCondition = "[PlateCity_T].[PlateCityID_int] = '" + TrafficList[TrafficList.Count - 1].PlateCityID_int + "'"; List <HPS.BLL.PlateCityBLL.BLLPlateCity_T> PlateCityList = PlateCityFactory.GetAllByCondition(PlateCityCondition); if (PlateCityList != null) { SavedPlateCityID_inttextBox.Text = PlateCityList[0].PlateCity_nvc; } HPS.BLL.ColorBLL.BLLColor_TFactory ColorFactory = new HPS.BLL.ColorBLL.BLLColor_TFactory(); string ColorCondition = "[Color_T].[ColorID_int] = '" + TrafficList[TrafficList.Count - 1].PlateColorID_int + "'"; List <HPS.BLL.ColorBLL.BLLColor_T> ColorList = ColorFactory.GetAllByCondition(ColorCondition); if (ColorList != null && ColorList.Count > 0) { SavedPlateColorID_inttextBox.Text = ColorList[0].Color_nvc; } SavedCountryID_inttextBox.Text = TrafficList[TrafficList.Count - 1].Country_nvc; SavedYearType_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].YearType_nvc; SavedProductionYear_intNumericTextBox.Text = TrafficList[TrafficList.Count - 1].ProductionYear_int.Value.ToString(); HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory LaderTypeFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory(); string LaderTypecondition = "[LaderType_T].[LaderTypeID_int] = '" + TrafficList[TrafficList.Count - 1].LaderTypeID_int + "'"; List <HPS.BLL.LaderTypeBLL.BLLLaderType_T> LaderTypeList = LaderTypeFactory.GetAllByCondition(LaderTypecondition); if (LaderTypeList != null) { SavedLaderType_nvctextBox.Text = LaderTypeList[0].LaderType_nvc; } SavedLaderTypeCode_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].LaderTypeCode_nvc; SavedSystemCode_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].SystemCode_nvc; SavedSystem_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].System_nvc; SavedCapacity_intNumericTextBox.Text = TrafficList[TrafficList.Count - 1].Capacity_flt.Value.ToString(); } else { Hepsa.Core.Common.MessageBox.ErrorMessage(string.Format(HPS.Exceptions.ExceptionCs.RecordNotFound, "ترددی با این مشخصات")); } }
private void TrafficFields() { try { HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory(); string TrafficCondition = "[Traffic_T].[NationalCode_int]= '" + NationCode + "'"; List <HPS.BLL.TrafficBLL.BLLTraffic_T> TrafficList = TrafficFactory.GetAllByCondition(TrafficCondition); if (TrafficList != null && TrafficList.Count > 0 && TrafficList[TrafficList.Count - 1].In_bit == true) { SavedFirstName_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].FirstName_nvc; SavedLastName_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].LastName_nvc; SavedDriverCardDate_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].DriverCardDate_nvc; SavedDriverType_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].DriverType_nvc; SavedInsuranceNumber_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].InsuranceNumber_nvc; HPS.BLL.CityBLL.BLLCity_TFactory CityFactory = new HPS.BLL.CityBLL.BLLCity_TFactory(); string CityCondition = "[City_T].[CityID_int] = '" + TrafficList[TrafficList.Count - 1].CityID_int + "'"; List <HPS.BLL.CityBLL.BLLCity_T> CityList = CityFactory.GetAllByCondition(CityCondition); if (CityList != null && CityList.Count > 0) { SavedDriverCity_nvcTextBox.Text = CityList[0].City_nvc; } SavedlicenceNumber_intNumericTextBox.Text = TrafficList[TrafficList.Count - 1].licenceNumber_int.ToString(); string LicenceCityCondition = "[City_T].[CityID_int] = '" + TrafficList[TrafficList.Count - 1].LicenceCityID_int.ToString() + "'"; List <HPS.BLL.CityBLL.BLLCity_T> LicenceCityList = CityFactory.GetAllByCondition(LicenceCityCondition); if (LicenceCityList != null && LicenceCityList.Count > 0) { SavedLicenceCity_nvcTextBox.Text = LicenceCityList[0].City_nvc; } SavedLicenceType_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].LicenceType_nvc; SavedLiceniceDate_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].LiceniceDate_nvc; SavedActivityScope_nvcTextBox.Text = TrafficList[TrafficList.Count - 1].ActivityScope_nvc; SavedNationalCode_intNumericTextBox.Text = TrafficList[TrafficList.Count - 1].NationalCode_int.ToString(); } } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
public IranianInNotOutTrafficReport(string FromDate, string ToDate, int TrafficType, int?PivotGroupID, int?ServicesID) { // // Required for Windows Form Designer support // InitializeComponent(); FromDatetxt.Text = FromDate; ToDatetxt.Text = ToDate; HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory(); DataTable TrafficDataTable = new DataTable(); string Condition = string.Empty; if (ServicesID.HasValue) { if (PivotGroupID.HasValue) { Condition = String.Format("(T1.TrafficTypeID_int='1') AND (T1.Date_nvc>='{0}') AND (T1.Date_nvc<='{1}') AND (LaderPivotGroup_T.LaderPivotGroupID_int={2}) AND (T1.ServiceID_int={3})", FromDate, ToDate, PivotGroupID, ServicesID); } else { Condition = String.Format("(T1.TrafficTypeID_int='1') AND (T1.Date_nvc>='{0}') AND (T1.Date_nvc<='{1}') AND (T1.ServiceID_int={2})", FromDate, ToDate, ServicesID); } } else { if (PivotGroupID.HasValue) { Condition = String.Format("(T1.TrafficTypeID_int='1') AND (T1.Date_nvc>='{0}') AND (T1.Date_nvc<='{1}') AND (LaderPivotGroup_T.LaderPivotGroupID_int={2})", FromDate, ToDate, PivotGroupID); } else { Condition = String.Format("(T1.TrafficTypeID_int='1') AND (T1.Date_nvc>='{0}') AND (T1.Date_nvc<='{1}')", FromDate, ToDate); } } TrafficFactory.GetAllByConditionAllInTrafficNotTemporaryOut(Condition, ref TrafficDataTable); TrafficDataTable.Columns.Add(new DataColumn("AllPayment_dec", typeof(decimal))); TrafficDataTable.Columns.Add(new DataColumn("Remained_dec", typeof(decimal))); HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory LaderTypeFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory(); HPS.BLL.LaderTypeBLL.BLLLaderType_TKeys LaderTypeKey = new HPS.BLL.LaderTypeBLL.BLLLaderType_TKeys(); string stopFeeCondition = string.Empty; var stopFeeFactory = new BLL.StopFeeBLL.BLLStopFee_TFactory(); BLL.StopFeeBLL.BLLStopFee_T oldStopFeeEntity = null; BLL.StopFeeBLL.BLLStopFee_TKeys stopFeeKey = null; BLL.LaderTypeBLL.BLLLaderType_T laderTypeEntity = null; HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory(); DataTable TrafficInWithladBillDataTable = null; DataTable TrafficInDatatable = null; HPS.BLL.SettingsBLL.BLLSetting_TFactory settingsFactory = new HPS.BLL.SettingsBLL.BLLSetting_TFactory(); HPS.BLL.SettingsBLL.BLLSetting_TKeys SettingKey = null; HPS.BLL.SettingsBLL.BLLSetting_T TurnHourSettingEntity = null; HPS.BLL.SettingsBLL.BLLSetting_T SettingEntity = null; foreach (DataRow row in TrafficDataTable.Rows) { DataTable LaderTypeDataTable = new DataTable(); try { oldStopFeeEntity = new BLL.StopFeeBLL.BLLStopFee_T(); stopFeeKey = new BLL.StopFeeBLL.BLLStopFee_TKeys(); stopFeeKey.StopFeeID_int = Convert.ToInt32(row["StopFeeID_int"]); oldStopFeeEntity = stopFeeFactory.GetBy(stopFeeKey); if ((Int32)row["TrafficTypeID_int"] == 1) { laderTypeEntity = new BLL.LaderTypeBLL.BLLLaderType_T(); LaderTypeKey.LaderTypeID_int = Convert.ToInt32(row["LaderTypeID_int"]); laderTypeEntity = LaderTypeFactory.GetBy(LaderTypeKey); stopFeeCondition = string.Format(" StartDate_nvc>'{0}' AND StopFee_T.TrafficTypeID_int={1} AND StopFee_T.ServicesID_int={2} AND StopFee_T.LaderPivotGroupID_int={3}", oldStopFeeEntity.EndDate_nvc, Convert.ToInt32(row["TrafficTypeID_int"]), Convert.ToInt32(row["ServiceID_int"]), laderTypeEntity.LaderPivotGroupID_int); } else { stopFeeCondition = string.Format(" StartDate_nvc>'{0}' AND StopFee_T.TrafficTypeID_int={1}", oldStopFeeEntity.StartDate_nvc, Convert.ToInt32(row["TrafficTypeID_int"])); } var newStopFeeTable = new DataTable(); stopFeeFactory.GetAllByCondition(stopFeeCondition, ref newStopFeeTable); Hepsa.Core.Common.MyDateTime InDateTime = new Hepsa.Core.Common.MyDateTime(row["Date_nvc"].ToString()); Hepsa.Core.Common.MyDateTime OutDateTime = new Hepsa.Core.Common.MyDateTime(TrafficFactory.ServerJalaliDate); string InDate = InDateTime.MyDate.ToString("yyyy/MM/dd"); //+ " " + InTime_nvcTextBox.Text; string OutDate = OutDateTime.MyDate.ToString("yyyy/MM/dd"); // + " " + Time_nvcTextBox.Text; if (InDate.Length == 16) { InDate += ":00"; } else if (InDate.Length > 19) { InDate = InDate.Substring(0, 19); } if (OutDate.Length == 16) { OutDate += ":00"; } else if (OutDate.Length > 19) { OutDate = OutDate.Substring(0, 19); } decimal Price = Convert.ToDecimal(row["Fee_dec"]); if (Convert.ToInt32(row["ServiceID_int"]) == 2) { Price = row["Fee_dec"] != null?Convert.ToInt32(row["Fee_dec"]) : 0; } string incondition = "Traffic_T.TrafficNumber_bint='" + row["TrafficNumber_bint"].ToString() + "'"; Condition = string.Format("Traffic_T.TurnNumber_bint='{0}' And Traffic_T.TrafficNumber_bint<>{1}", row["TurnNumber_bint"], row["TrafficNumber_bint"].ToString()); TrafficInWithladBillDataTable = new DataTable(); LadBillFactory.GetAllWithTrafficLadBillCreditByConditon(incondition, ref TrafficInWithladBillDataTable); TrafficInDatatable = new DataTable(); TrafficFactory.GetAllByCondition(Condition, ref TrafficInDatatable); SettingKey = new HPS.BLL.SettingsBLL.BLLSetting_TKeys(); SettingKey.SettingID_int = 1002; TurnHourSettingEntity = settingsFactory.GetBy(SettingKey); if (TrafficInDatatable.Rows.Count > 0) { DateTime TrafficDate = DateTime.Parse((new Hepsa.Core.Common.MyDateTime(TrafficInDatatable.Rows[0]["Date_nvc"].ToString())).MyDate.ToString("yyyy/MM/dd") + " " + TrafficInDatatable.Rows[0]["Time_nvc"].ToString()); Int32 Allowablehour = Convert.ToInt32(TurnHourSettingEntity.Value_nvc); if (TrafficFactory.ServerDate <= TrafficDate.AddHours(Allowablehour)) { if (TrafficInWithladBillDataTable.Rows.Count == 0) { Price = 0; } } } decimal Balanced = 0; TimeSpan ts = new TimeSpan(); if (newStopFeeTable != null && newStopFeeTable.Rows.Count > 0) { //Hepsa.Core.Common.MyDateTime stopFeeMiladiEndDate_nvc = new Hepsa.Core.Common.MyDateTime(newStopFeeTable.Rows[0]["EndDate_nvc"].ToString()); //string stopFeeEndDate_nvc = stopFeeMiladiEndDate_nvc.MyDate.ToString("yyyy/MM/dd"); Hepsa.Core.Common.MyDateTime stopFeeMiladiEndDate_nvc = new Hepsa.Core.Common.MyDateTime(oldStopFeeEntity.EndDate_nvc); string stopFeeEndDate_nvc = stopFeeMiladiEndDate_nvc.MyDate.ToString("yyyy/MM/dd"); ts = DateTime.Parse(stopFeeEndDate_nvc).Subtract(DateTime.Parse(InDate)); if (Convert.ToBoolean(row["TurnAccepted_bit"]) == true) { double ExtraHour = ts.TotalHours; SettingEntity = new HPS.BLL.SettingsBLL.BLLSetting_T(); SettingKey.SettingID_int = 1002; SettingEntity = settingsFactory.GetBy(SettingKey); ExtraHour -= Convert.ToDouble(SettingEntity.Value_nvc); if (ExtraHour > 0) { ///محاسبه مازاد بر اساس قیمت قبلی از ورود تا شروع قیمت جدید int days = (int)(ExtraHour / Convert.ToInt32(row["ExtraHour_int"])); Price += Math.Floor(((decimal)(days)) * Convert.ToDecimal(row["ExtraHourFee_dec"])); } Hepsa.Core.Common.MyDateTime stopFeeMiladiStartDate_nvc = new Hepsa.Core.Common.MyDateTime(newStopFeeTable.Rows[0]["StartDate_nvc"].ToString()); string newStopFeeStartDate_nvc = stopFeeMiladiStartDate_nvc.MyDate.ToString("yyyy/MM/dd"); TimeSpan ExtaTS = DateTime.Parse(newStopFeeStartDate_nvc).Subtract(DateTime.Parse(InDate)); double ExtraExtraHour = ExtaTS.TotalHours; if (ExtraExtraHour < Convert.ToDouble(SettingEntity.Value_nvc)) { ///محاسبه مازاد از شروع تاریخ قیمت جدید تا تاریخ خروج if (ExtraHour >= 0) { ts = DateTime.Parse(OutDate).AddDays(1).Subtract(DateTime.Parse(InDate)); } else { ts = DateTime.Parse(OutDate).Subtract(DateTime.Parse(InDate)); } ExtraHour = ts.TotalHours - Convert.ToDouble(SettingEntity.Value_nvc); if (ExtraHour >= 0) { Int32 days = Convert.ToInt32((ExtraHour / Convert.ToInt32(newStopFeeTable.Rows[0]["ExtraHour_int"]))); Price += Math.Floor((Convert.ToDecimal((days)) * Convert.ToDecimal(newStopFeeTable.Rows[0]["ExtraHourFee_dec"]))); } } else { ///محاسبه مازاد از شروع تاریخ قیمت جدید تا تاریخ خروج //Hepsa.Core.Common.MyDateTime stopFeeMiladiStartDate_nvc = new Hepsa.Core.Common.MyDateTime(newStopFeeTable.Rows[0]["StartDate_nvc"].ToString()); //string newStopFeeStartDate_nvc = stopFeeMiladiStartDate_nvc.MyDate.ToString("yyyy/MM/dd"); //ts = DateTime.Parse(OutDate).AddDays(1).Subtract(DateTime.Parse(newStopFeeStartDate_nvc)); if (ExtraHour > 0) { ts = DateTime.Parse(OutDate).AddDays(1).Subtract(DateTime.Parse(newStopFeeStartDate_nvc)); } else { ts = DateTime.Parse(OutDate).Subtract(DateTime.Parse(newStopFeeStartDate_nvc)); } ExtraHour = ts.TotalHours; if (ExtraHour > 0) { Int32 days = Convert.ToInt32((ExtraHour / Convert.ToInt32(newStopFeeTable.Rows[0]["ExtraHour_int"]))); Price += Math.Floor((Convert.ToDecimal((days)) * Convert.ToDecimal(newStopFeeTable.Rows[0]["ExtraHourFee_dec"]))); } } } else { if (Convert.ToDecimal(row["ExtraHourFee_dec"]) != 0) { ///محاسبه مازاد بر اساس قیمت قبلی از ورود تا شروع قیمت جدید double ExtraHour = ts.TotalHours - Convert.ToDouble(row["AllowableHour_int"]); int days = Convert.ToInt32((ExtraHour / Convert.ToInt32(row["ExtraHour_int"]))); Price += Math.Floor(((decimal)(days)) * Convert.ToDecimal(row["ExtraHourFee_dec"])); ///محاسبه مازاد از شروع تاریخ قیمت جدید تا تاریخ خروج Hepsa.Core.Common.MyDateTime stopFeeMiladiStartDate_nvc = new Hepsa.Core.Common.MyDateTime(newStopFeeTable.Rows[0]["StartDate_nvc"].ToString()); string newStopFeeStartDate_nvc = stopFeeMiladiStartDate_nvc.MyDate.ToString("yyyy/MM/dd"); ts = DateTime.Parse(OutDate).AddDays(1).Subtract(DateTime.Parse(newStopFeeStartDate_nvc)); ExtraHour = ts.TotalHours; days = (int)(ExtraHour / (int)newStopFeeTable.Rows[0]["ExtraHour_int"]); Price += Math.Floor(((decimal)(days)) * Convert.ToDecimal(newStopFeeTable.Rows[0]["ExtraHourFee_dec"])); } } } else { ts = DateTime.Parse(OutDate).Subtract(DateTime.Parse(InDate)); if (ts.TotalHours > Convert.ToInt32(row["AllowableHour_int"])) { if (Convert.ToBoolean(row["TurnAccepted_bit"]) == true) { double ExtraHour = ts.TotalHours; SettingEntity = new BLL.SettingsBLL.BLLSetting_T(); SettingKey.SettingID_int = 1002; SettingEntity = settingsFactory.GetBy(SettingKey); ExtraHour -= Convert.ToDouble(SettingEntity.Value_nvc); if (ExtraHour > 0) { int days = (int)(ExtraHour / Convert.ToInt32(row["ExtraHour_int"])); Price += Math.Floor(((decimal)(days)) * Convert.ToDecimal(row["ExtraHourFee_dec"])); } //else //{ // Price = 0; //} } else { if (Convert.ToDecimal(row["ExtraHourFee_dec"]) != 0) { double ExtraHour = ts.TotalHours - Convert.ToDouble(row["AllowableHour_int"]); int days = (int)(ExtraHour / Convert.ToInt32(row["ExtraHour_int"])); Price += Math.Floor(((decimal)(days)) * Convert.ToDecimal(row["ExtraHourFee_dec"])); } } } } row["AllPayment_dec"] = Convert.ToString(Price);//+ Balanced if (Price == Balanced) { row["Remained_dec"] = "0"; } else { row["Remained_dec"] = Price - Convert.ToDecimal(row["Price_dec"]);// } if ((Price - Balanced) < 0) { row["Remained_dec"] = Convert.ToDecimal(row["Price_dec"]); } } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } } //AllPayment_dec DataSource = TrafficDataTable; Datetxt.DataField = "Date_nvc"; Timetxt.DataField = "Time_nvc"; TurnNumbertxt.DataField = "TurnNumber_bint"; TrafficNumbertxt.DataField = "TrafficNumber_bint"; NumberPlateTextBox.DataField = "NumberPlate_nvc"; PlateCitytxt.DataField = "PlateCityID_intPlateCity_nvc"; SerialPlateTextBox.DataField = "SerialPlate_nvc"; CarCardNumbertxt.DataField = "CarCardNumber_nvc"; DriverCardNumbertxt.DataField = "DriverCardNumber_nvc"; Pricetxt.DataField = "Price_dec"; Usertxt.DataField = "UserName_nvc"; LastNametxt.DataField = "FullName_nvc"; TurnAcceptedchk.DataField = "TurnAccepted_bit"; ServiceType_nvctxt.DataField = "ServiceID_intServiceType_nvc"; DriverCardNumbertxt.DataField = "DriverInfraction_nvc"; CarInfractiontxt.DataField = "CarInfraction_nvc"; payment_dectxt.DataField = "AllPayment_dec"; remained_dectxt.DataField = "Remained_dec"; DateTextBox.Text = TrafficFactory.ServerJalaliDate; TimeTextBox.Text = TrafficFactory.ServerTime; UserNameTextBox.Text = HPS.Common.CurrentUser.user.UserName_nvc; decimal?AllPrice = (from row in TrafficDataTable.AsEnumerable() select(decimal?) row["Price_dec"]).Sum(); AllPricetxt.Text = AllPrice.HasValue ? AllPrice.ToString() : "0"; decimal?AllPayment_dec = (from row in TrafficDataTable.AsEnumerable() select(decimal?) row["AllPayment_dec"]).Sum(); allPayment_dectxt.Text = AllPayment_dec.HasValue ? AllPayment_dec.ToString() : "0"; decimal?AllRemained_dec = (from row in TrafficDataTable.AsEnumerable() select(decimal?) row["Remained_dec"]).Sum(); allRemained_dectxt.Text = AllRemained_dec.HasValue ? AllRemained_dec.ToString() : "0"; }
private void SaveButton_Click(object sender, EventArgs e) { HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillCreditFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory(); HPS.BLL.LadBillCreditCancelCommentBLL.BLLLadBillCreditCancelComment_TFactory LadBillCreditCancelCommentFactory = new HPS.BLL.LadBillCreditCancelCommentBLL.BLLLadBillCreditCancelComment_TFactory(); try { if (LadBillCreditCancelCommentID_intCheckedListBox.CheckedItems.Count == 0) { throw new ApplicationException("توضیحات ابطال مجوز انتخاب نشده است"); } HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_T LadBillCreditEntity = LadBillCreditFactory.GetBy(this._Key); HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory(); if (LadBillCreditEntity == null) { throw new HPS.Exceptions.LadBillCreditNotFound(); } LadBillCreditEntity.Canceled_bit = true; LadBillCreditEntity.CanceledComment_nvc = this.LadBillCreditCancelComment_nvcTextBox.Text; LadBillCreditEntity.CanceledDate_nvc = LadBillCreditFactory.ServerJalaliDate; LadBillCreditEntity.CanceledTime_nvc = LadBillCreditFactory.ServerTime; LadBillCreditEntity.CanceledUserName_nvc = HPS.Common.CurrentUser.user.UserName_nvc; if (TurnLeftRadioButton.Checked == true) { LadBillCreditEntity.Turn_bit = true; } else if (TurnCancelRadioButton.Checked == true) { LadBillCreditEntity.Turn_bit = false; } if (LadBillCreditEntity.Turn_bit.HasValue == false) { throw new ApplicationException("وضعیت نوبت را تعیین نمایید "); } if (LadeAssignmentLeftradioButton.Checked == false && LadeAssginmentCancelradioButton.Checked == false && OtherRemainedCancelRadioButton.Checked == false) { throw new ApplicationException("وضعیت اطلاع رسانی را تعیین نمایید "); } string strSelect = string.Format("TrafficID_bint='{0}'", _TrafficKey.TrafficID_bint); DataRow[] drSelect = _dataTable.Select(strSelect); DataTable TrafficStatusDataTable = new DataTable(); if (drSelect != null && drSelect.Length > 0) { LadBillCreditFactory.GetLastStatusForCancelLadBillCredit((string)Hepsa.Core.Common.PersentationController.GetEntityValue(drSelect[0]["NumberPlate_nvc"], TypeCode.String), (string)Hepsa.Core.Common.PersentationController.GetEntityValue(drSelect[0]["SerialPlate_nvc"], TypeCode.String), (string)Hepsa.Core.Common.PersentationController.GetEntityValue(drSelect[0]["CarCardNumber_nvc"], TypeCode.String), TrafficStatusDataTable); } if (TrafficStatusDataTable != null && TrafficStatusDataTable.Rows.Count > 0) { bool? HasTurn_bit = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["HasTurn_bit"], TypeCode.Boolean); bool? TurnReturn_bit = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["TurnReturn_bit"], TypeCode.Boolean); bool? TurnCanceled_bit = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["TurnCanceled_bit"], TypeCode.Boolean); bool? HasLadBillCredit_bit = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["HasLadBillCredit_bit"], TypeCode.Boolean); bool? LadBillCreditCancel_bit = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["LadBillCreditCancel_bit"], TypeCode.Boolean); bool? LadBillCreditTurn_bit = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["LadBillCreditTurn_bit"], TypeCode.Boolean); bool? TurnAccepted_bit = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["TurnAccepted_bit"], TypeCode.Boolean); Int64?AcceptedTurnNumber_bint = (Int64?)Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficStatusDataTable.Rows[0]["AcceptedTurnNumber_bint"], TypeCode.Int64); // DateTime TrafficDate = DateTime.Parse((new Hepsa.Core.Common.MyDateTime(TrafficEntity.Date_nvc)).MyDate.ToString("yyyy/MM/dd") + " " + TrafficEntity.Time_nvc); #region Conditions if ((Int32)drSelect[0]["ServiceID_int"] == 2) { if (TrafficStatusDataTable != null && TrafficStatusDataTable.Rows.Count > 0) { if (HasTurn_bit.HasValue == false || HasTurn_bit == true) { if (TurnAccepted_bit.HasValue && TurnAccepted_bit == true) { if (TurnCanceled_bit.HasValue && TurnCanceled_bit == true) { throw new ApplicationException("این نوبت باطل شده است"); } else { if (HasLadBillCredit_bit.HasValue && HasLadBillCredit_bit == true) { if (LadBillCreditCancel_bit.HasValue && LadBillCreditCancel_bit == false) { if (LadBillCreditTurn_bit.HasValue && LadBillCreditTurn_bit == true) { //محاسبه مدت مجاز سفر DateTime NowDate = DateTime.Parse((new Hepsa.Core.Common.MyDateTime(TrafficFactory.ServerJalaliDate)).MyDate.ToString("yyyy/MM/dd") + " " + TrafficFactory.ServerTime); DataTable TrafficDataTable = new DataTable(); if (TrafficDataTable != null && TrafficDataTable.Rows.Count > 0) { Int32 _CityTravelHour = 0; if (!string.IsNullOrEmpty(TrafficDataTable.Rows[0]["TravelTime_int"].ToString())) { _CityTravelHour = Convert.ToInt32(TrafficDataTable.Rows[0]["TravelTime_int"].ToString()); } /////////////// string _OutDate = TrafficDataTable.Rows[0]["Date_nvc"].ToString(); string _OutTime = TrafficDataTable.Rows[0]["Time_nvc"].ToString(); DateTime OutDate = DateTime.Parse((new Hepsa.Core.Common.MyDateTime(_OutDate)).MyDate.ToString("yyyy/MM/dd") + " " + _OutTime); if (TrafficDataTable.Rows[0]["Out_bit"].ToString() == "False") { TimeSpan date = NowDate - OutDate; if (date.TotalHours < _CityTravelHour) { throw new ApplicationException("مدت مجاز سفر برای این کامیون تمام نشده است و امکان ادامه عملیات ممکن نیست"); } } } } else { if (TurnLeftRadioButton.Checked) { DataTable TurnStatusDataTable = new DataTable(); //*************اگر خودرو خارج شده باشد اجازه حفظ نوبت را نداشته باشد93/06/10 List <HPS.BLL.TrafficBLL.BLLTraffic_T> TrafficList = TrafficFactory.GetAllBy(HPS.BLL.TrafficBLL.BLLTraffic_T.Traffic_TField.TrafficNumber_bint, drSelect[0]["TrafficNumber_bint"]); if (TrafficList.Count > 0 && TrafficList != null) { foreach (HPS.BLL.TrafficBLL.BLLTraffic_T item in TrafficList) { if (item.Out_bit == true) { //LadBillCreditEntity.Turn_bit = false; Hepsa.Core.Common.MessageBox.InformationMessage("این خودرو خارج شده است، امکان حفظ نوبت وجود ندارد"); return; } } } //BLL.SettingsBLL.BLLSetting_TKeys SettingKey = new BLL.SettingsBLL.BLLSetting_TKeys(); //BLL.SettingsBLL.BLLSetting_T SettingEntity = new BLL.SettingsBLL.BLLSetting_T(); //BLL.SettingsBLL.BLLSetting_TFactory SettingsFactory = new BLL.SettingsBLL.BLLSetting_TFactory(); //SettingKey.SettingID_int = 1009; //SettingEntity = SettingsFactory.GetBy(SettingKey); //TrafficFactory.SelectActiveTurnsForInTraffic(drSelect[0]["NumberPlate_nvc"].ToString(), drSelect[0]["SerialPlate_nvc"].ToString(), SettingEntity.Value_nvc, "00:00:00", TrafficFactory.ServerJalaliDate, "23:59:59", TurnStatusDataTable); TrafficFactory.GetTurnStatus((string)Hepsa.Core.Common.PersentationController.GetEntityValue(drSelect[0]["NumberPlate_nvc"], TypeCode.String), (string)Hepsa.Core.Common.PersentationController.GetEntityValue(drSelect[0]["SerialPlate_nvc"], TypeCode.String), TurnStatusDataTable); if (TurnStatusDataTable != null && TurnStatusDataTable.Rows.Count > 0) { if ((bool?)(Hepsa.Core.Common.PersentationController.GetEntityValue(TurnStatusDataTable.Rows[0]["Canceled_bit"], TypeCode.Boolean)) != false) { throw new ApplicationException(string.Format("ناوگان دارای شماره نوبت تأییدی < {0} >می باشد", TurnStatusDataTable.Rows[0]["AcceptedTurnNumber_bint"])); } } DataTable LadBillCreditTrafficStatusDataTable = new DataTable(); LadBillCreditFactory.GetLadBillCreditTrafficStatus((string)Hepsa.Core.Common.PersentationController.GetEntityValue(drSelect[0]["NumberPlate_nvc"], TypeCode.String), (string)Hepsa.Core.Common.PersentationController.GetEntityValue(drSelect[0]["SerialPlate_nvc"], TypeCode.String), LadBillCreditTrafficStatusDataTable); if (LadBillCreditTrafficStatusDataTable != null && LadBillCreditTrafficStatusDataTable.Rows.Count > 0) { int? LadBillCredit = (int?)Hepsa.Core.Common.PersentationController.GetEntityValue(LadBillCreditTrafficStatusDataTable.Rows[0]["LadBillCreditID_int"], TypeCode.Int32); int? TurnCancelComment = (int?)Hepsa.Core.Common.PersentationController.GetEntityValue(LadBillCreditTrafficStatusDataTable.Rows[0]["TurnCancelCommantID_int"], TypeCode.Int32); bool?Turnaccepted = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(LadBillCreditTrafficStatusDataTable.Rows[0]["Turnaccepted_bit"], TypeCode.Boolean); string strHas2LadBill = string.Format("TrafficID_bint='{0}'", drSelect[0]["TrafficID_bint"]); string strSecondStatus = string.Format("TrafficID_bint>'{0}'", drSelect[0]["TrafficID_bint"]); DataRow[] drHas2LadBill = LadBillCreditTrafficStatusDataTable.Select(strHas2LadBill); DataRow[] drSecondStatus = LadBillCreditTrafficStatusDataTable.Select(strSecondStatus); if (drHas2LadBill != null && drHas2LadBill.Length > 0) { if (drSecondStatus != null && drSecondStatus.Length > 0) { int? LadBillCreditSecond = (int?)Hepsa.Core.Common.PersentationController.GetEntityValue(drSecondStatus[0]["LadBillCreditID_int"], TypeCode.Int32); int? TurnCancelCommentSecond = (int?)Hepsa.Core.Common.PersentationController.GetEntityValue(drSecondStatus[0]["TurnCancelCommantID_int"], TypeCode.Int32); bool?TurnacceptedSecond = (bool?)Hepsa.Core.Common.PersentationController.GetEntityValue(drSecondStatus[0]["Turnaccepted_bit"], TypeCode.Boolean); if (TurnacceptedSecond.HasValue && TurnacceptedSecond == true) { if (LadBillCreditSecond.HasValue) { throw new ApplicationException(string.Format("این ناوگان به شماره نوبت< {0} >و شماره قبض< {1} >مجوز گرفته است", drSecondStatus[0]["AcceptedTurnNumber_bint"], drSecondStatus[0]["TrafficNumber_bint"])); } else { if (TurnCancelCommentSecond.HasValue == false) { throw new ApplicationException(string.Format("این ناوگان داراي شماره نوبت تأييد شده< {0} >مي باشد", drSecondStatus[0]["AcceptedTurnNumber_bint"], drSecondStatus[0]["TrafficNumber_bint"])); } } } } } else { DataTable TurnTtatusDataTable = new DataTable(); TrafficFactory.GetTurnStatus((string)Hepsa.Core.Common.PersentationController.GetEntityValue(drSelect[0]["NumberPlate_nvc"], TypeCode.String), (string)Hepsa.Core.Common.PersentationController.GetEntityValue(drSelect[0]["SerialPlate_nvc"], TypeCode.String), TurnTtatusDataTable); if (TurnTtatusDataTable != null && TurnTtatusDataTable.Rows.Count > 0) { if ((bool?)(Hepsa.Core.Common.PersentationController.GetEntityValue(TurnStatusDataTable.Rows[0]["Canceled_bit"], TypeCode.Boolean)) != false) { throw new ApplicationException(string.Format("ناوگان دارای شماره نوبت تأییدی < {0} >می باشد", TurnStatusDataTable.Rows[0]["AcceptedTurnNumber_bint"])); } } } } } else { if (TurnCancelRadioButton.Checked == true) { LadBillCreditEntity.Turn_bit = false; //*************اگر خودرو خارج نشده باشد اجازه ابطال را نداشته باشد94/10/01 List <HPS.BLL.TrafficBLL.BLLTraffic_T> TrafficOutList = TrafficFactory.GetAllByCondition(string.Format("[Traffic_T].Out_bit=1 and [Traffic_T].TrafficNumber_bint={0}", drSelect[0]["TrafficNumber_bint"].ToString())); if (TrafficOutList.Count == 0) { Hepsa.Core.Common.MessageBox.InformationMessage("این خودرو خارج نشده است، امکان ابطال وجود ندارد"); return; } } //ابطال نوبت HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory TurnManagementFactory = new HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory(); HPS.BLL.TurnManagementBLL.BLLTurnManagement_T TurnManagementEntity = new HPS.BLL.TurnManagementBLL.BLLTurnManagement_T(); TurnManagementEntity.TurnCancelCommantID_int = 11; TurnManagementEntity.TurnCancelCommment_nvc = "ابطال نوبت هنگام ابطال مجوز"; TurnManagementEntity.Return_bit = false; TurnManagementEntity.Date_nvc = TurnManagementFactory.ServerJalaliDate; TurnManagementEntity.Time_nvc = TurnManagementFactory.ServerTime; TurnManagementEntity.UserName_nvc = HPS.Common.CurrentUser.user.UserName_nvc; TurnManagementEntity.TrafficID_bint = (Int64?)drSelect[0]["TrafficID_bint"]; TurnManagementFactory.Insert(TurnManagementEntity); } } } else { DataTable TurnStatusDataTable = new DataTable(); TrafficFactory.GetTurnStatus((string)Hepsa.Core.Common.PersentationController.GetEntityValue(drSelect[0]["NumberPlate_nvc"], TypeCode.String), (string)Hepsa.Core.Common.PersentationController.GetEntityValue(drSelect[0]["SerialPlate_nvc"], TypeCode.String), TurnStatusDataTable); if (TurnStatusDataTable != null && TurnStatusDataTable.Rows.Count > 0) { throw new ApplicationException(string.Format("ناوگان دارای شماره نوبت تأییدی < {0} >می باشد", TurnStatusDataTable.Rows[TurnStatusDataTable.Rows.Count - 1]["AcceptedTurnNumber_bint"])); } } } else { if (TurnLeftRadioButton.Checked) { throw new ApplicationException(string.Format("این ناوگان دارای شماره نوبت تأیید شده {0} می باشد ومجوز نگرفته است", AcceptedTurnNumber_bint)); } } } } else { DataTable TrafficStatusForAcceptTurnDataTable = new DataTable(); TrafficFactory.GetLastStatusForAcceptTurn((Int64)Hepsa.Core.Common.PersentationController.GetEntityValue(drSelect[0]["TrafficID_bint"], TypeCode.Int64), TrafficStatusForAcceptTurnDataTable); if (TrafficStatusForAcceptTurnDataTable != null && TrafficStatusForAcceptTurnDataTable.Rows.Count > 0) { throw new ApplicationException(string.Format("این ناوگان دارای شماره نوبت تأیید شده {0} می باشد ومجوز نگرفته است", TrafficStatusForAcceptTurnDataTable.Rows[0]["AcceptedTurnNumber_bint"])); } } } } else { throw new ApplicationException("نوبت معتبر ندارد"); } } #endregion } LadBillCreditFactory.BeginProc(); if (LadeAssginmentCancelradioButton.Checked) { //ابطال اطلاع رسانی بار LadBillCreditFactory.Update(LadBillCreditEntity, this._Key); HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_TFactory LadeCancelAssignmentFactory = new HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_TFactory(); HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_T LadeCancelAssignmentEntity = new HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_T(); LadeCancelAssignmentEntity.LadeAssignmentID_bint = _LaKey.LadeAssignmentID_bint.Value; LadeCancelAssignmentEntity.LadeCancelCommentID_int = 6; LadeCancelAssignmentEntity.LadeCancelComment_nvc = "ابطال اطلاع رسانی بار هنگام ابطال مجوز"; LadeCancelAssignmentEntity.Count_int = 1; LadeCancelAssignmentEntity.Date_nvc = LadeCancelAssignmentFactory.ServerJalaliDate; LadeCancelAssignmentEntity.Time_nvc = LadeCancelAssignmentFactory.ServerTime; LadeCancelAssignmentEntity.UserName_nvc = HPS.Common.CurrentUser.user.UserName_nvc; LadeCancelAssignmentFactory.Insert(LadeCancelAssignmentEntity); } else if (OtherRemainedCancelRadioButton.Checked) { //ابطال اطلاع رسانی بار و باقی مانده ها HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_TFactory LadeCancelAssignmentFactory = new HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_TFactory(); HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_T LadeCancelAssignmentEntity = new HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_T(); BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory LadeAssignmentFactory = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory(); DataTable remainedLadeAssignmentTable = new DataTable(); string condition = string.Format("LadeAssignmentID_bint={0}", _LaKey.LadeAssignmentID_bint.Value); LadeAssignmentFactory.SelectRemainedDetailSelectByCondition(condition, remainedLadeAssignmentTable); int remaindCount_int = 0; if (remainedLadeAssignmentTable != null && remainedLadeAssignmentTable.Rows.Count > 0) { remaindCount_int = (Int32)remainedLadeAssignmentTable.Rows[remainedLadeAssignmentTable.Rows.Count - 1]["RemainderCount_int"]; } LadBillCreditFactory.Update(LadBillCreditEntity, this._Key); LadeCancelAssignmentEntity.LadeAssignmentID_bint = _LaKey.LadeAssignmentID_bint.Value; LadeCancelAssignmentEntity.LadeCancelCommentID_int = 6; LadeCancelAssignmentEntity.LadeCancelComment_nvc = "ابطال اطلاع رسانی بار هنگام ابطال مجوز"; LadeCancelAssignmentEntity.Count_int = remaindCount_int + 1; LadeCancelAssignmentEntity.Date_nvc = LadeCancelAssignmentFactory.ServerJalaliDate; LadeCancelAssignmentEntity.Time_nvc = LadeCancelAssignmentFactory.ServerTime; LadeCancelAssignmentEntity.UserName_nvc = HPS.Common.CurrentUser.user.UserName_nvc; LadeCancelAssignmentFactory.Insert(LadeCancelAssignmentEntity); } else { LadBillCreditFactory.Update(LadBillCreditEntity, this._Key); } //ابطال مجوز for (int index = 0; index < this.LadBillCreditCancelCommentID_intCheckedListBox.CheckedItems.Count; index++) { HPS.BLL.LadBillCreditCancelCommentBLL.BLLLadBillCreditCancelComment_T LadBillCreditCancelCommentEntity = new HPS.BLL.LadBillCreditCancelCommentBLL.BLLLadBillCreditCancelComment_T(); LadBillCreditCancelCommentEntity.LadBillCreditID_int = this._Key.LadBillCreditID_int; LadBillCreditCancelCommentEntity.LadBillCancelCommentID_int = ((HPS.BLL.LadBillCancelCommentBLL.BLLLadBillCancelComment_T) this.LadBillCreditCancelCommentID_intCheckedListBox.CheckedItems[index]).LadBillCancelCommentID_int; LadBillCreditCancelCommentEntity.LadbillCancelComment_nvc = ((HPS.BLL.LadBillCancelCommentBLL.BLLLadBillCancelComment_T) this.LadBillCreditCancelCommentID_intCheckedListBox.CheckedItems[index]).LadbillCancelComment_nvc; LadBillCreditCancelCommentFactory.Insert(LadBillCreditCancelCommentEntity); } LadBillCreditFactory.CommitProc(); if (this._dataTable != null) { DataRow[] dr = this._dataTable.Select(string.Format("LadBillCreditID_int = {0}", this._Key.LadBillCreditID_int)); if (dr != null && dr.Length > 0) { dr[0]["Canceled_bit"] = true; } this._dataTable.AcceptChanges(); } this.Close(); } catch (Exception ex) { LadBillCreditFactory.RollBackProc(); Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }