예제 #1
0
        public static string GetPic(string Goo_Code, string as_Pic)
        {
            if (as_Pic.Trim() != "")
            {
                return(as_Pic);
            }
            GoodsNoModel Mode = new GoodsNoModel();
            GoodsNoDAL   DAL  = new GoodsNoDAL();

            Mode = DAL.GetShowModel(Goo_Code);
            if (Mode == null)
            {
                return("");
            }
            return(Mode.Goo_image);
        }
예제 #2
0
        public static string GetMemo(string Goo_Code, string as_Memo)
        {
            if (as_Memo.Trim() != "")
            {
                return(as_Memo);
            }
            GoodsNoModel Mode = new GoodsNoModel();
            GoodsNoDAL   DAL  = new GoodsNoDAL();

            Mode = DAL.GetShowModel(Goo_Code);
            if (Mode == null)
            {
                return("");
            }
            return(Mode.Webmemo);
        }
예제 #3
0
        protected void IBtn_Save_Click(object sender, ImageClickEventArgs e)
        {
            Hashtable Hash = Shoping.GetHash();

            if (Hash.Count == 0)
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('你的购物车内没有商品!');", true);
                return;
            }
            GoodsNoDAL DAL = new GoodsNoDAL();

            //创建DataTable
            DataTable ldt_GoodsNo = new DataTable();

            ldt_GoodsNo.Columns.Add("GoodCode");
            ldt_GoodsNo.Columns.Add("GooNo");
            ldt_GoodsNo.Columns.Add("Num");
            ldt_GoodsNo.Columns.Add("GooType");
            ldt_GoodsNo.Columns.Add("GooMate");
            ldt_GoodsNo.Columns.Add("Getdetail_Memo");
            ldt_GoodsNo.Columns.Add("Goo_price");

            #region 先转换成DataTable
            foreach (string id in Hash.Keys)
            {
                string ls_Goodcode = id;
                if (ls_Goodcode.Trim().Length == 0 || ls_Goodcode == " ")
                {
                    continue;
                }

                string  ls_num = Hash[id].ToString();
                Decimal ld_Num;
                try
                {
                    ld_Num = Convert.ToDecimal(ls_num);
                    if (ld_Num <= 0)
                    {
                        continue;
                    }
                }
                catch
                { continue; }

                GoodsNoModel Mode = DAL.GetShowModel(id);
                DataRow      Dr   = ldt_GoodsNo.NewRow();
                Dr["GoodCode"]       = Mode.Goo_code;
                Dr["GooNo"]          = Mode.Goo_no;
                Dr["Num"]            = ld_Num;
                Dr["GooType"]        = Mode.Goo_type;
                Dr["GooMate"]        = Mode.Goo_mate;
                Dr["Getdetail_Memo"] = Mode.Getdetail_Memo;
                Dr["Goo_price"]      = Mode.Goo_price;
                if (Mode.Goo_price == "")
                {
                    Log.WriteTextLog("Dw_OrderSave_Err", "Log", "GoodCode=" + Mode.Goo_code + " Getdetail_Memo=" + Mode.Getdetail_Memo, 3);
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "",
                                                           "alert('获取价格失败!订单无法保存');", true);//select  * from dbo.uf_getcussaleprice('GD198','600001','2015-10-10','正常')
                    return;
                }
                ldt_GoodsNo.Rows.Add(Dr);
            }
            ldt_GoodsNo.DefaultView.Sort = "GooType,GooNo";
            #endregion

            #region 提取分单数据
            DataTable ldt_Extract   = new DataTable();
            string    ls_Extract_ID = publicfuns.of_GetMySysSet("网上商城", "分单");
            if (ls_Extract_ID != "")
            {
                ldt_Extract.Columns.Add("GoodCode");
                ldt_Extract.Columns.Add("GooNo");
                ldt_Extract.Columns.Add("Num");
                ldt_Extract.Columns.Add("GooType");
                ldt_Extract.Columns.Add("GooMate");
                ldt_Extract.Columns.Add("Getdetail_Memo");
                ldt_Extract.Columns.Add("Goo_price");

                for (int li_Rows = 0; li_Rows < ldt_GoodsNo.Rows.Count; li_Rows++)
                {
                    if (ldt_GoodsNo.Rows[li_Rows]["GooMate"].ToString().Trim() == ls_Extract_ID.Trim())
                    {
                        ldt_Extract.Rows.Add(ldt_GoodsNo.Rows[li_Rows].ItemArray);
                        ldt_GoodsNo.Rows[li_Rows].Delete();
                    }
                }

                ldt_Extract.DefaultView.Sort = "GooType,GooNo";
            }
            #endregion

            if (ldt_GoodsNo.Rows.Count > 0)
            {
                of_OrderSave(ldt_GoodsNo.DefaultView.ToTable());
            }
            if (ldt_Extract.Rows.Count > 0)
            {
                of_OrderSave(ldt_Extract.DefaultView.ToTable());
            }
            Shoping.Clear();
            ClientScript.RegisterClientScriptBlock(this.GetType(), "",
                                                   "alert('保存成功,谢谢你的订单!');location.href='Dw_OrderCar.aspx?UserKey=" + UserInfo.GetUserKey() + "&userweixinid=" + SysVisitor.Current.UserWeixinID + "'", true);



            //IBtn_Save2.Enabled = false;
            //Response.Redirect("Dw_OrderCar.aspx?UserKey=" + UserInfo.GetUserKey());
        }