Ejemplo n.º 1
0
    public void DataBind(int id)
    {
        Cms.Model.C_product model = new Cms.BLL.C_product().GetModel(id);
        this.parentId.SelectedValue = model.typeId.ToString();   //所属栏目、分类ID
        #region 基本信息
        this.isHidden.SelectedValue = model.isHidden.ToString(); //显示状态
        if (model.isTop.ToString() == "1")
        {
            cblItem.Items[0].Selected = true; //1 置顶
        }
        if (model.isRecommend.ToString() == "1")
        {
            cblItem.Items[1].Selected = true; //1 推荐
        }
        if (model.isHot.ToString() == "1")
        {
            cblItem.Items[2].Selected = true; //1 属于热门
        }
        if (model.isActive.ToString() == "1")
        {
            cblItem.Items[3].Selected = true;                                                    //1 属于评论
        }
        this.Title.Text           = model.name.ToString();                                       //标题
        this.photoUrl.Text        = model.litpic.ToString();                                     //缩略图
        this.photoUrlImg.ImageUrl = model.litpic.ToString();
        this.orderNumber.Text     = model.sortId.ToString();                                     //排序
        this.hits.Text            = model.views.ToString();                                      //浏览次数
        this.updateTime.Text      = string.Format("{0:yyyy-MM-dd HH:mm:ss}", model.createdTime); //添加时间
        this.intro.Text           = model.intro.ToString();                                      //简介
        this.content.Value        = model.content.ToString();                                    //内容
        this.seoTitle.Text        = model.seoTitle.ToString();                                   //SEO标题
        this.seoKeyword.Text      = model.seoKeyword.ToString();                                 //SEO关健字
        this.seoDescription.Text  = model.seoDescription.ToString();                             //SEO描述
        this.sales.Text           = model.sales.ToString();
        price.Text           = Convert.ToDecimal(model.price).ToString("0.00");
        marketPrice.Text     = Convert.ToDecimal(model.marketPrice).ToString("0.00");
        integral.Text        = model.integral.ToString();
        stock.Text           = model.stock.ToString();
        unit.Text            = model.unit.ToString();
        manufactureDate.Text = model.manufactureDate.ToString();
        factoryName.Text     = model.factoryName.ToString();
        factoryAddress.Text  = model.factoryAddress.ToString();
        ingredients.Text     = model.ingredients.ToString();


        #endregion
        #region 相册==============================
        //不是相册图片就绑定
        string filename = model.litpic.Substring(model.litpic.LastIndexOf("/") + 1);
        //绑定图片相册
        hidFocusPhoto.Value = model.litpic; //封面图片
        List <Cms.Model.c_product_albums> list = new List <Cms.Model.c_product_albums>();
        list = new Cms.BLL.c_product_albums().DataTableToList(Cms.DBUtility.DbHelperSQL.Query("select * from c_product_albums where productId=" + id).Tables[0]);
        rptAlbumList.DataSource = list;
        rptAlbumList.DataBind();
        #endregion
    }
Ejemplo n.º 2
0
    public void rptList2_Bind(int strparentId)
    {
        DataSet ds = new Cms.BLL.C_product().GetList("");

        if (ds.Tables[0].Rows.Count > 0)
        {
            this.rptList1.DataSource = ds;
            this.rptList1.DataBind();
        }
    }
Ejemplo n.º 3
0
    public static void RepeaterProduct(int top, string where, Repeater rep)
    {
        DataSet ds = new Cms.BLL.C_product().GetList(top, where + " ishidden=0", "sortId asc");

        if (ds != null && ds.Tables[0].Rows.Count > 0)
        {
            rep.DataSource = ds.Tables[0].DefaultView;
            rep.DataBind();
        }
    }
Ejemplo n.º 4
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        Repeater rptList = new Repeater();

        rptList = this.rptList1;
        foreach (RepeaterItem item in rptList.Items)
        {
            //获取选择框
            CheckBox check = item.FindControl("Check_Select") as CheckBox;
            if (check.Checked)
            {
                HiddenField field = item.FindControl("Fielddocid") as HiddenField;
                int         id    = int.Parse(field.Value);
                //删除文档的同时删除静态文档
                string title = new Cms.BLL.C_product().GetModel(id).name.ToString();
                new Cms.BLL.C_product().Delete(id);
                adminUser.AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除:产品信息" + title); //记录日志
            }
        }
        JscriptMsg("删除信息成功!", "list.aspx", "Success");
    }
Ejemplo n.º 5
0
    public override void ProcessNotify()
    {
        WxPayData notifyData = GetNotifyData();

        setlog("transaction_id", notifyData.GetValue("transaction_id").ToString());
        //检查支付结果中transaction_id是否存在
        if (!notifyData.IsSet("transaction_id"))
        {
            setlog("transaction_id", "不存在");
            //若transaction_id不存在,则立即返回结果给微信支付后台
            WxPayData res = new WxPayData();
            res.SetValue("return_code", "FAIL");
            res.SetValue("return_msg", "支付结果中微信订单号不存在");
            Log.Error(this.GetType().ToString(), "The Pay result is error : " + res.ToXml());
            page.Response.Write(res.ToXml());
            page.Response.End();
        }
        else
        {
            #region 支付成功后处理订单信息=============================================================
            setlog("transaction_id", "存在");
            Cms.BLL.C_order otBll = new Cms.BLL.C_order();

            setlog("orderid", notifyData.GetValue("out_trade_no").ToString());
            DataTable DT = otBll.GetList("order_num='" + notifyData.GetValue("out_trade_no").ToString() + "'").Tables[0];
            if (DT != null && DT.Rows.Count > 0)//购物
            {
                int orderId = Convert.ToInt32(DT.Rows[0]["id"].ToString());
                Cms.Model.C_order ordertmp = otBll.GetModel(orderId);
                ordertmp.trade_no = notifyData.GetValue("transaction_id").ToString();
                //ordertmp.notify_id = notifyData.GetValue("notify_id").ToString();
                //ordertmp.pay_info = notifyData.GetValue("pay_info").ToString();
                //orderEntity.price_sum = total_fee;
                ordertmp.payment_time   = DateTime.Now;
                ordertmp.is_transaction = 0;
                ordertmp.order_status   = 0;
                ordertmp.is_payment     = 1;
                #region 修改积分============================
                //setlog("修改积分", notifyData.GetValue("out_trade_no").ToString());
                //Cms.BLL.C_user user_bll = new Cms.BLL.C_user();
                //Cms.Model.C_user user_model = new Cms.BLL.C_user().GetModel(Convert.ToInt32(ordertmp.user_id));
                //user_model.userallscore = user_model.userallscore + ordertmp.integral_sum;
                //user_model.userscore = user_model.userscore + ordertmp.integral_sum;
                //user_bll.Update(user_model);

                //Cms.BLL.C_integral_rec integral_BLL = new Cms.BLL.C_integral_rec();
                //Cms.Model.C_integral_rec integral_model = new Cms.Model.C_integral_rec();
                //DataTable dt = new Cms.BLL.C_ordersub().GetList("order_id=" + ordertmp.id).Tables[0];
                //if (dt != null && dt.Rows.Count > 0)
                //{
                //    for (int i = 0; i < dt.Rows.Count; i++)
                //    {
                //        integral_model.article_id = Convert.ToInt32(dt.Rows[i]["article_id"].ToString());
                //        integral_model.user_id = Convert.ToInt32(dt.Rows[i]["user_id"].ToString());
                //        integral_model.usercard = user_model.usercard;
                //        integral_model.openid = user_model.openid;
                //        integral_model.numberid = dt.Rows[i]["id"].ToString();
                //        integral_model.scorename = "购买产品";
                //        integral_model.title = dt.Rows[i]["title"].ToString();
                //        integral_model.wescore = Convert.ToInt32(dt.Rows[i]["integral"].ToString() == "" ? "0" : dt.Rows[i]["integral"].ToString()) * Convert.ToInt32(dt.Rows[i]["quantity"].ToString());
                //        integral_model.quantity = Convert.ToInt32(dt.Rows[i]["quantity"].ToString());
                //        integral_model.type = 0;
                //        integral_model.updateTime = DateTime.Now;
                //        integral_BLL.Add(integral_model);
                //        try
                //        {
                //            wxuser.UserSale wu = new wxuser.UserSale();//积分修改同步到ERP
                //            wu = wxuser.getUserScore(user_model.usercard, user_model.openid, dt.Rows[i]["id"].ToString(), "购买产品", "+" + integral_model.wescore);
                //        }
                //        catch (Exception ex)
                //        {
                //            page.Response.Write(ex.Message);
                //            page.Response.End();
                //        }
                //    }
                //}
                #endregion
                #region 减库存加销量============================



                DataTable dt = new Cms.BLL.C_ordersub().GetList("order_id=" + ordertmp.id).Tables[0];
                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        try
                        {
                            int productId = Convert.ToInt32(dt.Rows[i]["article_id"].ToString());
                            int quantity  = Convert.ToInt32(dt.Rows[i]["quantity"].ToString());
                            Cms.Model.C_product product = new Cms.BLL.C_product().GetModel(productId);
                            if (product.stock - quantity > 0)
                            {
                                product.stock = product.stock - quantity;
                                product.sales = product.sales + quantity;
                                new Cms.BLL.C_product().Update(product);
                            }
                        }
                        catch (Exception ex)
                        {
                            page.Response.Write(ex.Message);
                            page.Response.End();
                        }
                    }
                }
                #endregion
                Cms.BLL.wx_log   logBll     = new Cms.BLL.wx_log();
                Cms.Model.wx_log logModel   = new Cms.Model.wx_log();
                string           payTmpType = "【微支付】";
                string           funName    = payTmpType + "【微支付】 订单付款成功,处理订单" + " ProcessPaySuccess_wx ";
                bool             ret        = otBll.Update(ordertmp);//修改主表订单信息
                if (!ret)
                {
                    logModel.modelName   = payTmpType;
                    logModel.funName     = funName;
                    logModel.logsContent = "订单号【" + notifyData.GetValue("out_trade_no").ToString() + "】支付成功后处理数据失败";
                    logModel.logsType    = 0;
                    logBll.Add(logModel);
                }
                logModel.modelName   = payTmpType;
                logModel.funName     = funName;
                logModel.logsContent = "订单号【" + notifyData.GetValue("out_trade_no").ToString() + "】支付成功后,处理数据成功";
                logModel.logsType    = 1;
                logBll.Add(logModel);
            }
            else//充值
            {
                DataTable dtRecharge = new Cms.BLL.C_user_recharge().GetList("orderNumber='" + notifyData.GetValue("out_trade_no").ToString() + "'").Tables[0];
                if (dtRecharge != null && dtRecharge.Rows.Count > 0)
                {
                    int orderId = Convert.ToInt32(dtRecharge.Rows[0]["id"].ToString());
                    Cms.Model.C_user_recharge orderRecharge = new Cms.BLL.C_user_recharge().GetModel(orderId);
                    orderRecharge.isPay = 1;

                    Cms.Model.C_user user = new Cms.BLL.C_user().GetModel(Convert.ToInt32(orderRecharge.userId));
                    user.userMoney = user.userMoney + orderRecharge.price;
                    new Cms.BLL.C_user().Update(user);

                    Cms.BLL.wx_log   logBll     = new Cms.BLL.wx_log();
                    Cms.Model.wx_log logModel   = new Cms.Model.wx_log();
                    string           payTmpType = "【微支付】";
                    string           funName    = payTmpType + "【微支付】 订单付款成功,处理订单" + " ProcessPaySuccess_wx ";
                    bool             ret        = new Cms.BLL.C_user_recharge().Update(orderRecharge);//修改订单信息
                    if (!ret)
                    {
                        logModel.modelName   = payTmpType;
                        logModel.funName     = funName;
                        logModel.logsContent = "订单号【" + notifyData.GetValue("out_trade_no").ToString() + "】支付成功后处理数据失败";
                        logModel.logsType    = 0;
                        logBll.Add(logModel);
                    }
                    else
                    {
                        logModel.modelName   = payTmpType;
                        logModel.funName     = funName;
                        logModel.logsContent = "订单号【" + notifyData.GetValue("out_trade_no").ToString() + "】支付成功后,处理数据成功";
                        logModel.logsType    = 1;
                        logBll.Add(logModel);
                    }
                }
            }

            #endregion
        }

        string transaction_id = notifyData.GetValue("transaction_id").ToString();
        //查询订单,判断订单真实性
        if (!QueryOrder(transaction_id))
        {
            setlog("return_code", "FAIL");
            //若订单查询失败,则立即返回结果给微信支付后台
            WxPayData res = new WxPayData();
            res.SetValue("return_code", "FAIL");
            res.SetValue("return_msg", "订单查询失败");
            Log.Error(this.GetType().ToString(), "Order query failure : " + res.ToXml());
            page.Response.Write(res.ToXml());
            page.Response.End();
        }
        //查询订单成功
        else
        {
            setlog("return_code", "SUCCESS");
            WxPayData res = new WxPayData();
            res.SetValue("return_code", "SUCCESS");
            res.SetValue("return_msg", "OK");
            Log.Info(this.GetType().ToString(), "order query success : " + res.ToXml());
            page.Response.Write(res.ToXml());
            page.Response.End();
            setlog("SUCCESS", res.ToXml());
        }
    }
Ejemplo n.º 6
0
 public void DataUpdate(int id)
 {
     Cms.Model.C_product model = new Cms.BLL.C_product().GetModel(id);
     #region 基本信息
     model.id          = id;
     model.typeId      = Convert.ToInt32(this.parentId.SelectedValue); //所属栏目、分类ID
     model.isHidden    = Convert.ToInt32(this.isHidden.SelectedValue); //显示状态
     model.isTop       = 0;                                            //0 不置顶
     model.isRecommend = 0;                                            //0 不推荐
     model.isHot       = 0;                                            //不属于热门
     model.isActive    = 0;
     if (cblItem.Items[0].Selected == true)
     {
         model.isTop = 1;//1 置顶
     }
     if (cblItem.Items[1].Selected == true)
     {
         model.isRecommend = 1;//1 推荐
     }
     if (cblItem.Items[2].Selected == true)
     {
         model.isHot = 1;//1 属于热门
     }
     if (cblItem.Items[3].Selected == true)
     {
         model.isActive = 1;              //1 属于评论
     }
     model.name = this.Title.Text.Trim(); //标题
     if (this.photoUrl.Text == "")
     {
         model.litpic = "/img/noPic.jpg";
     }
     else
     {
         model.litpic = this.photoUrl.Text;                                 //缩略图
     }
     model.sortId          = Convert.ToInt32(this.orderNumber.Text.Trim()); //排序
     model.views           = Convert.ToInt32(this.hits.Text.Trim());        //浏览次数
     model.createdTime     = Utils.StrToDateTime(updateTime.Text.Trim());   //添加时间
     model.intro           = this.intro.Text;                               //简介
     model.content         = this.content.Value;                            //内容
     model.seoTitle        = this.seoTitle.Text.Trim();                     //SEO标题
     model.seoKeyword      = this.seoKeyword.Text.Trim();                   //SEO关健字
     model.seoDescription  = this.seoDescription.Text.Trim();               //SEO描述
     model.sales           = Convert.ToInt32(sales.Text.Trim());
     model.price           = Convert.ToDecimal(price.Text.Trim());
     model.marketPrice     = Convert.ToDecimal(marketPrice.Text.Trim());
     model.integral        = Convert.ToInt32(integral.Text);
     model.stock           = Convert.ToInt32(stock.Text);
     model.unit            = unit.Text;
     model.sVersion        = Convert.ToInt32(0);
     model.manufactureDate = manufactureDate.Text;
     model.factoryName     = factoryName.Text;
     model.factoryAddress  = factoryAddress.Text;
     model.ingredients     = ingredients.Text;
     #endregion
     if (new Cms.BLL.C_product().Update(model))
     {
         adminUser.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), model.name); //记录日志
         #region 保存相册====================
         int cout = Cms.DBUtility.DbHelperSQL.ExecuteSql("delete from c_product_albums where productId=" + model.id);
         //检查是否有自定义图片
         if (photoUrl.Text.Trim() == "")
         {
             model.litpic = hidFocusPhoto.Value;
         }
         string[] albumArr  = Request.Form.GetValues("hid_photo_name");
         string[] remarkArr = Request.Form.GetValues("hid_photo_remark");
         if (albumArr != null && albumArr.Length > 0)
         {
             List <Cms.Model.c_product_albums> ls          = new List <Cms.Model.c_product_albums>();
             Cms.Model.c_product_albums        modelAlbums = new Cms.Model.c_product_albums();
             for (int i = 0; i < albumArr.Length; i++)
             {
                 string[] imgArr = albumArr[i].Split('|');
                 if (imgArr.Length == 3)
                 {
                     modelAlbums.original_path = imgArr[1];
                     modelAlbums.thumb_path    = imgArr[2];
                     if (!string.IsNullOrEmpty(remarkArr[i]))
                     {
                         modelAlbums.remark = remarkArr[i];
                     }
                     else
                     {
                     }
                     modelAlbums.productId = model.id;
                 }
                 new Cms.BLL.c_product_albums().Add(modelAlbums);
             }
         }
         #endregion
         JscriptMsg("修改信息成功!", "list.aspx", "Success");
     }
     else
     {
         JscriptMsg("修改信息失败!", "edit.aspx?action=edit", "Error");
     }
 }
Ejemplo n.º 7
0
    protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("Fielddocid")).Value);

        Cms.Model.C_product model = new Cms.BLL.C_product().GetModel(id);
        LinkButton          lb    = (LinkButton)e.Item.FindControl("lbedit");

        switch (e.CommandName)
        {
        case "lbtnIsMsg":
            if (model.isActive == 1)
            {
                this.updateSate(id, "isActive=0");
            }
            else
            {
                this.updateSate(id, "isActive=1");
            }
            break;

        case "lbtnIsTop":
            if (model.isTop == 1)
            {
                this.updateSate(id, "isTop=0");
            }
            else
            {
                this.updateSate(id, "isTop=1");
            }
            break;

        case "lbtnIsRed":
            if (model.isRecommend == 1)
            {
                this.updateSate(id, "isRecommend=0");
            }
            else
            {
                this.updateSate(id, "isRecommend=1");
            }
            break;

        case "lbtnIsHot":
            if (model.isHot == 1)
            {
                this.updateSate(id, "isHot=0");
            }
            else
            {
                this.updateSate(id, "isHot=1");
            }
            break;

        case "lbtnIsSlide":
            if (model.isHidden == 1)
            {
                this.updateSate(id, "isHidden=0");
            }
            else
            {
                this.updateSate(id, "isHidden=1");
            }
            break;
        }
    }