Beispiel #1
0
        private CRMBuyerInterestedRoomMapEntity BuildCRMBuyerInterestedRoomMapEntity()
        {
            CRMBuyerInterestedRoomMapEntity cRMBuyerInterestedRoomMapEntity = CurrentCRMBuyerInterestedRoomMapEntity;

            if (ddlBuyerBasicInfoID.Items.Count > 0)
            {
                if (ddlBuyerBasicInfoID.SelectedValue == "0")
                {
                }
                else
                {
                    cRMBuyerInterestedRoomMapEntity.BuyerBasicInfoID = Int64.Parse(ddlBuyerBasicInfoID.SelectedValue);
                }
            }

            if (ddlBuyerInterestedRoomCategoryID.Items.Count > 0)
            {
                if (ddlBuyerInterestedRoomCategoryID.SelectedValue == "0")
                {
                }
                else
                {
                    cRMBuyerInterestedRoomMapEntity.BuyerInterestedRoomCategoryID = Int64.Parse(ddlBuyerInterestedRoomCategoryID.SelectedValue);
                }
            }


            return(cRMBuyerInterestedRoomMapEntity);
        }
Beispiel #2
0
        Int64 ICRMBuyerInterestedRoomMapDataAccess.Add(CRMBuyerInterestedRoomMapEntity cRMBuyerInterestedRoomMapEntity, DatabaseOperationType option, TransactionRequired reqTran)
        {
            try
            {
                long retValues = -99;

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

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

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

                return(retValues);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #3
0
        private void SaveCRMBuyerInterestedRoomMapEntity()
        {
            if (IsValid)
            {
                try
                {
                    CRMBuyerInterestedRoomMapEntity cRMBuyerInterestedRoomMapEntity = BuildCRMBuyerInterestedRoomMapEntity();

                    Int64 result = -1;

                    if (cRMBuyerInterestedRoomMapEntity.IsNew)
                    {
                        result = FCCCRMBuyerInterestedRoomMap.GetFacadeCreate().Add(cRMBuyerInterestedRoomMapEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CRMBuyerInterestedRoomMapEntity.FLD_NAME_BuyerInterestedRoomMapID, cRMBuyerInterestedRoomMapEntity.BuyerInterestedRoomMapID.ToString(), SQLMatchType.Equal);
                        result = FCCCRMBuyerInterestedRoomMap.GetFacadeCreate().Update(cRMBuyerInterestedRoomMapEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _BuyerInterestedRoomMapID        = 0;
                        _CRMBuyerInterestedRoomMapEntity = new CRMBuyerInterestedRoomMapEntity();
                        PrepareInitialView();
                        BindCRMBuyerInterestedRoomMapList();

                        if (cRMBuyerInterestedRoomMapEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "C RMBuyer Interested Room Map Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "C RMBuyer Interested Room Map Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (cRMBuyerInterestedRoomMapEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add C RMBuyer Interested Room Map Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update C RMBuyer Interested Room Map Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Beispiel #4
0
        private Int64 UpdateTran(CRMBuyerInterestedRoomMapEntity cRMBuyerInterestedRoomMapEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.CRMBuyerInterestedRoomMap_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, "@BuyerInterestedRoomMapID", DbType.Int64, cRMBuyerInterestedRoomMapEntity.BuyerInterestedRoomMapID);
                db.AddInParameter(cmd, "@BuyerBasicInfoID", DbType.Int64, cRMBuyerInterestedRoomMapEntity.BuyerBasicInfoID);
                db.AddInParameter(cmd, "@BuyerInterestedRoomCategoryID", DbType.Int64, cRMBuyerInterestedRoomMapEntity.BuyerInterestedRoomCategoryID);

                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);
        }
Beispiel #5
0
        protected void lvCRMBuyerInterestedRoomMap_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 BuyerInterestedRoomMapID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(CRMBuyerInterestedRoomMapEntity.FLD_NAME_BuyerInterestedRoomMapID, BuyerInterestedRoomMapID.ToString(), SQLMatchType.Equal);

                        CRMBuyerInterestedRoomMapEntity cRMBuyerInterestedRoomMapEntity = new CRMBuyerInterestedRoomMapEntity();


                        result = FCCCRMBuyerInterestedRoomMap.GetFacadeCreate().Delete(cRMBuyerInterestedRoomMapEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _BuyerInterestedRoomMapID        = 0;
                            _CRMBuyerInterestedRoomMapEntity = new CRMBuyerInterestedRoomMapEntity();
                            PrepareInitialView();
                            BindCRMBuyerInterestedRoomMapList();

                            MiscUtil.ShowMessage(lblMessage, "C RMBuyer Interested Room Map has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete C RMBuyer Interested Room Map.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Beispiel #6
0
        private Int64 Update(CRMBuyerInterestedRoomMapEntity cRMBuyerInterestedRoomMapEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.CRMBuyerInterestedRoomMap_SET";

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

                Database.AddInParameter(cmd, "@BuyerInterestedRoomMapID", DbType.Int64, cRMBuyerInterestedRoomMapEntity.BuyerInterestedRoomMapID);
                Database.AddInParameter(cmd, "@BuyerBasicInfoID", DbType.Int64, cRMBuyerInterestedRoomMapEntity.BuyerBasicInfoID);
                Database.AddInParameter(cmd, "@BuyerInterestedRoomCategoryID", DbType.Int64, cRMBuyerInterestedRoomMapEntity.BuyerInterestedRoomCategoryID);

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

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

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

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

            return(returnCode);
        }
Beispiel #7
0
        private void PrepareEditView()
        {
            CRMBuyerInterestedRoomMapEntity cRMBuyerInterestedRoomMapEntity = CurrentCRMBuyerInterestedRoomMapEntity;


            if (!cRMBuyerInterestedRoomMapEntity.IsNew)
            {
                if (ddlBuyerBasicInfoID.Items.Count > 0 && cRMBuyerInterestedRoomMapEntity.BuyerBasicInfoID != null)
                {
                    ddlBuyerBasicInfoID.SelectedValue = cRMBuyerInterestedRoomMapEntity.BuyerBasicInfoID.ToString();
                }

                if (ddlBuyerInterestedRoomCategoryID.Items.Count > 0 && cRMBuyerInterestedRoomMapEntity.BuyerInterestedRoomCategoryID != null)
                {
                    ddlBuyerInterestedRoomCategoryID.SelectedValue = cRMBuyerInterestedRoomMapEntity.BuyerInterestedRoomCategoryID.ToString();
                }


                btnSubmit.Text    = "Update";
                btnAddNew.Visible = true;
            }
        }
Beispiel #8
0
 protected void btnAddNew_Click(object sender, EventArgs e)
 {
     _BuyerInterestedRoomMapID        = 0;
     _CRMBuyerInterestedRoomMapEntity = new CRMBuyerInterestedRoomMapEntity();
     PrepareInitialView();
 }
Beispiel #9
0
        private void SaveCRMBuyerBasicInfoEntity()
        {
            if (IsValid)
            {
                try
                {
                    CRMBuyerBasicInfoEntity cRMBuyerBasicInfoEntity = BuildCRMBuyerBasicInfoEntity();

                    Int64 result = -1;

                    if (cRMBuyerBasicInfoEntity.IsNew)
                    {
                        result = FCCCRMBuyerBasicInfo.GetFacadeCreate().Add(cRMBuyerBasicInfoEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CRMBuyerBasicInfoEntity.FLD_NAME_BuyerBasicInfoID, cRMBuyerBasicInfoEntity.BuyerBasicInfoID.ToString(), SQLMatchType.Equal);
                        result = FCCCRMBuyerBasicInfo.GetFacadeCreate().Update(cRMBuyerBasicInfoEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        #region Buyer Interested Room Map

                        try
                        {
                            IList <CRMBuyerInterestedRoomMapEntity> newMappedItems = new List <CRMBuyerInterestedRoomMapEntity>();

                            foreach (ListItem chbxItem in chbxBuyerInterestedRoom.Items)
                            {
                                if (chbxItem.Selected)
                                {
                                    CRMBuyerInterestedRoomMapEntity mDItemMapEntity = new CRMBuyerInterestedRoomMapEntity();
                                    mDItemMapEntity.BuyerBasicInfoID = result;
                                    mDItemMapEntity.BuyerInterestedRoomCategoryID = Int64.Parse(chbxItem.Value.ToString());
                                    newMappedItems.Add(mDItemMapEntity);
                                }
                            }

                            IList <CRMBuyerInterestedRoomMapEntity> deleteList = _CurrentCRMBuyerInterestedRoomMapEntityList.Except(newMappedItems, new CustomerComparer()).ToList();
                            IList <CRMBuyerInterestedRoomMapEntity> addNewList = newMappedItems.Except(_CurrentCRMBuyerInterestedRoomMapEntityList, new CustomerComparer()).ToList();

                            if (deleteList != null && deleteList.Count > 0)
                            {
                                foreach (CRMBuyerInterestedRoomMapEntity ent in deleteList)
                                {
                                    String fe1 = SqlExpressionBuilder.PrepareFilterExpression(CRMBuyerInterestedRoomMapEntity.FLD_NAME_BuyerBasicInfoID, ent.BuyerBasicInfoID.ToString(), SQLMatchType.Equal);
                                    String fe2 = SqlExpressionBuilder.PrepareFilterExpression(CRMBuyerInterestedRoomMapEntity.FLD_NAME_BuyerInterestedRoomCategoryID, ent.BuyerInterestedRoomCategoryID.ToString(), SQLMatchType.Equal);
                                    String fe  = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2);

                                    FCCCRMBuyerInterestedRoomMap.GetFacadeCreate().Delete(ent, fe, DatabaseOperationType.Delete, TransactionRequired.No);
                                }
                            }

                            if (addNewList != null && addNewList.Count > 0)
                            {
                                foreach (CRMBuyerInterestedRoomMapEntity ent in addNewList)
                                {
                                    FCCCRMBuyerInterestedRoomMap.GetFacadeCreate().Add(ent, DatabaseOperationType.Add, TransactionRequired.No);
                                }
                            }

                            //MiscUtil.ShowMessage(lblMessage, "Item Brand Map Information has been added successfully.", false);

                            if (Operation == "Communicate")
                            {
                                String navUrl = UrlHelper.BuildSecureUrl("~/CRM/CRMCommunication.aspx", string.Empty, "do", "Sales", UrlConstants.OVERVIEW_BUYER_BASIC_INFO_ID, result.ToString()).ToString();
                                Response.Redirect(navUrl);
                            }

                            else if (Operation == "none")
                            {
                                String navUrl = UrlHelper.BuildSecureUrl("~/CRM/CRMBuyerAllottee.aspx", string.Empty, UrlConstants.OVERVIEW_BUYER_BASIC_INFO_ID, result.ToString()).ToString();
                                Response.Redirect(navUrl);
                            }
                        }
                        catch (Exception ex)
                        {
                            MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                        }

                        #endregion

                        _BuyerBasicInfoID        = 0;
                        Operation                = "none";
                        _CRMBuyerBasicInfoEntity = new CRMBuyerBasicInfoEntity();
                        PrepareInitialView();
                        BindCRMBuyerBasicInfoList();
                        BindPRMItemBrandMapList();

                        if (cRMBuyerBasicInfoEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Buyer Basic Info Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Buyer Basic Info Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (cRMBuyerBasicInfoEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Buyer Basic Info Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Buyer Basic Info Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Beispiel #10
0
 Int64 ICRMBuyerInterestedRoomMapFacade.Delete(CRMBuyerInterestedRoomMapEntity cRMBuyerInterestedRoomMapEntity, String filterExpression, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateCRMBuyerInterestedRoomMapDataAccess().Delete(cRMBuyerInterestedRoomMapEntity, filterExpression, option, reqTran));
 }
Beispiel #11
0
 Int64 ICRMBuyerInterestedRoomMapFacade.Add(CRMBuyerInterestedRoomMapEntity cRMBuyerInterestedRoomMapEntity, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateCRMBuyerInterestedRoomMapDataAccess().Add(cRMBuyerInterestedRoomMapEntity, option, reqTran));
 }