Пример #1
0
    /// <summary>
    /// 获取价格
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public string GetProPrice(string values, string goodsId)
    {
        string str = "暂无价格";

        DataTable dt = Session["price"] as DataTable;

        string values2 = Common.NoHTML(values);

        if (dt.Rows.Count != 0)
        {
            if (dt.Select("isnull(valueinfo,'')='" + values2 + "'").Length != 0)
            {
                if (dt.Select("isnull(valueinfo,'')='" + values2 + "'")[0]["isoffline"].ToString() == "0")
                {
                    return("商品已下架");
                }
                string id = dt.Select("isnull(valueinfo,'')='" + values2 + "'")[0]["Id"].ToString();
                str = BLL.Common.GetGoodsPrice(dt.Select("isnull(valueinfo,'')='" + values2 + "'")[0]["CompID"].ToString().ToInt(0), this.DisID, Convert.ToInt32(id)).ToString("0.00") + "," + id;
            }
            else
            {
                str = "商品已删除";
            }
        }
        else
        {
            Hi.Model.BD_Goods goodsModel = new Hi.BLL.BD_Goods().GetModel(Convert.ToInt32(goodsId));
            if (goodsModel != null)
            {
                str = goodsModel.SalePrice.ToString("0.00");
            }
        }
        return(str);
    }
Пример #2
0
    /// <summary>
    /// 获取商品编码
    /// </summary>
    /// <returns></returns>
    public string GetGoodsCodes(string values)
    {
        if (values == null)
        {
            return("");
        }

        Hi.Model.BD_Goods goodsModel = new Hi.BLL.BD_Goods().GetModel(goodsId);

        if (Session["price"] == null)
        {
            return("");
        }
        if (goodsModel == null)
        {
            return("");
        }
        DataTable dt = Session["price"] as DataTable;

        if (dt.Rows.Count != 0)
        {
            if (dt.Select("isnull(valueinfo,'')='" + values + "'").Length != 0)
            {
                for (int i = 0; i < dt.Select("isnull(valueinfo,'')='" + values + "'").Length; i++)
                {
                    return(dt.Select("isnull(valueinfo,'')='" + values + "'")[i]["barcode"].ToString() + "," + dt.Select("isnull(valueinfo,'')='" + values + "'")[i]["inventory"].ToString());
                }
            }
        }
        return("");
    }
Пример #3
0
    /// <summary>
    /// 绑定
    /// </summary>
    public void Bind()
    {
        int    pageCount = 0;
        int    Counts    = 0;
        string strWhere  = " and ISNULL(dr,0)=0 and ComPid=" + KeyID + " and GoodsName!='' and isoffline=1";

        if (ViewState["strWhere"] != null)
        {
            strWhere += ViewState["strWhere"].ToString();
        }
        //每页显示的数据设置
        if (this.txtPager.Value.Trim().ToString() != "" && this.txtPager.Value.Trim().ToString() != "0")
        {
            if (this.txtPager.Value.Trim().Length >= 5)
            {
                Pager.PageSize      = 100;
                this.txtPager.Value = "100";
            }
            else
            {
                this.Pager.PageSize = this.txtPager.Value.Trim().ToInt(0);
            }
        }
        List <Hi.Model.BD_Goods> l = new Hi.BLL.BD_Goods().GetList(Pager.PageSize, Pager.CurrentPageIndex, "id", true, strWhere, out pageCount, out Counts);

        this.rptGoods.DataSource = l;
        this.rptGoods.DataBind();
        Pager.RecordCount = Counts;
        page = Pager.CurrentPageIndex.ToString();
    }
Пример #4
0
 /// <summary>
 /// 得到html数据
 /// </summary>
 /// <param name="title"></param>
 /// <returns></returns>
 public string GetHtml(string title)
 {
     if (comPid != 0)
     {
         StringBuilder html = new StringBuilder();
         List <Hi.Model.BD_ShopGoodsList> l = new Hi.BLL.BD_ShopGoodsList().GetList("", "isnull(dr,0)=0 and compId=" + comPid + " and title='" + title + "'", "");
         if (l.Count > 0)
         {
             for (int i = 0; i < l.Count; i++)
             {
                 if (i == 0)
                 {
                     html.Append("<li><i style=\"color: Red\">*</i>分类标题:<input type=\"text\" class=\"textBox txtTitle\" name=\"txtTitle\" value=\"" + l[i].Title + "\" /></li>");
                 }
                 string goodsName = new Hi.BLL.BD_Goods().GetModel(Convert.ToInt32(l[i].GoodsID)).GoodsName;
                 html.Append("<li><input type=\"hidden\" class=\"hidGoodsId\" name=\"hidGoodsId\"  value=\"" + l[i].GoodsID + "\" /></li><li><i style=\"color: Red\">*</i>选择商品:<input type=\"text\" class=\"textBox txtGoodsName\"  name=\"txtGoodsName\" readonly=\"readonly\" value=\"" + goodsName + "\"  />");
                 if (i == l.Count - 1)
                 {
                     html.Append("<i class=\"add_\" title=\"添加\">添加</i>");
                 }
                 else
                 {
                     html.Append("<i class=\"del_\" title=\"删除\">删除</i>");
                 }
                 html.Append("</li><li><i>*</i>显示名称:<input type=\"text\" class=\"textBox txtShowName\" name=\"txtShowName\" value=\"" + l[i].ShowName + "\" /></li>");
             }
         }
         return(html.ToString());
     }
     else
     {
         return("");
     }
 }
Пример #5
0
    /// <summary>
    /// 下架
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnOffline2_Click(object sender, EventArgs e)
    {
        SqlTransaction Tran = DBUtility.SqlHelper.CreateStoreTranSaction();

        try
        {
            List <int> l = new List <int>();
            foreach (RepeaterItem row in this.rptGoodsInfo.Items)
            {
                CheckBox cb = row.FindControl("CB_SelItem") as CheckBox;
                if (cb != null && cb.Checked)
                {
                    HiddenField fld = row.FindControl("HF_Id") as HiddenField;
                    if (fld != null)
                    {
                        int id = Convert.ToInt32(fld.Value);
                        l.Add(id);
                        Hi.Model.BD_GoodsInfo model = new Hi.BLL.BD_GoodsInfo().GetModel(id);
                        if (model != null)
                        {
                            model.ts         = DateTime.Now;
                            model.modifyuser = this.UserID;
                            model.IsOffline  = 0;
                            model.CompID     = this.CompID;
                            bool bol = new Hi.BLL.BD_GoodsInfo().Update(model, Tran);
                            List <Hi.Model.BD_GoodsInfo> ll = new Hi.BLL.BD_GoodsInfo().GetList("", "isnull(dr,0)=0 and compid=" + this.CompID + " and   goodsId=" + model.GoodsID + " and isnull(IsOffline,1)=1", "", Tran);
                            if (ll.Count == 0)
                            {
                                Hi.Model.BD_Goods model2 = new Hi.BLL.BD_Goods().GetModel(model.GoodsID, Tran);
                                if (model2 != null)
                                {
                                    model2.ts         = DateTime.Now;
                                    model2.modifyuser = this.UserID;
                                    model2.IsOffline  = 0;
                                    model2.CompID     = this.CompID;
                                    new Hi.BLL.BD_Goods().Update(model2, Tran);
                                }
                            }
                        }
                    }
                }
            }
            Tran.Commit();
        }
        catch (Exception)
        {
            if (Tran != null)
            {
                if (Tran.Connection != null)
                {
                    Tran.Rollback();
                }
            }
        }
        finally
        {
            DBUtility.SqlHelper.ConnectionClose();
        }
        Bind();
    }
Пример #6
0
    /// <summary>
    /// 绑定数据源
    /// </summary>
    public void BindData()
    {
        int    Counts        = 0;
        string SqlQueryCount = string.Empty;

        SqlQuery      = @"(  select FirstShow,b.coun,SortIndex,CreateDate,BD_Company.ID,CompName,ManageInfo,CompAddr,Principal,Phone,Address,ShopLogo,CompLogo,ShortName
                        from BD_Company   join ( select CompID,COUNT(CompID) coun from BD_Goods where
                        isnull(Pic,'')<>'' and BD_Goods.dr=0 and IsOffline=1   group by CompID having COUNT(CompID)>0 )b on b.CompID=BD_Company.ID 
                        where 1=1 " + SearchWhere() + " )";
        SqlQueryCount = @"(  select 1
                        from BD_Company   join ( select CompID,COUNT(CompID) coun from BD_Goods where
                        isnull(Pic,'')<>'' and BD_Goods.dr=0 and IsOffline=1   group by CompID having COUNT(CompID)>0 )b on b.CompID=BD_Company.ID 
                        where 1=1 " + SearchWhere() + " )";
        DataTable ListGoods = null;
        string    sql       = Sql(Pager_List.CurrentPageIndex, Pager_List.PageSize, SortName, SqlQuery + " s ");

        ListGoods          = new Hi.BLL.BD_Goods().GoodsAttr(sql);//分页的数据源
        RepComp.DataSource = ListGoods;
        RepComp.DataBind();
        if (CategoryID_type.Value != Request.QueryString["indid"] || A_Type.Value == "1" || A_Type.Value == "2")//如果状态未发生变化则不更新分页总数
        {
            CategoryID_type.Value = Common.NoHTML(Request.QueryString["indid"]);
            DataTable dt = new Hi.BLL.BD_Goods().GoodsAttr(SqlQueryCount);
            Counts = dt.Rows.Count;
        }
        Pager_List.RecordCount = Counts;
        //Pager_List.TextBeforePageIndexBox = "<i class='tf2'>共" + Pager_List.PageCount + "页</i> <span class='tf2'>到第:</span>";
        page = Pager_List.CurrentPageIndex.ToString();
        Page_index.InnerHtml  = Pager_List.CurrentPageIndex.ToString();
        Page_Count.InnerHtml  = Pager_List.PageCount.ToString();
        Count_goods.InnerHtml = Counts.ToString();
    }
Пример #7
0
 /// <summary>
 /// 验证是否重复
 /// </summary>
 /// <param name="goodsname"></param>
 /// <returns></returns>
 public string Yanz(string goodsname, string str, SqlTransaction Tran)
 {
     if (str == "商品名称")
     {
         List <Hi.Model.BD_Goods> count = new Hi.BLL.BD_Goods().GetList("", "goodsname='" + goodsname.Trim() + "' and isnull(dr,0)=0  and compid=" + this.CompID, "", Tran);
         if (count.Count > 0)
         {
             return("1");
         }
         else
         {
             return("0");
         }
     }
     else if (str == "商品编码")
     {
         List <Hi.Model.BD_GoodsInfo> count = new Hi.BLL.BD_GoodsInfo().GetList("", "barcode='" + goodsname.Trim() + "' and isnull(dr,0)=0  and compid=" + this.CompID, "", Tran);
         if (count.Count > 0)
         {
             return("1");
         }
         else
         {
             return("0");
         }
     }
     return("2");
 }
Пример #8
0
    /// <summary>
    /// 商品列表绑定
    /// </summary>
    public void Bind()
    {
        int    pageCount = 0;
        int    Counts    = 0;
        string strWhere  = Where();

        //每页显示的数据设置
        if (this.txtPageSize.Value.ToString() != "")
        {
            if (this.txtPageSize.Value.Trim().Length >= 5)
            {
                Pager.PageSize         = 100;
                this.txtPageSize.Value = "100";
            }
            else
            {
                Pager.PageSize = this.txtPageSize.Value.Trim().ToInt(0);
            }
        }
        string    JoinTableStr = " BD_Goods inner join BD_GoodsInfo bginfo on BD_Goods.ID= bginfo.GoodsID and BD_Goods.dr=0 and  bginfo.dr=0  left join bd_company bcp on bginfo.compid=bcp.id and bcp.dr=0  left join BD_GoodsCategory bgcate on BD_goods.CategoryID=bgcate.id ";
        DataTable DtGoodsInfo  = new Hi.BLL.BD_Goods().GetList(Pager.PageSize, Pager.CurrentPageIndex, "BD_Goods.IsFirstShow desc,BD_Goods.Sortindex desc,bginfo.ID", true, " IsFirstShow,BD_Goods.Sortindex, BD_Goods.GoodsName,bginfo.GoodsID,bginfo.Compid,bginfo.ID,bcp.CompName,BD_goods.Unit,BD_goods.Pic,CategoryName,ValueInfo,bginfo.isOffline ", JoinTableStr, strWhere, out pageCount, out Counts, "", false);

        this.rptGoods.DataSource = DtGoodsInfo;
        this.rptGoods.DataBind();
        Pager.RecordCount = Counts;
        page = Pager.CurrentPageIndex.ToString();
        this.Org.SelectedValue = this.OrgID == 0 ? Org.SelectedValue : this.OrgID.ToString();
    }
Пример #9
0
    private void Bind()
    {
        List <Hi.Model.BD_Company> LComp = null;

        if (HttpRuntime.Cache.Get("hotShop_RPT") == null)
        {
            LComp = new Hi.BLL.BD_Company().GetList("top 6 CompName,ID,CompLogo,ShortName,ShopLogo", " dr=0 and AuditState=2  and FirstShow=1  and IsEnabled=1 ", " SortIndex desc,id ");
            HttpRuntime.Cache.Insert("hotShop_RPT", LComp, null, DateTime.Now.AddMinutes(60), System.Web.Caching.Cache.NoSlidingExpiration);
        }
        else
        {
            LComp = HttpRuntime.Cache["hotShop_RPT"] as List <Hi.Model.BD_Company>;
        }
        hotShop_RPT.DataSource = LComp;
        hotShop_RPT.DataBind();

        List <Hi.Model.BD_Goods> LGood = null;

        if (HttpRuntime.Cache.Get("hotGood_RPT") == null)
        {
            string SqlQuery = " isnull(Pic2,'')<>'' and BD_Goods.dr=0 and IsOffline=1 ";
            LGood = new Hi.BLL.BD_Goods().GetList(" top 5 * ", SqlQuery, " BD_Goods.ID ");
            HttpRuntime.Cache.Insert("hotGood_RPT", LGood, null, DateTime.Now.AddMinutes(60), System.Web.Caching.Cache.NoSlidingExpiration);
        }
        else
        {
            LGood = HttpRuntime.Cache["hotGood_RPT"] as List <Hi.Model.BD_Goods>;
        }
        hotGoods_RPT.DataSource = LGood;
        hotGoods_RPT.DataBind();
    }
Пример #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         try
         {
             int goodsId             = Convert.ToInt32(Request["id"]);
             Hi.Model.BD_Goods model = new Hi.BLL.BD_Goods().GetModel(goodsId);
             if (model == null)
             {
                 this.DivShow.InnerHtml = "<p style=\"padding-top: 20px; line-height: 40px; padding-left: 20px\">暂无数据</p>";
             }
             if (model.Details == "")
             {
                 this.DivShow.InnerHtml = "<p style=\"padding-top: 20px; line-height: 40px; padding-left: 20px\">暂无数据</p>";
             }
             else
             {
                 this.DivShow.InnerHtml = model.Details.Replace("<pre>", "<p>").Replace("</pre>", "</p>");
             }
         }
         catch (Exception es)
         {
             this.DivShow.InnerHtml = "<p style=\"padding-top: 20px; line-height: 40px; padding-left: 20px\">" + es.Message + "</p>";
         }
     }
 }
Пример #11
0
    /// <summary>
    /// 商品列表绑定
    /// </summary>
    public void Bind()
    {
        int    pageCount = 0;
        int    Counts    = 0;
        string strWhere  = " and ISNULL(dr,0)=0 and  isenabled=1 and ComPid=" + this.CompID;

        if (ViewState["strWhere"] != null)
        {
            strWhere += ViewState["strWhere"].ToString();
        }
        //每页显示的数据设置
        if (this.txtPageSize.Value.ToString() != "")
        {
            if (this.txtPageSize.Value.Trim().Length >= 5)
            {
                Pager.PageSize         = 100;
                this.txtPageSize.Value = "100";
            }
            else
            {
                Pager.PageSize = this.txtPageSize.Value.Trim().ToInt(0);
            }
        }
        List <Hi.Model.BD_Goods> l = new Hi.BLL.BD_Goods().GetList(Pager.PageSize, Pager.CurrentPageIndex, "id", true, strWhere, out pageCount, out Counts);

        this.rptGoods.DataSource = l;
        this.rptGoods.DataBind();
        Pager.RecordCount = Counts;
        page = Pager.CurrentPageIndex.ToString();
        ClientScript.RegisterStartupScript(this.GetType(), "", "<script>$(function(){     $(\"#CB_SelAll\").trigger(\"click\");})</script>");
    }
Пример #12
0
    /// <summary>
    /// 保存
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        SqlTransaction Tran = null;

        try
        {
            Tran = DBUtility.SqlHelper.CreateStoreTranSaction();
            object disId   = Request["disId"];   //代理商id
            object goodsId = Request["goodsId"]; //商品Id
            if (disId != null && goodsId != null)
            {
                for (int i = 0; i < disId.ToString().Split(',').Length; i++)
                {
                    for (int z = 0; z < goodsId.ToString().Split(',').Length; z++)
                    {
                        List <Hi.Model.BD_GoodsAreas> l = new Hi.BLL.BD_GoodsAreas().GetList("", "isnull(dr,0)=0 and compId=" + this.CompID + " and disId=" + disId.ToString().Split(',')[i] + " and goodsId=" + goodsId.ToString().Split(',')[z], "", Tran);
                        if (l.Count == 0)
                        {
                            Hi.Model.BD_GoodsAreas  model  = new Hi.Model.BD_GoodsAreas();
                            Hi.Model.BD_Distributor model2 = new Hi.BLL.BD_Distributor().GetModel(Convert.ToInt32(disId.ToString().Split(',')[i]), Tran);
                            Hi.Model.BD_Goods       model3 = new Hi.BLL.BD_Goods().GetModel(Convert.ToInt32(goodsId.ToString().Split(',')[z]), Tran);
                            model.CompID     = this.CompID;
                            model.areaID     = model2.AreaID;
                            model.GoodsID    = Convert.ToInt32(goodsId.ToString().Split(',')[z]);
                            model.CategoryID = model3.CategoryID;
                            model.ts         = DateTime.Now;
                            model.dr         = 0;
                            model.modifyuser = this.UserID;
                            model.DisID      = Convert.ToInt32(disId.ToString().Split(',')[i]);
                            new Hi.BLL.BD_GoodsAreas().Add(model, Tran);
                        }
                        else
                        {
                            continue;
                        }
                    }
                }
            }
            Tran.Commit();
            Response.Redirect("GoodsAreaList.aspx");
        }
        catch (Exception ex)
        {
            if (Tran != null)
            {
                if (Tran.Connection != null)
                {
                    Tran.Rollback();
                }
            }
            JScript.AlertMethod(this, "保存失败了", JScript.IconOption.错误, "function(){location.href='GoodsAreaList.aspx';}");
            return;
        }
        finally
        {
            DBUtility.SqlHelper.ConnectionClose();
        }
    }
Пример #13
0
 public string GetMsgFor(string id)
 {
     if (id != "")
     {
         List <Hi.Model.BD_Goods> gList = new Hi.BLL.BD_Goods().GetList("", " CategoryID='" + id.ToString() + "'", "");
         return(gList != null && gList.Count > 0 ? "1" : "0");
     }
     return("0");
 }
Пример #14
0
    /// <summary>
    /// 上架
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnOffline_Click(object sender, EventArgs e)
    {
        SqlTransaction Tran = null;

        try
        {
            SqlConnection Connection = new SqlConnection(SqlHelper.LocalSqlServer);
            Connection.Open();
            Tran = Connection.BeginTransaction();
            List <int> CkIds = new List <int>();
            foreach (RepeaterItem row in this.rptGoods.Items)
            {
                CheckBox cb = row.FindControl("CB_SelItem") as CheckBox;
                if (cb != null && cb.Checked)
                {
                    HiddenField fld = row.FindControl("HF_Id") as HiddenField;
                    if (fld != null)
                    {
                        CkIds.Add(fld.Value.ToInt(0));
                    }
                }
            }
            List <Hi.Model.BD_Goods> GoodsList = new Hi.BLL.BD_Goods().GetList("", "ID in(" + string.Join(",", CkIds) + ")", "");
            foreach (Hi.Model.BD_Goods goods in GoodsList)
            {
                goods.ts         = DateTime.Now;
                goods.modifyuser = this.UserID;
                goods.IsOffline  = 1;
                new Hi.BLL.BD_Goods().Update(goods, Tran);
            }
            List <Hi.Model.BD_GoodsInfo> GoodsinfoList = new Hi.BLL.BD_GoodsInfo().GetList("", "dr=0 and GoodsID in(" + string.Join(",", CkIds) + ")", "");
            foreach (Hi.Model.BD_GoodsInfo info in GoodsinfoList)
            {
                info.ts         = DateTime.Now;
                info.modifyuser = this.UserID;
                info.IsOffline  = 1;
                new Hi.BLL.BD_GoodsInfo().Update(info, Tran);
            }
            Tran.Commit();
        }
        catch (Exception)
        {
            if (Tran != null)
            {
                if (Tran.Connection != null)
                {
                    Tran.Rollback();
                }
            }
        }
        finally
        {
            DBUtility.SqlHelper.ConnectionClose();
        }
        Bind();
    }
Пример #15
0
    public string GetPicURL(string goodsId, string compId, string format = null)
    {
        Hi.Model.BD_Goods goods = new Hi.BLL.BD_Goods().GetModel(Convert.ToInt32(goodsId));
        if (goods != null)
        {
            return(Common.GetPicURL(goods.Pic, format, compId));
        }

        return("../../images/havenopicsmallest.gif");
    }
Пример #16
0
 /// <summary>
 /// 得到商品名称
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public string GetGoodsName(int id)
 {
     Hi.Model.BD_GoodsInfo model = new Hi.BLL.BD_GoodsInfo().GetModel(id);
     if (model != null)
     {
         Hi.Model.BD_Goods model2 = new Hi.BLL.BD_Goods().GetModel(model.GoodsID);
         return(model2.GoodsName);
     }
     return("");
 }
Пример #17
0
    /// <summary>
    /// 查询条件
    /// </summary>
    /// <returns></returns>
    private string Where()
    {
        string strWhere = string.Empty;
        //赋值
        string areaId    = Common.NoHTML(this.txtDisAreaBox.areaId);                         //区域
        string goodsName = Common.NoHTML(this.txtGoodsName.Value.Trim().Replace("'", "''")); //商品名称
        string hideID    = Common.NoHTML(this.txtCategory.treeId);                           //类别id
        string idlist    = string.Empty;

        if (!Util.IsEmpty(areaId))
        {
            string aredIdList = Common.DisAreaId(Convert.ToInt32(areaId), this.CompID);//递归得到区域id
            strWhere += string.Format(" and areaId in({0})", aredIdList);
        }
        if (!Util.IsEmpty(goodsName))
        {
            List <Hi.Model.BD_Goods> l = new Hi.BLL.BD_Goods().GetList("", "goodsname like '%" + Common.NoHTML(goodsName) + "%' and isnull(dr,0)=0 and isenabled=1  and compid=" + this.CompID, "");
            if (l.Count > 0)
            {
                foreach (Hi.Model.BD_Goods item in l)
                {
                    idlist += item.ID + ",";
                }
            }
            if (!Util.IsEmpty(idlist))
            {
                strWhere += string.Format(" and Goodsid in( {0})", idlist.Substring(0, idlist.Length - 1));
            }
            else
            {
                strWhere += string.Format(" and Goodsid =''");
            }
        }
        if (!Util.IsEmpty(hideID) && txtCategory.treeName != "")
        {
            string cateID = Common.CategoryId(Convert.ToInt32(hideID), this.CompID);//商品分类递归
            List <Hi.Model.BD_Goods> ll = new Hi.BLL.BD_Goods().GetList("", "categoryID in(" + cateID + ") and isnull(dr,0)=0 and isenabled=1", "");
            if (ll.Count > 0)
            {
                foreach (Hi.Model.BD_Goods item in ll)
                {
                    idlist += item.ID + ",";
                }
            }
            if (!Util.IsEmpty(idlist))
            {
                strWhere += string.Format(" and Goodsid in( {0})", idlist.Substring(0, idlist.Length - 1));
            }
            else
            {
                strWhere += string.Format(" and Goodsid =''");
            }
        }
        return(strWhere);
    }
Пример #18
0
    /// <summary>
    /// 得到属性
    /// </summary>
    /// <returns></returns>
    public string GoodsAttr2(string id)
    {
        string    str = string.Empty;
        DataTable dt  = new Hi.BLL.BD_Goods().GoodsAttr(id, this.CompID.ToString());//属性

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            str += dt.Rows[i]["AttributeName"].ToString() + ",";
        }
        return(str == "" ? "" : str.Substring(0, str.Length - 1));
    }
Пример #19
0
 /// <summary>
 /// 获取单位
 /// </summary>
 /// <param name="goodsId"></param>
 /// <returns></returns>
 public string GetUnti(string goodsId)
 {
     Hi.Model.BD_Goods model = new Hi.BLL.BD_Goods().GetModel(Convert.ToInt32(goodsId));
     if (model != null)
     {
         return(model.Unit);
     }
     else
     {
         return("");
     }
 }
Пример #20
0
    /// <summary>
    /// 获取价格
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public string GetProPrice2(string values, string goodsId)
    {
        string str = "暂无价格";

        Hi.Model.BD_Goods            goodsModel = new Hi.BLL.BD_Goods().GetModel(Convert.ToInt32(goodsId));
        List <Hi.Model.BD_GoodsInfo> lll        = new Hi.BLL.BD_GoodsInfo().GetList("", "isnull(dr,0)=0 and isoffline=1 and compId=" + this.CompID + " and goodsid=" + goodsId, "");

        if (lll.Count != 0)
        {
            return(BLL.Common.GetGoodsPrice(Convert.ToInt32(this.CompID), this.DisID, Convert.ToInt32(lll[0].ID)).ToString("0.00"));
        }
        return(goodsModel.SalePrice.ToString("0.00"));
    }
Пример #21
0
    /// <summary>
    /// 附件绑定
    /// </summary>
    public void DataBindLink()
    {
        string goodsId = Request.QueryString["goodsId"];

        if (!string.IsNullOrWhiteSpace(goodsId))
        {
            string            gid   = Common.DesDecrypt(Request["goodsId"], Common.EncryptKey);
            Hi.Model.BD_Goods model = new Hi.BLL.BD_Goods().GetModel(Convert.ToInt32(gid));
            if (model != null && model.CompID == this.CompID)
            {
                if (!string.IsNullOrEmpty(model.registeredCertificate))
                {
                    //LinkButton linkFile = new LinkButton();
                    //linkFile.Click += new EventHandler(Download_Click);

                    //if (model.registeredCertificate.LastIndexOf("_") != -1)
                    //{
                    //    string text = model.registeredCertificate.Substring(0, model.registeredCertificate.LastIndexOf("_")) + Path.GetExtension(model.registeredCertificate);
                    //    if (text.Length < 15)
                    //        linkFile.Text = text;
                    //    else
                    //    {
                    //        linkFile.Text = text.Substring(0, 15) + "...";
                    //    }
                    //    linkFile.Attributes.Add("title", text);
                    //}
                    //else
                    //{
                    //    string text = model.registeredCertificate.Substring(0, model.registeredCertificate.LastIndexOf("-")) + Path.GetExtension(model.registeredCertificate);
                    //    if (text.Length < 15)
                    //        linkFile.Text = text;
                    //    else
                    //    {
                    //        linkFile.Text = text.Substring(0, 15) + "...";
                    //    }
                    //    linkFile.Attributes.Add("title", text);
                    //}
                    //linkFile.Style.Add("text-decoration", "underline");
                    //linkFile.Attributes.Add("fileName", model.registeredCertificate);
                    //HtmlGenericControl div = new HtmlGenericControl("div");
                    //div.Controls.Add(linkFile);

                    //UpFileText2.Controls.Add(div);


                    string url = Common.GetWebConfigKey("OssImgPath") + "UploadFile/" + model.registeredCertificate;
                    this.DivShow1.InnerHtml = "<img width=\"600\" src=\"" + url + "\"/>";
                }
            }
        }
    }
Пример #22
0
 public void DataBindShow()
 {
     if (KeyID > 0)
     {
         Hi.Model.BD_Goods good = new Hi.BLL.BD_Goods().GetModel(KeyID);
         //List<Hi.Model.BD_Goods> ListGoods = new Hi.BLL.BD_Goods().GetList("IsFirstShow,Sortindex,NewPic,GoodsName,ShowName,ID", " dr=0 and id=" + KeyID + "  ", "");
         if (good != null)
         {
             if (good.IsFirstShow)
             {
                 rdShowYes.Checked = true;
                 rdShowNo.Checked  = false;
             }
             if (!string.IsNullOrWhiteSpace(good.NewPic))
             {
                 ImgNewPic.Style.Remove("display");
                 ImgNewPic.Src      = ConfigurationManager.AppSettings["ImgViewPath"] + "CompImage/" + good.NewPic;
                 HdNewPicName.Value = good.NewPic;
             }
             lblGoodsName.InnerText = good.GoodsName;
             txt_SortIndex.Value    = good.Sortindex.ToString();
             txt_ShowName.Value     = good.ShowName;
         }
         else
         {
             if (Request.UrlReferrer != null)
             {
                 JScript.AlertMsgMo(this, "商品数据有误", "function (){ window.parent.layer.close(window.parent.LayserIndex); }");
                 return;
             }
             else
             {
                 Response.Write("商品数据有误。");
                 Response.End();
             }
         }
     }
     else
     {
         if (Request.UrlReferrer != null)
         {
             JScript.AlertMsgMo(this, "商品数据有误", "function (){ window.parent.layer.close(window.parent.LayserIndex); }");
             return;
         }
         else
         {
             Response.Write("商品数据有误。");
             Response.End();
         }
     }
 }
Пример #23
0
 protected void btnSubMit_Click(object sender, EventArgs e)
 {
     Hi.Model.BD_Goods good = new Hi.BLL.BD_Goods().GetModel(KeyID);
     //List<Hi.Model.BD_Goods> ListGoods = new Hi.BLL.BD_Goods().GetList("*", " dr=0 and id=" + KeyID + "  ", "");
     if (good != null)
     {
         good.Sortindex   = txt_SortIndex.Value.ToInt(0);
         good.IsFirstShow = rdShowYes.Checked;
         good.NewPic      = Common.NoHTML(HdNewPicName.Value);
         good.ShowName    = Common.NoHTML(txt_ShowName.Value.Trim());
         new Hi.BLL.BD_Goods().Update(good);
         ClientScript.RegisterStartupScript(this.GetType(), "Msg", "<script> if(window.parent.Reload){  window.parent.Reload(); }else { window.parent.layer.close(window.parent.LayserIndex)};  </script>");
     }
 }
Пример #24
0
    /// <summary>
    /// 购物车商品
    /// </summary>
    public void ShopCart()
    {
        DataTable dt = new Hi.BLL.DIS_ShopCart().GetGoodsCart(" sc.[CompID]=" + this.CompID + " and sc.[DisID]=" + this.DisID + "and sc.dr=0", "sc.[CreateDate] desc ");

        if (dt != null && dt.Rows.Count > 0)
        {
            decimal TotalAmount = 0;
            string  html        = string.Empty;
            string  Digits      = OrderInfoType.rdoOrderAudit("订单下单数量是否取整", this.CompID); //小数位数
            string  str6        = IsInve == 0 ? "" : "display:none";
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                int goodsinfoid = Convert.ToInt32(dt.Rows[i]["GoodsinfoID"].ToString());
                Hi.Model.BD_GoodsInfo model3 = new Hi.BLL.BD_GoodsInfo().GetModel(goodsinfoid);
                Hi.Model.BD_Goods     model4 = new Hi.BLL.BD_Goods().GetModel(model3.GoodsID);
                string pic       = dt.Rows[i]["pic"].ToString();                                                                // new Hi.BLL.BD_Goods().GetModel(Convert.ToInt32(model2.GoodsID)).Pic;
                string inventory = string.Empty;
                BLL.Common.GetInevntory(this.CompID, goodsinfoid, 0, Convert.ToDecimal(dt.Rows[i]["GoodsNum"]), out inventory); // dt.Rows[i]["Inventory"].ToString();
                string str7 = string.Empty;                                                                                     //是否促销
                if (dt.Rows[i]["ProID"].ToString() != "0")
                {
                    str7 = SelectGoodsInfo.protitle(dt.Rows[i]["ProID"].ToString(), dt.Rows[i]["Unit"].ToString());
                }
                string  strremark = string.Empty;
                decimal zxprice   = BLL.Common.GetGoodsPrice(this.CompID, this.DisID, goodsinfoid);//最新价格
                decimal num       = decimal.Parse(string.Format("{0:N4}", Convert.ToDecimal(dt.Rows[i]["GoodsNum"]).ToString("#,####" + Digits)));
                TotalAmount += zxprice * num;
                html        += "<tr tip=\"" + goodsinfoid + "\" trindex=\"" + i + "\" trindex2=\"" + i + "\" id=\"\"><td class=\"t8\"><div class=\"addg\"><a href=\"javascript:;\" class=\"minus2\"></a><a href=\"javascript:;\" class=\"add2\"></a></div></td><td><div class=\"sPic\"><a class=\"opt-i2\"></a><span><a href=\"javascript:;\"><img src=\"" + Common.GetPicURL(pic, "resize200") + "\" width=\"60\" height=\"60\"></a></span><a href=\"javascript:;\" class=\"code\">商品编码:" + dt.Rows[i]["barCode"].ToString() + str7 + "</a><a href=\"javascript:;\" class=\"name\">" + GetGoodsName(model4.GoodsName, model3.ValueInfo, "1") + "<i>" + GetGoodsName(model4.GoodsName, model3.ValueInfo, "2") + "</i></a></div></td><td><div class=\"tc\">" + model4.Unit + "</div></td><td><div class=\"tc divprice" + i + "\" tip=\"" + decimal.Parse(string.Format("{0:N2}", zxprice)).ToString("0.00") + "\">¥" + decimal.Parse(string.Format("{0:N2}", zxprice)).ToString("0.00") + "</div><input type=\"hidden\" class=\"hidPrice\" value=\"" + zxprice + "\" /></td><td style=\"" + str6 + "\"><div class=\"tc\"><input type=\"hidden\" id=\"hidInventory_" + i + "\" value=\"" + decimal.Parse(string.Format("{0:N2}", inventory)).ToString(Digits) + "\" />" + decimal.Parse(string.Format("{0:N2}", inventory)).ToString(Digits) + "</div></td><td><div class=\"sl divnum\" tip=\"" + dt.Rows[i]["GoodsinfoID"].ToString() + "\" tip2=\"" + i + "\"><a href=\"javascript:void(0);\"  class=\"minus\">-</a><input type=\"text\" class=\"box txtGoodsNum txtGoodsNum" + i + "\" onfocus=\"InputFocus(this)\" onkeyup='KeyInt2(this)' maxlength=\"9\"  value=\"" + num + "\"><a href=\"javascript:void(0);\"  class=\"add\">+</a></div></td><td><div class=\"tc lblTotal_" + i + "\">¥" + decimal.Parse(string.Format("{0:N2}", zxprice * num)).ToString("0.00") + "</div></td><td><div class=\"tc alink\"><a href=\"javascript:;\" class=\"aremark" + i + "\">添加</a>" + strremark + "</div></td></tr>";
            }
            //查询购物车商品数量、总价
            // DataTable dtp = new Hi.BLL.DIS_ShopCart().SumCartNum(this.CompID.ToString(), this.DisID.ToString());
            // if (dtp != null && dtp.Rows.Count > 0)
            //{
            //TotalAmount = (dtp.Rows[0]["SumAmount"].ToString().ToDecimal(0));
            //订单总价
            this.lblTotalAmount.InnerText = decimal.Parse(string.Format("{0:N2}", TotalAmount.ToString())).ToString("0.00");//商品总额
            //订单促销
            decimal ProAmount = Common.GetProPrice(TotalAmount, out ProID, out ProIDD, out ProType, this.CompID);
            this.lblCux.InnerText = decimal.Parse(string.Format("{0:N2}", ProAmount.ToString())).ToString("0.00");
            //合计
            string str8 = (TotalAmount - ProAmount).ToString("N");
            ClientScript.RegisterStartupScript(this.GetType(), "adder", "<script>$(function(){disId=" + this.DisID + "; $(\".tabLine table tbody tr:last\").before(\"" + html.Replace("\"", "'") + "\");$(\"#lblYFPrice\").text(\"" + str8 + "\")})</script>");
            // }
        }
        else
        {
            Response.Redirect("/Distributor/Shop.aspx");
        }
    }
Пример #25
0
    /// <summary>
    /// 得到商品名称
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public string GoodsName(string id)
    {
        string name = string.Empty;

        Hi.Model.BD_GoodsInfo model = new Hi.BLL.BD_GoodsInfo().GetModel(Convert.ToInt32(id));
        if (model != null)
        {
            Hi.Model.BD_Goods model2 = new Hi.BLL.BD_Goods().GetModel(model.GoodsID);
            if (model2 != null)
            {
                name = model2.GoodsName;
            }
        }
        return(name);
    }
Пример #26
0
    /// <summary>
    /// 绑定
    /// </summary>
    public void Bind()
    {
        int    pageCount = 0;
        int    Counts    = 0;
        string strWhere  = " and ISNULL(dr,0)=0 and IsEnabled=1 and ComPid=" + this.CompID;

        if (this.txtPager.Value.Trim().ToString() != "" && this.txtPager.Value.Trim().ToString() != "0")
        {
            if (this.txtPager.Value.Trim().Length >= 5)
            {
                Pager.PageSize      = 100;
                this.txtPager.Value = "100";
            }
            else
            {
                Pager.PageSize = this.txtPager.Value.Trim().ToInt(0);
            }
        }
        if (ViewState["strWhere"] != null)
        {
            strWhere += ViewState["strWhere"].ToString();
        }
        //List<Hi.Model.BD_Distributor> LDis = new Hi.BLL.BD_Distributor().GetList("", strWhere, "");
        //num = LDis.Count;
        //this.rptDis.DataSource = LDis;
        //this.rptDis.DataBind();
        List <Hi.Model.BD_Distributor> l = new Hi.BLL.BD_Distributor().GetList(Pager.PageSize, Pager.CurrentPageIndex, "id", true, strWhere, out pageCount, out Counts);

        num = l.Count;
        this.rptDis.DataSource = l;
        this.rptDis.DataBind();
        Pager.RecordCount = Counts;
        page = Pager.CurrentPageIndex.ToString();

        if (goodsInfoId != 0)
        {
            Hi.Model.BD_GoodsInfo model = new Hi.BLL.BD_GoodsInfo().GetModel(goodsInfoId);
            if (model != null)
            {
                Hi.Model.BD_Goods model2 = new Hi.BLL.BD_Goods().GetModel(model.GoodsID);
                if (model2 != null)
                {
                    this.lblGoodsName.InnerText = model2.GoodsName;
                    this.lblAttribute.InnerHtml = GoodsAttr(goodsInfoId);
                }
            }
        }
    }
Пример #27
0
    /// <summary>
    /// 获取商品信息
    /// </summary>
    /// <returns></returns>
    public string getGoodsStr(string goodsinfoid)
    {
        string str = string.Empty;

        Hi.Model.BD_GoodsInfo model = new Hi.BLL.BD_GoodsInfo().GetModel(Convert.ToInt32(goodsinfoid));
        if (model != null)
        {
            str = model.BarCode;
            Hi.Model.BD_Goods model2 = new Hi.BLL.BD_Goods().GetModel(model.GoodsID);
            if (model2 != null)
            {
                str += "&nbsp;" + model2.GoodsName;
            }
        }
        return(str);
    }
Пример #28
0
    /// <summary>
    /// 商品列表绑定
    /// </summary>
    public void Bind()
    {
        int    pageCount = 0;
        int    Counts    = 0;
        string strWhere  = "  and ComPid=" + this.CompID + " and isnull(dr,0)=0";

        if (ViewState["strWhere"] != null)
        {
            strWhere += ViewState["strWhere"].ToString();
        }
        else
        {
            if (this.ddlState.SelectedValue != "")
            {
                strWhere += " and isNUll(IsOffLine,0)=" + this.ddlState.SelectedValue;
            }
        }
        //每页显示的数据设置
        if (this.txtPageSize.Value.ToString() != "")
        {
            if (this.txtPageSize.Value.Trim().Length >= 5)
            {
                Pager.PageSize         = 100;
                this.txtPageSize.Value = "100";
            }
            else
            {
                Pager.PageSize = this.txtPageSize.Value.Trim().ToInt(0);
            }
        }
        List <Hi.Model.BD_Goods> l = new Hi.BLL.BD_Goods().GetList(Pager.PageSize, Pager.CurrentPageIndex, "id", true, strWhere, out pageCount, out Counts);
        List <int> CateIds         = l.Select(T => T.CategoryID).ToList();

        CateIds = CateIds.Distinct().ToList();
        List <Hi.Model.SYS_GType> CateList = new List <Hi.Model.SYS_GType>();

        if (CateIds.Count > 0)
        {
            CateList = new Hi.BLL.SYS_GType().GetList("TypeName,ID", "dr=0 and ID in(" + string.Join(",", CateIds) + ")", "");
        }
        ViewState["CateList"]    = CateList;
        this.rptGoods.DataSource = l;
        this.rptGoods.DataBind();
        Pager.RecordCount = Counts;
        page = Pager.CurrentPageIndex.ToString();
    }
Пример #29
0
 /// <summary>
 /// RepComp行绑定事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void RepComp_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         Repeater    GoodsList = e.Item.FindControl("GoodsList") as Repeater;
         DataRowView model     = (DataRowView)e.Item.DataItem;
         string where = string.Format(@" isnull(Pic,'')<>'' and BD_Goods.dr=0 and IsOffline=1 and CompID={0}", model["ID"].ToString());
         List <Hi.Model.BD_Goods> list = new Hi.BLL.BD_Goods().GetList(" top 4 * ", where, " BD_Goods.isindex desc ,BD_Goods.CreateDate ");   // BD_Goods.isindex desc ,BD_Goods.CreateDate
         //if (list.Count==0)
         //{
         //    Panel LI_panel = e.Item.FindControl("Li_" + model["ID"].ToString()) as Panel;
         //    LI_panel.Visible = false;
         //}
         GoodsList.DataSource = list;
         GoodsList.DataBind();
     }
 }
Пример #30
0
    /// <summary>
    /// 获取商品编码
    /// </summary>
    /// <returns></returns>
    public string GetGoodsCode(string values)
    {
        Hi.Model.BD_Goods goodsModel = new Hi.BLL.BD_Goods().GetModel(goodsId);

        DataTable dt    = Session["price"] as DataTable;
        string    isInv = OrderInfoType.rdoOrderAudit("订单下单数量是否取整", this.DisID); //是否取整

        if (dt.Rows.Count != 0)
        {
            if (dt.Select("isnull(valueinfo,'')='" + values + "'").Length != 0)
            {
                for (int i = 0; i < dt.Select("isnull(valueinfo,'')='" + values + "'").Length; i++)
                {
                    return(dt.Select("isnull(valueinfo,'')='" + values + "'")[i]["barcode"].ToString() + "," + decimal.Parse(string.Format("{0:N2}", dt.Select("isnull(valueinfo,'')='" + values + "'")[i]["inventory"].ToString())).ToString(isInv));
                }
            }
        }
        return("");
    }