/// <summary> /// 加载dropdownlist数据 /// </summary> void LoadNewPanelDropDownList() { using (GoldEntities context = new GoldEntities()) { //绑定存提状态 List <NameValueModel> ListPickOrStore = Gold.Utility.EnumData.GetEnumsList(typeof(Gold.Utility.EnumData.PickOrStore)); DropDownList_StorePickType.Items.Clear(); DropDownList_StorePickType.DataTextField = "Name"; DropDownList_StorePickType.DataValueField = "Value"; DropDownList_StorePickType.DataSource = ListPickOrStore; DropDownList_StorePickType.DataBind(); DropDownList_StorePickType.Items.Insert(0, new ListItem("", "")); //绑定盈亏状态 List <NameValueModel> ListIsProfitOrLoss = Gold.Utility.EnumData.GetEnumsList(typeof(Gold.Utility.EnumData.IsProfitOrLoss)); DropDownList_IsProfitOrLoss.Items.Clear(); DropDownList_IsProfitOrLoss.DataTextField = "Name"; DropDownList_IsProfitOrLoss.DataValueField = "Value"; DropDownList_IsProfitOrLoss.DataSource = ListIsProfitOrLoss; DropDownList_IsProfitOrLoss.DataBind(); DropDownList_IsProfitOrLoss.Items.Insert(0, new ListItem("", "")); //绑定包装 var result = (from r in context.Packages select new { r.PackageId, r.PackageName }).OrderBy(r => r.PackageName).ToList(); DropDownList_PackageName.Items.Clear(); DropDownList_PackageName.DataTextField = "PackageName"; DropDownList_PackageName.DataValueField = "PackageId"; DropDownList_PackageName.DataSource = result; DropDownList_PackageName.DataBind(); DropDownList_PackageName.Items.Insert(0, new ListItem("", "")); //绑定仓库 var resultWH = (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 = resultWH; DropDownList_WHCode.DataBind(); DropDownList_WHCode.Items.Insert(0, new ListItem("", "")); } }
/// <summary> /// 加载新增Panel中的dropdownlist数据 /// </summary> void LoadNewPanelDropDownList() { using (GoldEntities context = new GoldEntities()) { //绑定包装 查询 var result = (from r in context.Packages select new { r.PackageId, r.PackageName }).OrderBy(r => r.PackageName).ToList(); DropDownList_PackageName.Items.Clear(); DropDownList_PackageName.DataTextField = "PackageName"; DropDownList_PackageName.DataValueField = "PackageId"; DropDownList_PackageName.DataSource = result; DropDownList_PackageName.DataBind(); DropDownList_PackageName.Items.Insert(0, new ListItem("", "")); //绑定包装 新增 DropDownListNewPackage.Items.Clear(); DropDownListNewPackage.DataTextField = "PackageName"; DropDownListNewPackage.DataValueField = "PackageId"; DropDownListNewPackage.DataSource = result; DropDownListNewPackage.DataBind(); DropDownListNewPackage.Items.Insert(0, new ListItem("", "")); //绑定仓库 查询 var resultWH = (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 = resultWH; DropDownList_WHCode.DataBind(); DropDownList_WHCode.Items.Insert(0, new ListItem("", "")); //绑定仓库 新增 DropDownListNewWHCode.Items.Clear(); DropDownListNewWHCode.DataTextField = "WHName"; DropDownListNewWHCode.DataValueField = "WHCode"; DropDownListNewWHCode.DataSource = resultWH; DropDownListNewWHCode.DataBind(); DropDownListNewWHCode.Items.Insert(0, new ListItem("", "")); } }
private void LoadInfo(string ItemID) { using (GoldEntities context = new GoldEntities()) { //绑定存提状态 List <NameValueModel> ListPickOrStore = Gold.Utility.EnumData.GetEnumsList(typeof(Gold.Utility.EnumData.PickOrStore)); DropDownList_StorePickType.Items.Clear(); DropDownList_StorePickType.DataTextField = "Name"; DropDownList_StorePickType.DataValueField = "Value"; DropDownList_StorePickType.DataSource = ListPickOrStore; DropDownList_StorePickType.DataBind(); DropDownList_StorePickType.Items.Insert(0, new ListItem("", "")); //绑定包装 var result = (from r in context.Packages select new { r.PackageId, r.PackageName }).OrderBy(r => r.PackageName).ToList(); DropDownList_PackageName.Items.Clear(); DropDownList_PackageName.DataTextField = "PackageName"; DropDownList_PackageName.DataValueField = "PackageId"; DropDownList_PackageName.DataSource = result; DropDownList_PackageName.DataBind(); DropDownList_PackageName.Items.Insert(0, new ListItem("", "")); //绑定仓库 var resultWH = (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 = resultWH; DropDownList_WHCode.DataBind(); DropDownList_WHCode.Items.Insert(0, new ListItem("", "")); //编辑状态下进入此页面时 if (ItemID != "-1") { tbxCargoCode.Enabled = false; tbxCargoName.Enabled = false; btnSelectCargo1.Enabled = false; btnSelectCargo2.Enabled = false; DropDownList_WHCode.Enabled = false; DropDownList_StorePickType.Enabled = false; btnAccountNumberOld.Visible = false; btnComputeNewNumber.Visible = false; tbxStorePickNumber.Enabled = false; tbxAccountNumberNew.Enabled = false; tbxFactCheckNumberNew.Enabled = false; tbxIsProfitOrLostNew.Enabled = false; int ItemIDInt = int.Parse(ItemID); StorePickAccount existModel = (from r in context.StorePickAccount where r.StockPickAccountID == ItemIDInt select r).FirstOrDefault(); if (existModel != null) { string storePickType = existModel.StorePickType; DropDownList_StorePickType.SelectedIndex = DropDownList_StorePickType.Items.IndexOf(DropDownList_StorePickType.Items.FindByValue(storePickType)); tbxStorePickNumber.Text = existModel.StorePickNumber.ToString(); DropDownList_WHCode.SelectedIndex = DropDownList_WHCode.Items.IndexOf(DropDownList_WHCode.Items.FindByValue(existModel.WHCode)); tbxCargoCode.Text = existModel.CargoCode; tbxCargoName.Text = existModel.CargoName; tbxStorePickNumber.Text = existModel.StorePickNumber.ToString(); tbxAccountNumberOld.Text = existModel.AccountNumber.ToString(); tbxFactCheckNumberOld.Text = existModel.FactCheckNumber.ToString(); tbxIsProfitOrLostOld.Text = existModel.IsProfitOrLoss.ToString(); //编辑时数据一致 tbxAccountNumberNew.Text = existModel.AccountNumber.ToString(); tbxFactCheckNumberNew.Text = existModel.FactCheckNumber.ToString(); tbxIsProfitOrLostNew.Text = existModel.IsProfitOrLoss.ToString(); DropDownList_PackageName.SelectedIndex = DropDownList_PackageName.Items.IndexOf(DropDownList_PackageName.Items.FindByText(existModel.PackageName)); tbxPackageCount.Text = existModel.PackageCount.Value.ToString(); tbxStandardCountEachBag.Text = existModel.StandardCountEachBag.Value.ToString(); tbxPackageNoStart.Text = existModel.PackageNoStart; tbxPackageNoEnd.Text = existModel.PackageNoEnd; tbxStoreDescription.Text = existModel.StoreDescription; tbxRemark.Text = existModel.Remark; tbxPackageLockNo.Text = existModel.PackageLockNo; tbxPackageShareNo.Text = existModel.PackageShareNo; tbxRecordDetail.Text = existModel.RecordDetail; lblRecordTime.Text = existModel.RecordTime.ToString(); lblRecordMonth.Text = existModel.RecordMonth; } } } }