Exemplo n.º 1
0
 /// <summary>
 /// 获取代理商价格
 /// </summary>
 /// <returns></returns>
 public string GetPrice(string id, string price)
 {
     if (!Util.IsEmpty(this.ddlDisList.SelectedValue.Trim()))
     {
         List <Hi.Model.BD_GoodsPrice> l = new Hi.BLL.BD_GoodsPrice().GetList("", "isnull(dr,0)=0 and isenabled=1 and disid=" + this.ddlDisList.SelectedValue.Trim() + " and compid=" + this.CompID + " and goodsinfoid=" + id, "");
         if (l.Count > 0)
         {
             return(l[0].TinkerPrice.ToString());
         }
         else
         {
             Hi.Model.BD_GoodsInfo lll = new Hi.BLL.BD_GoodsInfo().GetModel(Convert.ToInt32(id));
             if (lll != null)
             {
                 return(lll.TinkerPrice.ToString());
             }
             else
             {
                 return(price);
             }
         }
     }
     else
     {
         return(price);
     }
 }
Exemplo n.º 2
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");
 }
Exemplo n.º 3
0
    /// <summary>
    /// 选择商品
    /// </summary>
    /// <returns></returns>
    public string disBing(string goodsinfoid = "")
    {
        List <Hi.Model.DIS_GoodsStock> gstocklist = null;
        StringBuilder strwhere = new StringBuilder();

        //启用库存
        strwhere.AppendFormat("and Inventory>=0 and a.compid=" + this.CompID + " and b.compid=" + this.CompID);
        if (!Util.IsEmpty(goodsinfoid))
        {
            strwhere.AppendFormat(" and a.id in(" + goodsinfoid + ")");
            gstocklist = new Hi.BLL.DIS_GoodsStock().GetList("", " GoodsInfo in( " + goodsinfoid + " )", "");
        }
        DataTable dt = new Hi.BLL.BD_GoodsInfo().GetGoodsModel(strwhere.ToString()).Tables[0];

        if (dt != null && dt.Rows.Count > 0)
        {
            if (gstocklist != null && gstocklist.Count > 0)
            {
                foreach (DataRow item in dt.Rows)
                {
                    List <Hi.Model.DIS_GoodsStock> stock = gstocklist.FindAll(p => p.GoodsInfo == item["ID"].ToString());
                    if (stock != null && stock.Count > 0)
                    {
                        item["Inventory"] = stock[0].StockTotalNum;
                    }
                }
            }
        }
        return(ConvertJson.ToJson(dt));
    }
Exemplo n.º 4
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();
    }
Exemplo n.º 5
0
    /// <summary>
    /// 得到属性
    /// </summary>
    /// <returns></returns>
    public string GoodsAttr(string id)
    {
        string str  = string.Empty;
        string str2 = string.Empty;

        Hi.Model.BD_GoodsInfo model = new Hi.BLL.BD_GoodsInfo().GetModel(Convert.ToInt32(id));
        if (model != null)
        {
            str = model.ValueInfo;
            if (!Util.IsEmpty(str))
            {
                string[] lsit  = { };
                string[] lsit2 = { };
                lsit = str.Replace(';', ';').Split(';');
                for (int i = 0; i < lsit.Length; i++)
                {
                    if (lsit[i] != "")
                    {
                        lsit2 = lsit[i].Split(':');
                        str2 += lsit2[0] + ":" + "<label style='color:#0080b8'>" + lsit2[1] + "</label>" + ";";
                    }
                }
            }
            else
            {
                str2 = Common.GetGoodsMemo(Convert.ToInt32(model.GoodsID));
            }
        }
        return(str2);
    }
Exemplo n.º 6
0
 /// <summary>
 /// 获取基础价格
 /// </summary>
 /// <returns></returns>
 public string GetPrice(int id)
 {
     Hi.Model.BD_GoodsInfo model = new Hi.BLL.BD_GoodsInfo().GetModel(id);
     if (model != null)
     {
         return(model.SalePrice.ToString());
     }
     return("");
 }
Exemplo n.º 7
0
    /// <summary>
    /// 最新价格
    /// </summary>
    /// <returns></returns>
    public string GoodsTinkerPrice(int id, string disId, string saleprice, int type)
    {
        string price = string.Empty;

        if (type == 1)
        {
            price = decimal.Parse(string.Format("{0:N2}", Convert.ToDecimal(saleprice.ToString()).ToString())).ToString("#,##0.00");
        }
        else
        {
            price = decimal.Parse(string.Format("{0:N2}", Convert.ToDecimal(saleprice.ToString()).ToString())).ToString("0.00");
        }
        if (disId.Split(',').Length == 1)
        {
            //List<Hi.Model.BD_DisPrice> ll = new Hi.BLL.BD_DisPrice().GetList("", "isnull(dr,0)=0 and isenabled=1 and compid=" + CompID + " and disids   like '%" + disId + "%'", " id desc");
            //if (ll.Count > 0)
            //{
            //    string disIdlist = string.Empty;
            //    foreach (Hi.Model.BD_DisPrice item in ll)
            //    {
            //        disIdlist += item.ID + ",";
            //    }
            List <Hi.Model.BD_GoodsPrice> l = new Hi.BLL.BD_GoodsPrice().GetList("", "isnull(dr,0)=0 and goodsinfoid =" + id + " and compid=" + this.CompID + " and disId=" + disId + " and isenabled=1", "id desc");
            if (l.Count > 0)
            {
                foreach (Hi.Model.BD_GoodsPrice item in l)
                {
                    if (type == 1)
                    {
                        price = decimal.Parse(string.Format("{0:N2}", Convert.ToDecimal(item.TinkerPrice.ToString()).ToString())).ToString("#,##0.00");
                    }
                    else
                    {
                        price = decimal.Parse(string.Format("{0:N2}", Convert.ToDecimal(item.TinkerPrice.ToString()).ToString())).ToString("0.00");
                    }
                }
            }
            else
            {
                Hi.Model.BD_GoodsInfo lll = new Hi.BLL.BD_GoodsInfo().GetModel(id);
                if (lll != null)
                {
                    if (type == 1)
                    {
                        price = decimal.Parse(string.Format("{0:N2}", Convert.ToDecimal(lll.TinkerPrice.ToString()).ToString())).ToString("#,##0.00");
                    }
                    else
                    {
                        price = decimal.Parse(string.Format("{0:N2}", Convert.ToDecimal(lll.TinkerPrice.ToString()).ToString())).ToString("0.00");
                    }
                }
            }
            // }
        }
        return(price);
    }
Exemplo n.º 8
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();
    }
Exemplo n.º 9
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("");
 }
Exemplo n.º 10
0
    protected override void OnInit(EventArgs e)
    {
        if (string.IsNullOrWhiteSpace(Request["goodsId"]) && string.IsNullOrWhiteSpace(Request["goodsInfoId"]))
        {
            Response.Redirect("~/index.aspx", true);
        }
        else
        {
            if (!string.IsNullOrEmpty(Request["comid"]))
            {
                compId = Convert.ToInt32(Request["comid"]);
            }

            if (!string.IsNullOrWhiteSpace(Request["goodsId"]))
            {
                goodsId = Convert.ToInt32(Request["goodsId"]);
            }
            if (!string.IsNullOrWhiteSpace(Request["goodsInfoId"]))
            {
                goodsInfoId = Convert.ToInt32(Request["goodsInfoId"]);
            }
            if (!string.IsNullOrWhiteSpace(Request["ycid"]))
            {
                this.hidycId.Value = Request["ycid"].ToString();

                Hi.Model.YZT_CMerchants cmModel = new Hi.BLL.YZT_CMerchants().GetModel(Request["ycid"].ToString().ToInt(0));
                if (cmModel != null)
                {
                    this.hidycId.Attributes.Add("yc-tip", cmModel.CompID.ToString());

                    // 判断是否厂商自己申请自己
                    LoginModel uModel = null;
                    if (HttpContext.Current.Session["UserModel"] is LoginModel)
                    {
                        uModel = HttpContext.Current.Session["UserModel"] as LoginModel;
                        if (LoginModel.GetUserCompID(uModel.UserID.ToString()) == cmModel.CompID)
                        {
                            yc_CompT = "1";
                        }
                    }
                }
                this.hidCompId.Value = Request["comid"].ToString();
            }
            if (goodsInfoId != 0)
            {
                Hi.Model.BD_GoodsInfo info = new Hi.BLL.BD_GoodsInfo().GetModel(goodsInfoId);
                goodsId = info == null ? 0 : info.GoodsID;
            }
            if (!string.IsNullOrWhiteSpace(Request["page"]))
            {
                page = Convert.ToInt32(Request["page"]);
            }
        }
    }
Exemplo n.º 11
0
    /// <summary>
    /// 商品基本价格
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public decimal GoodsPrice(string id)
    {
        decimal name = 0;

        Hi.Model.BD_GoodsInfo model = new Hi.BLL.BD_GoodsInfo().GetModel(Convert.ToInt32(id));
        if (model != null)
        {
            name = model.TinkerPrice;
        }
        return(name);
    }
Exemplo n.º 12
0
    public string disBings(string OrderOutDetailID = "")
    {
        StringBuilder strwhere = new StringBuilder();

        if (!Util.IsEmpty(OrderOutDetailID))
        {
            strwhere.AppendFormat(" and d.id in(" + OrderOutDetailID + ")");
        }
        DataTable dt = new Hi.BLL.BD_GoodsInfo().getDisGoodsStock(strwhere.ToString()).Tables[0];

        return(ConvertJson.ToJson(dt));
    }
Exemplo n.º 13
0
 /// <summary>
 /// 商品编号
 /// </summary>
 /// <param name="infoID"></param>
 /// <returns></returns>
 public string GoodsInfoPCode(string infoID)
 {
     if (infoID.ToString() != "")
     {
         Hi.Model.BD_GoodsInfo info = new Hi.BLL.BD_GoodsInfo().GetModel(infoID.ToInt(0));
         if (info != null && info.BarCode != null)
         {
             return(info.BarCode.ToString());
         }
     }
     return("");
 }
Exemplo n.º 14
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"));
    }
Exemplo n.º 15
0
    public string GetGoodsInfoID(string GoodsID)
    {
        string goodsinfoid = new Hi.BLL.BD_GoodsInfo().GetGoodsInfoID(GoodsID);

        if (goodsinfoid != "")
        {
            return(goodsinfoid);
        }
        else
        {
            return("");
        }
    }
Exemplo n.º 16
0
    public string disBings(string goodsinfoid = "")
    {
        StringBuilder strwhere = new StringBuilder();

        //启用库存
        // strwhere.AppendFormat(" and a.compid=" + this.CompID );
        if (!Util.IsEmpty(goodsinfoid))
        {
            strwhere.AppendFormat(" and a.id in(" + goodsinfoid + ")");
        }
        DataTable dt = new Hi.BLL.BD_GoodsInfo().GetGoodsModel(strwhere.ToString()).Tables[0];

        return(ConvertJson.ToJson(dt));
    }
Exemplo n.º 17
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");
        }
    }
Exemplo n.º 18
0
    /// <summary>
    /// 获取商品最新价格
    /// </summary>
    /// <param name="GoodsinfoID"></param>
    /// <param name="DisId"></param>
    /// <param name="CompId"></param>
    /// <returns></returns>
    public static decimal GoodsNewPrice(int GoodsinfoID, int DisId, int CompId)
    {
        decimal TinkerPrice = 0;

        //获取商品信息
        Hi.Model.BD_GoodsInfo goodsinfoModel = new Hi.BLL.BD_GoodsInfo().GetModel(GoodsinfoID);

        if (goodsinfoModel != null)
        {
            //判断商品是否上架
            if (goodsinfoModel.IsOffline != 1)
            {
                return(0);
            }

            //判断是否存在促销活动 优先取促销活动价
            if (Common.GetPro(goodsinfoModel.GoodsID.ToString(), goodsinfoModel.ID.ToString(), CompId.ToString()) == 0)
            {
                //判断是否启用代理商价格维护
                if (Common.IsDisPrice != "0")
                {
                    List <Hi.Model.BD_GoodsPrice> pl = new Hi.BLL.BD_GoodsPrice().GetList("top 1 *", "DisID=" + DisId + " and CompID=" + CompId + " and GoodsInfoID=" + GoodsinfoID + " and IsEnabled=1 and ISNULL(dr,0)=0", "");

                    if (pl != null && pl.Count > 0)
                    {
                        TinkerPrice = pl[0].TinkerPrice.ToString() == "" ? goodsinfoModel.TinkerPrice : pl[0].TinkerPrice;;
                    }
                    else
                    {
                        TinkerPrice = goodsinfoModel.TinkerPrice;
                    }
                }
                else
                {
                    TinkerPrice = goodsinfoModel.TinkerPrice;
                }
            }
            else
            {
                TinkerPrice = Common.GetProPrice(goodsinfoModel.GoodsID.ToString(), goodsinfoModel.ID.ToString(), CompId.ToString());
            }
            //判断是不是赠品
            //if (GoodsName(goodsinfoModel.GoodsID, "IsSale") == "1")
            //{
            //    TinkerPrice = 0;
            //}
        }
        return(TinkerPrice);
    }
Exemplo n.º 19
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);
    }
Exemplo n.º 20
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);
                }
            }
        }
    }
Exemplo n.º 21
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);
    }
Exemplo n.º 22
0
    /// <summary>
    /// 得到商品基础价格
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public decimal GoodsSalePrice(string id)
    {
        decimal price = 0;

        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)
            //{
            //    price = model2.SalePrice;
            //}
            price = model.SalePrice;
        }
        return(price);
    }
Exemplo n.º 23
0
    /// <summary>
    /// 修改库存
    /// </summary>
    /// <param name="inventory"></param>
    /// <returns></returns>
    public string UpdateInventory(string inventory, string id)
    {
        Hi.Model.BD_GoodsInfo model = new Hi.BLL.BD_GoodsInfo().GetModel(Convert.ToInt32(id));
        model.Inventory  = Convert.ToDecimal(inventory);
        model.modifyuser = this.UserID;
        model.ts         = DateTime.Now;
        bool bol = new Hi.BLL.BD_GoodsInfo().Update(model);

        if (bol)
        {
            return(inventory);
        }
        else
        {
            return("");
        }
    }
Exemplo n.º 24
0
    public string GoodsinfoModel(string Id)
    {
        Hi.Model.BD_GoodsInfo infomodel = new Hi.BLL.BD_GoodsInfo().GetModel(Id.ToInt(0));

        if (infomodel == null)
        {
            return("");
        }
        if (!infomodel.IsEnabled)
        {
            return("");
        }
        if (infomodel.IsOffline == 0)
        {
            return("");
        }
        return("1");
    }
Exemplo n.º 25
0
    /// <summary>
    /// 选择商品
    /// </summary>
    /// <returns></returns>
    public string disBing(string goodsinfoid = "", string disid = "", string str = "")
    {
        StringBuilder strwhere  = new StringBuilder();
        StringBuilder strwhere1 = new StringBuilder();

        //启用库存
        // strwhere.AppendFormat(" and a.compid=" + this.CompID );
        if (!Util.IsEmpty(goodsinfoid))
        {
            strwhere.AppendFormat(" and a.id in(" + goodsinfoid + ")");
            strwhere1.AppendFormat(" and c.GoodsID in(" + goodsinfoid + ")");
        }
        if (!Util.IsEmpty(disid))
        {
            //if (str == "CM")
            //{
            strwhere1.AppendFormat(" and f.DisID=" + disid);
            //}
        }

        DataTable dt = new Hi.BLL.BD_GoodsInfo().getGoodsModels(strwhere.ToString()).Tables[0];

        if (dt != null && dt.Rows.Count > 0)
        {
            DataTable fcdt = new Hi.BLL.BD_GoodsInfo().getGoodsCMerchants(strwhere1.ToString()).Tables[0];

            if (fcdt != null && fcdt.Rows.Count > 0)
            {
                foreach (DataRow item in fcdt.Rows)
                {
                    DataRow[] dr = dt.Select(" Id=" + item["GoodsID"]);
                    if (dr.Length > 0)
                    {
                        dr[0]["FirstCampID"]  = item["FirstCampID"];
                        dr[0]["htid"]         = item["htid"];
                        dr[0]["HospitalName"] = item["HospitalName"];
                        dr[0]["AreaID"]       = item["AreaID"];
                        dr[0]["AreaName"]     = item["AreaName"];
                    }
                }
            }
        }
        return(ConvertJson.ToJson(dt));
    }
Exemplo n.º 26
0
    /// <summary>
    /// 最新价格
    /// </summary>
    /// <returns></returns>
    public string GoodsTinkerPrice(int id, string disId, string tinkerprice)
    {
        Hi.Model.BD_GoodsInfo model = new Hi.BLL.BD_GoodsInfo().GetModel(id);
        if (model != null)
        {
            tinkerprice = model.TinkerPrice.ToString();
        }
        string price = tinkerprice.ToString();

        List <Hi.Model.BD_GoodsPrice> l = new Hi.BLL.BD_GoodsPrice().GetList("", "isnull(dr,0)=0 and isenabled=1 and goodsinfoid =" + id + " and disId=" + disId + " and compId=" + this.CompID, "id desc");

        if (l.Count > 0)
        {
            foreach (Hi.Model.BD_GoodsPrice item in l)
            {
                price = item.TinkerPrice.ToString();
            }
        }
        return(price);
    }
Exemplo n.º 27
0
    /// <summary>
    /// 调整价格
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public string UpdateGoodsInfo(string id, string price)
    {
        string str = string.Empty;

        Hi.Model.BD_GoodsInfo model = new Hi.BLL.BD_GoodsInfo().GetModel(Convert.ToInt32(id));
        if (model != null)
        {
            if (!Util.IsEmpty(price))
            {
                model.TinkerPrice = Convert.ToDecimal(price);
            }
            model.ts         = DateTime.Now;
            model.modifyuser = this.UserID;
            bool bol = new Hi.BLL.BD_GoodsInfo().Update(model);
            if (bol)
            {
                str = "cg";
            }
        }
        return(str);
    }
Exemplo n.º 28
0
    /// <summary>
    /// 获取价格
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public string GetProPrice2(string values, string comPid, string goodsId)
    {
        string sysNameWhere = string.Format(" CompID={0} and Name='是否店铺开放价格'", Request["Comid"].ToInt(0));
        List <Hi.Model.SYS_SysName> Sysl = new Hi.BLL.SYS_SysName().GetList("", sysNameWhere, "");

        string     str   = "暂无价格";
        LoginModel model = HttpContext.Current.Session["UserModel"] as LoginModel;

        Hi.Model.BD_Goods goodsModel = new Hi.BLL.BD_Goods().GetModel(Convert.ToInt32(goodsId));
        if (model == null || goodsModel.CompID != model.CompID)
        {
            if (Sysl.Count > 0)
            {
                if (Sysl[0].Value != "1")
                {
                    if (goodsModel.IsLS != 0)
                    {
                        return(goodsModel.LSPrice.ToString("#0.00"));
                    }
                    return("代理商可见");
                }
            }
            else
            {
                if (goodsModel.IsLS != 0)
                {
                    return(goodsModel.LSPrice.ToString("#0.00"));
                }
                return("代理商可见");
            }
        }
        List <Hi.Model.BD_GoodsInfo> lll = new Hi.BLL.BD_GoodsInfo().GetList("", "isnull(dr,0)=0 and isoffline=1 and compId=" + comPid + " and goodsid=" + goodsId, "");

        if (lll.Count != 0)
        {
            return(BLL.Common.GetGoodsPrice(Convert.ToInt32(comPid), Convert.ToInt32(comPid), Convert.ToInt32(lll[0].ID)).ToString("0.00"));
        }
        return("站务价格");
    }
Exemplo n.º 29
0
    /// <summary>
    /// 得到商品描述
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public string Goodsmemo(string id)
    {
        string name = string.Empty;

        Hi.Model.BD_GoodsInfo model = new Hi.BLL.BD_GoodsInfo().GetModel(Convert.ToInt32(id));
        if (model != null)
        {
            if (model.ValueInfo != "")
            {
                name = model.ValueInfo;
            }
            else
            {
                Hi.Model.BD_Goods model2 = new Hi.BLL.BD_Goods().GetModel(model.GoodsID);
                if (model2 != null)
                {
                    name = model2.memo;
                }
            }
        }
        return(name);
    }
Exemplo n.º 30
0
    protected void Page_Load(object sender, EventArgs e)
    {
        object obje = Request["action"];

        if (obje != null)
        {
            if (obje.ToString() == "price")          //获取价格
            {
                string valuelist = Request["value"]; //属性值列表
                Response.Write(GetProPrice(valuelist));
                Response.End();
            }
            if (obje.ToString() == "code")           //商品编码
            {
                string valuelist = Request["value"]; //属性值列表
                Response.Write(GetGoodsCode(valuelist));
                Response.End();
            }
        }
        if (!IsPostBack)
        {
            object obj2 = Common.DesDecrypt(Request["goodsId"], Common.EncryptKey);
            if (obj2 != null)
            {
                goodsId = Convert.ToInt32(obj2);
            }
            object obj3 = Request.QueryString["goodsInfoId"];
            if (obj3 != null)
            {
                goodsInfoId = Convert.ToInt32(obj3);
            }
            if (goodsId == 0)// || goodsInfoId == 0)
            {
                JScript.AlertMethod(this, "商品信息不存在!", JScript.IconOption.正确, "function (){ location.replace('" + ("GoodsInfoList.aspx") + "'); }");
                return;
            }
            List <Hi.Model.BD_ImageList> Imgl = new Hi.BLL.BD_ImageList().GetList("", "isnull(dr,0)=0 and compid=" + this.CompID + " and goodsId=" + goodsId, "");
            if (Imgl.Count > 0)
            {
                ImgShow.Visible   = false;
                rptImg.DataSource = Imgl;
                rptImg.DataBind();
            }
            else
            {
                ImgShow.Visible = true;
            }
            List <Hi.Model.BD_GoodsInfo> ll = new Hi.BLL.BD_GoodsInfo().GetList("", "isnull(dr,0)=0 and isenabled=1 and compid=" + this.CompID + " and goodsid=" + goodsId, ""); //Common.GetGoodsPrice(comPid, goodsId);//商品价格列表
            if (ll.Count > 0)
            {
                Session["price"] = Common.FillDataTable(ll);
            }
            GetGoodsLabels(goodsId); //商品标签
            Bind(goodsId);           //, goodsInfoId);
            if (Request["rtype"] + "" == "1")
            {
                atitle.InnerText = "商品库存";
                atitle.HRef      = "GoodsInfoList.aspx";
            }
        }
        DataBindLink();
    }