コード例 #1
0
 public void UpdateBrandWarrantyInfoBySysNo(ProductBrandWarrantyInfo productBrandWarrantyInfo)
 {
     using (var tran = new TransactionScope())
     {
         List <ProductBrandWarrantyInfo> _brandWarrantyInfoAll = GetBrandWarrantyInfoByAll();
         //更新日期和詳細信息
         foreach (int item in productBrandWarrantyInfo.SysNos)
         {
             ProductBrandWarrantyInfo _oldProductBrandWarrantyInfo =
                 _brandWarrantyInfoAll.Where(p => p.SysNo == item).FirstOrDefault();
             brandRequestDA.UpdateBrandWarrantyInfoBySysNo(new ProductBrandWarrantyInfo()
             {
                 SysNo        = item,
                 EditUser     = productBrandWarrantyInfo.EditUser,
                 WarrantyDay  = productBrandWarrantyInfo.WarrantyDay,
                 WarrantyDesc = productBrandWarrantyInfo.WarrantyDesc
             });
             string LogNote = String.Format(
                 @"用户名:{0} 批量更新操作 原数据:BrandSysNo:{1} C1SysNo:{2} C2SysNo:{3} C3SysNo:{4} WarrantyDay:{5} WarrantyDesc{6} 
             替换为 BrandSysNo:{7} C1SysNo:{8} C2SysNo:{9} C3SysNo:{10} WarrantyDay:{11} WarrantyDesc{12} "
                 , productBrandWarrantyInfo.EditUser.UserDisplayName, _oldProductBrandWarrantyInfo.BrandSysNo
                 , _oldProductBrandWarrantyInfo.C1SysNo, _oldProductBrandWarrantyInfo.C2SysNo
                 , _oldProductBrandWarrantyInfo.C3SysNo, _oldProductBrandWarrantyInfo.WarrantyDay
                 , _oldProductBrandWarrantyInfo.WarrantyDesc
                 , _oldProductBrandWarrantyInfo.BrandSysNo, _oldProductBrandWarrantyInfo.C1SysNo
                 , _oldProductBrandWarrantyInfo.C2SysNo, _oldProductBrandWarrantyInfo.C3SysNo
                 , productBrandWarrantyInfo.WarrantyDay, productBrandWarrantyInfo.WarrantyDesc);
             ExternalDomainBroker.CreateOperationLog(LogNote, BizLogType.IM_BrandWarranty_Edit, item, "8601");
         }
         tran.Complete();
     }
 }
コード例 #2
0
        protected List <Int32> GetC3SysNos(ProductBrandWarrantyInfo productBrandWarrantyInfo)
        {
            List <Int32> C3SysNos = new List <int>();

            if (productBrandWarrantyInfo.C3SysNo != null)
            {
                //c3
                C3SysNos.Add(int.Parse(productBrandWarrantyInfo.C3SysNo.ToString()));
            }
            else
            {
                if (productBrandWarrantyInfo.C2SysNo != null)
                {
                    //c2
                    brandRequestDA.GetC3SysNo(productBrandWarrantyInfo).ForEach(p =>
                    {
                        C3SysNos.Add(int.Parse(p.C3SysNo.ToString()));
                    });
                }
                else
                {
                    //c1
                    brandRequestDA.GetC3SysNo(productBrandWarrantyInfo).ForEach(p =>
                    {
                        C3SysNos.Add(int.Parse(p.C3SysNo.ToString()));
                    });
                }
            }
            return(C3SysNos);
        }
コード例 #3
0
 //删除操作
 public void DelBrandWarrantyInfoBySysNos(List <ProductBrandWarrantyInfo> productBrandWarrantyInfos)
 {
     using (var tranDel = new TransactionScope())
     {
         List <String> errorlist = new List <String>();
         productBrandWarrantyInfos.ForEach(p =>
         {
             ProductBrandWarrantyInfo _ProductBrandWarranty =
                 brandRequestDA.GetAllowDeleteBrandWarranty(
                     int.Parse(p.C3SysNo.ToString()), int.Parse(p.BrandSysNo.ToString()));
             if (_ProductBrandWarranty != null)
             {
                 errorlist.Add(String.Format("C3SysNo:{0} 品牌:{1} 有被商品使用,不能删除!"
                                             , p.C3SysNo.ToString(), p.BrandSysNo.ToString()));
             }
             else
             {
                 string LogNote =
                     String.Format("用户名:{0} 删除操作 品牌系统编号为{1}", p.EditUser.UserDisplayName, p.SysNo.ToString());
                 brandRequestDA.DelBrandWarrantyInfoBySysNo(int.Parse(p.SysNo.ToString()));
                 ExternalDomainBroker.CreateOperationLog(
                     LogNote, BizLogType.IM_BrandWarranty_Delete
                     , int.Parse(p.SysNo.ToString()), "8601");
             }
         });
         tranDel.Complete();
         if (errorlist.Count > 0)
         {
             throw new BizException(string.Format("失败{0}条,\n内容是:{1}"
                                                  , errorlist.Count, errorlist.Join(";")));
         }
     }
 }
コード例 #4
0
        public void BrandWarrantyInfoByAddOrUpdate(ProductBrandWarrantyInfo productBrandWarrantyInfo)
        {
            //查找数据库书否存在记录
            //存在更新操作反之添加操作
            //记录日志
            //如果C1SysNo 为1的话 那所有的 子类下的都需要 添加
            using (var tran = new TransactionScope())
            {
                //找出所有三级类
                int          sysNo    = 0;
                List <Int32> C3SysNos = GetC3SysNos(productBrandWarrantyInfo);
                List <ProductBrandWarrantyInfo> _brandWarrantyInfoAll = GetBrandWarrantyInfoByAll();
                foreach (int C3SysNo in C3SysNos)
                {
                    productBrandWarrantyInfo.C3SysNo = C3SysNo;
                    ProductBrandWarrantyInfo _newproductBrandWarrantyInfo = new ProductBrandWarrantyInfo();
                    ProductBrandWarrantyInfo _productBrandWarrantyInfo    = _brandWarrantyInfoAll
                                                                            .Where(p => p.C3SysNo.Equals(productBrandWarrantyInfo.C3SysNo))
                                                                            .Where(p => p.BrandSysNo.Equals(productBrandWarrantyInfo.BrandSysNo)).FirstOrDefault();
                    if (_productBrandWarrantyInfo == null)
                    {
                        sysNo = brandRequestDA.InsertBrandWarrantyInfo(
                            productBrandWarrantyInfo);
                    }
                    else
                    {
                        brandRequestDA.UpdateBrandWarrantyInfoByBrandSysNoAndC3SysNo(productBrandWarrantyInfo);
                    }

                    string LogNote = _productBrandWarrantyInfo == null
                        ? String.Format(
                        "用户名:{0} 添加操作 BrandSysNo:{1} C1SysNo:{2} C2SysNo:{3} C3SysNo:{4} WarrantyDay:{5} WarrantyDesc{6}"
                        , productBrandWarrantyInfo.EditUser.UserDisplayName, productBrandWarrantyInfo.BrandSysNo
                        , productBrandWarrantyInfo.C1SysNo, productBrandWarrantyInfo.C2SysNo
                        , productBrandWarrantyInfo.C3SysNo, productBrandWarrantyInfo.WarrantyDay
                        , productBrandWarrantyInfo.WarrantyDesc)
                       : String.Format(
                        @"用户名:{0} 更新操作 原数据:BrandSysNo:{1} C1SysNo:{2} C2SysNo:{3} C3SysNo:{4} WarrantyDay:{5} WarrantyDesc{6} 
                    替换为 BrandSysNo:{7} C1SysNo:{8} C2SysNo:{9} C3SysNo:{10} WarrantyDay:{11} WarrantyDesc{12} "
                        , productBrandWarrantyInfo.EditUser.UserDisplayName, _productBrandWarrantyInfo.BrandSysNo
                        , _productBrandWarrantyInfo.C1SysNo, _productBrandWarrantyInfo.C2SysNo
                        , _productBrandWarrantyInfo.C3SysNo, _productBrandWarrantyInfo.WarrantyDay
                        , _productBrandWarrantyInfo.WarrantyDesc
                        , productBrandWarrantyInfo.BrandSysNo, productBrandWarrantyInfo.C1SysNo
                        , productBrandWarrantyInfo.C2SysNo, productBrandWarrantyInfo.C3SysNo
                        , productBrandWarrantyInfo.WarrantyDay, productBrandWarrantyInfo.WarrantyDesc);

                    //记录日志
                    ExternalDomainBroker.CreateOperationLog(LogNote
                                                            , _productBrandWarrantyInfo == null
                            ? BizLogType.IM_BrandWarranty_Add : BizLogType.IM_BrandWarranty_Edit
                                                            , _productBrandWarrantyInfo == null
                            ? sysNo : int.Parse(_productBrandWarrantyInfo.SysNo.ToString()), "8601");
                }
                tran.Complete();
            }
        }
コード例 #5
0
        //查询三级别类别
        public List <ProductBrandWarrantyInfo> GetC3SysNo(ProductBrandWarrantyInfo productBrandWarranty)
        {
            DataCommand cmd = DataCommandManager.GetDataCommand("GetBrandWarrantyC3SysNo");

            cmd.SetParameterValue("@C1SysNo", productBrandWarranty.C1SysNo);
            cmd.SetParameterValue("@C2SysNo", productBrandWarranty.C2SysNo);
            cmd.SetParameterValue("@C3SysNo", productBrandWarranty.C3SysNo);
            return(cmd.ExecuteEntityList <ProductBrandWarrantyInfo>());
        }
コード例 #6
0
        //更新品牌維護
        public void UpdateBrandWarrantyInfoBySysNo(ProductBrandWarrantyInfo productBrandWarranty)
        {
            DataCommand cmd = DataCommandManager.GetDataCommand("UpdateBrandWarrantyInfoBySysNo");

            cmd.SetParameterValue("@SysNo", productBrandWarranty.SysNo);
            cmd.SetParameterValue("@WarrantyDay", productBrandWarranty.WarrantyDay);
            cmd.SetParameterValue("@WarrantyDesc", productBrandWarranty.WarrantyDesc);
            cmd.SetParameterValue("@EditUser", productBrandWarranty.EditUser.UserDisplayName);
            cmd.ExecuteNonQuery();
        }
コード例 #7
0
        //插入品牌维护
        public int InsertBrandWarrantyInfo(ProductBrandWarrantyInfo productBrandWarranty)
        {
            DataCommand cmd = DataCommandManager.GetDataCommand("InsertBrandWarrantyInfo");

            cmd.SetParameterValue("@BrandSysNo", productBrandWarranty.BrandSysNo);
            cmd.SetParameterValue("@C3SysNo", productBrandWarranty.C3SysNo);
            cmd.SetParameterValue("@WarrantyDay", productBrandWarranty.WarrantyDay);
            cmd.SetParameterValue("@WarrantyDesc", productBrandWarranty.WarrantyDesc);
            cmd.SetParameterValue("@InUser", productBrandWarranty.CreateUser.UserDisplayName);
            cmd.SetParameterValue("@LanguageCode", "Zh-Cn");
            cmd.ExecuteNonQuery();
            return((int)cmd.GetParameterValue("@SysNo"));
        }
コード例 #8
0
        public void UpdateProductRMAPolicy(ProductRMAPolicyInfo info)
        {
            if (info.WarrantyDay == 0)
            {
                info.WarrantyDay = null;
            }
            ProductInfo product = ObjectFactory <ProductProcessor> .Instance.GetProductInfo((int)info.ProductSysNo);

            ProductBrandWarrantyInfo warrantyentity = ObjectFactory <IProductBrandWarrantyDA> .Instance.GetBrandWarranty((int)product.ProductBasicInfo.ProductCategoryInfo.SysNo, (int)product.ProductBasicInfo.ProductBrandInfo.SysNo);

            if (info.IsBrandWarranty.ToUpper() == "Y" && warrantyentity == null)
            {
                throw new BizException(ResouceManager.GetMessageString("IM.Product", "UpdateProductRMAPolicyResult"));
            }
            ObjectFactory <IProductRMAPolicyDA> .Instance.UpdateProductRMAPolicy(info);
        }
コード例 #9
0
        public void UpdateBrandWarrantyInfoBySysNo(ProductBrandWarrantyInfo productBrandWarranty)
        {
            StringBuilder result = new StringBuilder();

            try
            {
                Biz.UpdateBrandWarrantyInfoBySysNo(productBrandWarranty);
            }
            catch (BizException ex)
            {
                result.AppendLine(string.Format(ResouceManager.GetMessageString("IM.Category", "FailReason") + ":{0}", ex.Message));
                throw new BizException(result.ToString());
            }
            //result.AppendLine(string.Format("提交成功!"));
            //throw new BizException(result.ToString());
        }
コード例 #10
0
        //更新或者添加品牌信息
        public void UpdateBrandWarrantyInfoBySysNo(List <Int32> SysNos
                                                   , ProductBrandWarrantyQueryVM ProductBrandWarranty
                                                   , EventHandler <RestClientEventArgs <dynamic> > callback)
        {
            ProductBrandWarrantyInfo data = new ProductBrandWarrantyInfo();

            data.SysNos   = SysNos;
            data.EditUser = new UserInfo {
                SysNo = CPApplication.Current.LoginUser.UserSysNo, UserName = CPApplication.Current.LoginUser.LoginName, UserDisplayName = CPApplication.Current.LoginUser.DisplayName
            };
            data.CreateUser = new UserInfo {
                SysNo = CPApplication.Current.LoginUser.UserSysNo, UserName = CPApplication.Current.LoginUser.LoginName, UserDisplayName = CPApplication.Current.LoginUser.DisplayName
            };
            data.WarrantyDay  = int.Parse(ProductBrandWarranty.WarrantyDay);
            data.WarrantyDesc = ProductBrandWarranty.WarrantyDesc;
            restClient.Update(UpdateBrandWarrantyInfoBySysNourl, data, callback);
        }
コード例 #11
0
        /// <summary>
        /// 组装商品退换货保修信息
        /// </summary>
        /// <param name="c3sysno"></param>
        /// <param name="brandsysno"></param>
        /// <returns></returns>
        public ProductRMAPolicyInfo MakeRMAPolicyEntity(int c3sysno, int brandsysno)
        {
            ProductRMAPolicyInfo entity = new ProductRMAPolicyInfo();

            entity.IsBrandWarranty = "N";
            //得到默认退换货
            DefaultRMAPolicyInfo dpolicyentity = ObjectFactory <IDefaultRMAPolicy> .Instance.GetDefaultRMAPolicy(c3sysno, brandsysno);

            if (dpolicyentity == null)
            {
                //得到标准退换货信息
                RmaPolicyInfo policyentity = ObjectFactory <IRmaPolicyQueryDA> .Instance.GetStandardRmaPolicy();

                if (policyentity == null) //没有默认也没有标准则不能创建商品
                {
                    throw new BizException(ResouceManager.GetMessageString("IM.Product", "MakeRMAPolicyEntityResult"));
                }
                entity.RMAPolicyMasterSysNo = policyentity.SysNo;
                entity.ReturnDate           = policyentity.ReturnDate;
                entity.ChangeDate           = policyentity.ChangeDate;
                entity.IsOnlineRequst       = policyentity.IsOnlineRequest == IsOnlineRequst.YES ? "Y" : "N";
            }
            else
            {
                //得到退换货详细信息
                RmaPolicyInfo info = ObjectFactory <IRmaPolicyQueryDA> .Instance.QueryRmaPolicyBySysNo((int)dpolicyentity.RMAPolicySysNo);

                entity.RMAPolicyMasterSysNo = info.SysNo;
                entity.ReturnDate           = info.ReturnDate;
                entity.ChangeDate           = info.ChangeDate;
                entity.IsOnlineRequst       = info.IsOnlineRequest == IsOnlineRequst.YES ? "Y" : "N";
            }

            ProductBrandWarrantyInfo warrantyentity = ObjectFactory <IProductBrandWarrantyDA> .Instance.GetBrandWarranty(c3sysno, brandsysno);

            if (warrantyentity != null)
            {
                entity.IsBrandWarranty = "Y";
            }

            return(entity);
        }
コード例 #12
0
        //更新或者添加品牌信息
        public void BrandWarrantyInfoByAddOrUpdate(ProductBrandWarrantyQueryVM ProductBrandWarranty
                                                   , EventHandler <RestClientEventArgs <dynamic> > callback)
        {
            ProductBrandWarrantyInfo data = new ProductBrandWarrantyInfo();

            data.SysNo      = ProductBrandWarranty.SysNo;
            data.BrandSysNo = ProductBrandWarranty.BrandSysNo;
            data.C1SysNo    = ProductBrandWarranty.C1SysNo;
            data.C2SysNo    = ProductBrandWarranty.C2SysNo;
            data.C3SysNo    = ProductBrandWarranty.C3SysNo;
            data.EditUser   = new UserInfo {
                SysNo = CPApplication.Current.LoginUser.UserSysNo, UserName = CPApplication.Current.LoginUser.LoginName, UserDisplayName = CPApplication.Current.LoginUser.DisplayName
            };
            data.CreateUser = new UserInfo {
                SysNo = CPApplication.Current.LoginUser.UserSysNo, UserName = CPApplication.Current.LoginUser.LoginName, UserDisplayName = CPApplication.Current.LoginUser.DisplayName
            };
            data.WarrantyDay  = int.Parse(ProductBrandWarranty.WarrantyDay);
            data.WarrantyDesc = ProductBrandWarranty.WarrantyDesc;
            restClient.Update(BrandWarrantyInfoByAddOrUpdateUrl, data, callback);
        }
コード例 #13
0
 public void UpdateBrandWarrantyInfoBySysNo(ProductBrandWarrantyInfo ProductBrandWarranty)
 {
     ObjectFactory <ProductBrandWarrantyService> .Instance
     .UpdateBrandWarrantyInfoBySysNo(ProductBrandWarranty);
 }
コード例 #14
0
 public void BrandWarrantyInfoByAddOrUpdate(ProductBrandWarrantyInfo ProductBrandWarranty)
 {
     ObjectFactory <ProductBrandWarrantyService> .Instance
     .BrandWarrantyInfoByAddOrUpdate(ProductBrandWarranty);
 }