コード例 #1
0
        private void PrepareEditView()
        {
            BDOperatorAddressInfoEntity bDOperatorAddressInfoEntity = CurrentBDOperatorAddressInfoEntity;


            if (!bDOperatorAddressInfoEntity.IsNew)
            {
                if (ddlOperatorID.Items.Count > 0 && bDOperatorAddressInfoEntity.OperatorID != null)
                {
                    ddlOperatorID.SelectedValue = bDOperatorAddressInfoEntity.OperatorID.ToString();
                }

                txtWebLink.Text = bDOperatorAddressInfoEntity.WebLink.ToString();
                if (ddlOperatorAddressTypeID.Items.Count > 0 && bDOperatorAddressInfoEntity.OperatorAddressTypeID != null)
                {
                    ddlOperatorAddressTypeID.SelectedValue = bDOperatorAddressInfoEntity.OperatorAddressTypeID.ToString();
                }

                txtAddressLine1.Text = bDOperatorAddressInfoEntity.AddressLine1.ToString();
                txtAddressLine2.Text = bDOperatorAddressInfoEntity.AddressLine2.ToString();
                txtCountryID.Text    = bDOperatorAddressInfoEntity.CountryID.ToString();
                txtCityID.Text       = bDOperatorAddressInfoEntity.CityID.ToString();
                txtZipCode.Text      = bDOperatorAddressInfoEntity.ZipCode.ToString();
                txtPhone.Text        = bDOperatorAddressInfoEntity.Phone.ToString();
                txtEmail.Text        = bDOperatorAddressInfoEntity.Email.ToString();

                btnSubmit.Text    = "Update";
                btnAddNew.Visible = true;
            }
        }
コード例 #2
0
        Int64 IBDOperatorAddressInfoDataAccess.Add(BDOperatorAddressInfoEntity bDOperatorAddressInfoEntity, DatabaseOperationType option, TransactionRequired reqTran)
        {
            try
            {
                long retValues = -99;

                switch (reqTran)
                {
                case TransactionRequired.No:
                {
                    retValues = Add(bDOperatorAddressInfoEntity, option);
                    break;
                }

                case TransactionRequired.Yes:
                {
                    retValues = AddTran(bDOperatorAddressInfoEntity, option);
                    break;
                }

                default:
                {
                    retValues = -99;
                    break;
                }
                }

                return(retValues);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #3
0
        private Int64 UpdateTran(BDOperatorAddressInfoEntity bDOperatorAddressInfoEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.BDOperatorAddressInfo_SET";

            Database db = DatabaseFactory.CreateDatabase();

            using (DbCommand cmd = db.GetStoredProcCommand(SP))
            {
                AddOptionParameter(cmd, option, db);
                AddOutputParameter(cmd, db);
                AddFilterExpressionParameter(cmd, filterExpression, db);

                db.AddInParameter(cmd, "@OperatorAddressInfoID", DbType.Int64, bDOperatorAddressInfoEntity.OperatorAddressInfoID);
                db.AddInParameter(cmd, "@OperatorID", DbType.Int64, bDOperatorAddressInfoEntity.OperatorID);
                db.AddInParameter(cmd, "@WebLink", DbType.String, bDOperatorAddressInfoEntity.WebLink);
                db.AddInParameter(cmd, "@OperatorAddressTypeID", DbType.Int64, bDOperatorAddressInfoEntity.OperatorAddressTypeID);
                db.AddInParameter(cmd, "@AddressLine1", DbType.String, bDOperatorAddressInfoEntity.AddressLine1);
                db.AddInParameter(cmd, "@AddressLine2", DbType.String, bDOperatorAddressInfoEntity.AddressLine2);
                db.AddInParameter(cmd, "@CountryID", DbType.Int64, bDOperatorAddressInfoEntity.CountryID);
                db.AddInParameter(cmd, "@CityID", DbType.Int64, bDOperatorAddressInfoEntity.CityID);
                db.AddInParameter(cmd, "@ZipCode", DbType.String, bDOperatorAddressInfoEntity.ZipCode);
                db.AddInParameter(cmd, "@Phone", DbType.String, bDOperatorAddressInfoEntity.Phone);
                db.AddInParameter(cmd, "@Email", DbType.String, bDOperatorAddressInfoEntity.Email);

                DbConnection connection = db.CreateConnection();
                connection.Open();
                DbTransaction transaction = connection.BeginTransaction();

                try
                {
                    using (IDataReader reader = db.ExecuteReader(cmd, transaction))
                    {
                        returnCode = GetReturnCodeFromParameter(cmd);
                    }

                    if (returnCode > 0)
                    {
                        transaction.Commit();
                    }
                    else
                    {
                        throw new ArgumentException("Error Code." + returnCode.ToString());
                    }
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    throw ex;
                }
                finally
                {
                    transaction.Dispose();
                    connection.Close();
                    connection = null;
                }
            }

            return(returnCode);
        }
コード例 #4
0
        private void SaveBDOperatorAddressInfoEntity()
        {
            if (IsValid)
            {
                try
                {
                    BDOperatorAddressInfoEntity bDOperatorAddressInfoEntity = BuildBDOperatorAddressInfoEntity();

                    Int64 result = -1;

                    if (bDOperatorAddressInfoEntity.IsNew)
                    {
                        result = FCCBDOperatorAddressInfo.GetFacadeCreate().Add(bDOperatorAddressInfoEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(BDOperatorAddressInfoEntity.FLD_NAME_OperatorAddressInfoID, bDOperatorAddressInfoEntity.OperatorAddressInfoID.ToString(), SQLMatchType.Equal);
                        result = FCCBDOperatorAddressInfo.GetFacadeCreate().Update(bDOperatorAddressInfoEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _OperatorAddressInfoID       = 0;
                        _BDOperatorAddressInfoEntity = new BDOperatorAddressInfoEntity();
                        PrepareInitialView();
                        BindBDOperatorAddressInfoList();

                        if (bDOperatorAddressInfoEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Operator Address Info Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Operator Address Info Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (bDOperatorAddressInfoEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Operator Address Info Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Operator Address Info Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
コード例 #5
0
        private BDOperatorAddressInfoEntity BuildBDOperatorAddressInfoEntity()
        {
            BDOperatorAddressInfoEntity bDOperatorAddressInfoEntity = CurrentBDOperatorAddressInfoEntity;

            if (ddlOperatorID.Items.Count > 0)
            {
                if (ddlOperatorID.SelectedValue == "0")
                {
                }
                else
                {
                    bDOperatorAddressInfoEntity.OperatorID = Int64.Parse(ddlOperatorID.SelectedValue);
                }
            }

            bDOperatorAddressInfoEntity.WebLink = txtWebLink.Text.Trim();
            if (ddlOperatorAddressTypeID.Items.Count > 0)
            {
                if (ddlOperatorAddressTypeID.SelectedValue == "0")
                {
                }
                else
                {
                    bDOperatorAddressInfoEntity.OperatorAddressTypeID = Int64.Parse(ddlOperatorAddressTypeID.SelectedValue);
                }
            }

            bDOperatorAddressInfoEntity.AddressLine1 = txtAddressLine1.Text.Trim();
            bDOperatorAddressInfoEntity.AddressLine2 = txtAddressLine2.Text.Trim();
            if (!txtCountryID.Text.Trim().IsNullOrEmpty())
            {
                bDOperatorAddressInfoEntity.CountryID = Int64.Parse(txtCountryID.Text.Trim());
            }
            else
            {
                bDOperatorAddressInfoEntity.CountryID = null;
            }

            if (!txtCityID.Text.Trim().IsNullOrEmpty())
            {
                bDOperatorAddressInfoEntity.CityID = Int64.Parse(txtCityID.Text.Trim());
            }
            else
            {
                bDOperatorAddressInfoEntity.CityID = null;
            }

            bDOperatorAddressInfoEntity.ZipCode = txtZipCode.Text.Trim();
            bDOperatorAddressInfoEntity.Phone   = txtPhone.Text.Trim();
            bDOperatorAddressInfoEntity.Email   = txtEmail.Text.Trim();

            return(bDOperatorAddressInfoEntity);
        }
コード例 #6
0
        protected void lvBDOperatorAddressInfo_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 OperatorAddressInfoID;

            Int64.TryParse(e.CommandArgument.ToString(), out OperatorAddressInfoID);

            if (OperatorAddressInfoID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _OperatorAddressInfoID = OperatorAddressInfoID;

                    PrepareEditView();

                    cpeEditor.Collapsed   = false;
                    cpeEditor.ClientState = "false";
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(BDOperatorAddressInfoEntity.FLD_NAME_OperatorAddressInfoID, OperatorAddressInfoID.ToString(), SQLMatchType.Equal);

                        BDOperatorAddressInfoEntity bDOperatorAddressInfoEntity = new BDOperatorAddressInfoEntity();


                        result = FCCBDOperatorAddressInfo.GetFacadeCreate().Delete(bDOperatorAddressInfoEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _OperatorAddressInfoID       = 0;
                            _BDOperatorAddressInfoEntity = new BDOperatorAddressInfoEntity();
                            PrepareInitialView();
                            BindBDOperatorAddressInfoList();

                            MiscUtil.ShowMessage(lblMessage, "Operator Address Info has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Operator Address Info.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
コード例 #7
0
        private Int64 DeleteTran(BDOperatorAddressInfoEntity bDOperatorAddressInfoEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.BDOperatorAddressInfo_SET";

            Database db = DatabaseFactory.CreateDatabase();


            using (DbCommand cmd = db.GetStoredProcCommand(SP))
            {
                AddOptionParameter(cmd, option);
                AddOutputParameter(cmd, db);
                AddFilterExpressionParameter(cmd, filterExpression, db);


                DbConnection connection = db.CreateConnection();
                connection.Open();
                DbTransaction transaction = connection.BeginTransaction();

                try
                {
                    using (IDataReader reader = db.ExecuteReader(cmd, transaction))
                    {
                        returnCode = GetReturnCodeFromParameter(cmd);
                    }

                    if (returnCode >= 0)
                    {
                        transaction.Commit();
                    }
                    else
                    {
                        throw new ArgumentException("Error Code." + returnCode.ToString());
                    }
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    throw ex;
                }
                finally
                {
                    transaction.Dispose();
                    connection.Close();
                    connection = null;
                }
            }

            return(returnCode);
        }
コード例 #8
0
        private Int64 Update(BDOperatorAddressInfoEntity bDOperatorAddressInfoEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.BDOperatorAddressInfo_SET";

            using (DbCommand cmd = Database.GetStoredProcCommand(SP))
            {
                AddOptionParameter(cmd, option);
                AddOutputParameter(cmd);
                AddFilterExpressionParameter(cmd, filterExpression);

                Database.AddInParameter(cmd, "@OperatorAddressInfoID", DbType.Int64, bDOperatorAddressInfoEntity.OperatorAddressInfoID);
                Database.AddInParameter(cmd, "@OperatorID", DbType.Int64, bDOperatorAddressInfoEntity.OperatorID);
                Database.AddInParameter(cmd, "@WebLink", DbType.String, bDOperatorAddressInfoEntity.WebLink);
                Database.AddInParameter(cmd, "@OperatorAddressTypeID", DbType.Int64, bDOperatorAddressInfoEntity.OperatorAddressTypeID);
                Database.AddInParameter(cmd, "@AddressLine1", DbType.String, bDOperatorAddressInfoEntity.AddressLine1);
                Database.AddInParameter(cmd, "@AddressLine2", DbType.String, bDOperatorAddressInfoEntity.AddressLine2);
                Database.AddInParameter(cmd, "@CountryID", DbType.Int64, bDOperatorAddressInfoEntity.CountryID);
                Database.AddInParameter(cmd, "@CityID", DbType.Int64, bDOperatorAddressInfoEntity.CityID);
                Database.AddInParameter(cmd, "@ZipCode", DbType.String, bDOperatorAddressInfoEntity.ZipCode);
                Database.AddInParameter(cmd, "@Phone", DbType.String, bDOperatorAddressInfoEntity.Phone);
                Database.AddInParameter(cmd, "@Email", DbType.String, bDOperatorAddressInfoEntity.Email);

                using (IDataReader reader = Database.ExecuteReader(cmd))
                {
                    returnCode = GetReturnCodeFromParameter(cmd);

                    switch (returnCode)
                    {
                    case SqlConstants.DB_STATUS_CODE_DATAALREADYEXIST:
                    {
                        throw new ArgumentException("BDOperatorAddressInfoEntity already exists. Please specify another BDOperatorAddressInfoEntity.");
                    }

                    case SqlConstants.DB_STATUS_CODE_DATAUPDATEDFROMOTHERSESSION:
                    {
                        throw new ArgumentException("BDOperatorAddressInfoEntity data already updated from different session.");
                    }

                    case SqlConstants.DB_STATUS_CODE_FAIL_OPERATION:
                    {
                        throw new ArgumentException("BDOperatorAddressInfoEntity already exists. Please specify another BDOperatorAddressInfoEntity.");
                    }
                    }
                }
            }

            return(returnCode);
        }
コード例 #9
0
        private Int64 Delete(BDOperatorAddressInfoEntity bDOperatorAddressInfoEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.BDOperatorAddressInfo_SET";

            using (DbCommand cmd = Database.GetStoredProcCommand(SP))
            {
                AddOptionParameter(cmd, option);
                AddOutputParameter(cmd);
                AddFilterExpressionParameter(cmd, filterExpression);


                using (IDataReader reader = Database.ExecuteReader(cmd))
                {
                    returnCode = GetReturnCodeFromParameter(cmd);

                    switch (returnCode)
                    {
                    case SqlConstants.DB_STATUS_CODE_DATAALREADYEXIST:
                    {
                        throw new ArgumentException("BDOperatorAddressInfoEntity already exists. Please specify another BDOperatorAddressInfoEntity.");
                    }

                    case SqlConstants.DB_STATUS_CODE_DATAUPDATEDFROMOTHERSESSION:
                    {
                        throw new ArgumentException("BDOperatorAddressInfoEntity data already updated from different session.");
                    }

                    case SqlConstants.DB_STATUS_CODE_FAIL_OPERATION:
                    {
                        throw new ArgumentException("BDOperatorAddressInfoEntity already exists. Please specify another BDOperatorAddressInfoEntity.");
                    }
                    }
                }
            }

            return(returnCode);
        }
コード例 #10
0
 protected void btnAddNew_Click(object sender, EventArgs e)
 {
     _OperatorAddressInfoID       = 0;
     _BDOperatorAddressInfoEntity = new BDOperatorAddressInfoEntity();
     PrepareInitialView();
 }
コード例 #11
0
 Int64 IBDOperatorAddressInfoFacade.Delete(BDOperatorAddressInfoEntity bDOperatorAddressInfoEntity, String filterExpression, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateBDOperatorAddressInfoDataAccess().Delete(bDOperatorAddressInfoEntity, filterExpression, option, reqTran));
 }
コード例 #12
0
 Int64 IBDOperatorAddressInfoFacade.Add(BDOperatorAddressInfoEntity bDOperatorAddressInfoEntity, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateBDOperatorAddressInfoDataAccess().Add(bDOperatorAddressInfoEntity, option, reqTran));
 }