コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        public string SaveCustomerPayAssign()
        {
            var service = new CustomerPayAssignBLL(this.CurrentUserInfo);

            string content      = string.Empty;
            string error        = "";
            var    responseData = new ResponseData();

            string key      = string.Empty;
            string AssignId = string.Empty;
            var    item     = Request("item");

            if (FormatParamValue(item) != null && FormatParamValue(item) != string.Empty)
            {
                key = FormatParamValue(item).ToString().Trim();
            }
            if (FormatParamValue(Request("AssignId")) != null && FormatParamValue(Request("AssignId")) != string.Empty)
            {
                AssignId = FormatParamValue(Request("AssignId")).ToString().Trim();
            }

            var obj = key.DeserializeJSONTo <CustomerPayAssignEntity>();

            if (Convert.ToInt32(obj.CustomerProportion) + Convert.ToInt32(obj.JITProportion) > 100)
            {
                responseData.success = false;
                responseData.msg     = "分成比例合计不能大于100";
                return(responseData.ToJSON());
            }

            if (AssignId == null || AssignId.Trim().Length == 0)
            {
                obj.AssignId       = Utils.NewGuid();
                obj.CustomerId     = CurrentUserInfo.CurrentUser.customer_id;
                obj.CreateBy       = CurrentUserInfo.CurrentUser.User_Id;
                obj.CreateTime     = DateTime.Now;
                obj.LastUpdateBy   = CurrentUserInfo.CurrentUser.User_Id;
                obj.LastUpdateTime = DateTime.Now;
                service.Create(obj);
            }
            else
            {
                obj.AssignId       = AssignId;
                obj.LastUpdateBy   = CurrentUserInfo.CurrentUser.User_Id;
                obj.LastUpdateTime = DateTime.Now;
                service.Update(obj, false);
            }

            responseData.success = true;
            responseData.msg     = error;

            content = responseData.ToJSON();
            return(content);
        }