protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string redirectUrl = string.Format("{0}User/CorporationList.aspx", NFMT.Common.DefaultValue.NftmSiteName);
                NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
                NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 16, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.冻结, NFMT.Common.OperateEnum.解除冻结 });

                this.navigation1.Routes.Add("企业管理", redirectUrl);
                this.navigation1.Routes.Add("客户明细", string.Empty);

                NFMT.User.BLL.CorporationDetailBLL corporationDetailBLL = new NFMT.User.BLL.CorporationDetailBLL();
                //int detailId = 0;
                int corpId = 0;
                //if (!string.IsNullOrEmpty(Request.QueryString["detailId"]) && int.TryParse(Request.QueryString["detailId"], out detailId))
                //{
                //    result = corporationDetailBLL.Get(user, detailId);
                //    NFMT.User.Model.CorporationDetail corporationDetail = result.ReturnValue as NFMT.User.Model.CorporationDetail;
                //    if (corporationDetail == null)
                //        Response.Redirect(redirectUrl);
                //    corpId = corporationDetail.CorpId;
                //}

                //if (detailId == 0)
                //{
                    if (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out corpId))
                        Response.Redirect(redirectUrl);
                //}

                NFMT.User.BLL.CorporationBLL corporationBLL = new NFMT.User.BLL.CorporationBLL();
                result = corporationBLL.Get(user, corpId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                corporation = result.ReturnValue as NFMT.User.Model.Corporation;
                if (corporation == null)
                    Response.Redirect(redirectUrl);

                result = corporationDetailBLL.GetByCorpId(user, corpId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                corpDetail = result.ReturnValue as NFMT.User.Model.CorporationDetail;
                if (corpDetail == null)
                    Response.Redirect(redirectUrl);

                System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                string json = serializer.Serialize(corporation);
                this.hidModel.Value = json;
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

            string corpStr = context.Request.Form["corp"];
            if (string.IsNullOrEmpty(corpStr))
            {
                context.Response.Write("公司主信息不能为空");
                context.Response.End();
            }

            string corpDetailStr = context.Request.Form["corpDetail"];
            if (string.IsNullOrEmpty(corpDetailStr))
            {
                context.Response.Write("公司明细不能为空");
                context.Response.End();
            }

            try
            {
                System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                NFMT.User.Model.Corporation corp = serializer.Deserialize<NFMT.User.Model.Corporation>(corpStr);
                NFMT.User.Model.CorporationDetail corpDetail = serializer.Deserialize<NFMT.User.Model.CorporationDetail>(corpDetailStr);
                if (corp == null || corpDetail == null)
                {
                    context.Response.Write("数据错误");
                    context.Response.End();
                }
                NFMT.User.BLL.CorporationDetailBLL bll = new NFMT.User.BLL.CorporationDetailBLL();
                result = bll.Update(user, corp, corpDetail);
                if (result.ResultStatus == 0)
                    result.Message = "客户修改成功";
            }
            catch (Exception ex)
            {
                result.ResultStatus = -1;
                result.Message = ex.Message;
            }

            context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
        }
        public void ProcessRequest(HttpContext context)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            context.Response.ContentType = "text/plain";
            int id = 0;//corpId
            int operateId = 0;

            if (!int.TryParse(context.Request.Form["id"], out id) || id <= 0)
            {
                context.Response.Write("序号错误");
                context.Response.End();
            }

            if (!int.TryParse(context.Request.Form["oi"], out operateId) || operateId <= 0)
            {
                context.Response.Write("操作错误");
                context.Response.End();
            }

            NFMT.User.BLL.CorporationDetailBLL bll = new NFMT.User.BLL.CorporationDetailBLL();

            NFMT.Common.OperateEnum operateEnum = (NFMT.Common.OperateEnum)operateId;
            NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

            switch (operateEnum)
            {
                case NFMT.Common.OperateEnum.作废:
                    result = bll.Invalid(user, id);
                    break;
                case NFMT.Common.OperateEnum.撤返:
                    result = bll.GoBack(user, id);
                    break;
                case NFMT.Common.OperateEnum.冻结:
                    result = bll.Freeze(user, id);
                    break;
                case NFMT.Common.OperateEnum.解除冻结:
                    result = bll.UnFreeze(user, id);
                    break;
            }

            context.Response.Write(result.Message);
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

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

            if (string.IsNullOrEmpty(context.Request.Form["source"]))
            {
                result.Message = "数据源为空";
                result.ResultStatus = -1;
                context.Response.Write(serializer.Serialize(result));
                context.Response.End();
            }

            bool isPass = false;
            if (string.IsNullOrEmpty(context.Request.Form["ispass"]) || !bool.TryParse(context.Request.Form["ispass"], out isPass))
            {
                result.Message = "审核结果错误";
                result.ResultStatus = -1;
                context.Response.Write(serializer.Serialize(result));
                context.Response.End();
            }

            try
            {
                string jsonData = context.Request.Form["source"];
                var obj = serializer.Deserialize<NFMT.WorkFlow.Model.DataSource>(jsonData);

                NFMT.User.BLL.CorporationDetailBLL bll = new NFMT.User.BLL.CorporationDetailBLL();
                result = bll.Audit(user, obj.RowId, isPass);
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
                result.ResultStatus = -1;
            }

            context.Response.Write(serializer.Serialize(result));
            context.Response.End();
        }
        public void ProcessRequest(HttpContext context)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

            try
            {
                int corpDetailId = 0;
                if (string.IsNullOrEmpty(context.Request.QueryString["corpDetailId"]) || !int.TryParse(context.Request.QueryString["corpDetailId"], out corpDetailId) || corpDetailId <= 0)
                {
                    context.Response.Write("公司明细序号错误");
                    context.Response.End();
                }

                int attachId = 0;
                if (string.IsNullOrEmpty(context.Request.QueryString["attachId"]) || !int.TryParse(context.Request.QueryString["attachId"], out attachId) || attachId <= 0)
                {
                    context.Response.Write("附件序号错误");
                    context.Response.End();
                }

                int attachType = 0;
                if (string.IsNullOrEmpty(context.Request.QueryString["attachType"]) || !int.TryParse(context.Request.QueryString["attachType"], out attachType) || attachType <= 0)
                {
                    context.Response.Write("附件类型错误");
                    context.Response.End();
                }

                NFMT.User.BLL.CorporationDetailBLL bll = new NFMT.User.BLL.CorporationDetailBLL();
                //result = bll.UpdateAttachId(user, corpDetailId, attachId, (NFMT.User.BLL.CorporationDetailBLL.CorpDetailAttachEnum)attachType);
            }
            catch (Exception e)
            {
                result.ResultStatus = -1;
                result.Message = e.Message;
            }

            context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
            context.Response.End();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string redirectUrl = string.Format("{0}User/CorporationList.aspx", NFMT.Common.DefaultValue.NftmSiteName);
                NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
                NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

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

                this.navigation1.Routes.Add("企业管理", redirectUrl);
                this.navigation1.Routes.Add("客户修改", string.Empty);

                int corpId = 0;
                if (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out corpId))
                    Response.Redirect(redirectUrl);

                NFMT.User.BLL.CorporationBLL corporationBLL = new NFMT.User.BLL.CorporationBLL();
                result = corporationBLL.Get(user, corpId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                corporation = result.ReturnValue as NFMT.User.Model.Corporation;
                if (corporation == null)
                    Response.Redirect(redirectUrl);

                NFMT.User.BLL.CorporationDetailBLL corporationDetailBLL = new NFMT.User.BLL.CorporationDetailBLL();
                result = corporationDetailBLL.GetByCorpId(user, corpId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                corpDetail = result.ReturnValue as NFMT.User.Model.CorporationDetail;
                if (corpDetail == null)
                    Response.Redirect(redirectUrl);
            }
        }