Ejemplo n.º 1
0
        /// <summary>
        /// get moban chanpins
        /// </summary>
        /// <param name="moBanId"></param>
        /// <returns></returns>
        IList <EyouSoft.Model.MCaiGouMoBanChanPinInfo> GetMoBanChanPins(string moBanId)
        {
            IList <EyouSoft.Model.MCaiGouMoBanChanPinInfo> items = new List <EyouSoft.Model.MCaiGouMoBanChanPinInfo>();
            var cmd = _db.GetSqlStringCommand("SELECT A.*,B.Name AS ChanPinName,C.Name AS GysName,B.JiLiangDanWei,B.GuiGe,B.JiaGe2,B.PinPai  FROM tbl_CaiGouMoBanChanPin AS A INNER JOIN tbl_ChanPin AS B ON A.ChanPinId=B.ChanPinId INNER JOIN tbl_GongSi AS C ON C.GongSiId=A.GysId WHERE A.MoBanId=@MoBanId ORDER BY A.IdentityId ASC");

            _db.AddInParameter(cmd, "MoBanId", DbType.AnsiStringFixedLength, moBanId);

            using (var rdr = DbHelper.ExecuteReader(cmd, _db))
            {
                while (rdr.Read())
                {
                    var item = new EyouSoft.Model.MCaiGouMoBanChanPinInfo();
                    item.ChanPinId     = rdr["ChanPinId"].ToString();
                    item.ChanPinName   = rdr["ChanPinName"].ToString();
                    item.GysId         = rdr["GysId"].ToString();
                    item.GysName       = rdr["GysName"].ToString();
                    item.Id            = rdr["Id"].ToString();
                    item.ShuLiang      = rdr.GetDecimal(rdr.GetOrdinal("ShuLiang"));
                    item.JiLiangDanWei = rdr["JiLiangDanWei"].ToString();
                    item.GuiGe         = rdr["GuiGe"].ToString();
                    //item.ChanPinJiaGe = rdr.GetDecimal(rdr.GetOrdinal("JiaGe2"));
                    item.ChanPinPinPai = rdr["PinPai"].ToString();

                    items.Add(item);
                }
            }

            return(items);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// get form info
        /// </summary>
        /// <returns></returns>
        EyouSoft.Model.MCaiGouMoBanInfo GetFormInfo()
        {
            var info = new EyouSoft.Model.MCaiGouMoBanInfo();

            info.CaoZuoRenId = YongHuInfo.YongHuId;
            info.CgsId       = YongHuInfo.GongSiId;
            info.ChanPins    = new List <EyouSoft.Model.MCaiGouMoBanChanPinInfo>();
            info.IsMoRen     = false;
            info.IssueTime   = DateTime.Now;
            info.MoBanId     = EditId;
            info.Name        = Utils.GetFormValue(txtMoBanName.UniqueID);

            var txt_moban_gysid     = Utils.GetFormValues("txt_moban_gysid");
            var txt_moban_chanpinid = Utils.GetFormValues("txt_moban_chanpinid");
            var txt_moban_shuliang  = Utils.GetFormValues("txt_moban_shuliang");

            if (txt_moban_gysid.Length != txt_moban_chanpinid.Length ||
                txt_moban_gysid.Length != txt_moban_shuliang.Length)
            {
                Utils.RCWE_AJAX("0", "表单异常");
            }

            for (int i = 0; i < txt_moban_gysid.Length; i++)
            {
                var item = new EyouSoft.Model.MCaiGouMoBanChanPinInfo();

                item.GysId     = txt_moban_gysid[i];
                item.ChanPinId = txt_moban_chanpinid[i];
                item.ShuLiang  = Utils.GetDecimal(txt_moban_shuliang[i]);

                if (string.IsNullOrEmpty(item.GysId) ||
                    string.IsNullOrEmpty(item.ChanPinId))
                {
                    continue;
                }

                bool isExists = false;
                foreach (var item1 in info.ChanPins)
                {
                    if (item1.ChanPinId == item.ChanPinId)
                    {
                        isExists = true;
                    }
                }

                if (isExists)
                {
                    continue;
                }

                info.ChanPins.Add(item);
            }

            if (info.ChanPins == null ||
                info.ChanPins.Count == 0)
            {
                Utils.RCWE_AJAX("0", "至少要选择一个有效产品");
            }

            return(info);
        }