Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 49, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.修改 });

                this.navigation1.Routes.Add("回购申请", redirectURL);
                this.navigation1.Routes.Add("回购申请修改", string.Empty);

                if (string.IsNullOrEmpty(Request.QueryString["id"]))
                    Response.Redirect(redirectURL);

                repoApplyId = 0;
                if (!int.TryParse(Request.QueryString["id"], out repoApplyId))
                    Response.Redirect(redirectURL);

                this.hidrepoApplyId.Value = repoApplyId.ToString();

                NFMT.WareHouse.BLL.RepoApplyDetailBLL repoApplyDetailBLL = new NFMT.WareHouse.BLL.RepoApplyDetailBLL();
                NFMT.Common.ResultModel result = repoApplyDetailBLL.Load(user, repoApplyId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectURL);

                List<NFMT.WareHouse.Model.RepoApplyDetail> details = result.ReturnValue as List<NFMT.WareHouse.Model.RepoApplyDetail>;
                if(details== null)
                    Response.Redirect(redirectURL);

                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                foreach (NFMT.WareHouse.Model.RepoApplyDetail detail in details)
                {
                    sb.Append(detail.StockId);
                    if (details.IndexOf(detail) < details.Count - 1)
                        sb.Append(",");
                }
                this.hidsids.Value = sb.ToString();

                NFMT.WareHouse.BLL.RepoApplyBLL repoApplyBLL = new NFMT.WareHouse.BLL.RepoApplyBLL();
                result = repoApplyBLL.Get(user, repoApplyId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectURL);

                NFMT.WareHouse.Model.RepoApply repoApply = result.ReturnValue as NFMT.WareHouse.Model.RepoApply;
                if (repoApply == null)
                    Response.Redirect(redirectURL);

                NFMT.Operate.BLL.ApplyBLL applyBLL = new NFMT.Operate.BLL.ApplyBLL();
                result = applyBLL.Get(user, repoApply.ApplyId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectURL);

                apply = result.ReturnValue as NFMT.Operate.Model.Apply;

                this.hidDeptId.Value = apply.ApplyDept.ToString();
                this.txbMemo.Value = apply.ApplyDesc;

            }
        }
        public void ProcessRequest(HttpContext context)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            context.Response.ContentType = "text/plain";
            string resultStr = "添加失败";

            string sids = context.Request.Form["sids"];
            if (string.IsNullOrEmpty(sids))
            {
                resultStr = "请选择回购库存";
                context.Response.Write(resultStr);
                context.Response.End();
            }

            if (sids.Split(',').Length < 1)
            {
                resultStr = "请选择回购库存";
                context.Response.Write(resultStr);
                context.Response.End();
            }

            string memo = context.Request.Form["memo"];

            int deptId = 0;
            if (!string.IsNullOrEmpty(context.Request.Form["deptId"]))
            {
                if (!int.TryParse(context.Request.Form["deptId"], out deptId))
                {
                    resultStr = "部门错误";
                    context.Response.Write(resultStr);
                    context.Response.End();
                }
            }

            int repurApplyId = 0;
            if (!string.IsNullOrEmpty(context.Request.Form["aid"]))
            {
                if (!int.TryParse(context.Request.Form["aid"], out repurApplyId))
                {
                    resultStr = "参数错误";
                    context.Response.Write(resultStr);
                    context.Response.End();
                }
            }

            NFMT.WareHouse.BLL.RepoApplyBLL repoApplyBLL = new NFMT.WareHouse.BLL.RepoApplyBLL();
            NFMT.Common.ResultModel result = repoApplyBLL.Get(user, repurApplyId);
            if (result.ResultStatus != 0)
            {
                context.Response.Write(result.Message);
                context.Response.End();
            }

            NFMT.WareHouse.Model.RepoApply repoApply = result.ReturnValue as NFMT.WareHouse.Model.RepoApply;

            NFMT.Operate.BLL.ApplyBLL applyBLL = new NFMT.Operate.BLL.ApplyBLL();
            result = applyBLL.Get(user, repoApply.ApplyId);
            if (result.ResultStatus != 0)
            {
                context.Response.Write(string.Format("申请内容有误,{0}", result.Message));
                context.Response.End();
            }

            NFMT.Operate.Model.Apply apply = result.ReturnValue as NFMT.Operate.Model.Apply;
            apply.ApplyDesc = memo;
            apply.ApplyDept = deptId;

            result = applyBLL.Update(user, apply);
            if (result.ResultStatus != 0)
            {
                context.Response.Write(result.Message);
                context.Response.End();
            }

            result = repoApplyBLL.RepoApplyUpdateHandle(user, apply, new NFMT.WareHouse.Model.RepoApply() { RepoApplyId = repurApplyId }, sids);
            context.Response.Write(result.Message);
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            string redirectURL = string.Format("{0}WareHouse/RepoApplyList.aspx", NFMT.Common.DefaultValue.NftmSiteName);

            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 49, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.提交审核, NFMT.Common.OperateEnum.作废, NFMT.Common.OperateEnum.撤返, NFMT.Common.OperateEnum.确认完成, NFMT.Common.OperateEnum.确认完成撤销 });

                NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

                this.navigation1.Routes.Add("回购申请", redirectURL);
                this.navigation1.Routes.Add("回购申请明细", string.Empty);

                int aid = 0;
                if (!string.IsNullOrEmpty(Request.QueryString["aid"]))
                    int.TryParse(Request.QueryString["aid"], out aid);

                int id = 0;
                if (aid <= 0)
                {
                    if (string.IsNullOrEmpty(Request.QueryString["id"]))
                        Response.Redirect(redirectURL);
                    if (!int.TryParse(Request.QueryString["id"], out id))
                        Response.Redirect(redirectURL);
                }

                NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

                NFMT.WareHouse.BLL.RepoApplyBLL repoApplyBLL = new NFMT.WareHouse.BLL.RepoApplyBLL();
                if (aid > 0)
                    result = repoApplyBLL.GetByApplyId(user, aid);
                else
                    result = repoApplyBLL.Get(user, id);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectURL);

                this.hidid.Value = id.ToString();

                NFMT.WareHouse.Model.RepoApply repoApply = result.ReturnValue as NFMT.WareHouse.Model.RepoApply;
                if (repoApply == null)
                    Response.Redirect(redirectURL);

                this.repoId = repoApply.RepoApplyId;

                NFMT.WareHouse.BLL.RepoApplyDetailBLL repoApplyDetailBLL = new NFMT.WareHouse.BLL.RepoApplyDetailBLL();
                result = repoApplyDetailBLL.Load(user, repoApply.RepoApplyId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectURL);

                List<NFMT.WareHouse.Model.RepoApplyDetail> details = result.ReturnValue as List<NFMT.WareHouse.Model.RepoApplyDetail>;
                if (details == null)
                    Response.Redirect(redirectURL);

                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                foreach (NFMT.WareHouse.Model.RepoApplyDetail detail in details)
                {
                    sb.Append(detail.StockId);
                    if (details.IndexOf(detail) < details.Count - 1)
                        sb.Append(",");
                }
                this.stockIds = sb.ToString();

                NFMT.Operate.BLL.ApplyBLL applyBLL = new NFMT.Operate.BLL.ApplyBLL();
                result = applyBLL.Get(user, repoApply.ApplyId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectURL);

                apply = result.ReturnValue as NFMT.Operate.Model.Apply;
                if (apply == null)
                    Response.Redirect(redirectURL);

                NFMT.User.Model.Department dept = NFMT.User.UserProvider.Departments.SingleOrDefault(a => a.DeptId == apply.ApplyDept);
                if (dept == null)
                    Response.Redirect(redirectURL);

                NFMT.User.Model.Corporation corp = NFMT.User.UserProvider.Corporations.SingleOrDefault(a => a.CorpId == apply.ApplyCorp);
                if (corp == null)
                    Response.Redirect(redirectURL);

                this.txbApplyDept.InnerText = dept.DeptName;
                this.txbApplyCorp.InnerText = corp.CorpName;
                this.txbMemo.InnerText = apply.ApplyDesc;

                string json = serializer.Serialize(apply);
                this.hidmodel.Value = json;
            }
        }