// Methods
        public static IKEEPERBumpAnalysisCommon CreateBumpAnalysis(Context ctx, IBillModel BillModel, string strFormid)
        {
            IKEEPERBumpAnalysisCommon common = null;
            string str = strFormid;

            if (str == null)
            {
                return(common);
            }
            if (str != "CRM_OPP_Opportunity")
            {
                if (str != "CRM_CUST")
                {
                    if (str != "CRM_OPP_Clue")
                    {
                        return(common);
                    }
                    return(new KEEPERClueBump(ctx, BillModel));
                }
            }
            else
            {
                return(new KEEPEROpportunityBump(ctx, BillModel));
            }
            return(new KEEPERCrmCustBump(ctx, BillModel));
        }
Beispiel #2
0
        //构建线索单据数据包
        public string bumpAnalyse(string parameterJson)
        {
            JObject jsonRoot = new JObject(); //根节点
            JObject mBEntry  = new JObject(); //model中单据体,存储普通变量,baseData
            JArray  entrys   = new JArray();  //单个model中存储多行分录体集合,存储mBentry

            //string value = HttpContext.Current.Request.Form["Data"];//获取前端传递过来的单据必要信息
            //JObject jObject = (JObject)JsonConvert.DeserializeObject(value);//反序列化成JObject对象
            //F_PEJK_ClueName = jObject["F_PEJK_ClueName"]!=null&& !jObject["F_PEJK_ClueName"].Equals("")? jObject["F_PEJK_ClueName"].ToString():"";
            //FRemarks = jObject["FRemarks"] != null && !jObject["FRemarks"].Equals("") ? jObject["FRemarks"].ToString() : "";
            //FCustomerName = jObject["FCustomerName"] != null && !jObject["FCustomerName"].Equals("") ? jObject["FCustomerName"].ToString() : "";
            //F_PEJK_ReqDeptId = jObject["F_PEJK_ReqDeptId"] != null && !jObject["F_PEJK_ReqDeptId"].Equals("") ? jObject["F_PEJK_ReqDeptId"].ToString() : "";
            //FContactName = jObject["FContactName"] != null && !jObject["FContactName"].Equals("") ? jObject["FContactName"].ToString() : "";
            //FPhone = jObject["FPhone"] != null && !jObject["FPhone"].Equals("") ? jObject["FPhone"].ToString() : "";
            //BumpResult = jObject["BumpResult"].ToString();
            BumpResult = "立体仓库沈阳新松小高";
            Action <IDynamicFormViewService> fillBillPropertys = new Action <IDynamicFormViewService>(fillPropertys);
            IBillModel BillNodel = CRMServiceHelper.installBumpBillData(Ctx, "CRM_OPP_Clue", fillBillPropertys);
            IKEEPERBumpAnalysisCommon      bumpCommon  = KEEPERBumpAnalysisFactory.CreateBumpAnalysis(Ctx, BillNodel, BillNodel.BusinessInfo.GetForm().Id);
            BumpAnalysisResultEntrity      resultEntry = bumpCommon.ResultEntrity;
            Dictionary <string, Hashtable> bumpResult  = resultEntry.DicMacthDesc;

            if (bumpResult.Count <= 0)
            {
                jsonRoot.Add("bumpResult", "fasle");
                return(JsonConvert.SerializeObject(jsonRoot));
            }
            foreach (Hashtable item in bumpResult.Values)
            {
                mBEntry = new JObject();
                foreach (DictionaryEntry de in item)
                {
                    mBEntry.Add(Convert.ToString(de.Key), Convert.ToString(de.Value));
                }
                entrys.Add(mBEntry);
            }
            jsonRoot.Add("bumpResult", entrys);
            return(JsonConvert.SerializeObject(jsonRoot));
        }
        public void bump(BeforeSaveEventArgs e)
        {
            Action <FormResult>       action     = null;
            IKEEPERBumpAnalysisCommon bumpCommon = KEEPERBumpAnalysisFactory.CreateBumpAnalysis(base.Context, base.View.Model, this.Model.BusinessInfo.GetForm().Id);

            if (bumpCommon.IsShowResult)
            {
                BillShowParameter param = new BillShowParameter
                {
                    FormId              = "CRM_BumpAnalysisShow",
                    OpenStyle           = { ShowType = ShowType.Modal },
                    PageId              = SequentialGuid.NewGuid().ToString(),
                    CustomComplexParams = { {
                                                "ResultEntrity",
                                                bumpCommon.ResultEntrity
                                            } }
                };
                e.Cancel = true;
                if (action == null)
                {
                    action = delegate(FormResult result) {
                        if (result.ReturnData != null)
                        {
                            if (((bool)result.ReturnData) && !bumpCommon.IsAllowSave)
                            {
                                this.View.ShowMessage(ResManager.LoadKDString("撞单后单据不允许保存", "006021030001299", SubSystemType.CRM, new object[0]), MessageBoxType.Notice);
                            }
                            else if (((bool)result.ReturnData) && bumpCommon.IsAllowSave)
                            {
                                this.is_bumped = true;
                                this.View.InvokeFormOperation(FormOperationEnum.Save);
                            }
                        }
                    };
                }
                base.View.ShowForm(param, action);
            }
        }