예제 #1
0
        protected override void Delete()
        {
            HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory TurnManagementFactory = new HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory();

            try
            {
                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.DeleteMessage) == true)
                {
                    TurnManagementFactory.BeginProc();
                    TurnManagementFactory.Delete((HPS.BLL.TurnManagementBLL.BLLTurnManagement_TKeys)Key);
                    TurnManagementFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.TurnManagementBLL.BLLTurnManagement_T.TurnManagement_TField.TurnManagementID_int.ToString() + "='" + ((HPS.BLL.TurnManagementBLL.BLLTurnManagement_TKeys)Key).TurnManagementID_int.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0].Delete();
                        }
                        DataTable.AcceptChanges();
                    }
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                TurnManagementFactory.RollBackProc();
                throw ex;
            }
        }
예제 #2
0
        private Int32 DoCancelOperation(string Date_nvc, string LaderTypeID_nvc)
        {
            string CancelDate = string.Empty;

            if (string.IsNullOrEmpty(Date_nvc))
            {
                HPS.BLL.SettingsBLL.BLLSetting_TFactory SettingFactory = new HPS.BLL.SettingsBLL.BLLSetting_TFactory();
                HPS.BLL.SettingsBLL.BLLSetting_T        SettingEntity  = new HPS.BLL.SettingsBLL.BLLSetting_T();
                HPS.BLL.SettingsBLL.BLLSetting_TKeys    SettingKey     = new HPS.BLL.SettingsBLL.BLLSetting_TKeys();

                SettingKey.SettingID_int = 1003;
                SettingEntity            = SettingFactory.GetBy(SettingKey);

                Hepsa.Core.Common.MyDateTime CurrentDate = new Hepsa.Core.Common.MyDateTime(SettingFactory.ServerJalaliDate);
                string CancelTime      = SettingFactory.ServerTime;
                string CurrentDateTime = CurrentDate.MyDate.ToString("yyyy/MM/dd") + " " + CancelTime;

                DateTime SubtractedDate = DateTime.Parse(CurrentDateTime);
                SubtractedDate = SubtractedDate.AddHours(-Int32.Parse(SettingEntity.Value_nvc));

                CancelDate = new Hepsa.Core.Common.MyDateTime(SubtractedDate).ConvertToPersianShortDate();
            }
            else
            {
                CancelDate = Date_nvc;
            }


            HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory TurnCancelCommentFactory = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory();
            HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T        TurnCancelCommentEntity  = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T();
            HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys    TurnCancelCommentKey     = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys();
            TurnCancelCommentKey.TurnCancelCommentID_int = 40;
            TurnCancelCommentEntity = TurnCancelCommentFactory.GetBy(TurnCancelCommentKey);
            HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory TurnManagementFactory = new HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory();
            HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory();
            DataTable AcceptedTurnsWithoutLadBillDataTable        = new DataTable();

            if (string.IsNullOrEmpty(LaderTypeID_nvc))
            {
                TrafficFactory.SelectInTurnAcceptedForDelete(CancelDate, string.Empty, AcceptedTurnsWithoutLadBillDataTable);
            }
            else
            {
                TrafficFactory.SelectInTurnAcceptedForDelete(CancelDate, LaderTypeID_nvc, AcceptedTurnsWithoutLadBillDataTable);
            }

            int rowcount = -1;

            if (AcceptedTurnsWithoutLadBillDataTable != null && AcceptedTurnsWithoutLadBillDataTable.Rows.Count > 0)
            {
                rowcount = AcceptedTurnsWithoutLadBillDataTable.Rows.Count;
                foreach (DataRow row in AcceptedTurnsWithoutLadBillDataTable.Rows)
                {
                    HPS.BLL.TurnManagementBLL.BLLTurnManagement_T TurnManagementEntity = new HPS.BLL.TurnManagementBLL.BLLTurnManagement_T();
                    TurnManagementEntity.TurnCancelCommantID_int = TurnCancelCommentEntity.TurnCancelCommentID_int;
                    TurnManagementEntity.TurnCancelCommment_nvc  = TurnCancelCommentEntity.TurnCancelComment_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 = Convert.ToInt64(row["TrafficID_bint"]);
                    TurnManagementFactory.BeginProc();
                    TurnManagementFactory.Insert(TurnManagementEntity);
                    TurnManagementFactory.CommitProc();
                }
            }
            return(rowcount);
        }
예제 #3
0
        protected override void Edit()
        {
            HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory TurnManagementFactory = new HPS.BLL.TurnManagementBLL.BLLTurnManagement_TFactory();
            try
            {
                HPS.BLL.TurnManagementBLL.BLLTurnManagement_T TurnManagementEntity = new HPS.BLL.TurnManagementBLL.BLLTurnManagement_T();
                TurnManagementEntity.TrafficID_bint = this._TrafficKey.TrafficID_bint;
                if (_TurnStatus == 1)
                {
                    if (TurnManagementEntity.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Validate, "DuplicateTurnNumberInUpdateRule") == false)
                    {
                        Hepsa.Core.Validation.InvalidBusinessObjectException exception = new Hepsa.Core.Validation.InvalidBusinessObjectException(TurnManagementEntity.BrokenRulesList().ToString());
                        throw new ApplicationException(exception.Message);
                    }
                }
                //if (_LadBillCreditID_int!=null&&_LadBillCreditID_int != 0)
                //{
                //    var LadBillFactory = new BLL.LadBillCreditBLL.BLLLadBillCredit_TFactory();
                //    var LadBillEntity = new BLL.LadBillCreditBLL.BLLLadBillCredit_T();
                //    var LadBillKey = new BLL.LadBillCreditBLL.BLLLadBillCredit_TKeys();
                //    LadBillKey.LadBillCreditID_int=_LadBillCreditID_int.Value;
                //    LadBillEntity = LadBillFactory.GetBy(LadBillKey);
                //    if (LadBillEntity != null )
                //    {
                //        LadBillEntity.Turn_bit = true;
                //        LadBillFactory.Update(LadBillEntity, LadBillKey);
                //    }
                //    else
                //        throw new ApplicationException("مجوز مورد نظر یافت نشد");
                //}
                //else
                if (_LadBillCreditID_int == 0)
                {
                    TurnManagementEntity.TurnCancelCommantID_int = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(TurnCancelCommantID_intComboBox.SelectedValue, TypeCode.Int32);
                    TurnManagementEntity.TurnCancelCommment_nvc  = Hepsa.Core.Common.PersentationController.GetEntityValue(TurnCancelCommantID_intComboBox.Text, TypeCode.String).ToString();
                    TurnManagementEntity.Return_bit     = Return_bitCheckBox.Checked;
                    TurnManagementEntity.Date_nvc       = TurnManagementFactory.ServerJalaliDate;
                    TurnManagementEntity.Time_nvc       = TurnManagementFactory.ServerTime;
                    TurnManagementEntity.UserName_nvc   = HPS.Common.CurrentUser.user.UserName_nvc;
                    TurnManagementEntity.TrafficID_bint = this._TrafficKey.TrafficID_bint;
                    if (TurnManagementEntity.TurnCancelCommantID_int.HasValue && TurnManagementEntity.Return_bit == true)
                    {
                        throw new ApplicationException("امکان ابطال نوبت و احیا همزمان وجود ندارد");
                    }
                    if (TurnManagementEntity.TurnCancelCommantID_int.HasValue == false && TurnManagementEntity.Return_bit == false)
                    {
                        throw new ApplicationException("هیچ موردی انتخاب نشده است");
                    }
                    TurnManagementFactory.BeginProc();
                    TurnManagementFactory.Insert(TurnManagementEntity);
                    TurnManagementFactory.CommitProc();


                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.TurnManagementBLL.BLLTurnManagement_T.TurnManagement_TField.TrafficID_bint.ToString() + "='" + this._TrafficKey.TrafficID_bint.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0][HPS.BLL.TurnManagementBLL.BLLTurnManagement_T.TurnManagement_TField.TurnManagementID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(TurnManagementEntity.TurnManagementID_int, TypeCode.Int32);
                            dr[0]["TrafficID_bint"] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(TurnManagementEntity.TrafficID_bint, TypeCode.Int64);
                            dr[0][HPS.BLL.TurnManagementBLL.BLLTurnManagement_T.TurnManagement_TField.TurnCancelCommantID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(TurnManagementEntity.TurnCancelCommantID_int, TypeCode.Int32);
                            dr[0]["TurnCancelCommantID_intTurnCancelCommant_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(TurnCancelCommantID_intComboBox);
                            dr[0][HPS.BLL.TurnManagementBLL.BLLTurnManagement_T.TurnManagement_TField.Return_bit.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(TurnManagementEntity.Return_bit, TypeCode.Boolean);
                            dr[0][HPS.BLL.TurnManagementBLL.BLLTurnManagement_T.TurnManagement_TField.Date_nvc.ToString()]   = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(TurnManagementEntity.Date_nvc, TypeCode.String);
                            dr[0][HPS.BLL.TurnManagementBLL.BLLTurnManagement_T.TurnManagement_TField.Time_nvc.ToString()]   = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(TurnManagementEntity.Time_nvc, TypeCode.String);
                            dr[0]["TMUser"] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(TurnManagementEntity.UserName_nvc, TypeCode.String);
                        }

                        DataTable.AcceptChanges();
                    }
                }
                this.ClearForm(this);
            }
            catch (Exception ex)
            {
                TurnManagementFactory.RollBackProc();
                throw ex;
            }
        }