コード例 #1
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);
        }
コード例 #2
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);
        }
コード例 #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public GoodsNoModel GetShowModel(string Goo_code, bool is_GyNo)
        {
            GoodsNoDAL   DAL   = new GoodsNoDAL();
            GoodsNoModel model = DAL.GetEditModel(Goo_code, is_GyNo);

            if (null == model)
            {
                return(null);
            }

            model.Goo_image  = Goo_Type_Memo.GetPic(model.Goo_type, model.Goo_mate, model.Goo_image);
            model.Goo_image2 = Goo_Type_Memo.GetPic(model.Goo_type, model.Goo_mate, model.Goo_image2);
            model.Goo_image3 = Goo_Type_Memo.GetPic(model.Goo_type, model.Goo_mate, model.Goo_image3);

            model.Webmemo = Goo_Type_Memo.GetMemo(model.Goo_type, model.Goo_mate, model.Webmemo);

            return(model);
        }
コード例 #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public int Update(GoodsNoModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update GoodsNo set ");
            strSql.Append("goo_no=@goo_no,");
            strSql.Append("goo_name=@goo_name,");
            strSql.Append("Webtype=@Webtype,");
            strSql.Append("webimageBath=@webimageBath,");
            strSql.Append("webimageBath2=@webimageBath2,");
            strSql.Append("webimageBath3=@webimageBath3,");
            strSql.Append("spec=@spec,");
            strSql.Append("Webmemo=@Webmemo,");
            strSql.Append("WebIntegral=@WebIntegral,");
            strSql.Append("Content=@Content,");
            strSql.Append("Specnum=@Specnum,");
            strSql.Append("Getdetail_Memo=@Getdetail_Memo,");
            strSql.Append("isWeb=@isWeb");
            strSql.Append(" where goo_code=@goo_code ");
            GysoftParameter[] parameters =
            {
                new GysoftParameter("@goo_no",         model.Goo_no),
                new GysoftParameter("@goo_name",       model.Goo_name),
                new GysoftParameter("@Webtype",        model.Goo_Category),
                new GysoftParameter("@webimageBath",   model.Goo_image),
                new GysoftParameter("@webimageBath2",  model.Goo_image2),
                new GysoftParameter("@webimageBath3",  model.Goo_image3),
                new GysoftParameter("@spec",           model.Goo_spec),
                new GysoftParameter("@Webmemo",        model.Webmemo),
                new GysoftParameter("@goo_code",       model.Goo_code),
                new GysoftParameter("@WebIntegral",    model.WebIntegral),
                new GysoftParameter("@Content",        model.Content),
                new GysoftParameter("@Specnum",        model.Specnum),
                new GysoftParameter("@Getdetail_Memo", model.Getdetail_Memo),
                new GysoftParameter("@isWeb",          model.IsWeb)
            };

            return(SqlHelper.ExecuteNonQuery(strSql.ToString(), parameters));
        }
コード例 #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public GoodsNoModel GetEditModel(string Goo_code, bool is_GyNo)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select top 1 ");
            strSql.Append("goo_no,goo_name,goo_code,goo_type,goo_mate,Webtype,webimageBath,webimageBath2,webimageBath3,spec,");
            strSql.Append("Webmemo,WebIntegral,Content,isnull(Specnum,0) as Specnum,Getdetail_Memo,");
            strSql.Append("isnull(isweb,'" + WebSet.GetMySetGoodsIsWeb() + "') as isweb");
            strSql.Append(" from GoodsNo where isnull(visible,'Y')='Y' ");
            if (is_GyNo)
            {
                strSql.Append(" and GyNo = @goo_code ");
            }
            else
            {
                strSql.Append(" and goo_code = @goo_code ");
            }

            string ls_typeid = UserInfo.GetCussaleItem();

            if (ls_typeid != "")
            {
                strSql.Append(" and goo_type in (" + ls_typeid + ") ");
            }
            GysoftParameter[] parameters =
            {
                new GysoftParameter("@goo_code", Goo_code)
            };

            GoodsNoModel model = new GoodsNoModel();
            DataTable    dt    = SqlHelper.ExecuteDataTable(CommandType.Text, strSql.ToString(), parameters);

            if (dt.Rows.Count == 0)
            {
                return(null);
            }
            model.Goo_no       = dt.Rows[0]["goo_no"].ToString().Trim();
            model.Goo_name     = dt.Rows[0]["goo_name"].ToString().Trim();
            model.Goo_code     = dt.Rows[0]["goo_code"].ToString().Trim();
            model.Goo_type     = dt.Rows[0]["Goo_type"].ToString().Trim();
            model.Goo_mate     = dt.Rows[0]["goo_mate"].ToString().Trim();
            model.Goo_Category = dt.Rows[0]["Webtype"].ToString().Trim();

            model.Goo_image  = dt.Rows[0]["webimageBath"].ToString();
            model.Goo_image2 = dt.Rows[0]["webimageBath2"].ToString();
            model.Goo_image3 = dt.Rows[0]["webimageBath3"].ToString();

            model.Goo_spec = dt.Rows[0]["spec"].ToString().Trim();

            model.Webmemo = dt.Rows[0]["Webmemo"].ToString().Trim();

            if (dt.Rows[0]["WebIntegral"].ToString() != "")
            {
                model.WebIntegral = Convert.ToInt32(dt.Rows[0]["WebIntegral"]);
            }
            else
            {
                model.WebIntegral = 0;
            }
            model.Content = dt.Rows[0]["Content"].ToString().Trim();
            if (dt.Rows[0]["Specnum"].ToString().Trim() != "")
            {
                model.Specnum = Convert.ToDecimal(dt.Rows[0]["Specnum"]);
            }
            model.Getdetail_Memo = dt.Rows[0]["Getdetail_Memo"].ToString().Trim();

            model.IsWeb = dt.Rows[0]["isweb"].ToString().Trim();


            return(model);
        }
コード例 #6
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 == "&nbsp;")
                {
                    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());
        }