示例#1
0
 //批量删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("  store_allot_order", DTEnums.ActionEnum.Delete.ToString()); //检查权限
     int sucCount = 0;
     int errorCount = 0;
     BLL.AllotOrder bll = new BLL.AllotOrder();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
         if (cb.Checked)
         {
             if (bll.Delete(id))
             {
                 sucCount += 1;
             }
             else
             {
                 errorCount += 1;
             }
         }
     }
     AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除调拨单成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
     JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("  store_allot_order.aspx", "storein_order_id={0}&goods_id={1}&beginTime={2}&endTime={3}",
         this.storein_order_id.ToString(), this.goods_id.ToString(), this.beginTime.ToString(), this.endTime));
 }
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("  store_allot_order", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.AllotOrder bll = new BLL.AllotOrder();
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    if (bll.Delete(id))
                    {
                        sucCount += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }
            AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除调拨单成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("  store_allot_order.aspx", "storein_order_id={0}&goods_id={1}&beginTime={2}&endTime={3}",
                                                                                        this.storein_order_id.ToString(), this.goods_id.ToString(), this.beginTime.ToString(), this.endTime));
        }
        private bool DoAdd()
        {
            bool result = false;

            if (string.IsNullOrWhiteSpace(txtAllotTime.Text))
            {
                JscriptMsg("调拨时间不能为空!", "");
                return(false);
            }
            Model.AllotOrder model = new Model.AllotOrder();
            BLL.AllotOrder   bll   = new BLL.AllotOrder();

            model.AllotTime  = DateTime.Parse(txtAllotTime.Text);
            model.Admin      = txtAdmin.Text;
            model.Remark     = txtRemark.Text;
            model.Status     = 0;
            model.CreateTime = DateTime.Now;

            string[] storeInOrderIds = Request.Form.GetValues("StoreInOrderId");
            string[] storeInGoodsIds = Request.Form.GetValues("StoreInGoodsId");
            string[] sourceStoreIds  = Request.Form.GetValues("SourceStoreId");
            string[] purposeStoreIds = Request.Form.GetValues("PurposeStoreId");
            string[] allotCounts     = Request.Form.GetValues("AllotCount");
            string[] allotRemarks    = Request.Form.GetValues("AllotRemark");
            if (storeInOrderIds != null && storeInGoodsIds != null && sourceStoreIds != null &&
                purposeStoreIds != null && allotCounts != null && allotRemarks != null &&
                storeInOrderIds.Length > 0 && storeInGoodsIds.Length > 0 && sourceStoreIds.Length > 0 &&
                purposeStoreIds.Length > 0 && allotCounts.Length > 0 && allotRemarks.Length > 0)
            {
                for (int i = 0; i < storeInOrderIds.Length; i++)
                {
                    decimal allotCount;
                    int     storeInOrderId, storeInGoodsId, sourceStoreId, purposeStoreId;
                    if (int.TryParse(storeInOrderIds[i], out storeInOrderId) &&
                        int.TryParse(storeInGoodsIds[i], out storeInGoodsId) &&
                        int.TryParse(sourceStoreIds[i], out sourceStoreId) &&
                        int.TryParse(purposeStoreIds[i], out purposeStoreId) &&
                        decimal.TryParse(allotCounts[i], out allotCount))
                    {
                        model.AddAllotGoods(new AllotGoods(storeInOrderId, storeInGoodsId, sourceStoreId, purposeStoreId, allotCount, allotRemarks[i]));
                    }
                }
            }

            if (bll.Add(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加调拨货物:" + model.Id); //记录日志
                result = true;
            }
            return(result);
        }
        private void ShowInfo(int _id)
        {
            BLL.AllotOrder   bll   = new BLL.AllotOrder();
            Model.AllotOrder model = bll.GetModel(_id);

            txtAllotTime.Text = model.AllotTime.ToString("yyyy-MM-dd");
            txtAdmin.Text     = model.Admin;
            txtRemark.Text    = model.Remark;

            BLL.AllotGoods goodsVehicleBLL = new BLL.AllotGoods();
            DataTable      goodsVehicleDT  = goodsVehicleBLL.GetList(" and A.AllotOrderId = " + _id + "").Tables[0];

            this.rptAllotGoodsList.DataSource = goodsVehicleDT;
            this.rptAllotGoodsList.DataBind();
        }
        private void RptBind(string _strWhere, string _goodsby)
        {
            this.page         = DTRequest.GetQueryInt("page", 1);
            txtBeginTime.Text = this.beginTime;
            txtEndTime.Text   = this.endTime;
            BLL.AllotOrder bll = new BLL.AllotOrder();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _goodsby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("  store_allot_order.aspx", "storein_order_id={0}&goods_id={1}&beginTime={2}&endTime={3}&page={4}",
                                              this.storein_order_id.ToString(), this.goods_id.ToString(), this.beginTime.ToString(), this.endTime, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
示例#6
0
        private void RptBind(string _strWhere, string _goodsby)
        {
            this.page = DTRequest.GetQueryInt("page", 1);
            txtBeginTime.Text = this.beginTime;
            txtEndTime.Text = this.endTime;
            BLL.AllotOrder bll = new BLL.AllotOrder();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _goodsby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("  store_allot_order.aspx", "storein_order_id={0}&goods_id={1}&beginTime={2}&endTime={3}&page={4}",
                this.storein_order_id.ToString(), this.goods_id.ToString(), this.beginTime.ToString(), this.endTime, "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
        private void ShowInfo(int _id)
        {
            BLL.AllotOrder bll = new BLL.AllotOrder();
            Model.AllotOrder model = bll.GetModel(_id);

            txtAllotTime.Text = model.AllotTime.ToString("yyyy-MM-dd");
            txtAdmin.Text = model.Admin;
            txtRemark.Text = model.Remark;

            BLL.AllotGoods goodsVehicleBLL = new BLL.AllotGoods();
            DataTable goodsVehicleDT = goodsVehicleBLL.GetList(" and A.AllotOrderId = " + _id + "").Tables[0];
            this.rptAllotGoodsList.DataSource = goodsVehicleDT;
            this.rptAllotGoodsList.DataBind();
        }
        private bool DoEdit(int _id)
        {
            bool result = false;
            if (string.IsNullOrWhiteSpace(txtAllotTime.Text))
            {
                JscriptMsg("调拨时间不能为空!", "");
                return false;
            }
            BLL.AllotOrder bll = new BLL.AllotOrder();
            Model.AllotOrder model = bll.GetModel(_id);

            model.AllotTime = DateTime.Parse(txtAllotTime.Text);
            model.Admin = txtAdmin.Text;
            model.Remark = txtRemark.Text;

            string[] storeInOrderIds = Request.Form.GetValues("StoreInOrderId");
            string[] storeInGoodsIds = Request.Form.GetValues("StoreInGoodsId");
            string[] sourceStoreIds = Request.Form.GetValues("SourceStoreId");
            string[] purposeStoreIds = Request.Form.GetValues("PurposeStoreId");
            string[] allotCounts = Request.Form.GetValues("AllotCount");
            string[] allotRemarks = Request.Form.GetValues("AllotRemark");
            if (storeInOrderIds != null && storeInGoodsIds != null && sourceStoreIds != null
                && purposeStoreIds != null && allotCounts != null && allotRemarks != null
                && storeInOrderIds.Length > 0 && storeInGoodsIds.Length > 0 && sourceStoreIds.Length > 0
                && purposeStoreIds.Length > 0 && allotCounts.Length > 0 && allotRemarks.Length > 0)
            {
                for (int i = 0; i < storeInOrderIds.Length; i++)
                {
                    decimal allotCount;
                    int storeInOrderId, storeInGoodsId, sourceStoreId, purposeStoreId;
                    if (int.TryParse(storeInOrderIds[i], out storeInOrderId)
                        && int.TryParse(storeInGoodsIds[i], out storeInGoodsId)
                        && int.TryParse(sourceStoreIds[i], out sourceStoreId)
                        && int.TryParse(purposeStoreIds[i], out purposeStoreId)
                        && decimal.TryParse(allotCounts[i], out allotCount))
                    {
                        model.AddAllotGoods(new AllotGoods(storeInOrderId, storeInGoodsId, sourceStoreId, purposeStoreId, allotCount, allotRemarks[i]));
                    }
                }
            }

            if (bll.Update(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改调拨货物信息:" + model.Id); //记录日志
                result = true;
            }
            return result;
        }