コード例 #1
0
        public IList <CRMBuyerBasicInfoEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <CRMBuyerBasicInfoEntity> cRMBuyerBasicInfoEntityList = new List <CRMBuyerBasicInfoEntity>();

            try
            {
                if (pageSize == -1)
                {
                    pageSize = 1000000000;
                }

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = CRMBuyerBasicInfoEntity.FLD_NAME_BuyerBasicInfoID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

                startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1;

                cRMBuyerBasicInfoEntityList = FCCCRMBuyerBasicInfo.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

                if (cRMBuyerBasicInfoEntityList != null && cRMBuyerBasicInfoEntityList.Count > 0)
                {
                    totalRowCount = cRMBuyerBasicInfoEntityList[0].TotalRowCount;
                }
            }
            catch (Exception ex)
            {
            }

            return(cRMBuyerBasicInfoEntityList ?? new List <CRMBuyerBasicInfoEntity>());
        }
コード例 #2
0
        protected void lvCRMBuyerBasicInfo_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 BuyerBasicInfoID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(CRMBuyerBasicInfoEntity.FLD_NAME_BuyerBasicInfoID, BuyerBasicInfoID.ToString(), SQLMatchType.Equal);

                        CRMBuyerBasicInfoEntity cRMBuyerBasicInfoEntity = new CRMBuyerBasicInfoEntity();


                        result = FCCCRMBuyerBasicInfo.GetFacadeCreate().Delete(cRMBuyerBasicInfoEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _BuyerBasicInfoID        = 0;
                            _CRMBuyerBasicInfoEntity = new CRMBuyerBasicInfoEntity();
                            PrepareInitialView();
                            BindCRMBuyerBasicInfoList();

                            MiscUtil.ShowMessage(lblMessage, "C RMBuyer Basic Info has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete C RMBuyer Basic Info.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
コード例 #3
0
        public IList <CRMBuyerBasicInfoEntity> GetData()
        {
            IList <CRMBuyerBasicInfoEntity> cRMBuyerBasicInfoEntityList = new List <CRMBuyerBasicInfoEntity>();

            try
            {
                cRMBuyerBasicInfoEntityList = FCCCRMBuyerBasicInfo.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

                if (cRMBuyerBasicInfoEntityList != null && cRMBuyerBasicInfoEntityList.Count > 0)
                {
                    totalRowCount = cRMBuyerBasicInfoEntityList[0].TotalRowCount;
                }
            }
            catch (Exception ex)
            {
            }

            return(cRMBuyerBasicInfoEntityList ?? new List <CRMBuyerBasicInfoEntity>());
        }
コード例 #4
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);
                }
            }
        }