コード例 #1
0
        public void PopulateBusinessObjectFromReader(HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T businessObject, IDataReader dataReader)
        {
            businessObject.CompanyLadBillID_bint = dataReader.GetInt64(dataReader.GetOrdinal(HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.CompanyLadBillID_bint.ToString()));
            businessObject.CompanyID_int         = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.CompanyID_int.ToString()));
            businessObject.CompanyCode_nvc       = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.CompanyCode_nvc.ToString()));
            if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.Date_nvc.ToString())) == false)
            {
                businessObject.Date_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.Date_nvc.ToString()));
            }
            else
            {
                businessObject.Date_nvc = String.Empty;
            }

            businessObject.Serial_nvc           = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.Serial_nvc.ToString()));
            businessObject.StartNumber_int      = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.StartNumber_int.ToString()));
            businessObject.EndNumber_int        = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.EndNumber_int.ToString()));
            businessObject.AssignmentNumber_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.AssignmentNumber_nvc.ToString()));
            if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.DeliveryUserCode_nvc.ToString())) == false)
            {
                businessObject.DeliveryUserCode_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.DeliveryUserCode_nvc.ToString()));
            }
            else
            {
                businessObject.DeliveryUserCode_nvc = String.Empty;
            }
        }
コード例 #2
0
        public void Update(HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T businessObject, HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TKeys businessObjectKey)
        {
            try
            {
                if (businessObject.CompanyLadBillID_bint == businessObjectKey.CompanyLadBillID_bint)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueCompanyLadBillID_bint") == 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);
            }
        }
コード例 #3
0
        public HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T SelectByPrimaryKey(HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T businessObject = new HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_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;
            }
        }
コード例 #4
0
        public List <HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T> PopulateObjectsFromReader(IDataReader dataReader)
        {
            List <HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T> list = new List <HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T>();

            while (dataReader.Read())
            {
                HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T businessObject = new HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T();
                PopulateBusinessObjectFromReader(businessObject, dataReader);
                list.Add(businessObject);
            }
            return(list);
        }
コード例 #5
0
        private void UsedLadBillToolStripButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.LadBillWithTrafficGridView.CurrentRow != null && CompanyLadBillGridView.CurrentRow != null)
                {
                    if (this.LadBillWithTrafficGridView.CurrentRow.Cells["LadBillCreditID_int"].Value != null && this.CompanyLadBillGridView.CurrentRow.Cells["CompanyLadBillID_bint"].Value != null)
                    {
                        HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_T UsedLadBillEntity = new HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_T();
                        UsedLadBillEntity.LadBillCreditID_int = (Int32)Hepsa.Core.Common.PersentationController.GetEntityValue(this.LadBillWithTrafficGridView.CurrentRow.Cells["LadBillCreditID_int"].Value, TypeCode.Int32);
                        HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TKeys CompanyLadBillKey = new HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TKeys();
                        CompanyLadBillKey.CompanyLadBillID_bint = (Int64)this.CompanyLadBillGridView.CurrentRow.Cells["CompanyLadBillID_bint"].Value;
                        //////////////

                        HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TFactory CompanyLaddBillFactory = new HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TFactory();
                        HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T        CompanyLadBillEntity   = CompanyLaddBillFactory.GetBy((HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TKeys)CompanyLadBillKey);

                        HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_TFactory UsedLadBillFactory = new HPS.BLL.UsedLadBillBLL.BLLUsedLadBill_TFactory();
                        string    Condition             = "(CompanyLadBill_T.StartNumber_int=N'" + CompanyLadBillEntity.StartNumber_int + "') AND (UsedLadBill_T.Serial_nvc =N'" + CompanyLadBillEntity.Serial_nvc + "') ";
                        DataTable LadBillCountDataTable = new DataTable();
                        UsedLadBillFactory.GetCountByCondition(Condition, ref LadBillCountDataTable);
                        int LadBillCount = 0;
                        if (LadBillCountDataTable != null && LadBillCountDataTable.Rows.Count > 0)
                        {
                            LadBillCount = Convert.ToInt32(LadBillCountDataTable.Rows[0]["UsedLadbBillCount"].ToString());
                        }
                        int Count = (CompanyLadBillEntity.EndNumber_int - CompanyLadBillEntity.StartNumber_int);
                        if (!(Count - LadBillCount > 0))
                        {
                            throw new ApplicationException("تعداد بارنامه های داده شده به این شرکت به اتمام رسیده است");
                        }
                        else
                        {
                            UsedLadBillEntityForm UsedLadBill = new UsedLadBillEntityForm((DataTable)this.CompanyLadBillGridView.DataSource, (DataTable)LadBillWithTrafficGridView.DataSource, UsedLadBillEntity.LadBillCreditID_int, CompanyLadBillKey, Convert.ToString(this.LadBillWithTrafficGridView.CurrentRow.Cells["DriverName"].Value), Convert.ToString(this.LadBillWithTrafficGridView.CurrentRow.Cells["NumberPlate"].Value));
                            UsedLadBill.ShowDialog();
                        }
                    }
                    //LoadAllLadBill();
                }
                else
                {
                    throw new ApplicationException("اطلاع رسانی بار و اختصاص بارنامه مربوط خالی است");
                }
            }
            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
コード例 #6
0
        public void Insert(HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T businessObject)
        {
            try
            {
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "CompanyLadBillID_bint") == 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);
            }
        }
コード例 #7
0
 private void Show()
 {
     try
     {
         HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TFactory CompanyLaddBillFactory = new HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TFactory();
         HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T        CompanyLadBillEntity   = CompanyLaddBillFactory.GetBy((HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TKeys)_CompanyLadBillKey);
         Serial_nvcTextBox.Text      = Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyLadBillEntity.Serial_nvc, TypeCode.String).ToString();
         StartNumber_intTextBox.Text = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyLadBillEntity.StartNumber_int, TypeCode.Int64));
         DriverName_nvcTextBox.Text  = _DriverName;
         NumberPlate_nvcTextBox.Text = _NumberPlate;
     }
     catch (Exception ex)
     {
         Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
     }
 }
コード例 #8
0
 protected override void ShowForm()
 {
     this.FillCombo();
     HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TFactory CompanyLadBillFactory = new HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TFactory();
     HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T        CompanyLadBillEntity  = CompanyLadBillFactory.GetBy((HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TKeys)Key);
     if (CompanyLadBillEntity == null)
     {
         throw new HPS.Exceptions.CompanyLadBillNotFound();
     }
     Hepsa.Core.Common.PersentationController.SetComboBoxValue(ref CompanyID_intComboBox, CompanyLadBillEntity.CompanyID_int, TypeCode.Int32);
     CompanyCode_nvcTextBox.Text        = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyLadBillEntity.CompanyCode_nvc, TypeCode.String));
     Date_nvcTextBox.Text               = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyLadBillEntity.Date_nvc, TypeCode.String));
     Serial_nvcTextBox.Text             = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyLadBillEntity.Serial_nvc, TypeCode.String));
     StartNumber_intNumericTextBox.Text = Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyLadBillEntity.StartNumber_int, TypeCode.Int32).ToString();
     EndNumber_intNumericTextBox.Text   = Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyLadBillEntity.EndNumber_int, TypeCode.Int32).ToString();
     AssignmentNumber_nvcTextBox.Text   = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyLadBillEntity.AssignmentNumber_nvc, TypeCode.String));
     DeliveryUserCode_nvcTextBox.Text   = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyLadBillEntity.DeliveryUserCode_nvc, TypeCode.String));
 }
コード例 #9
0
        protected override void Edit()
        {
            HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TFactory CompanyLadBillFactory = new HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TFactory();
            try
            {
                HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T CompanyLadBillEntity = new HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T();
                CompanyLadBillEntity.CompanyID_int        = (Int32)Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyID_intComboBox.SelectedValue, TypeCode.Int32);
                CompanyLadBillEntity.CompanyCode_nvc      = Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyCode_nvcTextBox.Text, TypeCode.String).ToString();
                CompanyLadBillEntity.Date_nvc             = Hepsa.Core.Common.PersentationController.GetEntityValue(Date_nvcTextBox.Text, TypeCode.String).ToString();
                CompanyLadBillEntity.Serial_nvc           = Hepsa.Core.Common.PersentationController.GetEntityValue(Serial_nvcTextBox.Text, TypeCode.String).ToString();
                CompanyLadBillEntity.StartNumber_int      = (Int32)Hepsa.Core.Common.PersentationController.GetEntityValue(StartNumber_intNumericTextBox.NumericText, TypeCode.Int32);
                CompanyLadBillEntity.EndNumber_int        = (Int32)Hepsa.Core.Common.PersentationController.GetEntityValue(EndNumber_intNumericTextBox.NumericText, TypeCode.Int32);
                CompanyLadBillEntity.AssignmentNumber_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(AssignmentNumber_nvcTextBox.Text, TypeCode.String).ToString();
                CompanyLadBillEntity.DeliveryUserCode_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(DeliveryUserCode_nvcTextBox.Text, TypeCode.String).ToString();

                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true)
                {
                    CompanyLadBillFactory.BeginProc();
                    CompanyLadBillFactory.Update(CompanyLadBillEntity, (HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TKeys)Key);
                    CompanyLadBillFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.CompanyLadBillID_bint.ToString() + "='" + ((HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TKeys)Key).CompanyLadBillID_bint.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0]["CompanyID_intCompany_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(CompanyID_intComboBox);
                            dr[0][HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.CompanyCode_nvc.ToString()]      = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyLadBillEntity.CompanyCode_nvc, TypeCode.String);
                            dr[0][HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.Date_nvc.ToString()]             = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyLadBillEntity.Date_nvc, TypeCode.String);
                            dr[0][HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.Serial_nvc.ToString()]           = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyLadBillEntity.Serial_nvc, TypeCode.String);
                            dr[0][HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.StartNumber_int.ToString()]      = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyLadBillEntity.StartNumber_int, TypeCode.Int32);
                            dr[0][HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.EndNumber_int.ToString()]        = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyLadBillEntity.EndNumber_int, TypeCode.Int32);
                            dr[0][HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.AssignmentNumber_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyLadBillEntity.AssignmentNumber_nvc, TypeCode.String);
                            dr[0][HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.DeliveryUserCode_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyLadBillEntity.DeliveryUserCode_nvc, TypeCode.String);
                        }
                        DataTable.AcceptChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                CompanyLadBillFactory.RollBackProc();
                throw ex;
            }
        }
コード例 #10
0
        protected override void Insert()
        {
            HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TFactory CompanyLadBillFactory = new HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_TFactory();
            try
            {
                HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T CompanyLadBillEntity = new HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T();
                CompanyLadBillEntity.CompanyID_int        = (Int32)Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyID_intComboBox.SelectedValue, TypeCode.Int32);
                CompanyLadBillEntity.CompanyCode_nvc      = Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyCode_nvcTextBox.Text, TypeCode.String).ToString();
                CompanyLadBillEntity.Date_nvc             = Hepsa.Core.Common.PersentationController.GetEntityValue(Date_nvcTextBox.Text, TypeCode.String).ToString();
                CompanyLadBillEntity.Serial_nvc           = Hepsa.Core.Common.PersentationController.GetEntityValue(Serial_nvcTextBox.Text, TypeCode.String).ToString();
                CompanyLadBillEntity.StartNumber_int      = (Int32)Hepsa.Core.Common.PersentationController.GetEntityValue(StartNumber_intNumericTextBox.NumericText, TypeCode.Int32);
                CompanyLadBillEntity.EndNumber_int        = (Int32)Hepsa.Core.Common.PersentationController.GetEntityValue(EndNumber_intNumericTextBox.NumericText, TypeCode.Int32);
                CompanyLadBillEntity.AssignmentNumber_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(AssignmentNumber_nvcTextBox.Text, TypeCode.String).ToString();
                CompanyLadBillEntity.DeliveryUserCode_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(DeliveryUserCode_nvcTextBox.Text, TypeCode.String).ToString();

                CompanyLadBillFactory.BeginProc();
                CompanyLadBillFactory.Insert(CompanyLadBillEntity);
                CompanyLadBillFactory.CommitProc();
                if (DataTable != null)
                {
                    DataRow dr = this.DataTable.NewRow();
                    dr[HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.CompanyLadBillID_bint.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyLadBillEntity.CompanyLadBillID_bint, TypeCode.Int64);
                    dr[HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.CompanyID_int.ToString()]         = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyLadBillEntity.CompanyID_int, TypeCode.Int32);
                    dr["CompanyID_intCompany_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(CompanyID_intComboBox);
                    dr[HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.CompanyCode_nvc.ToString()]      = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyLadBillEntity.CompanyCode_nvc, TypeCode.String);
                    dr[HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.Date_nvc.ToString()]             = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyLadBillEntity.Date_nvc, TypeCode.String);
                    dr[HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.Serial_nvc.ToString()]           = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyLadBillEntity.Serial_nvc, TypeCode.String);
                    dr[HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.StartNumber_int.ToString()]      = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyLadBillEntity.StartNumber_int, TypeCode.Int32);
                    dr[HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.EndNumber_int.ToString()]        = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyLadBillEntity.EndNumber_int, TypeCode.Int32);
                    dr[HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.AssignmentNumber_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyLadBillEntity.AssignmentNumber_nvc, TypeCode.String);
                    dr[HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T.CompanyLadBill_TField.DeliveryUserCode_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyLadBillEntity.DeliveryUserCode_nvc, TypeCode.String);

                    DataTable.Rows.Add(dr);
                    DataTable.AcceptChanges();
                }
                this.ClearForm(this);
            }
            catch (Exception ex)
            {
                CompanyLadBillFactory.RollBackProc();
                throw ex;
            }
        }
コード例 #11
0
        public void Insert(HPS.BLL.CompanyLadBillBLL.BLLCompanyLadBill_T businessObject)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

                SqlParameter CompanyLadBillID_bint = new SqlParameter();
                CompanyLadBillID_bint.ParameterName = "@CompanyLadBillID_bint";
                CompanyLadBillID_bint.SqlDbType     = SqlDbType.BigInt;
                CompanyLadBillID_bint.Direction     = ParameterDirection.Output;
                CompanyLadBillID_bint.IsNullable    = false;
                CompanyLadBillID_bint.Value         = businessObject.CompanyLadBillID_bint;
                this.Command.Parameters.Add(CompanyLadBillID_bint);

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

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

                SqlParameter Date_nvc = new SqlParameter();
                Date_nvc.ParameterName = "@Date_nvc";
                Date_nvc.SqlDbType     = SqlDbType.NVarChar;
                Date_nvc.Direction     = ParameterDirection.Input;
                Date_nvc.IsNullable    = true;
                if (String.IsNullOrEmpty(businessObject.Date_nvc))
                {
                    Date_nvc.Value = DBNull.Value;
                }
                else
                {
                    Date_nvc.Value = businessObject.Date_nvc;
                }
                this.Command.Parameters.Add(Date_nvc);

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

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

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

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

                SqlParameter DeliveryUserCode_nvc = new SqlParameter();
                DeliveryUserCode_nvc.ParameterName = "@DeliveryUserCode_nvc";
                DeliveryUserCode_nvc.SqlDbType     = SqlDbType.NVarChar;
                DeliveryUserCode_nvc.Direction     = ParameterDirection.Input;
                DeliveryUserCode_nvc.IsNullable    = true;
                if (String.IsNullOrEmpty(businessObject.DeliveryUserCode_nvc))
                {
                    DeliveryUserCode_nvc.Value = DBNull.Value;
                }
                else
                {
                    DeliveryUserCode_nvc.Value = businessObject.DeliveryUserCode_nvc;
                }
                this.Command.Parameters.Add(DeliveryUserCode_nvc);



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

                this.Command.ExecuteNonQuery();

                businessObject.CompanyLadBillID_bint = (Int64)(this.Command.Parameters["@CompanyLadBillID_bint"].Value);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }