/// <summary> /// 绑定采购状态 /// </summary> protected void BindApplyState() { RcbApplyState.DataSource = ApplyStockStateList.Where(act => act.Key >= (int)ApplyStockState.Obligation).ToDictionary(act => act.Key, a => a.Value); RcbApplyState.DataBind(); RcbApplyState.Items.Insert(0, new RadComboBoxItem("全部", string.Empty)); if (!IsPostBack) { RcbApplyState.SelectedValue = string.Format("{0}", (int)ApplyStockState.Applying); } }
/// <summary> /// 门店采购申请数据源 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void RgApplyStockListNeedDataSource(object sender, GridNeedDataSourceEventArgs e) { Guid filialeID = string.IsNullOrEmpty(RcbShopFrontList.SelectedValue) ? Guid.Empty : new Guid(RcbShopFrontList.SelectedValue); int applyStockState = string.IsNullOrEmpty(RcbApplyState.SelectedValue) ? -1 : Convert.ToInt32(RcbApplyState.SelectedValue); List <int> states = !IsPostBack ? new List <int> { (int)ApplyStockState.Applying, (int)ApplyStockState.Delivering } : applyStockState == -1 ? new List <int>() : new List <int> { applyStockState }; if (applyStockState == -1) { if (IsPostBack && (string.IsNullOrEmpty(RcbShopFrontList.SelectedValue) || RcbShopFrontList.SelectedValue == Guid.Empty.ToString())) { states = ApplyStockStateList.Where(act => act.Key >= (int)ApplyStockState.Obligation).Select( act => act.Key).ToList(); } } var goodsIds = new List <Guid>(); if (!string.IsNullOrEmpty(RtbGoodsName.Text)) { goodsIds = _goodsCenterSao.GetRealGoodsIdListByGoodsNameOrCode(RtbGoodsName.Text).ToList(); } string tradeCode = RtbSearchKey.Text.Trim(); DateTime startTime = RdpStartTime.SelectedDate ?? DateTime.MinValue; DateTime endTime = RdpEndTime.SelectedDate ?? DateTime.MinValue; int purchaseType = int.Parse(RcbPurchaseType.SelectedValue); if (endTime <= DateTime.MinValue) { endTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); } if (startTime <= DateTime.MinValue || startTime >= endTime) { startTime = endTime.AddMonths(-6); } endTime = endTime.AddDays(1).AddMinutes(-1); var dataList = _applyStockDal.GetApplyStockList(filialeID, purchaseType, states, startTime, endTime, tradeCode, goodsIds); RgApplyStockList.DataSource = dataList; }