private void AcceptButton_Click(object sender, EventArgs e) { try { HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory LadeAssignmentFactory = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory(); HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T LadeAssignmentEntity = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T(); LadeAssignmentEntity = LadeAssignmentFactory.GetBy(LadeAssignmentKeys); if (LadeAssignmentEntity == null) { throw new HPS.Exceptions.LadeAssignmentNotFound(); } LadeAssignmentEntity.Accepted_bit = true; LadeAssignmentFactory.BeginProc(); LadeAssignmentFactory.Update(LadeAssignmentEntity, LadeAssignmentKeys); LadeAssignmentFactory.CommitProc(); if (this._DataTable != null) { DataRow[] dr = this._DataTable.Select("LadeAssignmentID_bint=" + this.LadeAsssignmentID.ToString()); if (dr != null && dr.Length > 0) { dr[0].Delete(); this._DataTable.AcceptChanges(); } } this.Close(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
public override bool Validate(params object[] value) { try { this.Description = string.Empty; if (value.Length != Field.Length) { this.Description = Hepsa.Core.My.Resources.ValidationMessage.IncorrectDataType; return(false); } Int64?LadeAssignmentID_bint = (Int64?)value[0]; int? Count_int = (int?)value[1]; if (LadeAssignmentID_bint.HasValue == false || Count_int.HasValue == false || Count_int == 0) { return(true); } HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillCreditFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory(); string condition = string.Format(" LadBillCredit_T.LadeAssignmentID_bint={0} AND Canceled_bit=0", LadeAssignmentID_bint); List <HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_T> LadBillCreditList = LadBillCreditFactory.GetAllByCondition(condition); int LadBillCreditCount = 0; if (LadBillCreditList != null && LadBillCreditList.Count > 0) { LadBillCreditCount = LadBillCreditList.Count; } HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory LadeAssignmentFactory = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory(); HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys LadeAssignmentKey = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys(); LadeAssignmentKey.LadeAssignmentID_bint = LadeAssignmentID_bint; HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T LadeAssignmentEntity = LadeAssignmentFactory.GetBy(LadeAssignmentKey); if (LadeAssignmentEntity != null) { if (LadeAssignmentEntity.CarCount_int - LadBillCreditCount < Count_int) { this.Description = string.Format(Hepsa.Core.My.Resources.ValidationMessage.ValueShouldNotGreater, "تعداد ماشین حذفی", LadeAssignmentEntity.CarCount_int - LadBillCreditCount); return(false); } } return(true); } catch (System.Exception ex) { this.Description = ex.Message; return(false); } }
private void ChooseLadeAssignmentAcceptedButton_Click(object sender, EventArgs e) { try { HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory LadeAssignmentFactory = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory(); HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T LadeAssignmentEntity = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T(); HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys LadeAssignmentKeys = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys(); DataTable gridTable = new DataTable(); gridTable = LadeAssignmentDataTable.Copy(); DataRow[] dr = null; LadeAssignmentFactory.BeginProc(); foreach (Janus.Windows.GridEX.GridEXRow itm in LadeAssignmentGridView.GetCheckedRows()) { LadeAssignmentKeys.LadeAssignmentID_bint = (Int64)itm.Cells["LadeAssignmentID_bint"].Value; LadeAssignmentEntity = LadeAssignmentFactory.GetBy(LadeAssignmentKeys); LadeAssignmentEntity.Accepted_bit = true; LadeAssignmentEntity.AcceptUserName_nvc = HPS.Common.CurrentUser.user.UserName_nvc; LadeAssignmentEntity.AcceptDate_vc = LadeAssignmentFactory.ServerJalaliDate; LadeAssignmentEntity.AcceptTime_vc = LadeAssignmentFactory.ServerTime; LadeAssignmentFactory.Update(LadeAssignmentEntity, LadeAssignmentKeys); dr = gridTable.Select(HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T.LadeAssignment_TField.LadeAssignmentID_bint.ToString() + "='" + (Int64)itm.Cells["LadeAssignmentID_bint"].Value + "'"); if (dr.Length > 0) { dr[0].Delete(); } gridTable.AcceptChanges(); } LadeAssignmentFactory.CommitProc(); LadeAssignmentGridView.DataSource = null; LadeAssignmentGridView.SetDataBinding(gridTable, "gridTable"); LadeAssignmentDataTable = gridTable.Copy(); gridTable.Dispose(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void LadeAssignmentAcceptForm_Load(object sender, EventArgs e) { HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory LadeAssignmentFactory = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory(); LadeAssignmentKeys.LadeAssignmentID_bint = (Int64?)Hepsa.Core.Common.PersentationController.GetEntityValue(LadeAsssignmentID, TypeCode.Int64); DataTable LadeAssignmentDataTable = new DataTable(); LadeAssignmentFactory.GetBy(LadeAssignmentKeys, ref LadeAssignmentDataTable); LadingDate_nvcTextBox.Text = LadeAssignmentDataTable.Rows[0]["LadingDate_nvc"].ToString(); LadingTime_nvcTextBox.Text = LadeAssignmentDataTable.Rows[0]["LadingTime_nvc"].ToString(); City_vncTextBox.Text = LadeAssignmentDataTable.Rows[0]["CityID_intCity_nvc"].ToString(); CityCode_nvcTextBox.Text = LadeAssignmentDataTable.Rows[0]["CityCode_nvc"].ToString(); Good_nvcTextBox.Text = LadeAssignmentDataTable.Rows[0]["GoodID_intGood_nvc"].ToString(); // GoodCode_nvcTextBox.Text = LadeAssignmentDataTable.Rows[0]["GoodCode_nvc"].ToString(); Boxing_nvcTextBox.Text = LadeAssignmentDataTable.Rows[0]["BoxingID_intBoxingType_nvc"].ToString(); // BoxingCode_nvcTextBox.Text = LadeAssignmentDataTable.Rows[0]["BoxingCode_nvc"].ToString(); // LaderType_nvcTextBox.Text = LadeAssignmentDataTable.Rows[0]["LaderTypeID_intLaderType_nvc"].ToString(); // LaderTypeCode_nvcTextBox.Text = LadeAssignmentDataTable.Rows[0]["LaderTypeCode_nvc"].ToString(); CarCount_intNumericTextBox.Text = LadeAssignmentDataTable.Rows[0]["CarCount_int"].ToString(); Company_nvcTextBox.Text = LadeAssignmentDataTable.Rows[0]["CompanyID_intCompany_nvc"].ToString(); // CompanyCode_nvcTextBox.Text = LadeAssignmentDataTable.Rows[0]["CompanyCode_nvc"].ToString(); }
private void LadeCancelStripButton_Click(object sender, EventArgs e) { try { BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory LadeAssignmentFactory = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory(); HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_TFactory LadeCancelAssignmentFactory = new HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_TFactory(); HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys LadeAssignmentKey = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys(); LadeAssignmentKey.LadeAssignmentID_bint = (Int64?)this.LadeAssignmentGridView.CurrentRow.Cells["colLadeAssignmentID_bint"].Value; HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T LadeAssignmentEntity = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T(); LadeAssignmentEntity = LadeAssignmentFactory.GetBy(LadeAssignmentKey); if (LadeAssignmentEntity.Accepted_bit == true) { HPS.BLL.LadeAssignmentCacelRequestBLL.BLLLadeAssignmentCacelRequest_TFactory LadeAssignmentCacelRequestFactory = new HPS.BLL.LadeAssignmentCacelRequestBLL.BLLLadeAssignmentCacelRequest_TFactory(); DataTable LadeAssignmentCacelRequestDataTable = new DataTable(); LadeAssignmentCacelRequestFactory.GetAllBy(HPS.BLL.LadeAssignmentCacelRequestBLL.BLLLadeAssignmentCacelRequest_T.LadeAssignmentCacelRequest_TField.LadeAssignmentID_bint, LadeAssignmentKey.LadeAssignmentID_bint, ref LadeAssignmentCacelRequestDataTable); if (!(LadeAssignmentCacelRequestDataTable != null && LadeAssignmentCacelRequestDataTable.Rows.Count > 0 && HPS.Common.CurrentUser.user.CompanyID_int.HasValue == false)) { throw new ApplicationException("این اطلاع سرانی بار تأیید شده است و قابل تغییر نمی باشد"); } if (string.IsNullOrEmpty(LadeAssignmentCacelRequestDataTable.Rows[0]["AcceptedDate_nvc"].ToString())) { throw new ApplicationException("درخواست انصراف یا اعمال تغییرات قبول نشده است"); } } DataTable remainedLadeAssignmentTable = new DataTable(); string remainedCarCondition = string.Format("LadeAssignmentID_bint={0}", Hepsa.Core.Common.PersentationController.GetEntityValue(this.LadeAssignmentGridView.CurrentRow.Cells[colLadeAssignmentID_bint.Name].Value, TypeCode.Int64)); LadeAssignmentFactory.SelectRemainedDetailSelectByCondition(remainedCarCondition, remainedLadeAssignmentTable); int remaindCount_int = 0; if (remainedLadeAssignmentTable != null && remainedLadeAssignmentTable.Rows.Count > 0) { remaindCount_int = (Int32)remainedLadeAssignmentTable.Rows[remainedLadeAssignmentTable.Rows.Count - 1]["RemainderCount_int"]; } if (remaindCount_int == 0) { string LadeCancelCondition = string.Format("LadeCancelAssignment_T.LadeAssignmentID_bint={0}", Hepsa.Core.Common.PersentationController.GetEntityValue(this.LadeAssignmentGridView.CurrentRow.Cells[colLadeAssignmentID_bint.Name].Value, TypeCode.Int64)); List <HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_T> LadeCancelList = LadeCancelAssignmentFactory.GetAllByCondition(LadeCancelCondition); if (LadeCancelList != null && LadeCancelList.Count > 0) { throw new ApplicationException("بار مورد نظر باطل شده است"); } else { HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillCreditFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory(); string condition = "LadBillCredit_T.LadeAssignmentID_bint='" + Hepsa.Core.Common.PersentationController.GetEntityValue(this.LadeAssignmentGridView.CurrentRow.Cells[colLadeAssignmentID_bint.Name].Value, TypeCode.Int64) + "' and LadBillCredit_T.LadBillCreditID_int is not null and LadBillCredit_T.Canceled_bit=0 "; List <HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_T> LadBillCreditList = new List <HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_T>(); LadBillCreditList = LadBillCreditFactory.GetAllByCondition(condition); if (LadBillCreditList != null && LadBillCreditList.Count > 0) { throw new ApplicationException("بار مورد نظر مجوز گرفته است"); } } } HPS.Present.LadeCancelAssignment.LadeCancelAssignmentEntityForm LadeCancelAssignment = new HPS.Present.LadeCancelAssignment.LadeCancelAssignmentEntityForm(LadeAssignmentKey); LadeCancelAssignment.ShowDialog(); LadeAssignmentGridView_SelectionChanged(this.LadeAssignmentCommentGridView, null); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void EditButton_Click(object sender, EventArgs e) { try { bool CanNotChangeCount = false; BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory LadeAssignmentFactory = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TFactory(); HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys LadeAssignmentKey = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_TKeys(); LadeAssignmentKey.LadeAssignmentID_bint = (Int64?)this.LadeAssignmentGridView.CurrentRow.Cells["colLadeAssignmentID_bint"].Value; HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T LadeAssignmentEntity = new HPS.BLL.LadeAssignmentBLL.BLLLadeAssignment_T(); LadeAssignmentEntity = LadeAssignmentFactory.GetBy(LadeAssignmentKey); if (LadeAssignmentEntity.Accepted_bit == true) { ///Select ladbillcredit HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory LadBillCreditFactory = new HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory(); string condition = "LadBillCredit_T.LadeAssignmentID_bint='" + Hepsa.Core.Common.PersentationController.GetEntityValue(this.LadeAssignmentGridView.CurrentRow.Cells[colLadeAssignmentID_bint.Name].Value, TypeCode.Int64) + "' or (LadBillCredit_T.LadBillCreditID_int is not null and LadBillCredit_T.Canceled_bit=0 AND LadBillCredit_T.Turn_bit is not NULL) order by [LadBillCredit_T].[LadBillCreditID_int] desc"; List <HPS.BLL.LadBillCreditBLL.BLLLadBillCredit_T> LadBillCreditList = LadBillCreditFactory.GetAllByCondition(condition); ///Select canceleced HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_TFactory LadeCancelFactory = new HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_TFactory(); List <HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_T> LadeCancelList = new List <HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_T>(); LadeCancelList = LadeCancelFactory.GetAllByCondition(string.Format("LadeCancelAssignment_T.LadeAssignmentID_bint={0} order by [LadeCancelAssignment_T].[LadeCancelAssignmentID_int] desc", Hepsa.Core.Common.PersentationController.GetEntityValue(this.LadeAssignmentGridView.CurrentRow.Cells[colLadeAssignmentID_bint.Name].Value, TypeCode.Int64))); ///select Remained DataTable remainedLadeAssignmentTable = new DataTable(); string RemainedCondition = string.Format("LadeAssignmentID_bint={0}", Hepsa.Core.Common.PersentationController.GetEntityValue(this.LadeAssignmentGridView.CurrentRow.Cells[colLadeAssignmentID_bint.Name].Value, TypeCode.Int64)); LadeAssignmentFactory.SelectRemainedDetailSelectByCondition(RemainedCondition, remainedLadeAssignmentTable); int remaindCount_int = 0; if (remainedLadeAssignmentTable != null && remainedLadeAssignmentTable.Rows.Count > 0) { remaindCount_int = (Int32)remainedLadeAssignmentTable.Rows[remainedLadeAssignmentTable.Rows.Count - 1]["RemainderCount_int"]; } if (LadeCancelList != null && LadeCancelList.Count > 0) { if (LadeCancelList[0].Count_int != null && remaindCount_int == 0) { throw new ApplicationException("این اطلاع رسانی باطل شده است و تعداد مانده ها صفر می باشد"); } else { CanNotChangeCount = true; } } if (remaindCount_int == 0) { throw new ApplicationException("بار مورد نظر مجوز گرفته است"); } else { CanNotChangeCount = true; } HPS.BLL.LadeAssignmentCacelRequestBLL.BLLLadeAssignmentCacelRequest_TFactory LadeAssignmentCacelRequestFactory = new HPS.BLL.LadeAssignmentCacelRequestBLL.BLLLadeAssignmentCacelRequest_TFactory(); DataTable LadeAssignmentCacelRequestDataTable = new DataTable(); LadeAssignmentCacelRequestFactory.GetAllBy(HPS.BLL.LadeAssignmentCacelRequestBLL.BLLLadeAssignmentCacelRequest_T.LadeAssignmentCacelRequest_TField.LadeAssignmentID_bint, LadeAssignmentKey.LadeAssignmentID_bint, ref LadeAssignmentCacelRequestDataTable); if (!(LadeAssignmentCacelRequestDataTable != null && LadeAssignmentCacelRequestDataTable.Rows.Count > 0 && HPS.Common.CurrentUser.user.CompanyID_int.HasValue == false)) { throw new ApplicationException("این اطلاع رسانی بار تأیید شده است و قابل تغییر نمی باشد"); } if (string.IsNullOrEmpty(LadeAssignmentCacelRequestDataTable.Rows[0]["AcceptedDate_nvc"].ToString())) { throw new ApplicationException("درخواست انصراف یا اعمال تغییرات قبول نشده است"); } } LadeAssignmentInforming LadeAssignment = new LadeAssignmentInforming(BaseEntityForm1.enmState.Edit, (DataTable)this.LadeAssignmentGridView.DataSource, LadeAssignmentKey, CanNotChangeCount); LadeAssignment.ShowDialog(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }