Exemplo n.º 1
0
        public JsonResult AjaxBatchPublish()
        {
            List <int> sysnoList   = SerializationUtility.JsonDeserialize2 <List <int> >(Request.Params["sysNoList"]);
            var        batchResult = GiftPromotionService.BatchSubmitAudit(sysnoList, UserAuthHelper.GetCurrentUser().UserDisplayName);

            return(Json(new { successCount = batchResult.Item1, failCount = batchResult.Item2, resultMsg = batchResult.Item3 }));
        }
Exemplo n.º 2
0
 public ActionResult AjaxSaveProductStockAdjustmentInfo()
 {
     if (!string.IsNullOrEmpty(Request["info"]))
     {
         ProductStockAdjustInfo adjustInfo = SerializationUtility.JsonDeserialize2 <ProductStockAdjustInfo>(Request["info"]);
         if (null != adjustInfo)
         {
             if (!adjustInfo.SysNo.HasValue)
             {
                 adjustInfo.Status = ProductStockAdjustStatus.Origin;
             }
             else
             {
                 foreach (var item in adjustInfo.AdjustItemList)
                 {
                     item.InUserSysNo = UserAuthHelper.GetCurrentUser().SellerSysNo;
                 }
             }
             adjustInfo.CurrencyCode = 1;
             adjustInfo.VendorSysNo  = UserAuthHelper.GetCurrentUser().SellerSysNo;
             adjustInfo.InUserSysNo  = adjustInfo.EditUserSysNo = adjustInfo.AuditUserSysNo = UserAuthHelper.GetCurrentUser().UserSysNo;
             adjustInfo.InDate       = adjustInfo.EditDate = adjustInfo.AuditDate = DateTime.Now;
         }
         ProductPurchaseService.SaveProductStockAdjustmentInfo(adjustInfo);
     }
     return(Json(new { Data = true }));
 }
Exemplo n.º 3
0
        public ActionResult AjaxAddTemplate()
        {
            var storePage       = SerializationUtility.JsonDeserialize2 <StorePage>(Request.Form["data"]);
            var pageLayouts     = StoreService.QueryAllPageLayout();
            var pageTemplateKey = storePage.StorePageTemplate.Key;
            var Temp            = StoreService.QueryStorePageTemplateByTemplateKey(pageTemplateKey);

            storePage.StorePageTemplate.PageTemplateType = Temp.PageTemplateType;
            storePage.StorePageTemplate.DataValue        = Temp.DataValue;
            storePage.StorePageTemplate.PageTypeKey      = Temp.PageTypeKey.Trim();
            storePage.StorePageTemplate.Name             = Temp.Name;
            storePage.StorePageTemplate.Desc             = Temp.Desc;
            storePage.StorePageTemplate.TemplateViewPath = Temp.TemplateViewPath;
            storePage.StorePageTemplate.MockupUrl        = Temp.MockupUrl;
            storePage.StorePageTemplate.Status           = Temp.Status;
            storePage.StorePageTemplate.Memo             = Temp.Memo;
            storePage.StorePageTemplate.Priority         = Temp.Priority;

            foreach (var storePageLayout in pageLayouts)
            {
                if (pageTemplateKey.Contains(storePageLayout.PageLayoutKey))
                {
                    storePage.StorePageTemplate.StorePageLayouts.Add(storePageLayout);
                }
            }
            return(Json(storePage));
        }
Exemplo n.º 4
0
        protected T GetParams <T>()
        {
            var str = GetParams();
            var obj = new JavaScriptSerializer().Deserialize <T>(str);

            return(SerializationUtility.JsonDeserialize2 <T>(str));
        }
Exemplo n.º 5
0
        protected T BuildQueryFilterEntity <T>(Action <T> manualMapping) where T : class
        {
            object t = Activator.CreateInstance(typeof(T));

            if (!string.IsNullOrEmpty(this.Request["queryfilter[]"]))
            {
                t = SerializationUtility.JsonDeserialize2 <T>(this.Request["queryfilter[]"]);
            }
            if (t is QueryFilter)
            {
                //每页显示条数:
                int pageSize = Convert.ToInt32(Request["length"]);
                //当前页码:
                int pageIndex = Convert.ToInt32(Request["start"]) % pageSize == 0 ? Convert.ToInt32(Request["start"]) / pageSize : Convert.ToInt32(Request["start"]) / pageSize + 1;
                //排序:
                string sortBy = null;
                if (!string.IsNullOrEmpty(Request["order[0][column]"]))
                {
                    string colIndex    = Request["order[0][column]"];
                    string sortByField = string.IsNullOrEmpty(Request[string.Format("columns[{0}][name]", colIndex)]) ? Request[string.Format("columns[{0}][data]", colIndex)] : Request[string.Format("columns[{0}][name]", colIndex)];
                    string sortDir     = Request["order[0][dir]"];
                    sortBy = string.Format("{0} {1}", sortByField, sortDir.ToUpper());
                }
                ((QueryFilter)t).PageSize   = pageSize;
                ((QueryFilter)t).PageIndex  = pageIndex;
                ((QueryFilter)t).SortFields = sortBy;
            }

            if (manualMapping != null)
            {
                manualMapping((T)t);
            }
            return((T)t);
        }
Exemplo n.º 6
0
        public JsonResult AjaxGetProductSalesAreaInfo()
        {
            var queryFilter = SerializationUtility.JsonDeserialize2 <ProductQueryFilter>(this.Request["queryfilter[]"]);
            var data        = ProductMaintainService.GetProductSalesAreaInfoBySysNo(queryFilter);

            return(AjaxGridJson(data));
        }
Exemplo n.º 7
0
        public ActionResult AjaxMaintainUpdate()
        {
            var soUpdateInfo = SerializationUtility.JsonDeserialize2 <SOUpdateInfo>(Request.Form["data"]);

            SOService.SOUpdate(soUpdateInfo);
            return(new JsonResult());
        }
Exemplo n.º 8
0
        public ActionResult AjaxSOVoid()
        {
            SOIncomeRefundInfo refundInfo = SerializationUtility.JsonDeserialize2 <SOIncomeRefundInfo>(Request.Form["data"]);
            LoginUser          user       = EntityConverter <UserAuthVM, LoginUser> .Convert(UserAuthHelper.GetCurrentUser());

            SOService.VoidSO(refundInfo.SOSysNo.Value, refundInfo, loginUser: user);
            return(new JsonResult());
        }
Exemplo n.º 9
0
        public ActionResult AjaxSOOutStock()
        {
            SOOutStockWaitReportRequest outStockWaitReportRequest = SerializationUtility.JsonDeserialize2 <SOOutStockWaitReportRequest>(Request.Form["data"]);
            LoginUser user = EntityConverter <UserAuthVM, LoginUser> .Convert(UserAuthHelper.GetCurrentUser());

            outStockWaitReportRequest.User = user;
            SOService.OutStockWaitReport(outStockWaitReportRequest);
            return(new JsonResult());
        }
Exemplo n.º 10
0
        public ActionResult AjaxAddNewPurchaseOrderItem()
        {
            if (string.IsNullOrWhiteSpace(Request["Data"]))
            {
                throw new BusinessException("采购商品信息为空");
            }
            PurchaseOrderItemProductInfo product       = SerializationUtility.JsonDeserialize2 <PurchaseOrderItemProductInfo>(Request["Data"]);
            PurchaseOrderItemInfo        orderItemInfo = ProductPurchaseService.AddNewPurchaseOrderItem(product, UserAuthHelper.GetCurrentUser().SellerSysNo);

            return(Json(orderItemInfo));
        }
Exemplo n.º 11
0
        public ActionResult AjaxAbandonPurchaseOrder()
        {
            if (string.IsNullOrWhiteSpace(Request["Data"]))
            {
                throw new BusinessException("采购单信息为空");
            }
            PurchaseOrderInfo poInfo = SerializationUtility.JsonDeserialize2 <PurchaseOrderInfo>(Request["Data"]);

            SetUserInfo(poInfo);
            poInfo = ProductPurchaseService.AbandonPO(poInfo);
            return(Json(poInfo));
        }
Exemplo n.º 12
0
        public T DecryptCookie <T>(string cookieValue, Dictionary <string, string> parameters)
        {
            T      result            = default(T);
            string strEncCookieValue = string.Empty;
            string strContent        = string.Empty;
            string strSHA1Sign       = string.Empty;
            string strShA1Temp       = string.Empty;

            string[] arrayCookieValue = new string[2];

            try
            {
                if (cookieValue.Length < 40)
                {
                    return(result);
                }
                //  取出签名和密文
                strSHA1Sign       = cookieValue.Substring(0, 40);
                strEncCookieValue = cookieValue.Substring(40);
                //  签名校验
                strShA1Temp = HashEncrypt.SHA1Encrypt(HttpUtility.UrlDecode(strEncCookieValue).Trim() + parameters["hashkey"]);
                if (strSHA1Sign != strShA1Temp)
                {
                    return(result);
                }
                strEncCookieValue = HttpUtility.UrlDecode(strEncCookieValue);
                //  还原成明文
                strContent = RC4Encrypt.Decrypt(strEncCookieValue, parameters["rc4key"], RC4Encrypt.EncoderMode.HexEncoder);
                if (strContent.Length == 0)
                {
                    return(result);
                }

                arrayCookieValue = SerializationUtility.JsonDeserialize2 <string[]>(strContent);
                if (arrayCookieValue != null && arrayCookieValue.Length == 3)
                {
                    if (DateTime.Parse(arrayCookieValue[1]) > DateTime.Now && GetClientIP() == arrayCookieValue[2])
                    {
                        result = SerializationUtility.JsonDeserialize2 <T>(arrayCookieValue[0]);
                        //Cookie有效,则继续延续有效期
                        CookieHelper.SaveCookie <T>(parameters["nodeName"], result);
                    }
                }

                return(result);
            }
            catch
            {
                return(result);
            }
        }
Exemplo n.º 13
0
        public ActionResult AjaxAppForCertification()
        {
            var request = Request.Form["data"];
            var data    = SerializationUtility.JsonDeserialize2 <CertificationInfo>(Request.Form["data"]);

            data.SellerName      = CurrUser.SellerName;
            data.SellerSysNo     = CurrUser.SellerSysNo;
            data.UserID          = CurrUser.UserID;
            data.Status          = "I";
            data.UserDisplayName = CurrUser.UserDisplayName;

            StoreService.SaveCertification(data);
            return(Json(new { Success = true, Message = LanguageHelper.GetText("操作成功") }));
        }
Exemplo n.º 14
0
        public static ShoppingCart GetShoppingCartByCustomer(int userSysNo)
        {
            ShoppingCart shoppingCart = GetShoppingCartFromCookieOrCreateNew();

            if (shoppingCart == null)
            {
                shoppingCart = new ShoppingCart();
            }
            string key = CookieHelper.GetCookie <string>(MY_SHOPPINGCART_SIGN_KEY);

            if (String.IsNullOrEmpty(key))
            {
                key = Guid.NewGuid().ToString("N");
                CookieHelper.SaveCookie <string>(MY_SHOPPINGCART_SIGN_KEY, key);
            }
            shoppingCart.ShoppingCartID = key;
            if (userSysNo > 0)
            {
                //获取数据库最新数据购物车
                ShoppingCartPersistent shoppingCartPersistent = ShoppingPersistentDA.GetShoppingCartByCustomer(userSysNo);
                ShoppingCart           newShoppingCart        = new ShoppingCart();
                if (shoppingCartPersistent != null && !string.IsNullOrEmpty(shoppingCartPersistent.ShoppingCart))
                {
                    newShoppingCart = SerializationUtility.JsonDeserialize2 <ShoppingCart>(shoppingCartPersistent.ShoppingCart);
                }
                //判断购物车是否发生变化
                if (newShoppingCart.ShoppingCartID != shoppingCart.ShoppingCartID)
                {
                    newShoppingCart.ShoppingCartID = shoppingCart.ShoppingCartID;
                    //合并购物车
                    MergeShoppingCart(shoppingCart, newShoppingCart);
                }
                //写入DB
                ShoppingPersistentDA.SaveShoppingCart(new ShoppingCartPersistent()
                {
                    CustomerSysNo    = userSysNo,
                    ShoppingCart     = SerializationUtility.JsonSerialize2(shoppingCart),
                    ShoppingCartMini = ""
                });
            }
            else
            {
                shoppingCart = GetShoppingCartFromCookie();
            }
            //写入Cookie
            CookieHelper.SaveCookie <ShoppingCart>(MY_SHOPPINGCART_COOKIE_NAME, shoppingCart);
            return(shoppingCart);
        }
Exemplo n.º 15
0
        public static StorePage QueryStorePageByPageName(string pageName, int sellerSysNo)
        {
            var page = StoreDA.QueryStorePageByPageName(pageName, sellerSysNo);

            if (page != null)
            {
                var value = page.DataValue;
                if (!string.IsNullOrEmpty(value))
                {
                    var result = SerializationUtility.JsonDeserialize2 <StorePage>(value);
                    result.SysNo = page.SysNo;
                    return(result);
                }
            }
            return(null);
        }
Exemplo n.º 16
0
        public ActionResult AjaxSaveBasicInfo()
        {
            var info = SerializationUtility.JsonDeserialize2 <StoreBasicInfo>(Request.Form["data"]);

            info.Status        = 1;
            info.SellerSysNo   = CurrUser.SellerSysNo;
            info.InUserSysNo   = CurrUser.UserSysNo;
            info.InUserName    = CurrUser.UserDisplayName;
            info.EditDate      = DateTime.Now;
            info.EditUserName  = CurrUser.UserDisplayName;
            info.EditUserSysNo = CurrUser.UserSysNo;
            StoreService.SaveStoreBasicInfo(info);
            var result = new { Success = true, Message = LanguageHelper.GetText("保存成功") };

            return(Json(result));
        }
Exemplo n.º 17
0
        public ActionResult AjaxSavePurchaseOrder()
        {
            if (string.IsNullOrWhiteSpace(Request["Data"]))
            {
                throw new BusinessException("采购单信息为空");
            }
            PurchaseOrderInfo poInfo = SerializationUtility.JsonDeserialize2 <PurchaseOrderInfo>(Request["Data"]);

            SetUserInfo(poInfo);
            poInfo.VendorInfo = new VendorBasicInfo()
            {
                VendorID = UserAuthHelper.GetCurrentUser().SellerSysNo.ToString()
            };
            poInfo = ProductPurchaseService.CreatePO(poInfo);
            return(Json(poInfo));
        }
Exemplo n.º 18
0
        public ActionResult AjaxSavePageHeader()
        {
            var data = SerializationUtility.JsonDeserialize2 <StorePageHeader>(Request.Form["data"]);

            data.SellerSysNo   = CurrUser.SellerSysNo;
            data.EditDate      = DateTime.Now;
            data.EditUserName  = CurrUser.UserDisplayName;
            data.EditUserSysNo = CurrUser.UserSysNo;
            if (!data.SysNo.HasValue)
            {
                data.InDate      = data.EditDate;
                data.InUserName  = data.EditUserName;
                data.InUserSysNo = data.EditUserSysNo;
            }
            StoreService.SavePageHeader(data);

            return(Json(new { Success = true, Message = LanguageHelper.GetText("操作成功") }));
        }
Exemplo n.º 19
0
        public JsonResult SaveGiftPromotion()
        {
            var result = 0;

            if (!string.IsNullOrEmpty(Request["giftInfo"]))
            {
                SalesGiftInfo giftInfo = SerializationUtility.JsonDeserialize2 <SalesGiftInfo>(Request["giftInfo"]);
                if (null != giftInfo)
                {
                    giftInfo.SellerSysNo   = UserAuthHelper.GetCurrentUser().SellerSysNo;
                    giftInfo.InUserSysNo   = UserAuthHelper.GetCurrentUser().UserSysNo;
                    giftInfo.InUserName    = UserAuthHelper.GetCurrentUser().UserDisplayName;
                    giftInfo.EditUserSysNo = UserAuthHelper.GetCurrentUser().UserSysNo;
                    giftInfo.EditUser      = giftInfo.EditUserName = UserAuthHelper.GetCurrentUser().UserDisplayName;
                }
                result = GiftPromotionService.SaveGiftPromotionInfo(giftInfo, UserAuthHelper.GetCurrentUser().UserDisplayName);
            }
            return(Json(new { Data = result }));
        }
Exemplo n.º 20
0
        /// <summary>
        /// 查询区域
        /// </summary>
        /// <returns></returns>
        public ActionResult QueryArea()
        {
            var queryFilter = SerializationUtility.JsonDeserialize2 <AreaInfoQueryFilter>(this.Request["queryfilter[]"]);

            switch (queryFilter.ProvinceSysNo)
            {
            case "-1":
                queryFilter.ProvinceSysNo = null;
                break;

            case "-2":
                queryFilter.ProvinceSysNo = ConstValue.regionHuadong;
                break;

            case "-3":
                queryFilter.ProvinceSysNo = ConstValue.regionHuanan;
                break;

            case "-4":
                queryFilter.ProvinceSysNo = ConstValue.regionHuabei;
                break;

            case "-5":
                queryFilter.ProvinceSysNo = ConstValue.regionHuazhong;
                break;

            case "-6":
                queryFilter.ProvinceSysNo = ConstValue.regionXinan;
                break;

            case "-7":
                queryFilter.ProvinceSysNo = ConstValue.regionXibei;
                break;

            case "-8":
                queryFilter.ProvinceSysNo = ConstValue.regionDongbei;
                break;
            }
            var data = CommonService.QueryArea(queryFilter);

            return(AjaxGridJson(data));
        }
Exemplo n.º 21
0
        public ActionResult FinancialReportDataText()
        {
            SalesStatisticsReportQueryFilter filter = SerializationUtility.JsonDeserialize2 <SalesStatisticsReportQueryFilter>(Request.Form["data"]);

            filter.C1SysNo    = filter.Category.C1SysNo == 0 ? null : filter.Category.C1SysNo;
            filter.C2SysNo    = filter.Category.C2SysNo == 0 ? null : filter.Category.C2SysNo;
            filter.C3SysNo    = filter.Category.C3SysNo == 0 ? null : filter.Category.C3SysNo;
            filter.SortFields = "B.ProductID DESC";

            int MerchantSysNo = UserAuthHelper.GetCurrentUser().SellerSysNo;

            filter.VendorSysNoList = new List <int>();
            filter.VendorSysNoList.Add(MerchantSysNo);
            filter.SOStatusList = new List <int>();
            if (filter.SOStatus.HasValue)
            {
                filter.SOStatusList.Add(filter.SOStatus.Value);
            }
            var    result = FinancialReportService.SalesStatisticsReportQuery(filter);
            string text   = "";

            if (result.SalesStatisticsResult.ResultList != null && result.SalesStatisticsResult.ResultList.Count > 0)
            {
                string page = string.Format("{0}: --- 销售成本:{1}  销售金额:{2}  优惠金额:{3}  实际销售金额:{4}  商品毛利:{5}",
                                            "本页小计",
                                            result.CostReportStatisticList[0].ProductCost,
                                            result.CostReportStatisticList[0].ProductPriceAmount,
                                            result.CostReportStatisticList[0].PromotionDiscountAmount,
                                            result.CostReportStatisticList[0].ProductSaleAmount,
                                            result.CostReportStatisticList[0].ProductGrossMargin);
                string Total = string.Format("{0}: --- 销售成本:{1}  销售金额:{2}  优惠金额:{3}  实际销售金额:{4}  商品毛利:{5}",
                                             "全部总计",
                                             result.CostReportStatisticList[1].ProductCost,
                                             result.CostReportStatisticList[1].ProductPriceAmount,
                                             result.CostReportStatisticList[1].PromotionDiscountAmount,
                                             result.CostReportStatisticList[1].ProductSaleAmount,
                                             result.CostReportStatisticList[1].ProductGrossMargin);
                text = "<div class='col-md-12' style='color:red;'>" + page + "</div><div class='col-md-12' style='color:red;'>" + Total + "</div>";
            }
            return(Content(text));
        }
        public ActionResult FreeShippingChargeRuleSave()
        {
            FreeShippingChargeRuleInfo info = SerializationUtility.JsonDeserialize2 <FreeShippingChargeRuleInfo>(Request.Form["data"]);
            var loginUser = UserAuthHelper.GetCurrentUser();

            info.SellerSysNo   = loginUser.SellerSysNo;
            info.InUserSysNo   = loginUser.UserSysNo;
            info.InUserName    = loginUser.UserDisplayName;
            info.EditUserSysNo = loginUser.UserSysNo;
            info.EditUserName  = loginUser.UserDisplayName;
            if (info.SysNo > 0)
            {
                FreeShippingChargeRuleService.Update(info);
                return(JsonSuccess(info.SysNo.Value, LanguageHelper.GetText("更新成功。")));
            }
            else
            {
                FreeShippingChargeRuleService.Create(info);
                return(JsonSuccess(info.SysNo.Value, LanguageHelper.GetText("创建成功。")));
            }
        }
Exemplo n.º 23
0
        public T DecryptCookie <T>(string cookieValue, Dictionary <string, string> parameters)
        {
            T      result            = default(T);
            string strEncCookieValue = string.Empty;
            string strContent        = string.Empty;
            string strSHA1Sign       = string.Empty;
            string strShA1Temp       = string.Empty;

            try
            {
                if (cookieValue.Length < 40)
                {
                    return(result);
                }
                //  取出签名和密文
                strSHA1Sign       = cookieValue.Substring(0, 40);
                strEncCookieValue = cookieValue.Substring(40);
                //  签名校验
                strShA1Temp = HashEncrypt.SHA1Encrypt(HttpUtility.UrlDecode(strEncCookieValue).Trim() + parameters["hashkey"]);
                if (strSHA1Sign != strShA1Temp)
                {
                    return(result);
                }
                strEncCookieValue = HttpUtility.UrlDecode(strEncCookieValue);
                //  还原成明文
                strContent = RC4Encrypt.Decrypt(strEncCookieValue, parameters["rc4key"], RC4Encrypt.EncoderMode.HexEncoder);
                if (strContent.Length == 0)
                {
                    return(result);
                }

                result = SerializationUtility.JsonDeserialize2 <T>(strContent);

                return(result);
            }
            catch
            {
                return(result);
            }
        }
Exemplo n.º 24
0
        public ActionResult AjaxSaveAttachment()
        {
            var data = SerializationUtility.JsonDeserialize2 <List <StoreAttachment> >(Request.Form["data"]);

            data.ForEach(p =>
            {
                p.SellerSysNo   = CurrUser.SellerSysNo;
                p.EditDate      = DateTime.Now;
                p.EditUserName  = CurrUser.UserDisplayName;
                p.EditUserSysNo = CurrUser.UserSysNo;
                p.Status        = 1;
                if (!p.SysNo.HasValue)
                {
                    p.InUserName  = CurrUser.UserDisplayName;
                    p.InUserSysNo = CurrUser.UserSysNo;
                }
            });

            StoreService.SaveStoreAttachment(data);

            return(Json(new { Success = true, Message = LanguageHelper.GetText("操作成功"), Data = StoreService.QueryStoreAttachment(CurrUser.SellerSysNo) }));
        }
Exemplo n.º 25
0
        public ActionResult AjaxSOOpreate()
        {
            var soSysNos    = SerializationUtility.JsonDeserialize2 <int[]>(Request.Form["data"]);
            var opreateName = Request.Form["opreateName"];

            switch (opreateName)
            {
            case "AuditAccept":
                SOService.AuditAccept(soSysNos);
                break;

            case "BatchVoid":
                LoginUser user = EntityConverter <UserAuthVM, LoginUser> .Convert(UserAuthHelper.GetCurrentUser());

                SOService.BatchVoidSO(soSysNos, user: user);
                break;

            case "BatchOutStock":
                SOService.BatchOutStock(soSysNos);
                break;

            case "BatcReported":
                SOService.BatcReported(soSysNos);
                break;

            case "BatchCustomsPass":
                SOService.BatchCustomsPass(soSysNos);
                break;

            case "BatchUpdateToPaid":
                SOService.BatcUpdateToPaid(soSysNos);
                break;

            default:
                throw new BusinessException(LanguageHelper.GetText("无效的操作类型"));
            }

            return(new JsonResult());
        }
Exemplo n.º 26
0
        public ActionResult AjaxSaveStorePage()
        {
            var data = SerializationUtility.JsonDeserialize2 <StorePage>(Request.Form["data"]);

            data.SellerSysNo   = CurrUser.SellerSysNo;
            data.EditDate      = DateTime.Now;
            data.EditUserName  = CurrUser.UserDisplayName;
            data.EditUserSysNo = CurrUser.UserSysNo;

            data.InUserSysNo = CurrUser.UserSysNo;
            data.InDate      = DateTime.Now;
            data.InUserName  = CurrUser.UserDisplayName;

            var flag = Request.Form["flag"];

            if (flag.Equals("save"))
            {
                if (!data.Status.HasValue)
                {
                    data.Status = 1;
                }
                data.DataValue = SerializationUtility.JsonSerialize2(data);
                StoreService.SaveStorePage(data);
            }
            else if (flag.Equals("audit"))
            {
                data.Status    = 2;//待审核   审核通过Status=3
                data.DataValue = SerializationUtility.JsonSerialize2(data);
                StoreService.SaveStorePage(data);
            }
            else
            {
                data.Status    = 1;
                data.DataValue = SerializationUtility.JsonSerialize2(data);
                StoreService.PublishStorePage(data);
            }
            return(Json(new { Success = true, Message = LanguageHelper.GetText("操作成功") }));
        }
Exemplo n.º 27
0
        public ActionResult AjaxSaveExcel()
        {
            var data = SerializationUtility.JsonDeserialize2 <List <ExcelInfo> >(Request.Form["data"]);

            if (!string.IsNullOrEmpty(data[0].Url))
            {
                System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex(".");
                System.Text.RegularExpressions.Match m = r.Match(data[0].Url);
                if (m.Success)
                {
                    string suffix = data[0].Url.Substring(data[0].Url.LastIndexOf(".") + 1);
                    if (suffix != "xls" && suffix != "xlsx" && suffix != "xlsm")
                    {
                        throw new BusinessException(LanguageHelper.GetText("只能导入Excel格式,请参考模板!!!"));
                    }
                }
            }
            string    Url = System.Web.HttpContext.Current.Server.MapPath(string.Format("~/UploadFiles/{0}", data[0].Url));
            DataTable dt  = FileSvr.GetExcelDatatable(Url, data[0].Name);

            if (dt.Rows.Count > 0)
            {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append("<SOTrackingInfos>");
                string    UserID          = UserAuthHelper.GetCurrentUser().UserID;
                int       SellerSysNo     = UserAuthHelper.GetCurrentUser().SellerSysNo;
                int[]     soSysNos        = new int[dt.Rows.Count];
                ArrayList TrackingNumbers = new ArrayList();
                int       i = 0;
                foreach (DataRow dr in dt.Rows)
                {
                    SOOutStockWaitReportRequest outStockWaitReportRequest = new Entity.SO.SOOutStockWaitReportRequest();
                    outStockWaitReportRequest.Logistics = new LogisticsInfo();
                    //如果订单号为空,SOSysNo=0
                    if (!string.IsNullOrEmpty(dr[0].ToString()))
                    {
                        try
                        {
                            outStockWaitReportRequest.SOSysNo = int.Parse(dr[0].ToString());
                        }
                        catch (Exception ex)
                        {
                            throw new BusinessException(LanguageHelper.GetText("订单号只能是正整数"));
                        }
                    }
                    else
                    {
                        outStockWaitReportRequest.SOSysNo = 0;
                    }
                    outStockWaitReportRequest.Logistics.TrackingNumber = string.IsNullOrEmpty(dr[1].ToString()) ? "" : dr[1].ToString();
                    soSysNos.SetValue(outStockWaitReportRequest.SOSysNo, i++);
                    TrackingNumbers.Add(outStockWaitReportRequest.Logistics.TrackingNumber);
                    stringBuilder.Append("<SOTrackingInfo><SONumber>" + outStockWaitReportRequest.SOSysNo + "</SONumber><TrackingNumber>" + outStockWaitReportRequest.Logistics.TrackingNumber + "</TrackingNumber></SOTrackingInfo>");
                }
                stringBuilder.Append("</SOTrackingInfos>");
                SOService.CreatMoreSOSysNoAndTrackingNumber(stringBuilder.ToString(), UserID, SellerSysNo, soSysNos, TrackingNumbers);
                return(Json(new { Success = true, Message = LanguageHelper.GetText("操作成功") }));
            }
            else
            {
                return(Json(new { Error = true, Message = LanguageHelper.GetText("Excel没有数据") }));
            }
        }
Exemplo n.º 28
0
        public ActionResult Save()
        {
            string json = Request["data"];

            if (string.IsNullOrWhiteSpace(json))
            {
                throw new BusinessException("传入数据不能为空");
            }
            Company entity = SerializationUtility.JsonDeserialize2 <Company>(json);

            SetEntityBaseUserInfo(entity);
            entity.CompanyStatus = CompanyStatus.Init;
            if (string.IsNullOrEmpty(entity.Name))
            {
                throw new BusinessException("请输入客户名称");
            }
            SystemUser customer = new SystemUser();

            //if (!string.IsNullOrEmpty(entity.ContactCellPhone))
            //{
            if (string.IsNullOrEmpty(entity.ContactName))
            {
                throw new BusinessException("请输入联系人姓名");
            }
            if (string.IsNullOrEmpty(entity.ContactCellPhone))
            {
                throw new BusinessException("请输入联系人手机号");
            }
            if (!WebPortalHelper.IsPhonenum(entity.ContactCellPhone))
            {
                throw new BusinessException("请输入正确的手机号!");
            }

            customer = SystemUserService.LoadSystemUserByLoginNameAndCellPhone(entity.ContactCellPhone, ConstValue.ApplicationID);
            // }

            Company company = CompanyService.LoadCompanyByName(entity.Name);

            if (entity.SysNo > 0)
            {
                Company curentcompany = CompanyService.LoadCompany(entity.SysNo, false);
                if (curentcompany == null)
                {
                    throw new BusinessException("未找到此公司的相关信息");
                }
                if (company != null && company.SysNo != curentcompany.SysNo)
                {
                    throw new BusinessException("系统中已存在当前客户,请重新输入客户名称!");
                }


                if (customer != null && customer.SysNo > 0 && ((!string.IsNullOrEmpty(entity.ContactCellPhone) && !string.Equals(customer.CellPhone, entity.ContactCellPhone)) || (entity.SysNo != customer.MasterSysNo)))
                {
                    throw new BusinessException("系统中已存在此手机号,请更换手机号重试!");
                }
                using (ITransaction it = TransactionManager.Create())
                {
                    //if (!string.IsNullOrEmpty(entity.ContactCellPhone))
                    //{
                    //    if (customer == null || !string.Equals(entity.ContactCellPhone, customer.CellPhone))
                    //    {
                    //        customer = new SystemUser();
                    //        customer.MasterSysNo = entity.SysNo;
                    //        customer.LoginName = customer.CellPhone = entity.ContactCellPhone;
                    //        customer.LoginPassword = AuthMgr.EncryptPassword(entity.ContactCellPhone);
                    //        customer.UserFullName = entity.ContactName;
                    //        customer.CommonStatus = CommonStatus.Actived;
                    //        SetEntityBaseUserInfo(customer);

                    //        var usersysno = user_service.InsertSystemUser(customer);
                    //        if (usersysno > 0)
                    //        {
                    //            if (rolesysno != 0)
                    //            {
                    //                List<Role> roles = new List<Role> { new Role { SysNo = rolesysno } };
                    //                usersrole.SaveUsersRole(usersysno, roles, ConstValue.ApplicationID);
                    //            }
                    //        }

                    //    }
                    //}
                    entity.CompanyStatus = curentcompany.CompanyStatus;
                    entity.AccountSysNo  = curentcompany.AccountSysNo;
                    if (curentcompany.CompanyStatus == CompanyStatus.Invalid)
                    {
                        entity.CompanyStatus = CompanyStatus.Init;
                    }
                    CompanyService.UpdateCompany(entity);
                    it.Complete();
                }
            }
            else
            {
                if (company != null)
                {
                    throw new BusinessException("系统中已存在当前客户,请重新输入客户名称!");
                }
                if (customer != null && customer.SysNo > 0)
                {
                    throw new BusinessException("系统中已存在此手机号,请更换手机号重试!");
                }
                if (!string.IsNullOrEmpty(entity.ContactCellPhone))
                {
                    customer               = new SystemUser();
                    customer.LoginName     = entity.LoginName;
                    customer.CellPhone     = "";
                    customer.LoginPassword = AuthMgr.EncryptPassword(entity.LoginName);
                    customer.UserFullName  = entity.ContactName;
                    customer.CommonStatus  = CommonStatus.Actived;
                    SetEntityBaseUserInfo(customer);
                }
                using (ITransaction it = TransactionManager.Create())
                {
                    entity.SysNo         = CompanyService.InsertCompany(entity);
                    customer.MasterSysNo = entity.SysNo;
                    if (!string.IsNullOrEmpty(entity.ContactCellPhone))
                    {
                        var usersysno = user_service.InsertSystemUser(customer);
                        if (usersysno > 0)
                        {
                            entity.AccountSysNo = usersysno;
                            CompanyService.UpdateCompany(entity);

                            if (rolesysno != 0)
                            {
                                List <Role> roles = new List <Role> {
                                    new Role {
                                        SysNo = rolesysno
                                    }
                                };
                                usersrole.SaveUsersRole(usersysno, roles, ConstValue.ApplicationID);
                            }
                        }
                    }
                    it.Complete();
                }
            }

            return(Json(new AjaxResult {
                Success = true, Message = "保存成功", Data = entity.SysNo
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 29
0
 public T DecryptCookie <T>(string cookieValue, Dictionary <string, string> parameters)
 {
     return(SerializationUtility.JsonDeserialize2 <T>(cookieValue));
 }
Exemplo n.º 30
0
        public FileResult AjaxFinancialExportData(string queryString)
        {
            //每页显示条数:
            SalesStatisticsReportQueryFilter getQueryEntity = SerializationUtility.JsonDeserialize2 <SalesStatisticsReportQueryFilter>(queryString);

            getQueryEntity.C1SysNo    = getQueryEntity.Category.C1SysNo == 0 ? null : getQueryEntity.Category.C1SysNo;
            getQueryEntity.C2SysNo    = getQueryEntity.Category.C2SysNo == 0 ? null : getQueryEntity.Category.C2SysNo;
            getQueryEntity.C3SysNo    = getQueryEntity.Category.C3SysNo == 0 ? null : getQueryEntity.Category.C3SysNo;
            getQueryEntity.SortFields = "B.ProductID DESC";

            int MerchantSysNo = UserAuthHelper.GetCurrentUser().SellerSysNo;

            getQueryEntity.VendorSysNoList = new List <int>();
            getQueryEntity.VendorSysNoList.Add(MerchantSysNo);
            getQueryEntity.SOStatusList = new List <int>();
            if (getQueryEntity.SOStatus.HasValue)
            {
                getQueryEntity.SOStatusList.Add(getQueryEntity.SOStatus.Value);
            }

            getQueryEntity.PageSize  = 10000000;
            getQueryEntity.PageIndex = 0;


            SalesStatisticsReport result = FinancialReportService.SalesStatisticsReportQuery(getQueryEntity);


            List <DataTable> dataTableList = new List <DataTable>();

            if (result.SalesStatisticsResult.ResultList.Count <= 0)
            {
                throw new BusinessException("无数据可导出!!!");
            }


            DataTable newDt = ToDataTableTow(result.SalesStatisticsResult.ResultList);

            dataTableList.Add(newDt);

            List <ColumnData> columndatalist = new List <ColumnData>();
            ColumnData        columndata     = null;

            columndata = new ColumnData()
            {
                FieldName = "ProductID", Width = 20, Title = "商品ID"
            };
            columndatalist.Add(columndata);
            columndata = new ColumnData()
            {
                FieldName = "ProductName", Width = 30, Title = "商品名称"
            };
            columndatalist.Add(columndata);
            columndata = new ColumnData()
            {
                FieldName = "C1Name", Width = 15, Title = "一级分类"
            };
            columndatalist.Add(columndata);
            columndata = new ColumnData()
            {
                FieldName = "C2Name", Width = 15, Title = "二级分类"
            };
            columndatalist.Add(columndata);
            columndata = new ColumnData()
            {
                FieldName = "C3Name", Width = 15, Title = "三级分类", ValueFormat = ""
            };
            columndatalist.Add(columndata);
            columndata = new ColumnData()
            {
                FieldName = "BeginDate", Width = 20, Title = "开始时间"
            };
            columndatalist.Add(columndata);
            columndata = new ColumnData()
            {
                FieldName = "EndDate", Width = 20, Title = "结束时间"
            };
            columndatalist.Add(columndata);
            columndata = new ColumnData()
            {
                FieldName = "BrandName", Width = 20, Title = "品牌"
            };
            columndatalist.Add(columndata);
            columndata = new ColumnData()
            {
                FieldName = "VendorName", Width = 20, Title = "供应商"
            };
            columndatalist.Add(columndata);
            columndata = new ColumnData()
            {
                FieldName = "StockName", Width = 20, Title = "仓库"
            };
            columndatalist.Add(columndata);
            columndata = new ColumnData()
            {
                FieldName = "BMCode", Width = 20, Title = "BM编号"
            };
            columndatalist.Add(columndata);
            columndata = new ColumnData()
            {
                FieldName = "ProductProperty1", Width = 20, Title = "属性1"
            };
            columndatalist.Add(columndata);
            columndata = new ColumnData()
            {
                FieldName = "ProductProperty2", Width = 20, Title = "属性2"
            };
            columndatalist.Add(columndata);
            columndata = new ColumnData()
            {
                FieldName = "Quantity", Width = 20, Title = "数量"
            };
            columndatalist.Add(columndata);
            columndata = new ColumnData()
            {
                FieldName = "ProductCost", Width = 20, Title = "销售成本"
            };
            columndatalist.Add(columndata);
            columndata = new ColumnData()
            {
                FieldName = "ProductPriceAmount", Width = 20, Title = "销售金额"
            };
            columndatalist.Add(columndata);
            columndata = new ColumnData()
            {
                FieldName = "PromotionDiscountAmount", Width = 20, Title = "优惠金额"
            };
            columndatalist.Add(columndata);
            columndata = new ColumnData()
            {
                FieldName = "ProductSaleAmount", Width = 20, Title = "实际销售金额"
            };
            columndatalist.Add(columndata);
            columndata = new ColumnData()
            {
                FieldName = "PayTypeName", Width = 20, Title = "支付方式"
            };
            columndatalist.Add(columndata);
            columndata = new ColumnData()
            {
                FieldName = "ProductGrossMargin", Width = 20, Title = "商品毛利"
            };
            columndatalist.Add(columndata);
            List <List <ColumnData> > columnList = new List <List <ColumnData> >();

            columnList.Add(columndatalist);
            //步骤5:调用生成Excel的公共方法,返回

            /*例如:
             * IFileExport excelExport = new ExcelFileExporter();
             * byte[] excelByte = excelExport.CreateFile(dataTableList, columnList, null, out fileName, "测试导出Excel");
             * return File(new MemoryStream(excelByte), "application/ms-excel", fileName);
             */
            string      fileName    = "";
            IFileExport excelExport = new ExcelFileExporter();

            byte[] excelByte = excelExport.CreateFile(dataTableList, columnList, null, out fileName, "销售统计报表");
            return(File(new MemoryStream(excelByte), "application/ms-excel", fileName));
        }