Esempio n. 1
0
        protected override void Edit()
        {
            HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory TurnCancelCommentFactory = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory();
            try
            {
                HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T TurnCancelCommentEntity = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T();
                TurnCancelCommentEntity.TurnCancelComment_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(TurnCancelComment_nvcTextBox.Text, TypeCode.String).ToString();
                TurnCancelCommentEntity.UserGroupID_int       = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(UserGroupID_intComboBox.SelectedValue, TypeCode.Int32);

                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true)
                {
                    TurnCancelCommentFactory.BeginProc();
                    TurnCancelCommentFactory.Update(TurnCancelCommentEntity, (HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys)Key);
                    TurnCancelCommentFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T.TurnCancelComment_TField.TurnCancelCommentID_int.ToString() + "='" + ((HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys)Key).TurnCancelCommentID_int.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0][HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T.TurnCancelComment_TField.TurnCancelComment_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(TurnCancelCommentEntity.TurnCancelComment_nvc, TypeCode.String);
                            dr[0]["UserGroupID_intUserGroup_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(UserGroupID_intComboBox);
                        }
                        DataTable.AcceptChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                TurnCancelCommentFactory.RollBackProc();
                throw ex;
            }
        }
Esempio n. 2
0
        protected override void Insert()
        {
            HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory TurnCancelCommentFactory = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory();
            try
            {
                HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T TurnCancelCommentEntity = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T();
                TurnCancelCommentEntity.TurnCancelComment_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(TurnCancelComment_nvcTextBox.Text, TypeCode.String).ToString();
                TurnCancelCommentEntity.UserGroupID_int       = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(UserGroupID_intComboBox.SelectedValue, TypeCode.Int32);

                TurnCancelCommentFactory.BeginProc();
                TurnCancelCommentFactory.Insert(TurnCancelCommentEntity);
                TurnCancelCommentFactory.CommitProc();
                if (DataTable != null)
                {
                    DataRow dr = this.DataTable.NewRow();
                    dr[HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T.TurnCancelComment_TField.TurnCancelCommentID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(TurnCancelCommentEntity.TurnCancelCommentID_int, TypeCode.Int32);
                    dr[HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T.TurnCancelComment_TField.TurnCancelComment_nvc.ToString()]   = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(TurnCancelCommentEntity.TurnCancelComment_nvc, TypeCode.String);
                    dr[HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T.TurnCancelComment_TField.UserGroupID_int.ToString()]         = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(TurnCancelCommentEntity.UserGroupID_int, TypeCode.Int32);
                    dr["UserGroupID_intUserGroup_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(UserGroupID_intComboBox);

                    DataTable.Rows.Add(dr);
                    DataTable.AcceptChanges();
                }
                this.ClearForm(this);
            }
            catch (Exception ex)
            {
                TurnCancelCommentFactory.RollBackProc();
                throw ex;
            }
        }
Esempio n. 3
0
        public HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T SelectByPrimaryKey(HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

            this.Command.CommandText = "[sp_TurnCancelComment_T_SelectByPrimaryKey]";
            this.Command.CommandType = CommandType.StoredProcedure;

            try{
                this.Command.Parameters.Clear();

                SqlParameter TurnCancelCommentID_int = new SqlParameter();
                TurnCancelCommentID_int.ParameterName = "@TurnCancelCommentID_int";
                TurnCancelCommentID_int.SqlDbType     = SqlDbType.Int;
                TurnCancelCommentID_int.Direction     = ParameterDirection.Input;
                TurnCancelCommentID_int.IsNullable    = false;
                TurnCancelCommentID_int.Value         = businessObjectKey.TurnCancelCommentID_int;
                this.Command.Parameters.Add(TurnCancelCommentID_int);



                if (ControlConnection)
                {
                    this.BeginTransaction();
                }

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T businessObject = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T();
                if (dataReader.Read())
                {
                    PopulateBusinessObjectFromReader(businessObject, dataReader);
                }
                else
                {
                    businessObject = null;
                }

                if (dataReader.IsClosed == false)
                {
                    dataReader.Close();
                }


                if (ControlConnection)
                {
                    this.Commit();
                }
                return(businessObject);
            }
            catch (System.Exception ex) {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Esempio n. 4
0
        public List <HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T> PopulateObjectsFromReader(IDataReader dataReader)
        {
            List <HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T> list = new List <HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T>();

            while (dataReader.Read())
            {
                HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T businessObject = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T();
                PopulateBusinessObjectFromReader(businessObject, dataReader);
                list.Add(businessObject);
            }
            return(list);
        }
Esempio n. 5
0
 protected override void ShowForm()
 {
     this.FillCombo();
     HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory TurnCancelCommentFactory = new HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TFactory();
     HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T        TurnCancelCommentEntity  = TurnCancelCommentFactory.GetBy((HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys)Key);
     if (TurnCancelCommentEntity == null)
     {
         throw new HPS.Exceptions.TurnCancelCommentNotFound();
     }
     TurnCancelComment_nvcTextBox.Text = Hepsa.Core.Common.PersentationController.GetEntityValue(TurnCancelCommentEntity.TurnCancelComment_nvc, TypeCode.String).ToString();
     Hepsa.Core.Common.PersentationController.SetComboBoxValue(ref UserGroupID_intComboBox, TurnCancelCommentEntity.UserGroupID_int, TypeCode.Int32);
 }
Esempio n. 6
0
 public void PopulateBusinessObjectFromReader(HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T businessObject, IDataReader dataReader)
 {
     businessObject.TurnCancelCommentID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T.TurnCancelComment_TField.TurnCancelCommentID_int.ToString()));
     businessObject.TurnCancelComment_nvc   = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T.TurnCancelComment_TField.TurnCancelComment_nvc.ToString()));
     if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T.TurnCancelComment_TField.UserGroupID_int.ToString())) == false)
     {
         businessObject.UserGroupID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T.TurnCancelComment_TField.UserGroupID_int.ToString()));
     }
     else
     {
         businessObject.UserGroupID_int = null;
     }
 }
Esempio n. 7
0
        public void Insert(HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T businessObject)
        {
            try{
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "TurnCancelCommentID_int") == false)
                {
                    throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString());
                }

                _dataObject.Insert(businessObject);
            }catch (System.Exception ex) {
                throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
            }
        }
Esempio n. 8
0
        public void Update(HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T businessObject, HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys businessObjectKey)
        {
            try{
                if (businessObject.TurnCancelCommentID_int == businessObjectKey.TurnCancelCommentID_int)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueTurnCancelCommentID_int") == false)
                    {
                        throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString());
                    }
                }
                else
                {
                    if (businessObject.IsValid() == false)
                    {
                        throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString());
                    }
                }

                _dataObject.Update(businessObject, businessObjectKey);
            }catch (System.Exception ex) {
                throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
            }
        }
Esempio n. 9
0
        public void Update(HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_T businessObject, HPS.BLL.TurnCancelCommentBLL.BLLTurnCancelComment_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

            this.Command.CommandText = "[sp_TurnCancelComment_T_Update]";
            this.Command.CommandType = CommandType.StoredProcedure;

            try{
                this.Command.Parameters.Clear();

                SqlParameter TurnCancelComment_nvc = new SqlParameter();
                TurnCancelComment_nvc.ParameterName = "@TurnCancelComment_nvc";
                TurnCancelComment_nvc.SqlDbType     = SqlDbType.NVarChar;
                TurnCancelComment_nvc.Direction     = ParameterDirection.Input;
                TurnCancelComment_nvc.IsNullable    = false;
                TurnCancelComment_nvc.Value         = businessObject.TurnCancelComment_nvc;
                this.Command.Parameters.Add(TurnCancelComment_nvc);

                SqlParameter UserGroupID_int = new SqlParameter();
                UserGroupID_int.ParameterName = "@UserGroupID_int";
                UserGroupID_int.SqlDbType     = SqlDbType.Int;
                UserGroupID_int.Direction     = ParameterDirection.Input;
                UserGroupID_int.IsNullable    = false;
                if (businessObject.UserGroupID_int.HasValue == false)
                {
                    UserGroupID_int.Value = DBNull.Value;
                }
                else
                {
                    UserGroupID_int.Value = businessObject.UserGroupID_int;
                }
                this.Command.Parameters.Add(UserGroupID_int);


                SqlParameter pk_TurnCancelCommentID_int = new SqlParameter();
                pk_TurnCancelCommentID_int.ParameterName = "@pk_TurnCancelCommentID_int";
                pk_TurnCancelCommentID_int.SqlDbType     = SqlDbType.Int;
                pk_TurnCancelCommentID_int.Direction     = ParameterDirection.Input;
                pk_TurnCancelCommentID_int.IsNullable    = false;
                pk_TurnCancelCommentID_int.Value         = businessObjectKey.TurnCancelCommentID_int;
                this.Command.Parameters.Add(pk_TurnCancelCommentID_int);



                if (ControlConnection)
                {
                    this.BeginTransaction();
                }

                this.Command.ExecuteNonQuery();

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex) {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Esempio n. 10
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);
        }