コード例 #1
0
        private void ProcessText()
        {
            String input = txtText.Content.ToString();

            String newOutPut = String.Empty;

            String fe = SqlExpressionBuilder.PrepareFilterExpression(CRMAgreementVariableMapEntity.FLD_NAME_AgreementID, OverviewAgreementID.ToString(), SQLMatchType.Equal);
            IList <CRMAgreementVariableMapEntity> cRMAgreementVariableMapList = FCCCRMAgreementVariableMap.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

            if (cRMAgreementVariableMapList != null && cRMAgreementVariableMapList.Count > 0)
            {
                foreach (CRMAgreementVariableMapEntity ent in cRMAgreementVariableMapList)
                {
                    newOutPut = MiscUtil.ReplaceFullWords(input, ent.Name, ent.Value.ToString());
                    input     = newOutPut;
                }
            }

            if (newOutPut.IsNotNullOrEmpty())
            {
                lblTextView.Text = newOutPut;
            }
            else
            {
                lblTextView.Text = input;
            }
        }
コード例 #2
0
        public IList <CRMAgreementVariableMapEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <CRMAgreementVariableMapEntity> cRMAgreementVariableMapEntityList = new List <CRMAgreementVariableMapEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = CRMAgreementVariableMapEntity.FLD_NAME_AgreementVariableMapID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                cRMAgreementVariableMapEntityList = FCCCRMAgreementVariableMap.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(cRMAgreementVariableMapEntityList ?? new List <CRMAgreementVariableMapEntity>());
        }
コード例 #3
0
        private void SaveCRMAgreementVariableMapEntity()
        {
            if (IsValid)
            {
                try
                {
                    CRMAgreementVariableMapEntity cRMAgreementVariableMapEntity = BuildCRMAgreementVariableMapEntity();

                    Int64 result = -1;

                    if (cRMAgreementVariableMapEntity.IsNew)
                    {
                        result = FCCCRMAgreementVariableMap.GetFacadeCreate().Add(cRMAgreementVariableMapEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CRMAgreementVariableMapEntity.FLD_NAME_AgreementVariableMapID, cRMAgreementVariableMapEntity.AgreementVariableMapID.ToString(), SQLMatchType.Equal);
                        result = FCCCRMAgreementVariableMap.GetFacadeCreate().Update(cRMAgreementVariableMapEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _AgreementVariableMapID        = 0;
                        _CRMAgreementVariableMapEntity = new CRMAgreementVariableMapEntity();
                        PrepareInitialView();
                        BindCRMAgreementVariableMapList();

                        if (cRMAgreementVariableMapEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Agreement Variable Map Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Agreement Variable Map Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (cRMAgreementVariableMapEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Agreement Variable Map Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Agreement Variable Map Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
コード例 #4
0
        protected void lvCRMAgreementVariableMap_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 AgreementVariableMapID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(CRMAgreementVariableMapEntity.FLD_NAME_AgreementVariableMapID, AgreementVariableMapID.ToString(), SQLMatchType.Equal);

                        CRMAgreementVariableMapEntity cRMAgreementVariableMapEntity = new CRMAgreementVariableMapEntity();


                        result = FCCCRMAgreementVariableMap.GetFacadeCreate().Delete(cRMAgreementVariableMapEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _AgreementVariableMapID        = 0;
                            _CRMAgreementVariableMapEntity = new CRMAgreementVariableMapEntity();
                            PrepareInitialView();
                            BindCRMAgreementVariableMapList();

                            MiscUtil.ShowMessage(lblMessage, "C RMAgreement Variable Map has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete C RMAgreement Variable Map.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
コード例 #5
0
        public IList <CRMAgreementVariableMapEntity> GetData()
        {
            IList <CRMAgreementVariableMapEntity> cRMAgreementVariableMapEntityList = new List <CRMAgreementVariableMapEntity>();

            try
            {
                cRMAgreementVariableMapEntityList = FCCCRMAgreementVariableMap.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(cRMAgreementVariableMapEntityList ?? new List <CRMAgreementVariableMapEntity>());
        }
コード例 #6
0
        private void PrepareEditView()
        {
            CRMAgreementEntity cRMAgreementEntity = CurrentCRMAgreementEntity;


            if (!cRMAgreementEntity.IsNew)
            {
                if (ddlPaymentScheduleID.Items.Count > 0 && cRMAgreementEntity.PaymentScheduleID != null)
                {
                    ddlPaymentScheduleID.SelectedValue = cRMAgreementEntity.PaymentScheduleID.ToString();
                }
                if (ddlAgreementTypeID.Items.Count > 0 && cRMAgreementEntity.AgreementTypeID != null)
                {
                    ddlAgreementTypeID.SelectedValue = cRMAgreementEntity.AgreementTypeID.ToString();
                }

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

                if (ddlProjectID.Items.Count > 0 && cRMAgreementEntity.ProjectID != null)
                {
                    ddlProjectID.SelectedValue = cRMAgreementEntity.ProjectID.ToString();
                }

                BuildProjectFloorUnitByProjectID();

                if (ddlProjectFloorUnitID.Items.Count > 0 && cRMAgreementEntity.ProjectFloorUnitID != null)
                {
                    ddlProjectFloorUnitID.SelectedValue = cRMAgreementEntity.ProjectFloorUnitID.ToString();
                }

                txtText.Content       = cRMAgreementEntity.Text.ToString();
                txtAgreementDate.Text = cRMAgreementEntity.AgreementDate.ToStringDefault();
                txtSignDate.Text      = cRMAgreementEntity.SignDate.ToStringDefault();
                txtExecuteDate.Text   = cRMAgreementEntity.ExecuteDate.ToStringDefault();
                txtWizardRemarks.Text = cRMAgreementEntity.Remarks.ToString();

                if (ddlAgreementApprovalStatusID.Items.Count > 0 && cRMAgreementEntity.AgreementApprovalStatusID != null)
                {
                    ddlAgreementApprovalStatusID.SelectedValue = cRMAgreementEntity.AgreementApprovalStatusID.ToString();
                }

                #region Process Your Data Here

                String input = cRMAgreementEntity.Text.ToString();

                String newOutPut = String.Empty;

                IList <CRMAgreementVariableMapEntity> cRMAgreementVariableList = FCCCRMAgreementVariableMap.GetFacadeCreate().GetIL(null, null, String.Empty, String.Empty, DatabaseOperationType.Load);

                if (cRMAgreementVariableList != null && cRMAgreementVariableList.Count > 0)
                {
                    foreach (CRMAgreementVariableMapEntity ent in cRMAgreementVariableList)
                    {
                        if (input.Contains(ent.Name))
                        {
                            newOutPut = MiscUtil.ReplaceFullWords(input, ent.Name, ent.Value.ToString());
                            input     = newOutPut;
                        }
                    }
                }

                lblTextView.Text = newOutPut;

                #endregion
            }
        }
コード例 #7
0
        private void SaveCRMAgreementEntity()
        {
            if (IsValid)
            {
                try
                {
                    CRMAgreementEntity cRMAgreementEntity = BuildCRMAgreementEntity();

                    Int64 result = -1;

                    if (cRMAgreementEntity.IsNew)
                    {
                        result = FCCCRMAgreement.GetFacadeCreate().Add(cRMAgreementEntity, DatabaseOperationType.Add, TransactionRequired.No);

                        String input = txtText.Content.ToString();

                        String newOutPut = String.Empty;

                        IList <CRMMDAgreementVariableEntity> cRMAgreementVariableList = FCCCRMMDAgreementVariable.GetFacadeCreate().GetIL(null, null, String.Empty, String.Empty, DatabaseOperationType.Load);

                        if (cRMAgreementVariableList != null && cRMAgreementVariableList.Count > 0)
                        {
                            foreach (CRMMDAgreementVariableEntity ent in cRMAgreementVariableList)
                            {
                                if (input.Contains(ent.Name))  // AGR body matching
                                {
                                    CRMAgreementVariableMapEntity cRMAgrementVariableMapEnt = new CRMAgreementVariableMapEntity();
                                    cRMAgrementVariableMapEnt.Name  = ent.Name;
                                    cRMAgrementVariableMapEnt.Value = ent.Value;
                                    cRMAgreementVariableMapEntityList.Add(cRMAgrementVariableMapEnt);
                                    newOutPut = MiscUtil.ReplaceFullWords(input, ent.Name, ent.Value.ToString());
                                    input     = newOutPut;
                                }
                            }
                        }

                        if (newOutPut.IsNotNullOrEmpty())
                        {
                            lblTextView.Text = Server.HtmlDecode(newOutPut);
                        }
                        else
                        {
                            lblTextView.Text = Server.HtmlDecode(input);
                        }
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CRMAgreementEntity.FLD_NAME_AgreementID, cRMAgreementEntity.AgreementID.ToString(), SQLMatchType.Equal);
                        result = FCCCRMAgreement.GetFacadeCreate().Update(cRMAgreementEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);

                        String input = txtText.Content.ToString();

                        String newOutPut = String.Empty;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(CRMAgreementVariableMapEntity.FLD_NAME_AgreementID, result.ToString(), SQLMatchType.Equal);
                        IList <CRMAgreementVariableMapEntity> cRMAgreementVariableList = FCCCRMAgreementVariableMap.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

                        if (cRMAgreementVariableList != null && cRMAgreementVariableList.Count > 0)
                        {
                            cRMAgreementVariableMapEntityList = new List <CRMAgreementVariableMapEntity>();

                            foreach (CRMAgreementVariableMapEntity ent in cRMAgreementVariableList)
                            {
                                if (input.Contains(ent.Name))
                                {
                                    CRMAgreementVariableMapEntity cRMAgrementVariableMapEnt = new CRMAgreementVariableMapEntity();
                                    cRMAgrementVariableMapEnt.Name  = ent.Name;
                                    cRMAgrementVariableMapEnt.Value = ent.Value;
                                    //cRMAgreementVariableMapEntityList.Add(cRMAgrementVariableMapEnt);
                                    newOutPut = MiscUtil.ReplaceFullWords(input, ent.Name, ent.Value.ToString());
                                    input     = newOutPut;
                                }
                            }
                        }

                        if (newOutPut.IsNotNullOrEmpty())
                        {
                            lblTextView.Text = Server.HtmlDecode(newOutPut);
                        }
                        else
                        {
                            lblTextView.Text = input;
                        }
                    }

                    if (result > 0)
                    {
                        #region Agreement variable Map

                        if (cRMAgreementEntity.IsNew)
                        {
                            if (cRMAgreementVariableMapEntityList != null && cRMAgreementVariableMapEntityList.Count > 0)
                            {
                                // Delete Variable Map Table

                                //String fe_delete=SqlExpressionBuilder.PrepareFilterExpression(CRMAgreementVariableMapEntity.FLD_NAME_AgreementID,result.ToString(),SQLMatchType.Equal);
                                //IList<CRMAgreementVariableMapEntity> deleteList = FCCCRMAgreementVariableMap.GetFacadeCreate().GetIL(null, null, String.Empty, fe_delete, DatabaseOperationType.LoadWithFilterExpression);

                                //if (deleteList != null && deleteList.Count > 0)
                                //{
                                //    foreach (CRMAgreementVariableMapEntity ent in cRMAgreementVariableMapEntityList)
                                //    {
                                //        FCCCRMAgreementVariableMap.GetFacadeCreate().Delete(ent, fe_delete, DatabaseOperationType.Delete, TransactionRequired.No);
                                //    }
                                //}

                                foreach (CRMAgreementVariableMapEntity ent in cRMAgreementVariableMapEntityList)
                                {
                                    CRMAgreementVariableMapEntity cRMAgrementVariableMapEnt = new CRMAgreementVariableMapEntity();
                                    cRMAgrementVariableMapEnt.Name                = ent.Name;
                                    cRMAgrementVariableMapEnt.Value               = ent.Value;
                                    cRMAgrementVariableMapEnt.IP                  = MiscUtil.GetLocalIP();
                                    cRMAgrementVariableMapEnt.Remarks             = "Auto Generated";
                                    cRMAgrementVariableMapEnt.CreateDate          = System.DateTime.Now;
                                    cRMAgrementVariableMapEnt.CreatedByEmployeeID = CurrentemployeeID;
                                    cRMAgrementVariableMapEnt.AgreementID         = result;

                                    FCCCRMAgreementVariableMap.GetFacadeCreate().Add(cRMAgrementVariableMapEnt, DatabaseOperationType.Add, TransactionRequired.No);
                                }
                            }
                        }

                        #endregion

                        if (cRMAgreementEntity.AgreementTypeID == MasterDataConstants.CRMMDAgreementType.SPECS)
                        {
                            hypAgreementSpec.NavigateUrl = UrlHelper.BuildSecureUrl("~/CRM/CRMAgreementSpecs.aspx", String.Empty, UrlConstants.OVERVIEW_AGREEMENT_ID, result.ToString()).ToString();
                            hypAgreementSpec.Target      = "_blank";
                            hypAgreementSpec.Visible     = true;
                        }

                        hypAgreementVariablePopup.NavigateUrl = UrlHelper.BuildSecureUrl("~/CRM/CRMAgreementVariableMap.aspx", String.Empty, UrlConstants.OVERVIEW_AGREEMENT_ID, result.ToString()).ToString();
                        hypAgreementVariablePopup.Target      = "_blank";
                        hypAgreementVariablePopup.Visible     = true;

                        _AgreementID = result;
                        //_CRMAgreementEntity = new CRMAgreementEntity();
                        PrepareEditView();
                        BindCRMAgreementList();

                        if (cRMAgreementEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Agreement Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Agreement Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (cRMAgreementEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Agreement Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Agreement Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
コード例 #8
0
        private void SaveCRMAgreementSpecsEntity()
        {
            if (IsValid)
            {
                try
                {
                    CRMAgreementSpecsEntity cRMAgreementSpecsEntity = BuildCRMAgreementSpecsEntity();

                    Int64 result = -1;

                    if (cRMAgreementSpecsEntity.IsNew)
                    {
                        result = FCCCRMAgreementSpecs.GetFacadeCreate().Add(cRMAgreementSpecsEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CRMAgreementSpecsEntity.FLD_NAME_AgreementSpecsID, cRMAgreementSpecsEntity.AgreementSpecsID.ToString(), SQLMatchType.Equal);
                        result = FCCCRMAgreementSpecs.GetFacadeCreate().Update(cRMAgreementSpecsEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        if (cRMAgreementSpecsEntity.IsNew)
                        {
                            for (Int32 i = 1; i <= 5; i++)
                            {
                                CRMAgreementVariableMapEntity ent = new CRMAgreementVariableMapEntity();
                                switch (i)
                                {
                                //case 1:
                                //    ent.Name = "&lt;%$$" + cRMAgreementSpecsEntity.AgreementSpecsType+"_"+cRMAgreementSpecsEntity.Item +"_IName"+ result.ToString() + "%&gt;";
                                //    ent.Value = cRMAgreementSpecsEntity.Item;
                                //    break;
                                //case 2:
                                //    ent.Name = "&lt;%$$" + cRMAgreementSpecsEntity.AgreementSpecsType + "_" + ddlBrandID.SelectedItem + "_IBrand_" + result.ToString() + "%&gt;";
                                //    ent.Value = ddlBrandID.SelectedItem.ToString();
                                //    break;
                                //case 3:
                                //    ent.Name = "&lt;%$$" + cRMAgreementSpecsEntity.AgreementSpecsType + "_" + cRMAgreementSpecsEntity.Item+"_IQty_"+ result.ToString()+ "%&gt;";
                                //    ent.Value = cRMAgreementSpecsEntity.BayQty.ToString();
                                //    break;
                                //case 4:
                                //    ent.Name = "&lt;%$$" + cRMAgreementSpecsEntity.AgreementSpecsType + "_" + cRMAgreementSpecsEntity.Item+"_IPrice_"+ result.ToString()+"%&gt;";
                                //    ent.Value = cRMAgreementSpecsEntity.BayPrice.ToString();
                                //    break;
                                //case 5:
                                //    ent.Name = "&lt;%$$" + cRMAgreementSpecsEntity.AgreementSpecsType + "_" + cRMAgreementSpecsEntity.Field1+ "_IUnit_"+ result.ToString() + "%&gt;";
                                //    ent.Value = cRMAgreementSpecsEntity.Field1.ToString();
                                //    break;

                                case 1:
                                    ent.Name  = "&lt;%$$" + cRMAgreementSpecsEntity.AgreementSpecsType + "_IName" + result.ToString() + "%&gt;";
                                    ent.Value = cRMAgreementSpecsEntity.Item;
                                    break;

                                case 2:
                                    ent.Name  = "&lt;%$$" + cRMAgreementSpecsEntity.AgreementSpecsType + "_IBrand_" + result.ToString() + "%&gt;";
                                    ent.Value = ddlBrandID.SelectedItem.ToString();
                                    break;

                                case 3:
                                    ent.Name  = "&lt;%$$" + cRMAgreementSpecsEntity.AgreementSpecsType + "_IQty_" + result.ToString() + "%&gt;";
                                    ent.Value = cRMAgreementSpecsEntity.BayQty.ToString();
                                    break;

                                case 4:
                                    ent.Name  = "&lt;%$$" + cRMAgreementSpecsEntity.AgreementSpecsType + "_IPrice_" + result.ToString() + "%&gt;";
                                    ent.Value = cRMAgreementSpecsEntity.BayPrice.ToString();
                                    break;

                                case 5:
                                    ent.Name  = "&lt;%$$" + cRMAgreementSpecsEntity.AgreementSpecsType + "_IUnit_" + result.ToString() + "%&gt;";
                                    ent.Value = cRMAgreementSpecsEntity.Field1.ToString();
                                    break;
                                }

                                ent.CreateDate          = System.DateTime.Now;
                                ent.CreatedByEmployeeID = MiscUtil.GetCurrentEmployeeByMemberID(CurrentMember);
                                ent.IP          = MiscUtil.GetLocalIP();
                                ent.Remarks     = "Auto Generated";
                                ent.AgreementID = OverviewAgreementID;

                                FCCCRMAgreementVariableMap.GetFacadeCreate().Add(ent, DatabaseOperationType.Add, TransactionRequired.No);
                            }
                        }
                        _AgreementSpecsID        = 0;
                        _CRMAgreementSpecsEntity = new CRMAgreementSpecsEntity();
                        PrepareInitialView();
                        BindCRMAgreementSpecsList();

                        if (cRMAgreementSpecsEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Agreement Specs Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Agreement Specs Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (cRMAgreementSpecsEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Agreement Specs Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Agreement Specs Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }