Ejemplo n.º 1
0
        private void ConvertStatus(ConsignSettlementRulesInfo entity)
        {
            if (null != entity && entity.StatusString.HasValue)
            {
                switch (entity.StatusString)
                {
                case (char)ConsignSettleRuleStatus.Wait_Audit:
                    entity.Status = ConsignSettleRuleStatus.Wait_Audit;
                    break;

                case (char)ConsignSettleRuleStatus.Stop:
                    entity.Status = ConsignSettleRuleStatus.Stop;
                    break;

                case (char)ConsignSettleRuleStatus.Forbid:
                    entity.Status = ConsignSettleRuleStatus.Forbid;
                    break;

                case (char)ConsignSettleRuleStatus.Enable:
                    entity.Status = ConsignSettleRuleStatus.Enable;
                    break;

                case (char)ConsignSettleRuleStatus.Disable:
                    entity.Status = ConsignSettleRuleStatus.Disable;
                    break;

                case (char)ConsignSettleRuleStatus.Available:
                    entity.Status = ConsignSettleRuleStatus.Available;
                    break;

                default:
                    break;
                }
            }
        }
        private void Hyperlink_Abandon_Click(object sender, RoutedEventArgs e)
        {
            //作废操作:
            DynamicXml getSelectedItem = this.QueryResultGrid.SelectedItem as DynamicXml;

            if (null != getSelectedItem)
            {
                ConsignSettlementRulesInfoVM editInfo = DynamicConverter <ConsignSettlementRulesInfoVM> .ConvertToVM(getSelectedItem);

                if (null != editInfo)
                {
                    Window.Confirm(ResSettledProductsRuleQuery.AlertMsg_ConfirmAbandon, (obj, args) =>
                    {
                        if (args.DialogResult == DialogResultType.OK)
                        {
                            ConsignSettlementRulesInfo info = EntityConverter <ConsignSettlementRulesInfoVM, ConsignSettlementRulesInfo> .Convert(editInfo);
                            serviceFacade.AbandonConsignSettleRule(info, (obj2, args2) =>
                            {
                                if (args2.FaultsHandle())
                                {
                                    return;
                                }
                                Window.Alert(ResSettledProductsRuleQuery.AlertMsg_AlertTitle, ResSettledProductsRuleQuery.AlertMsg_OprSuc, MessageType.Information, (obj3, args3) =>
                                {
                                    if (args3.DialogResult == DialogResultType.Cancel)
                                    {
                                        QueryResultGrid.Bind();
                                    }
                                });
                            });
                        }
                    });
                }
            }
        }
Ejemplo n.º 3
0
 private void btnAbandon_Click(object sender, RoutedEventArgs e)
 {
     //作废操作 :
     //终止操作 :
     CurrentWindow.Confirm(ResSettledProductsRuleQuery.InfoMsg_SettleRule_ConfirmAbandon, (obj, args) =>
     {
         if (args.DialogResult == DialogResultType.OK)
         {
             ConsignSettlementRulesInfo info = EntityConverter <ConsignSettlementRulesInfoVM, ConsignSettlementRulesInfo> .Convert(editVM);
             serviceFacade.AbandonConsignSettleRule(info, (obj2, args2) =>
             {
                 if (args2.FaultsHandle())
                 {
                     return;
                 }
                 CurrentWindow.Alert(ResSettledProductsRuleQuery.InfoMsg_SettleRule_Title, ResSettledProductsRuleQuery.InfoMsg_SettleRule_OprSuc, MessageType.Information, (obj3, args3) =>
                 {
                     if (args3.DialogResult == DialogResultType.Cancel)
                     {
                         Dialog.ResultArgs.DialogResult = DialogResultType.OK;
                         Dialog.ResultArgs.Data         = editVM;
                         Dialog.Close(true);
                     }
                 });
             });
         }
     });
 }
Ejemplo n.º 4
0
        public int CreateConsignSettlementRule(ConsignSettlementRulesInfo entity)
        {
            DataCommand command = DataCommandManager.GetDataCommand("InsertConsignSettleRule");

            command.SetParameterValue("@ApprovedDate", DBNull.Value);
            command.SetParameterValue("@ApprovedUser", DBNull.Value);
            command.SetParameterValue("@BeginDate", entity.BeginDate);
            command.SetParameterValue("@CompanyCode", entity.CompanyCode);
            command.SetParameterValue("@CreateDate", DateTime.Now);
            command.SetParameterValue("@CreateUser", entity.CreateUser);
            command.SetParameterValue("@CurrencyCode", entity.CurrencyCode);
            command.SetParameterValue("@EditDate", DateTime.Now);
            command.SetParameterValue("@EditUser", entity.CreateUser);
            command.SetParameterValue("@EndDate", entity.EndDate);
            command.SetParameterValue("@LanguageCode", "zh-CN");
            command.SetParameterValue("@NewSettlePrice", entity.NewSettlePrice);
            command.SetParameterValue("@OldSetttlePrice", entity.OldSettlePrice);
            command.SetParameterValue("@ProductSysNo", entity.ProductSysNo);
            command.SetParameterValue("@SettleedQuantity", DBNull.Value);
            command.SetParameterValue("@SettleRuleName", entity.SettleRulesName);
            command.SetParameterValue("@SettleRuleQuantity", entity.SettleRulesQuantity);
            command.SetParameterValue("@SettleRulesCode", entity.SettleRulesCode);
            command.SetParameterValue("@Status", (char)entity.Status);
            command.SetParameterValue("@StopDate", DBNull.Value);
            command.SetParameterValue("@StopUser", DBNull.Value);
            command.SetParameterValue("@StoreCompanyCode", entity.CompanyCode);
            command.SetParameterValue("@VendorSysNo", entity.VendorSysNo);

            int sysNo = Convert.ToInt32(command.ExecuteScalar());

            return(sysNo);
        }
Ejemplo n.º 5
0
 private static void SetDefaultValue(ConsignSettlementRulesInfo entity)
 {
     if (string.IsNullOrEmpty(entity.CurrencyCode))
     {
         entity.CurrencyCode = "CNY";
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 终止代销商品规则
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public virtual ConsignSettlementRulesInfo StopConsignSettlementRule(string settleRulesCode)
        {
            ConsignSettlementRulesInfo entity = ConsignSettlementRuleDA.GetConsignSettleRuleByCode(settleRulesCode);

            if (entity == null)
            {
                //规则({0})不存在,无法终止
                throw new BizException(string.Format(GetExceptionString("ConsignRule_RuleNotExist_Stop"), settleRulesCode));
            }

            if (entity.Status != ConsignSettleRuleStatus.Available &&
                entity.Status != ConsignSettleRuleStatus.Enable)
            {
                //规则({0})不处于“未生效”和“已生效”状态,无法终止
                throw new BizException(string.Format(GetExceptionString("ConsignRule_Available_Invalid_Stop"), settleRulesCode));
            }

            entity.Status   = ConsignSettleRuleStatus.Stop;
            entity.EditUser = ExternalDomainBroker.GetUserNameByUserSysNo(ServiceContext.Current.UserSysNo);
            entity          = Modify(entity, ConsignSettleRuleActionType.Stop);

            //记录系统日志
            //WriteLog(entity, LogType.ConsignSettleRule_Stop);
            ExternalDomainBroker.CreateLog(" Stop ConsignSettleRule "
                                           , BizEntity.Common.BizLogType.ConsignSettleRule_Stop
                                           , entity.RuleSysNo.Value
                                           , entity.CompanyCode);
            return(entity);
        }
        /// <summary>
        /// 审核代销商品规则
        /// </summary>
        /// <param name="info"></param>
        /// <param name="callback"></param>
        public void AuditConsignSettleRule(ConsignSettlementRulesInfo info, EventHandler <RestClientEventArgs <ConsignSettlementRulesInfo> > callback)
        {
            info.CompanyCode   = CPApplication.Current.CompanyCode;
            info.EditUserSysNo = CPApplication.Current.LoginUser.UserSysNo;
            info.EditUser      = CPApplication.Current.LoginUser.DisplayName;
            string relativeUrl = "/POService/ConsignSettlementRules/AuditConsignSettleRule";

            restClient.Update <ConsignSettlementRulesInfo>(relativeUrl, info, callback);
        }
Ejemplo n.º 8
0
        //规则的时间点重叠检测
        private void CheckRuleDateRepeat(ConsignSettlementRulesInfo entity)
        {
            ConsignSettlementRulesInfo item = ConsignSettlementRuleDA.GetSettleRuleByItemVender(entity);

            if (item != null)
            {
                //相同Item({0}),相同商家({1})在同一个时间点只能存在一个结算规则({2})
                throw new BizException(string.Format(GetExceptionString("ConsignRule_SettleRuleOnlyOne"), item.ProductID, item.VendorName, item.SettleRulesCode));
            }
        }
Ejemplo n.º 9
0
        public BizEntity.PO.ConsignSettlementRulesInfo GetConsignSettleRuleByCode(string settleRulesCode)
        {
            DataCommand command = DataCommandManager.GetDataCommand("QueryConsignSettleRuleByCode");

            command.SetParameterValue("@SettleRulesCode", settleRulesCode);

            ConsignSettlementRulesInfo returnEntity = command.ExecuteEntity <ConsignSettlementRulesInfo>();

            ConvertStatus(returnEntity);
            return(returnEntity);
        }
Ejemplo n.º 10
0
        //修改规则
        private ConsignSettlementRulesInfo Modify(ConsignSettlementRulesInfo entity, ConsignSettleRuleActionType actionType)
        {
            int rows = ConsignSettlementRuleDA.UpdateConsignSettlementRulesInfo(entity, actionType);

            if (rows <= 0)
            {
                //未能修改规则_{0}
                throw new BizException(string.Format(GetExceptionString("ConsignRule_CannotUpdateRule"), entity.SettleRulesCode));
            }

            return(entity);
        }
Ejemplo n.º 11
0
 private void CheckEntity(ConsignSettlementRulesInfo entity)
 {
     if (entity == null)
     {
         throw new ArgumentNullException("entity");
     }
     if (string.IsNullOrEmpty(entity.SettleRulesCode))
     {
         //规则代码不能为空
         throw new BizException(GetExceptionString("ConsignRule_CodeEmpty"));
     }
     if (string.IsNullOrEmpty(entity.SettleRulesName))
     {
         //规则名称不能为空
         throw new BizException(GetExceptionString("ConsignRule_NameEmpty"));
     }
     if (!entity.ProductSysNo.HasValue || entity.ProductSysNo <= 0)
     {
         //无效的商品({0})
         throw new BizException(string.Format(GetExceptionString("ConsignRule_ProductInvalid"), entity.ProductSysNo));
     }
     if (!entity.VendorSysNo.HasValue || entity.VendorSysNo <= 0)
     {
         //无效的商家({0})
         throw new BizException(string.Format(GetExceptionString("ConsignRule_VendorInvalid"), entity.VendorSysNo));
     }
     if (!entity.OldSettlePrice.HasValue || entity.OldSettlePrice < 0M)
     {
         //无效的原结算价格({0})
         throw new BizException(string.Format(GetExceptionString("ConsignRule_OldSettlePriceInvalid"), entity.OldSettlePrice));
     }
     if (!entity.NewSettlePrice.HasValue || entity.NewSettlePrice < 0M)
     {
         //无效的现结算价格({0})
         throw new BizException(string.Format(GetExceptionString("ConsignRule_NewSettlePriceInvalid"), entity.NewSettlePrice));
     }
     if (!entity.BeginDate.HasValue || entity.BeginDate <= DateTime.Parse("1900-1-1"))
     {
         //无效的开始时间({0})
         throw new BizException(string.Format(GetExceptionString("ConsignRule_BeginDateInvalid"), entity.BeginDate));
     }
     if (!entity.EndDate.HasValue || entity.EndDate <= DateTime.Parse("1900-1-1"))
     {
         //无效的结束时间({0})
         throw new BizException(string.Format(GetExceptionString("ConsignRule_EndDateInvalid"), entity.EndDate));
     }
     if (entity.SettleRulesQuantity.HasValue &&
         entity.SettleRulesQuantity.Value <= 0)
     {
         //无效的结算数量({0})
         throw new BizException(string.Format(GetExceptionString("ConsignRule_SettleQtyInvalid"), entity.SettleRulesQuantity));
     }
 }
Ejemplo n.º 12
0
        public ConsignSettlementRulesInfo GetSettleRuleByItemVender(ConsignSettlementRulesInfo entity)
        {
            DataCommand command = DataCommandManager.GetDataCommand("GetSettleRuleByItemVender");

            command.SetParameterValue("@SettleRulesCode", entity.SettleRulesCode);
            command.SetParameterValue("@ProductSysNo", entity.ProductSysNo);
            command.SetParameterValue("@VendorSysNo", entity.VendorSysNo);
            command.SetParameterValue("@BeginDate", entity.BeginDate);
            command.SetParameterValue("@EndDate", entity.EndDate);

            ConsignSettlementRulesInfo returnEntity = command.ExecuteEntity <ConsignSettlementRulesInfo>();

            ConvertStatus(returnEntity);
            return(returnEntity);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 审核代销商品规则
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public virtual ConsignSettlementRulesInfo AuditConsignSettlementRule(ConsignSettlementRulesInfo info)
        {
            ConsignSettlementRulesInfo entity = ConsignSettlementRuleDA.GetConsignSettleRuleByCode(info.SettleRulesCode);

            if (entity == null)
            {
                //规则({0})不存在,无法审核
                throw new BizException(string.Format(GetExceptionString("ConsignRule_RuleNotExist_Audit"), info.SettleRulesCode));
            }

            if (entity.Status != ConsignSettleRuleStatus.Wait_Audit)
            {
                //规则({0})不是待审核状态,无法审核
                throw new BizException(string.Format(GetExceptionString("ConsignRule_WaitingAudit_Invalid_Audit"), info.SettleRulesCode));
            }

            ////审核人和创建人不能相同
            //if (info.EditUser == entity.CreateUser)
            //{
            //    throw new BizException(GetExceptionString("ConsignRule_CreateAndAuditUserNotTheSame"));
            //}

            //检测商品的属性
            CheckProduct(entity.ProductSysNo.Value);

            //时间段重复性的检测
            CheckRuleDateRepeat(entity);

            entity.Status   = ConsignSettleRuleStatus.Available;
            entity.EditUser = ExternalDomainBroker.GetUserNameByUserSysNo(ServiceContext.Current.UserSysNo);
            entity          = Modify(entity, ConsignSettleRuleActionType.Audit);

            //发送ESB消息
            EventPublisher.Publish <SettlementRuleAuditMessage>(new SettlementRuleAuditMessage()
            {
                AuditUserSysNo  = ServiceContext.Current.UserSysNo,
                SettleRulesCode = entity.SettleRulesCode
            });

            //记录系统日志
            //WriteLog(entity, LogType.ConsignSettleRule_Audit);

            ExternalDomainBroker.CreateLog(" Audit ConsignSettleRule "
                                           , BizEntity.Common.BizLogType.ConsignSettleRule_Audit
                                           , entity.RuleSysNo.Value
                                           , entity.CompanyCode);
            return(entity);
        }
Ejemplo n.º 14
0
        public int UpdateConsignSettlementRulesInfo(ConsignSettlementRulesInfo entity, BizEntity.PO.ConsignSettleRuleActionType actionType)
        {
            DataCommand command = DataCommandManager.GetDataCommand("UpdateConsignSettleRule");

            if (actionType == BizEntity.PO.ConsignSettleRuleActionType.Audit)
            {
                command.SetParameterValue("@ApprovedDate", DateTime.Now);
                command.SetParameterValue("@ApprovedUser", entity.EditUser);
            }
            else
            {
                command.SetParameterValue("@ApprovedDate", DBNull.Value);
                command.SetParameterValue("@ApprovedUser", DBNull.Value);
            }

            command.SetParameterValue("@BeginDate", entity.BeginDate);
            command.SetParameterValue("@CurrencyCode", entity.CurrencyCode);
            command.SetParameterValue("@EditDate", DateTime.Now);
            command.SetParameterValue("@EditUser", entity.EditUser);
            command.SetParameterValue("@EndDate", entity.EndDate);
            command.SetParameterValue("@LanguageCode", "zh-CN");
            command.SetParameterValue("@NewSettlePrice", entity.NewSettlePrice);
            command.SetParameterValue("@OldSetttlePrice", entity.OldSettlePrice);
            command.SetParameterValue("@ProductSysNo", entity.ProductSysNo);
            command.SetParameterValue("@SettleedQuantity", DBNull.Value);
            command.SetParameterValue("@SettleRuleName", entity.SettleRulesName);
            command.SetParameterValue("@SettleRuleQuantity", entity.SettleRulesQuantity);
            command.SetParameterValue("@SettleRulesCode", entity.SettleRulesCode);
            command.SetParameterValue("@Status", (char)entity.Status);
            if (actionType == BizEntity.PO.ConsignSettleRuleActionType.Stop)
            {
                command.SetParameterValue("@StopDate", DateTime.Now);
                command.SetParameterValue("@StopUser", entity.EditUser);
            }
            else
            {
                command.SetParameterValue("@StopDate", DBNull.Value);
                command.SetParameterValue("@StopUser", DBNull.Value);
            }
            command.SetParameterValue("@VendorSysNo", entity.VendorSysNo);
            command.SetParameterValue("@SysNo", entity.RuleSysNo);
            return(command.ExecuteNonQuery());
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 创建代销商品规则
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public virtual ConsignSettlementRulesInfo CreateConsignSettlementRule(ConsignSettlementRulesInfo entity)
        {
            //检测数据完整性
            CheckEntity(entity);

            //Code的重复性检测
            ConsignSettlementRulesInfo chkEntity = ConsignSettlementRuleDA.GetConsignSettleRuleByCode(entity.SettleRulesCode);

            if (chkEntity != null)
            {
                //规则编码({0})已存在,请重新设置
                throw new BizException(string.Format(GetExceptionString("ConsignRule_RuleExist"), entity.SettleRulesCode));
            }

            //检测商品的属性
            CheckProduct(entity.ProductSysNo.Value);

            //时间段重复性的检测
            CheckRuleDateRepeat(entity);

            entity.Status = ConsignSettleRuleStatus.Wait_Audit;
            SetDefaultValue(entity);

            int sysNo = ConsignSettlementRuleDA.CreateConsignSettlementRule(entity);

            entity.RuleSysNo = sysNo;

            //发送ESB消息
            EventPublisher.Publish <SettlementRuleCreateMessage>(new SettlementRuleCreateMessage()
            {
                CreateUserSysNo = ServiceContext.Current.UserSysNo,
                SettleRulesCode = entity.SettleRulesCode
            });

            //记录系统日志
            //WriteLog(entity, LogType.ConsignSettleRule_Create);

            ExternalDomainBroker.CreateLog(" Create ConsignSettle "
                                           , BizEntity.Common.BizLogType.ConsignSettleRule_Create
                                           , sysNo
                                           , entity.CompanyCode);
            return(entity);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 更新代销商品规则
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public virtual ConsignSettlementRulesInfo UpdateConsignSettlementRule(ConsignSettlementRulesInfo entity)
        {
            //检测数据完整性
            CheckEntity(entity);

            //查询原实体
            ConsignSettlementRulesInfo oldEntity = ConsignSettlementRuleDA.GetConsignSettleRuleByCode(entity.SettleRulesCode);

            if (oldEntity == null)
            {
                //规则({0})不存在,无法修改
                throw new BizException(string.Format(GetExceptionString("ConsignRule_RuleNotExist"), entity.SettleRulesCode));
            }
            if (oldEntity.Status != ConsignSettleRuleStatus.Wait_Audit)
            {
                //规则({0})不处于待审核状态,无法修改
                throw new BizException(string.Format(GetExceptionString("ConsignRule_WaitingAudit_Invalid"), entity.SettleRulesCode));
            }

            //检测商品的属性
            CheckProduct(entity.ProductSysNo.Value);

            //时间段重复性的检测
            CheckRuleDateRepeat(entity);

            SetDefaultValue(entity);

            entity.EditUser = ExternalDomainBroker.GetUserNameByUserSysNo(ServiceContext.Current.UserSysNo);

            entity = Modify(entity, ConsignSettleRuleActionType.Update);

            //记录系统日志
            //WriteLog(entity, LogType.ConsignSettleRule_Update);

            ExternalDomainBroker.CreateLog(" Updated ConsignSettleRule "
                                           , BizEntity.Common.BizLogType.ConsignSettleRule_Update
                                           , entity.RuleSysNo.Value
                                           , entity.CompanyCode);

            return(entity);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// 获取已经超过结算数量的规则
        /// </summary>
        /// <param name="entity">请求的结算单</param>
        /// <returns>超过结算数量的规则</returns>
        public ConsignSettlementRulesInfo GetOverConsignRule(CollectionPaymentInfo entity)
        {
            ConsignSettlementRulesInfo result = null;

            //提取结算单中包括的规则的项,并统计
            StringBuilder ruleIds = new StringBuilder();

            ruleIds.Append("-9999");
            var ruleSysNoList = entity.SettleItems.Select(p => p.SettleRuleSysNo.ToString()).Distinct();

            foreach (var item in ruleSysNoList)
            {
                if (!string.IsNullOrEmpty(item))
                {
                    ruleIds.Append("," + item + "");
                }
            }

            //提出需要判断的规则相关参数
            var ruleList = ConsignSettlementRulesDA.GetSettleRuleListBySysNos(ruleIds.ToString());

            if (ruleList.Count > 0)
            {
                foreach (var rule in ruleList)
                {
                    //提交规则对应的数量hack
                    rule.SubmitSettleQuantity = (int)entity.SettleItems.Where(p => p.SettleRuleSysNo == rule.RuleSysNo).Sum(p => p.ConsignQty);

                    //判断数量是否超过结算数量
                    if (rule.IsOverQuantity)
                    {
                        result = rule;
                        break;
                    }
                }
            }

            return(result);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 作废代销商品规则
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public virtual ConsignSettlementRulesInfo AbandonConsignSettlementRule(string settleRulesCode)
        {
            ConsignSettlementRulesInfo entity = ConsignSettlementRuleDA.GetConsignSettleRuleByCode(settleRulesCode);

            if (entity == null)
            {
                //规则({0})不存在,无法作废
                throw new BizException(string.Format(GetExceptionString("ConsignRule_RuleNotExist_Abandon"), settleRulesCode));
            }

            if (entity.Status != ConsignSettleRuleStatus.Wait_Audit)
            {
                //规则({0})不处于待审核状态,无法作废
                throw new BizException(string.Format(GetExceptionString("ConsignRule_WaitingAudit_Invalid_Abandon"), settleRulesCode));
            }

            entity.Status   = ConsignSettleRuleStatus.Forbid;
            entity.EditUser = ExternalDomainBroker.GetUserNameByUserSysNo(ServiceContext.Current.UserSysNo);
            entity          = Modify(entity, ConsignSettleRuleActionType.Abandon);

            //发送ESB消息
            EventPublisher.Publish <SettlementRuleAbandonMessage>(new SettlementRuleAbandonMessage()
            {
                AbandonUserSysNo = ServiceContext.Current.UserSysNo,
                SettleRulesCode  = settleRulesCode
            });

            //记录系统日志
            // WriteLog(entity, LogType.ConsignSettleRule_Abadon);

            ExternalDomainBroker.CreateLog(" Abandon ConsignSettleRule "
                                           , BizEntity.Common.BizLogType.ConsignSettleRule_Abadon
                                           , entity.RuleSysNo.Value
                                           , entity.CompanyCode);
            return(entity);
        }
 public virtual ConsignSettlementRulesInfo AuditConsignRule(ConsignSettlementRulesInfo info)
 {
     return(ConsignSettlementRulesProcessor.AuditConsignSettlementRule(info));
 }
 public virtual ConsignSettlementRulesInfo UpdateConsignRule(ConsignSettlementRulesInfo info)
 {
     return(ConsignSettlementRulesProcessor.UpdateConsignSettlementRule(info));
 }
Ejemplo n.º 21
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            //保存操作 :
            if (!ValidationManager.Validate(this))
            {
                return;
            }

            List <string> checkPricesList        = new List <string>();
            string        pricesCheckAlertString = string.Empty;
            string        oldPriceNullString     = string.Empty;

            if (string.IsNullOrEmpty(viewVM.OldSettlePrice))
            {
                oldPriceNullString += ResSettledProductsRuleQuery.InfoMsg_SettleRule_OldSettlePriceNullAlert + Environment.NewLine;
            }
            if (!string.IsNullOrEmpty(viewVM.OldSettlePrice) && Convert.ToDecimal(viewVM.OldSettlePrice) <= 0)
            {
                checkPricesList.Add(ResSettledProductsRuleQuery.InfoMsg_SettleRule_OldSettlePrice);
            }
            if (!string.IsNullOrEmpty(viewVM.NewSettlePrice) && Convert.ToDecimal(viewVM.NewSettlePrice) <= 0)
            {
                checkPricesList.Add(ResSettledProductsRuleQuery.InfoMsg_SettleRule_NewSettlePrice);
            }
            if (checkPricesList.Count > 0)
            {
                pricesCheckAlertString += string.Join(ResSettledProductsRuleQuery.Label_And, checkPricesList);
            }

            if (!string.IsNullOrEmpty(pricesCheckAlertString) || !string.IsNullOrEmpty(oldPriceNullString))
            {
                string confirmStr = string.Empty;
                if (!string.IsNullOrEmpty(pricesCheckAlertString))
                {
                    confirmStr += string.Format(ResSettledProductsRuleQuery.InfoMsg_SettleRule_ContinueAlert, pricesCheckAlertString) + Environment.NewLine;
                }
                if (!string.IsNullOrEmpty(oldPriceNullString))
                {
                    confirmStr += oldPriceNullString + Environment.NewLine;
                }
                CurrentWindow.Confirm(confirmStr, (obj, args) =>
                {
                    if (args.DialogResult == DialogResultType.OK)
                    {
                        ConsignSettlementRulesInfo info = EntityConverter <ConsignSettlementRulesInfoVM, ConsignSettlementRulesInfo> .Convert(viewVM);
                        info.OldSettlePrice             = (info.OldSettlePrice.HasValue ? info.OldSettlePrice.Value : 0);
                        info.EndDate = info.EndDate.Value.AddHours(23).AddMinutes(59).AddSeconds(59).AddMilliseconds(997);
                        serviceFacade.CreateConsignSettleRule(info, (obj2, args2) =>
                        {
                            if (args2.FaultsHandle())
                            {
                                return;
                            }
                            this.Dialog.ResultArgs.DialogResult = DialogResultType.OK;
                            CurrentWindow.Alert(ResSettledProductsRuleQuery.InfoMsg_SettleRule_Title, ResSettledProductsRuleQuery.InfoMsg_SettleRule_OprSuc, MessageType.Information, (obj3, args3) =>
                            {
                                if (args3.DialogResult == DialogResultType.Cancel)
                                {
                                    this.Dialog.ResultArgs.DialogResult = DialogResultType.OK;
                                    this.Dialog.Close(true);
                                }
                            });
                        });
                    }
                });
            }
            else
            {
                ConsignSettlementRulesInfo info = EntityConverter <ConsignSettlementRulesInfoVM, ConsignSettlementRulesInfo> .Convert(viewVM);

                info.OldSettlePrice = (info.OldSettlePrice.HasValue ? info.OldSettlePrice.Value : 0);
                serviceFacade.CreateConsignSettleRule(info, (obj2, args2) =>
                {
                    if (args2.FaultsHandle())
                    {
                        return;
                    }
                    this.Dialog.ResultArgs.DialogResult = DialogResultType.OK;
                    CurrentWindow.Alert(ResSettledProductsRuleQuery.InfoMsg_SettleRule_Title, ResSettledProductsRuleQuery.InfoMsg_SettleRule_OprSuc, MessageType.Information, (obj, args) =>
                    {
                        if (args.DialogResult == DialogResultType.Cancel)
                        {
                            this.Dialog.ResultArgs.DialogResult = DialogResultType.OK;
                            this.Dialog.Close(true);
                        }
                    });
                });
            }
        }
Ejemplo n.º 22
0
 public ConsignSettlementRulesInfo AuditConsignSettleRule(ConsignSettlementRulesInfo info)
 {
     return(ObjectFactory <ConsignSettlementRulesAppService> .Instance.AuditConsignRule(info));
 }