Ejemplo n.º 1
0
        /// <summary>
        /// 加载新增Panel中的dropdownlist数据
        /// </summary>
        void LoadNewPanelDropDownList()
        {
            using (GoldEntities context = new GoldEntities())
            {
                //绑定型号
                var allModelList = (from r in context.Models orderby r.ModelName select new { r.ModelId, r.ModelName }).ToList();
                DropDownList_CargoModel.Items.Clear();
                DropDownList_CargoModel.DataTextField  = "ModelName";
                DropDownList_CargoModel.DataValueField = "ModelID";
                DropDownList_CargoModel.DataSource     = allModelList;
                DropDownList_CargoModel.DataBind();
                DropDownList_CargoModel.Items.Insert(0, new ListItem("", ""));

                //绑定规格
                var allSpecList = (from r in context.Specifications orderby r.SpecName select new { r.SpecId, r.SpecName }).ToList();
                DropDownList_CargoSpec.Items.Clear();
                DropDownList_CargoSpec.DataTextField  = "SpecName";
                DropDownList_CargoSpec.DataValueField = "SpecId";
                DropDownList_CargoSpec.DataSource     = allSpecList;
                DropDownList_CargoSpec.DataBind();
                DropDownList_CargoSpec.Items.Insert(0, new ListItem("", ""));

                //绑定可售状态
                List <NameValueModel> ListBinType = Gold.Utility.EnumData.GetEnumsList(typeof(Gold.Utility.EnumData.CargoSaleStatus));
                DropDownList_SaleStatus.Items.Clear();
                DropDownList_SaleStatus.DataTextField  = "Name";
                DropDownList_SaleStatus.DataValueField = "Value";
                DropDownList_SaleStatus.DataSource     = ListBinType;
                DropDownList_SaleStatus.DataBind();
                DropDownList_SaleStatus.Items.Insert(0, new ListItem("", ""));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 加载dropdownlist数据
        /// </summary>
        void LoadNewPanelDropDownList()
        {
            using (GoldEntities context = new GoldEntities())
            {
                //绑定型号
                var allModelList = (from r in context.Models orderby r.ModelName select new { r.ModelId, r.ModelName }).ToList();
                DropDownList_CargoModel.Items.Clear();
                DropDownList_CargoModel.DataTextField  = "ModelName";
                DropDownList_CargoModel.DataValueField = "ModelID";
                DropDownList_CargoModel.DataSource     = allModelList;
                DropDownList_CargoModel.DataBind();
                DropDownList_CargoModel.Items.Insert(0, new ListItem("", ""));

                //绑定规格
                var allSpecList = (from r in context.Specifications orderby r.SpecName select new { r.SpecId, r.SpecName }).ToList();
                DropDownList_CargoSpec.Items.Clear();
                DropDownList_CargoSpec.DataTextField  = "SpecName";
                DropDownList_CargoSpec.DataValueField = "SpecId";
                DropDownList_CargoSpec.DataSource     = allSpecList;
                DropDownList_CargoSpec.DataBind();
                DropDownList_CargoSpec.Items.Insert(0, new ListItem("", ""));

                //绑定仓库
                var result = (from r in context.WareHouse select new { r.WHCode, r.WHName }).OrderBy(r => r.WHCode).ToList();
                DropDownList_WHCode.Items.Clear();
                DropDownList_WHCode.DataTextField  = "WHName";
                DropDownList_WHCode.DataValueField = "WHCode";
                DropDownList_WHCode.DataSource     = result;
                DropDownList_WHCode.DataBind();
                DropDownList_WHCode.Items.Insert(0, new ListItem("", ""));
            }
        }
Ejemplo n.º 3
0
        private void LoadInfo(string ItemID)
        {
            using (GoldEntities context = new GoldEntities())
            {
                //绑定型号
                var allModelList = (from r in context.Models orderby r.ModelName select new { r.ModelId, r.ModelName }).ToList();
                DropDownList_CargoModel.Items.Clear();
                DropDownList_CargoModel.DataTextField  = "ModelName";
                DropDownList_CargoModel.DataValueField = "ModelID";
                DropDownList_CargoModel.DataSource     = allModelList;
                DropDownList_CargoModel.DataBind();
                DropDownList_CargoModel.Items.Insert(0, new ListItem("", ""));

                //绑定规格
                var allSpecList = (from r in context.Specifications orderby r.SpecName select new { r.SpecId, r.SpecName }).ToList();
                DropDownList_CargoSpec.Items.Clear();
                DropDownList_CargoSpec.DataTextField  = "SpecName";
                DropDownList_CargoSpec.DataValueField = "SpecId";
                DropDownList_CargoSpec.DataSource     = allSpecList;
                DropDownList_CargoSpec.DataBind();
                DropDownList_CargoSpec.Items.Insert(0, new ListItem("", ""));

                //绑定可售状态
                List <NameValueModel> ListBinType = Gold.Utility.EnumData.GetEnumsList(typeof(Gold.Utility.EnumData.CargoSaleStatus));
                DropDownList_SaleStatus.Items.Clear();
                DropDownList_SaleStatus.DataTextField  = "Name";
                DropDownList_SaleStatus.DataValueField = "Value";
                DropDownList_SaleStatus.DataSource     = ListBinType;
                DropDownList_SaleStatus.DataBind();


                //编辑状态下进入此页面时
                if (ItemID != "-1")
                {
                    Cargos existModel = (from r in context.Cargos where r.CargoCode == ItemID select r).FirstOrDefault();
                    if (existModel != null)
                    {
                        tbxCargoCode.Text = existModel.CargoCode;
                        tbxCargoName.Text = existModel.CargoName;

                        //设置选中项
                        DropDownList_CargoModel.SelectedIndex = DropDownList_CargoModel.Items.IndexOf(DropDownList_CargoModel.Items.FindByText(existModel.CargoModel.Trim()));
                        DropDownList_CargoSpec.SelectedIndex  = DropDownList_CargoSpec.Items.IndexOf(DropDownList_CargoSpec.Items.FindByText(existModel.CargoSpec.Trim()));

                        tbxUnits.Text = existModel.CargoUnits;
                        tbxYear.Text  = existModel.ProduceYear;

                        DropDownList_SaleStatus.SelectedIndex = DropDownList_SaleStatus.Items.IndexOf(DropDownList_SaleStatus.Items.FindByValue(existModel.SaleStatus == null ? "" : existModel.SaleStatus.Value.ToString()));
                        tbxPrice1.Text = existModel.Price1 == null ? "" : existModel.Price1.Value.ToString();
                        tbxPrice2.Text = existModel.Price2 == null ? "" : existModel.Price2.Value.ToString();
                        tbxPrice3.Text = existModel.Price3 == null ? "" : existModel.Price3.Value.ToString();
                        tbxPrice4.Text = existModel.Price4 == null ? "" : existModel.Price4.Value.ToString();
                        tbxPrice5.Text = existModel.Price5 == null ? "" : existModel.Price5.Value.ToString();

                        tbxComment.Text = existModel.Comment;
                    }
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 加载新增Panel中的dropdownlist数据
        /// </summary>
        void LoadNewPanelDropDownList()
        {
            try
            {
                using (GoldEntities context = new GoldEntities())
                {
                    ////绑定仓库
                    //var allWareHouse = (from r in context.WareHouse orderby r.WHCode select new { r.WHCode, r.WHName }).ToList();
                    //DropDownList_WareHouse.Items.Clear();
                    //DropDownList_WareHouse.DataTextField = "WHName";
                    //DropDownList_WareHouse.DataValueField = "WHCode";
                    //DropDownList_WareHouse.DataSource = allWareHouse;
                    //DropDownList_WareHouse.DataBind();
                    //DropDownList_WareHouse.Items.Insert(0, new ListItem("", ""));

                    ////绑定层位
                    //DropDownList_WareHouse_SelectedIndexChanged(DropDownList_WareHouse, new EventArgs());

                    //绑定型号
                    var allModelList = (from r in context.Models orderby r.ModelName select new { r.ModelId, r.ModelName }).ToList();
                    DropDownList_CargoModel.Items.Clear();
                    DropDownList_CargoModel.DataTextField  = "ModelName";
                    DropDownList_CargoModel.DataValueField = "ModelID";
                    DropDownList_CargoModel.DataSource     = allModelList;
                    DropDownList_CargoModel.DataBind();
                    DropDownList_CargoModel.Items.Insert(0, new ListItem("", ""));

                    //绑定规格
                    var allSpecList = (from r in context.Specifications orderby r.SpecName select new { r.SpecId, r.SpecName }).ToList();
                    DropDownList_CargoSpec.Items.Clear();
                    DropDownList_CargoSpec.DataTextField  = "SpecName";
                    DropDownList_CargoSpec.DataValueField = "SpecId";
                    DropDownList_CargoSpec.DataSource     = allSpecList;
                    DropDownList_CargoSpec.DataBind();
                    DropDownList_CargoSpec.Items.Insert(0, new ListItem("", ""));
                }
            }
            catch (Exception ex)
            {
                lblGridViewMsg.Text = "查询条件绑定数据时出现异常!" + Utility.LogHelper.GetExceptionMsg(ex);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 加载新增Panel中的dropdownlist数据
        /// </summary>
        void LoadNewPanelDropDownList()
        {
            using (GoldEntities context = new GoldEntities())
            {
                //绑定型号
                var allModelList = (from r in context.Models orderby r.ModelName select new { r.ModelId, r.ModelName }).ToList();
                DropDownList_CargoModel.Items.Clear();
                DropDownList_CargoModel.DataTextField  = "ModelName";
                DropDownList_CargoModel.DataValueField = "ModelID";
                DropDownList_CargoModel.DataSource     = allModelList;
                DropDownList_CargoModel.DataBind();
                DropDownList_CargoModel.Items.Insert(0, new ListItem("", ""));

                //绑定规格
                var allSpecList = (from r in context.Specifications orderby r.SpecName select new { r.SpecId, r.SpecName }).ToList();
                DropDownList_CargoSpec.Items.Clear();
                DropDownList_CargoSpec.DataTextField  = "SpecName";
                DropDownList_CargoSpec.DataValueField = "SpecId";
                DropDownList_CargoSpec.DataSource     = allSpecList;
                DropDownList_CargoSpec.DataBind();
                DropDownList_CargoSpec.Items.Insert(0, new ListItem("", ""));

                //绑定仓库
                var result = (from r in context.WareHouse select new { r.WHCode, r.WHName }).OrderBy(r => r.WHCode).ToList();
                DropDownList_WHCode.Items.Clear();
                DropDownList_WHCode.DataTextField  = "WHName";
                DropDownList_WHCode.DataValueField = "WHCode";
                DropDownList_WHCode.DataSource     = result;
                DropDownList_WHCode.DataBind();
                DropDownList_WHCode.Items.Insert(0, new ListItem("", ""));

                //绑定是否低于安全库存量状态
                List <NameValueModel> ListIsUnderSafeLine = Gold.Utility.EnumData.GetEnumsList(typeof(Gold.Utility.EnumData.IsUnderSafeLine));
                DropDownList_IsUnderSafe.Items.Clear();
                DropDownList_IsUnderSafe.DataTextField  = "Name";
                DropDownList_IsUnderSafe.DataValueField = "Value";
                DropDownList_IsUnderSafe.DataSource     = ListIsUnderSafeLine;
                DropDownList_IsUnderSafe.DataBind();
                DropDownList_IsUnderSafe.Items.Insert(0, new ListItem("", ""));
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 加载新增Panel中的dropdownlist数据
        /// </summary>
        void LoadNewPanelDropDownList()
        {
            using (GoldEntities context = new GoldEntities())
            {
                //绑定型号
                var allModelList = (from r in context.Models orderby r.ModelName select new { r.ModelId, r.ModelName }).ToList();
                DropDownList_CargoModel.Items.Clear();
                DropDownList_CargoModel.DataTextField  = "ModelName";
                DropDownList_CargoModel.DataValueField = "ModelID";
                DropDownList_CargoModel.DataSource     = allModelList;
                DropDownList_CargoModel.DataBind();
                DropDownList_CargoModel.Items.Insert(0, new ListItem("", ""));

                //绑定规格
                var allSpecList = (from r in context.Specifications orderby r.SpecName select new { r.SpecId, r.SpecName }).ToList();
                DropDownList_CargoSpec.Items.Clear();
                DropDownList_CargoSpec.DataTextField  = "SpecName";
                DropDownList_CargoSpec.DataValueField = "SpecId";
                DropDownList_CargoSpec.DataSource     = allSpecList;
                DropDownList_CargoSpec.DataBind();
                DropDownList_CargoSpec.Items.Insert(0, new ListItem("", ""));

                //绑定仓库
                var result = (from r in context.WareHouse select new { r.WHCode, r.WHName }).OrderBy(r => r.WHCode).ToList();
                DropDownList_WHCode.Items.Clear();
                DropDownList_WHCode.DataTextField  = "WHName";
                DropDownList_WHCode.DataValueField = "WHCode";
                DropDownList_WHCode.DataSource     = result;
                DropDownList_WHCode.DataBind();
                DropDownList_WHCode.Items.Insert(0, new ListItem("", ""));

                string whCode = WebConfigHelper.Instance.GetAppSettingValue("DefaultWHCode");
                var    WHName = (from r in context.WareHouse where r.WHCode == whCode select r.WHName).FirstOrDefault();
                if (WHName != null)
                {
                    lblWHName.Text = WHName.ToString();
                }
            }
        }