示例#1
0
        private void btnUpdateProductTags_Click(object sender, System.EventArgs e)
        {
            string text = base.Request.Form["CheckBoxGroup"];

            if (string.IsNullOrEmpty(text))
            {
                this.ShowMsg("请先选择要关联的商品", false);
                return;
            }
            System.Collections.Generic.IList <int> list = new System.Collections.Generic.List <int>();
            if (!string.IsNullOrEmpty(this.txtProductTag.Text.Trim()))
            {
                string   text2 = this.txtProductTag.Text.Trim();
                string[] array;
                if (text2.Contains(","))
                {
                    array = text2.Split(new char[]
                    {
                        ','
                    });
                }
                else
                {
                    array = new string[]
                    {
                        text2
                    };
                }
                string[] array2 = array;
                for (int i = 0; i < array2.Length; i++)
                {
                    string value = array2[i];
                    list.Add(System.Convert.ToInt32(value));
                }
            }
            string[] array3;
            if (text.Contains(","))
            {
                array3 = text.Split(new char[]
                {
                    ','
                });
            }
            else
            {
                array3 = new string[]
                {
                    text
                };
            }
            int num = 0;

            string[] array4 = array3;
            for (int j = 0; j < array4.Length; j++)
            {
                string value2 = array4[j];
                ProductHelper.DeleteProductTags(System.Convert.ToInt32(value2), null);
                if (list.Count > 0 && ProductHelper.AddProductTags(System.Convert.ToInt32(value2), list, null))
                {
                    num++;
                }
            }
            if (num > 0)
            {
                EventLogs.WriteOperationLog(Privilege.SubjectProducts, string.Format(CultureInfo.InvariantCulture, "已成功修改了{0}件商品的商品标签", new object[]
                {
                    num,
                }));
                this.ShowMsg(string.Format("已成功修改了{0}件商品的商品标签", num), true);
            }
            else
            {
                this.ShowMsg("已成功取消了商品的关联商品标签", true);
            }
            this.txtProductTag.Text = "";
        }
示例#2
0
文件: OrderHelper.cs 项目: zwkjgs/XKD
        public static bool SendGoods(OrderInfo order)
        {
            ManagerHelper.CheckPrivilege(Privilege.OrderSendGoods);
            bool flag = false;

            if (order.CheckAction(OrderActions.SELLER_SEND_GOODS))
            {
                OrderDao orderDao = new OrderDao();
                order.OrderStatus  = OrderStatus.SellerAlreadySent;
                order.ShippingDate = new DateTime?(DateTime.Now);
                flag = orderDao.UpdateOrder(order, null);
                string text = "";
                if (flag)
                {
                    bool flag2 = false;
                    foreach (LineItemInfo current in order.LineItems.Values)
                    {
                        OrderStatus orderItemsStatus = current.OrderItemsStatus;
                        switch (orderItemsStatus)
                        {
                        case OrderStatus.WaitBuyerPay:
                        case OrderStatus.BuyerAlreadyPaid:
                            text = text + "'" + current.SkuId + "',";
                            break;

                        default:
                            if (orderItemsStatus == OrderStatus.ApplyForRefund)
                            {
                                flag2 = true;
                                text  = text + "'" + current.SkuId + "',";
                            }
                            break;
                        }
                    }
                    if (flag2)
                    {
                        orderDao.DeleteReturnRecordForSendGoods(order.OrderId);
                    }
                    if (!string.IsNullOrEmpty(text))
                    {
                        orderDao.UpdateItemsStatus(order.OrderId, 3, text.Substring(0, text.Length - 1));
                    }
                    bool flag3 = true;
                    foreach (LineItemInfo current in order.LineItems.Values)
                    {
                        if (current.Type == 0)
                        {
                            flag3 = false;
                            break;
                        }
                    }
                    if (order.Gateway.ToLower() == "hishop.plugins.payment.podrequest" || flag3)
                    {
                        orderDao.UpdatePayOrderStock(order);
                        foreach (LineItemInfo current in order.LineItems.Values)
                        {
                            text = text + current.SkuId + ",";
                            ProductDao  productDao     = new ProductDao();
                            ProductInfo productDetails = productDao.GetProductDetails(current.ProductId);
                            productDetails.SaleCounts     += current.Quantity;
                            productDetails.ShowSaleCounts += current.Quantity;
                            productDao.UpdateProduct(productDetails, null);
                        }
                    }
                    MemberInfo member = MemberHelper.GetMember(order.UserId);
                    try
                    {
                        if (order != null)
                        {
                            Messenger.SendWeiXinMsg_OrderDeliver(order);
                        }
                    }
                    catch (Exception var_10_293)
                    {
                    }
                    EventLogs.WriteOperationLog(Privilege.OrderSendGoods, string.Format(CultureInfo.InvariantCulture, "发货编号为\"{0}\"的订单", new object[]
                    {
                        order.OrderId
                    }));
                }
            }
            return(flag);
        }
示例#3
0
        public static string AddProductNew(ProductInfo product, Dictionary <string, SKUItem> skus, Dictionary <int, IList <int> > attrs, IList <int> tagsId)
        {
            string str = string.Empty;

            if (null == product)
            {
                return("未知错误");
            }
            Globals.EntityCoding(product, true);
            int decimalLength = SettingsManager.GetMasterSettings(true).DecimalLength;

            if (product.MarketPrice.HasValue)
            {
                product.MarketPrice = new decimal?(Math.Round(product.MarketPrice.Value, decimalLength));
            }
            ProductActionStatus unknowError = ProductActionStatus.UnknowError;

            using (DbConnection connection = DatabaseFactory.CreateDatabase().CreateConnection())
            {
                connection.Open();
                DbTransaction dbTran = connection.BeginTransaction();
                try
                {
                    ProductDao dao       = new ProductDao();
                    int        productId = dao.AddProduct(product, dbTran);
                    if (productId == 0)
                    {
                        dbTran.Rollback();
                        return("货号重复");
                    }
                    str = productId.ToString();
                    product.ProductId = productId;
                    if (((skus != null) && (skus.Count > 0)) && !dao.AddProductSKUs(productId, skus, dbTran))
                    {
                        dbTran.Rollback();
                        return("添加SUK出错");
                    }
                    if (((attrs != null) && (attrs.Count > 0)) && !dao.AddProductAttributes(productId, attrs, dbTran))
                    {
                        dbTran.Rollback();
                        return("添加商品属性出错");
                    }
                    if (((tagsId != null) && (tagsId.Count > 0)) && !new TagDao().AddProductTags(productId, tagsId, dbTran))
                    {
                        dbTran.Rollback();
                        return("添加商品标签出错");
                    }
                    dbTran.Commit();
                    unknowError = ProductActionStatus.Success;
                }
                catch (Exception)
                {
                    dbTran.Rollback();
                }
                finally
                {
                    connection.Close();
                }
            }
            if (unknowError == ProductActionStatus.Success)
            {
                EventLogs.WriteOperationLog(Privilege.AddProducts, string.Format(CultureInfo.InvariantCulture, "上架了一个新商品:”{0}”", new object[] { product.ProductName }));
            }
            return(str);
        }
示例#4
0
        public static bool SendGoods(OrderInfo order)
        {
            ManagerHelper.CheckPrivilege(Privilege.OrderSendGoods);
            bool flag = false;

            if (order.CheckAction(OrderActions.SELLER_SEND_GOODS))
            {
                OrderDao dao = new OrderDao();
                order.OrderStatus  = OrderStatus.SellerAlreadySent;
                order.ShippingDate = new DateTime?(DateTime.Now);
                //线下支付,发货时更新付款时间
                if (order.Gateway == "hishop.plugins.payment.offlinerequest")
                {
                    order.PayDate = new DateTime?(DateTime.Now);
                }
                flag = dao.UpdateOrder(order, null);
                string str = "";
                if (!flag)
                {
                    return(flag);
                }
                bool flag2 = false;
                foreach (LineItemInfo info in order.LineItems.Values)
                {
                    OrderStatus orderItemsStatus = info.OrderItemsStatus;
                    switch (orderItemsStatus)
                    {
                    case OrderStatus.WaitBuyerPay:
                    case OrderStatus.BuyerAlreadyPaid:
                        break;

                    default:
                    {
                        if (orderItemsStatus == OrderStatus.ApplyForRefund)
                        {
                            flag2 = true;
                            str   = str + "'" + info.SkuId + "',";
                        }
                        continue;
                    }
                    }
                    str = str + "'" + info.SkuId + "',";
                }
                if (flag2)
                {
                    dao.DeleteReturnRecordForSendGoods(order.OrderId);
                }
                if (!string.IsNullOrEmpty(str))
                {
                    dao.UpdateItemsStatus(order.OrderId, 3, str.Substring(0, str.Length - 1));
                }
                //货到付款 更新库存
                if (order.Gateway.ToLower() == "hishop.plugins.payment.podrequest")
                {
                    dao.UpdatePayOrderStock(order.OrderId);
                    foreach (LineItemInfo info2 in order.LineItems.Values)
                    {
                        str = str + info2.SkuId + ",";
                        ProductDao  dao2           = new ProductDao();
                        ProductInfo productDetails = dao2.GetProductDetails(info2.ProductId);
                        productDetails.SaleCounts     += info2.Quantity;
                        productDetails.ShowSaleCounts += info2.Quantity;
                        dao2.UpdateProduct(productDetails, null);
                    }
                }
                MemberInfo member = MemberHelper.GetMember(order.UserId);
                Messenger.OrderShipping(order, member, order.wid);
                EventLogs.WriteOperationLog(Privilege.OrderSendGoods, string.Format(CultureInfo.InvariantCulture, "发货编号为\"{0}\"的订单", new object[] { order.OrderId }));
            }
            return(flag);
        }
示例#5
0
        private void btnCreateReport_Click(object sender, System.EventArgs e)
        {
            ManagerHelper.CheckPrivilege(Privilege.AggregatePayable);
            DbQueryResult balanceDetailsNoPage = MemberHelper.ExportReconciliationOrders(new ReconciliationOrdersQuery
            {
                StartDate = this.dateStart,
                EndDate   = this.dateEnd,
                SortBy    = "TradingTime",
                SortOrder = SortAction.Desc,
            });
            StringBuilder sbstr = new StringBuilder();

            string text = string.Empty;

            sbstr.Append("付款日期");
            sbstr.Append(",订单号");
            sbstr.Append(",实际金额");
            sbstr.Append(",收款金额");
            sbstr.Append(",退款金额");
            sbstr.Append(",买家昵称");
            sbstr.Append(",拍单时间");
            sbstr.Append(",付款时间");
            sbstr.Append(",商品总金额");
            sbstr.Append(",订单金额");
            sbstr.Append(",优惠金额");
            sbstr.Append(",运费");
            sbstr.Append(",税额");
            sbstr.Append(",货到付款服务费");
            sbstr.Append(",订单备注");
            sbstr.Append(",买家留言");
            sbstr.Append(",收货地址");
            sbstr.Append(",收货人名称");
            sbstr.Append(",收货国家");
            sbstr.Append(",州/省");
            sbstr.Append(",城市");
            sbstr.Append(",区");
            sbstr.Append(",邮编");
            sbstr.Append(",联系电话");
            sbstr.Append(",手机");
            sbstr.Append(",买家选择物流");
            sbstr.Append(",最晚发货时间");
            sbstr.Append(",海外订单");
            sbstr.Append(",是否货到付款");
            sbstr.Append(",订单状态");
            sbstr.Append(",发货快递单号");
            sbstr.Append(",快递公司");
            sbstr.Append(",货主Id");
            sbstr.Append(",货主名称\r\n");
            foreach (System.Data.DataRow dataRow in ((System.Data.DataTable)balanceDetailsNoPage.Data).Rows)
            {
                sbstr.Append(dataRow["TradingTime"]);
                sbstr.AppendFormat(",\"\t{0}\"", dataRow["OrderId"]);
                sbstr.AppendFormat(",{0}", dataRow["ActualAmount"]);
                sbstr.AppendFormat(",{0}", dataRow["TotalAmount"]);
                sbstr.AppendFormat(",{0}", dataRow["RefundAmount"]);
                sbstr.AppendFormat(",{0}", dataRow["RealName"]);
                sbstr.AppendFormat(",{0}", dataRow["OrderDate"]);
                sbstr.AppendFormat(",{0}", dataRow["PayDate"]);
                sbstr.AppendFormat(",{0}", dataRow["Amount"]);
                sbstr.AppendFormat(",{0}", dataRow["OrderTotal"]);
                sbstr.AppendFormat(",{0}", dataRow["DiscountAmount"]);
                sbstr.AppendFormat(",{0}", dataRow["AdjustedFreight"]);
                sbstr.AppendFormat(",{0}", dataRow["Tax"]);
                sbstr.AppendFormat(",{0}", dataRow["PayCharge"]);

                sbstr.AppendFormat(",\"{0}\"", dataRow["ManagerRemark"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["Remark"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["Address"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["ShipTo"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["Country"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["Province"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["City"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["Area"]);
                sbstr.AppendFormat(",\"\t{0}\"", dataRow["ZipCode"]);
                sbstr.AppendFormat(",\"\t{0}\"", dataRow["TelPhone"]);
                sbstr.AppendFormat(",\"\t{0}\"", dataRow["CellPhone"]);



                sbstr.AppendFormat(",\"{0}\"", dataRow["ModeName"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["LatestDelivery"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["OverseasOrders"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["CashDelivery"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["OrderStatus"]);
                sbstr.AppendFormat(",\"\t{0}\"", dataRow["ShipOrderNumber"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["ExpressCompanyName"]);
                sbstr.AppendFormat(",{0}", dataRow["ownerId"]);
                sbstr.AppendFormat(",\"{0}\"", dataRow["ownername"]);
                object obj = sbstr.ToString();
                text = string.Concat(new object[]
                {
                    obj,
                    ",",
                    "\r\n"
                });
            }
            this.Page.Response.Clear();
            this.Page.Response.Buffer  = false;
            this.Page.Response.Charset = "GB2312";
            this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=BalanceDetailsStatistics.csv");
            this.Page.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
            this.Page.Response.ContentType     = "application/octet-stream";
            this.Page.EnableViewState          = false;
            this.Page.Response.Write(text);

            EventLogs.WriteOperationLog(Privilege.AggregatePayable, string.Format(CultureInfo.InvariantCulture, "用户{0}生成平台销售额及应付总汇报告成功", new object[]
            {
                this.User.Identity.Name
            }));

            this.Page.Response.End();
        }
示例#6
0
 public int Add(EventLogs eventLog)
 {
     return(_eventLogRepository.Add(eventLog));
 }
示例#7
0
        private void btnCreateReport_Click(object sender, System.EventArgs e)
        {
            DbQueryResult balanceDetailsNoPage = MemberHelper.GetBalanceDetailsNoPage(new BalanceDetailQuery
            {
                FromDate  = this.dateStart,
                ToDate    = this.dateEnd,
                SortBy    = "TradeDate",
                SortOrder = SortAction.Desc,
                UserName  = this.userName
            });
            string text = string.Empty;

            text += "用户名";
            text += ",交易时间";
            text += ",业务摘要";
            text += ",转入金额";
            text += ",转出金额";
            text += ",当前余额\r\n";
            foreach (System.Data.DataRow dataRow in ((System.Data.DataTable)balanceDetailsNoPage.Data).Rows)
            {
                string str = string.Empty;
                switch (System.Convert.ToInt32(dataRow["TradeType"]))
                {
                case 1:
                    str = "自助充值";
                    break;

                case 2:
                    str = "后台加款";
                    break;

                case 3:
                    str = "消费";
                    break;

                case 4:
                    str = "提现";
                    break;

                case 5:
                    str = "订单退款";
                    break;

                default:
                    str = "其他";
                    break;
                }
                text += dataRow["UserName"];
                text  = text + "," + dataRow["TradeDate"];
                text  = text + "," + str;
                text  = text + "," + dataRow["Income"];
                text  = text + "," + dataRow["Expenses"];
                object obj = text;
                text = string.Concat(new object[]
                {
                    obj,
                    ",",
                    dataRow["Balance"],
                    "\r\n"
                });
            }
            this.Page.Response.Clear();
            this.Page.Response.Buffer  = false;
            this.Page.Response.Charset = "GB2312";
            //this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=BalanceDetailsStatistics.csv");
            if (!(this.calendarStart.SelectedDate.HasValue && this.calendarEnd.SelectedDate.HasValue))
            {
                this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=会员预付款报表.csv");
            }
            else
            {
                this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=会员预付款报表_" + this.dateStart.Value.ToString("yyyyMMdd") + "-" + this.dateEnd.Value.ToString("yyyyMMdd") + ".csv");
            }
            this.Page.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
            this.Page.Response.ContentType     = "application/octet-stream";
            this.Page.EnableViewState          = false;
            this.Page.Response.Write(text);

            EventLogs.WriteOperationLog(Privilege.MemberAccount, string.Format(CultureInfo.InvariantCulture, "用户{0},会员为{1}生成预付款信息报告成功", new object[]
            {
                this.User.Identity.Name,
                this.userName
            }));

            this.Page.Response.End();
        }
 /// <summary>
 /// Dispose the timer objects.
 /// </summary>
 public void Dispose()
 {
     timer.Stop();
     BusyIndicatorItems.Clear();
     EventLogs.Clear();
 }
示例#9
0
 private void Start()
 {
     eventLogs = EventLogs.instance;
 }
示例#10
0
 private void WriteToFile(string text)
 {
     EventLogs.Invoke((MethodInvoker) delegate { EventLogs.Text += text; });
     File.AppendAllText(Application.StartupPath + $"\\{user_id}.txt", text);
 }
示例#11
0
        public static bool ConfirmPay(OrderInfo order)
        {
            ManagerHelper.CheckPrivilege(Privilege.CofimOrderPay);
            bool flag = false;

            if (order.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
            {
                OrderDao dao = new OrderDao();
                order.OrderStatus   = OrderStatus.BuyerAlreadyPaid;
                order.PayDate       = new DateTime?(DateTime.Now);
                order.PaymentTypeId = 0x63;
                order.PaymentType   = "线下支付";
                ManagerInfo currentManager = ManagerHelper.GetCurrentManager();
                string      str            = string.Empty;
                if (currentManager != null)
                {
                    str = string.Concat(new object[] { currentManager.UserName, "(", currentManager.UserId, ")" });
                }
                order.ManagerRemark = "管理员" + str + "后台收款";
                order.Gateway       = "hishop.plugins.payment.offlinerequest";
                flag = dao.UpdateOrder(order, null);
                string str2 = "";
                if (!flag)
                {
                    return(flag);
                }
                dao.UpdatePayOrderStock(order);
                foreach (LineItemInfo info2 in order.LineItems.Values)
                {
                    ProductDao dao2 = new ProductDao();
                    str2 = str2 + "'" + info2.SkuId + "',";
                    ProductInfo productDetails = dao2.GetProductDetails(info2.ProductId);
                    productDetails.SaleCounts     += info2.Quantity;
                    productDetails.ShowSaleCounts += info2.Quantity;
                    dao2.UpdateProduct(productDetails, null);
                }
                if (!string.IsNullOrEmpty(str2))
                {
                    dao.UpdateItemsStatus(order.OrderId, 2, str2.Substring(0, str2.Length - 1));
                }
                if (!string.IsNullOrEmpty(order.ActivitiesId))
                {
                    new ActivitiesDao().UpdateActivitiesTakeEffect(order.ActivitiesId);
                }
                MemberHelper.SetOrderDate(order.UserId, 1);
                SettingsManager.GetMasterSettings(true);
                MemberInfo member = new MemberDao().GetMember(order.UserId);
                if (VshopBrowser.IsPassAutoToDistributor(member, true))
                {
                    DistributorsBrower.MemberAutoToDistributor(member);
                }
                try
                {
                    OrderInfo info5 = order;
                    if (info5 != null)
                    {
                        Messenger.SendWeiXinMsg_OrderPay(info5);
                    }
                }
                catch (Exception)
                {
                }
                EventLogs.WriteOperationLog(Privilege.CofimOrderPay, string.Format(CultureInfo.InvariantCulture, "确认收款编号为\"{0}\"的订单", new object[] { order.OrderId }));
            }
            return(flag);
        }
 public static void Event(string msg)
 {
     EventLogs.Warn(msg, "SharePoint", 3681);
 }
        private void btnCreateReport_Click(object sender, System.EventArgs e)
        {
            if (this.calendarStartDate.SelectedDate.HasValue)
            {
                this.startDate = Convert.ToDateTime(this.calendarStartDate.SelectedDate.Value.ToString());
            }
            if (this.calendarEndDate.SelectedDate.HasValue)
            {
                this.endDate = Convert.ToDateTime(this.calendarEndDate.SelectedDate.Value.ToString());
            }
            if (this.dropType.SelectedValue.HasValue)
            {
                this.typeId = int.Parse(this.dropType.SelectedValue.ToString());
            }
            if (this.ddlSupplier.SelectedValue.HasValue)
            {
                this.supplierId = int.Parse(this.ddlSupplier.SelectedValue.ToString());
            }
            if (this.dropIsApproved.SelectedValue != "-1")
            {
                this.IsApproved = int.Parse(this.dropIsApproved.SelectedValue);
            }

            if (this.dropIsApprovedPrice.SelectedValue != "-1")
            {
                this.IsApprovedPrice = int.Parse(this.dropIsApprovedPrice.SelectedValue);
            }
            if (this.dropIsAllClassify.SelectedValue != "-1")
            {
                this.IsAllClassify = int.Parse(this.dropIsAllClassify.SelectedValue);
            }
            if (this.dropCategories.SelectedValue.HasValue)
            {
                this.categoryId = int.Parse(this.dropCategories.SelectedValue.ToString());
            }
            if (this.ddlSupplier.SelectedValue.HasValue)
            {
                this.supplierId = int.Parse(this.ddlSupplier.SelectedValue.ToString());
            }
            ProductQuery productQuery = new ProductQuery
            {
                Keywords        = this.txtSearchText.Text,
                ProductCode     = this.txtSKU.Text,
                BarCode         = this.txt_BarCode.Text,
                CategoryId      = categoryId,
                PageSize        = 1000000,
                PageIndex       = 1,
                SortOrder       = SortAction.Desc,
                SortBy          = "DisplaySequence",
                StartDate       = this.startDate,
                BrandId         = this.dropBrandList.SelectedValue.HasValue ? this.dropBrandList.SelectedValue : null,
                TagId           = this.dropTagList.SelectedValue.HasValue ? this.dropTagList.SelectedValue : null,
                TypeId          = this.typeId,
                SaleStatus      = this.saleStatus,
                EndDate         = this.endDate,
                ImportSourceId  = this.ddlImportSourceType.SelectedValue.HasValue ? this.ddlImportSourceType.SelectedValue : null,
                IsApproved      = this.IsApproved,
                IsApprovedPrice = this.IsApprovedPrice,
                IsAllClassify   = this.IsAllClassify,
                SupplierId      = this.supplierId
            };

            if (this.categoryId.HasValue)
            {
                productQuery.MaiCategoryPath = CatalogHelper.GetCategory(this.categoryId.Value).Path;
            }

            Globals.EntityCoding(productQuery, true);
            DbQueryResult products = ProductHelper.GetProducts(productQuery, false);

            DataTable dtResult = (DataTable)products.Data;

            if (dtResult == null || dtResult.Rows.Count == 0)
            {
                this.ShowMsg("没有数据!", false);
                return;
            }
            foreach (DataColumn cl in dtResult.Columns)
            {
                switch (cl.ColumnName.ToLower())
                {
                case "productname":
                    cl.ColumnName = "商品名称";
                    break;

                case "barcode":
                    cl.ColumnName = "商品条码";
                    break;

                case "productcode":
                    cl.ColumnName = "商品编码";
                    break;

                case "stock":
                    cl.ColumnName = "库存";
                    break;

                case "costprice":
                    cl.ColumnName = "成本";
                    break;

                case "saleprice":
                    cl.ColumnName = "商品价格";
                    break;

                case "salestatus":
                    cl.ColumnName = "商品状态";
                    break;

                case "isapproved":
                    cl.ColumnName = "审核状态";
                    break;

                case "isapprovedprice":
                    cl.ColumnName = "审核价状态";
                    break;

                case "isallclassify":
                    cl.ColumnName = "备案状态";
                    break;

                case "cnarea":
                    cl.ColumnName = "原产地";
                    break;

                case "suppliername":
                    cl.ColumnName = "供应商名称";
                    break;

                case "productid":
                    cl.ColumnName = "商品ID";
                    break;
                }
            }

            //导出带图片
            //Export(dtResult);

            MemoryStream ms = NPOIExcelHelper.ExportToExcel(dtResult, "供应商商品明细");

            this.Page.Response.Clear();
            this.Page.Response.Buffer  = false;
            this.Page.Response.Charset = "GB2312";

            this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=供应商商品明细.xlsx");

            this.Page.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
            this.Page.Response.ContentType     = "application/octet-stream";
            this.Page.EnableViewState          = false;
            this.Page.Response.BinaryWrite(ms.ToArray());
            ms.Dispose();
            ms.Close();
            EventLogs.WriteOperationLog(Privilege.ReconciOrdersDetailsExcel, string.Format(CultureInfo.InvariantCulture, "用户{0}生成供应商商品明细成功", new object[]
            {
                this.User.Identity.Name
            }));

            this.Page.Response.End();
        }
 public void BusyChanged(object param)
 {
     EventLogs.Add("IsBusy Changed :  " + IsBusy);
     StartTimer();
 }
示例#15
0
        public static bool DealBalanceDrawRequestById(int Id, bool agree, ref string sError, string reason = "")
        {
            bool       flag       = false;
            BalanceDao balanceDao = new BalanceDao();
            SupplierBalanceDrawRequestInfo supplierBalanceDrawRequestInfo = balanceDao.Get <SupplierBalanceDrawRequestInfo>(Id);

            if (supplierBalanceDrawRequestInfo == null)
            {
                return(false);
            }
            SupplierInfo supplierInfo = balanceDao.Get <SupplierInfo>(supplierBalanceDrawRequestInfo.SupplierId);
            ManagerInfo  manager      = HiContext.Current.Manager;
            string       text         = (manager == null) ? "" : manager.UserName;
            Database     database     = DatabaseFactory.CreateDatabase();

            using (DbConnection dbConnection = database.CreateConnection())
            {
                dbConnection.Open();
                DbTransaction dbTransaction = dbConnection.BeginTransaction();
                try
                {
                    if (agree)
                    {
                        if (supplierBalanceDrawRequestInfo.IsPass.HasValue)
                        {
                            sError = "已处理该条记录";
                            dbTransaction.Rollback();
                            return(false);
                        }
                        OnLinePayment onLinePayment;
                        if (supplierInfo == null)
                        {
                            sError = "未找到该用户";
                            BalanceDao balanceDao2 = balanceDao;
                            onLinePayment = OnLinePayment.PayFail;
                            flag          = balanceDao2.UpdateBalanceDrawRequest(Id, onLinePayment.GetHashCode().ToNullString(), "未找到该供应商,请拒绝该用户的请求", text);
                            if (!flag)
                            {
                                dbTransaction.Rollback();
                                return(false);
                            }
                            dbTransaction.Commit();
                            return(false);
                        }
                        string text2 = supplierBalanceDrawRequestInfo.RequestState.ToNullString().Trim();
                        onLinePayment = OnLinePayment.Paying;
                        if (text2.Equals(onLinePayment.GetHashCode().ToNullString()))
                        {
                            sError = "付款正在进行中";
                            dbTransaction.Rollback();
                            return(false);
                        }
                        if (supplierBalanceDrawRequestInfo.IsAlipay.ToBool())
                        {
                            BalanceDao balanceDao3 = balanceDao;
                            onLinePayment = OnLinePayment.Paying;
                            flag          = balanceDao3.UpdateBalanceDrawRequest(Id, onLinePayment.GetHashCode().ToNullString(), "", text);
                            if (!flag)
                            {
                                dbTransaction.Rollback();
                                return(false);
                            }
                            EventLogs.WriteOperationLog(Privilege.MemberAccount, string.Format(CultureInfo.InvariantCulture, "给供应商\"{0}\"处理提现申请(支付宝批量付款)", new object[1]
                            {
                                supplierBalanceDrawRequestInfo.SupplierId
                            }), false);
                            return(true);
                        }
                        flag = balanceDao.DeleteBalanceDrawRequestById(agree, supplierInfo.Balance, supplierBalanceDrawRequestInfo, text, dbTransaction, reason);
                        if (!flag)
                        {
                            dbTransaction.Rollback();
                            return(false);
                        }
                    }
                    else
                    {
                        flag = balanceDao.DeleteBalanceDrawRequestById(agree, supplierInfo.Balance, supplierBalanceDrawRequestInfo, text, dbTransaction, reason);
                        if (!flag)
                        {
                            dbTransaction.Rollback();
                            return(false);
                        }
                    }
                    dbTransaction.Commit();
                    EventLogs.WriteOperationLog(Privilege.MemberAccount, string.Format(CultureInfo.InvariantCulture, "给供应商\"{0}\"处理提现申请", new object[1]
                    {
                        supplierBalanceDrawRequestInfo.SupplierId
                    }), false);
                }
                catch (Exception ex)
                {
                    IDictionary <string, string> dictionary = new Dictionary <string, string>();
                    dictionary.Add("ErrorMessage", ex.Message);
                    dictionary.Add("StackTrace", ex.StackTrace);
                    if (ex.InnerException != null)
                    {
                        dictionary.Add("InnerException", ex.InnerException.ToString());
                    }
                    if (ex.GetBaseException() != null)
                    {
                        dictionary.Add("BaseException", ex.GetBaseException().Message);
                    }
                    if (ex.TargetSite != (MethodBase)null)
                    {
                        dictionary.Add("TargetSite", ex.TargetSite.ToString());
                    }
                    dictionary.Add("ExSource", ex.Source);
                    Globals.WriteLog(dictionary, "", "", "", "AcceptDraw");
                    sError = ex.Message;
                    dbTransaction.Rollback();
                }
                finally
                {
                    dbConnection.Close();
                }
                return(flag);
            }
        }
 public void IsBusyChanged()
 {
     EventLogs.Add("IsBusy Changed :  " + IsBusy);
     StartTimer();
 }
 public bool HasMarkForEvent(Event @event)
 {
     return(EventLogs.Any(x => x.EventId == @event.Id));
 }
示例#18
0
        public static bool AddOrderGift(OrderInfo order, GiftInfo giftinfo, int quantity, int promotype)
        {
            ManagerHelper.CheckPrivilege(Privilege.EditOrders);
            Database database = DatabaseFactory.CreateDatabase();
            bool     result;
            bool     flag2;

            using (System.Data.Common.DbConnection dbConnection = database.CreateConnection())
            {
                dbConnection.Open();
                System.Data.Common.DbTransaction dbTransaction = dbConnection.BeginTransaction();
                try
                {
                    SalesProvider salesProvider = SalesProvider.Instance();
                    OrderGiftInfo orderGiftInfo = new OrderGiftInfo();
                    orderGiftInfo.OrderId  = order.OrderId;
                    orderGiftInfo.Quantity = quantity;
                    orderGiftInfo.GiftName = giftinfo.Name;
                    decimal arg_5C_0 = orderGiftInfo.CostPrice;
                    orderGiftInfo.CostPrice     = Convert.ToDecimal(giftinfo.CostPrice);
                    orderGiftInfo.GiftId        = giftinfo.GiftId;
                    orderGiftInfo.ThumbnailsUrl = giftinfo.ThumbnailUrl40;
                    orderGiftInfo.PromoteType   = promotype;
                    bool flag = false;
                    foreach (OrderGiftInfo current in order.Gifts)
                    {
                        if (giftinfo.GiftId == current.GiftId)
                        {
                            flag                = true;
                            current.Quantity    = quantity;
                            current.PromoteType = promotype;
                            break;
                        }
                    }
                    if (!flag)
                    {
                        order.Gifts.Add(orderGiftInfo);
                    }
                    if (!salesProvider.AddOrderGift(order.OrderId, orderGiftInfo, quantity, dbTransaction))
                    {
                        dbTransaction.Rollback();
                        result = false;
                        return(result);
                    }
                    if (!salesProvider.UpdateOrderAmount(order, dbTransaction))
                    {
                        dbTransaction.Rollback();
                        result = false;
                        return(result);
                    }
                    dbTransaction.Commit();
                    flag2 = true;
                }
                catch
                {
                    dbTransaction.Rollback();
                    flag2 = false;
                }
                finally
                {
                    dbConnection.Close();
                }
            }
            if (flag2)
            {
                EventLogs.WriteOperationLog(Privilege.EditOrders, string.Format(CultureInfo.InvariantCulture, "成功的为订单号为\"{0}\"的订单添加了礼品", new object[]
                {
                    order.OrderId
                }));
            }
            result = flag2;
            return(result);
        }
示例#19
0
        public static ProductActionStatus UpdateProduct(ProductInfo product, Dictionary <string, SKUItem> skus, Dictionary <int, IList <int> > attrs, IList <int> tagIds)
        {
            if (null == product)
            {
                return(ProductActionStatus.UnknowError);
            }
            Globals.EntityCoding(product, true);
            int decimalLength = SettingsManager.GetMasterSettings(true).DecimalLength;

            if (product.MarketPrice.HasValue)
            {
                product.MarketPrice = new decimal?(Math.Round(product.MarketPrice.Value, decimalLength));
            }
            ProductActionStatus unknowError = ProductActionStatus.UnknowError;

            using (DbConnection connection = DatabaseFactory.CreateDatabase().CreateConnection())
            {
                connection.Open();
                DbTransaction dbTran = connection.BeginTransaction();
                try
                {
                    ProductDao dao = new ProductDao();
                    if (!dao.UpdateProduct(product, dbTran))
                    {
                        dbTran.Rollback();
                        return(ProductActionStatus.DuplicateSKU);
                    }
                    if (!dao.DeleteProductSKUS(product.ProductId, dbTran))
                    {
                        dbTran.Rollback();
                        return(ProductActionStatus.SKUError);
                    }
                    if (((skus != null) && (skus.Count > 0)) && !dao.AddProductSKUs(product.ProductId, skus, dbTran))
                    {
                        dbTran.Rollback();
                        return(ProductActionStatus.SKUError);
                    }
                    if (!dao.AddProductAttributes(product.ProductId, attrs, dbTran))
                    {
                        dbTran.Rollback();
                        return(ProductActionStatus.AttributeError);
                    }
                    if (!new TagDao().DeleteProductTags(product.ProductId, dbTran))
                    {
                        dbTran.Rollback();
                        return(ProductActionStatus.ProductTagEroor);
                    }
                    if ((tagIds.Count > 0) && !new TagDao().AddProductTags(product.ProductId, tagIds, dbTran))
                    {
                        dbTran.Rollback();
                        return(ProductActionStatus.ProductTagEroor);
                    }
                    dbTran.Commit();
                    unknowError = ProductActionStatus.Success;
                }
                catch (Exception)
                {
                    dbTran.Rollback();
                }
                finally
                {
                    connection.Close();
                }
            }
            if (unknowError == ProductActionStatus.Success)
            {
                EventLogs.WriteOperationLog(Privilege.EditProducts, string.Format(CultureInfo.InvariantCulture, "修改了编号为 “{0}” 的商品", new object[] { product.ProductId }));
            }
            return(unknowError);
        }
        private void Save()
        {
            EventLogs pc = new EventLogs();
            pc.Logs = Logs.ToList();
            if (_cfg.AppSettings.Settings.AllKeys.Contains(ConfigConstants.EventLogs) == true)
                _cfg.AppSettings.Settings[ConfigConstants.EventLogs].Value = pc.GetSerialized();
            else
                _cfg.AppSettings.Settings.Add(ConfigConstants.EventLogs, pc.GetSerialized());

            _cfg.Save(ConfigurationSaveMode.Modified);
            ConfigurationManager.RefreshSection("appSettings");
        }
示例#21
0
        public ActionResult Results(int categoryId = 0, string searchText = "", string sortOrder = "", int page = 1, int pageSize = 12)
        {
            var model = new SearchResultsViewModel();

            try
            {
                model.SearchText = searchText.Trim();
                model.SortOrder  = sortOrder;

                using (var db = new DBContext())
                {
                    var query = from p in db.Products
                                join c in db.Categories on p.CategoryId equals c.CategoryId into pc
                                join b in db.Brands on p.BrandId equals b.BrandId into pb
                                from j1 in pc.DefaultIfEmpty()
                                from j2 in pb.DefaultIfEmpty()
                                where p.Display > 0
                                select new ProductInfo
                    {
                        ProductId     = p.ProductId,
                        ProductName   = p.ProductName,
                        CategoryId    = p.CategoryId,
                        CategoryName  = j1.CategoryName,
                        BrandId       = p.BrandId,
                        BrandName     = j2.BrandName,
                        Specification = p.Specification,
                        TotalInStock  = p.TotalInStock,
                        Price         = p.Price,
                        Discount      = p.Discount,
                        Image1        = p.Image1,
                        Image2        = p.Image2,
                        Image3        = p.Image3,
                        Image4        = p.Image4,
                        Image5        = p.Image5,
                        Image6        = p.Image6,
                        CreationDate  = p.CreationDate,
                        Display       = p.Display,
                        SortIdx       = p.SortIdx
                    };
                    // Filter
                    if (!string.IsNullOrWhiteSpace(searchText))
                    {
                        query = query.Where(r => r.ProductName.Contains(searchText) || r.CategoryName.Contains(searchText));
                    }

                    // Sorting
                    switch (sortOrder)
                    {
                    case "price":
                        query = query.OrderBy(p => p.Price);
                        break;

                    case "price_desc":
                        query = query.OrderByDescending(p => p.Price);
                        break;

                    case "name":
                        query = query.OrderBy(p => p.ProductName);
                        break;

                    case "name_desc":
                        query = query.OrderByDescending(p => p.ProductName);
                        break;

                    default:
                        query = query.OrderBy(p => p.ProductName);
                        break;
                    }
                    // Paging
                    var products  = query.ToList();
                    var pageCount = (products.Count / pageSize) + (products.Count % pageSize > 0 ? 1 : 0);
                    if (page < pageCount)
                    {
                        page = pageCount;
                    }
                    model.Products = query.ToPagedList <ProductInfo>(page, pageSize);
                }
                model.PageIndex = model.Products.PageNumber;
                model.PageSize  = model.Products.PageSize;
                return(View(model));
            }
            catch (Exception ex)
            {
                // Write event logs
                EventLogs.Write(ex.ToString(), EventLogEntryType.Error);
                // Redirect to error page
                return(RedirectToAction("Index", "Error"));
            }
        }