protected void Page_Load(object sender, EventArgs e)
        {
            string redirectStr = string.Format("{0}BasicData/DeliverPlaceList.aspx", NFMT.Common.DefaultValue.NftmSiteName);
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

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

                this.navigation1.Routes.Add("交货地管理", redirectStr);
                this.navigation1.Routes.Add("交货地修改", string.Empty);

                this.hidBDStyleId.Value = ((int)NFMT.Data.StyleEnum.交货地类型).ToString();

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

                NFMT.Data.BLL.DeliverPlaceBLL deliverPlaceBLL = new NFMT.Data.BLL.DeliverPlaceBLL();
                result = deliverPlaceBLL.Get(user, dPId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectStr);

                deliverPlace = result.ReturnValue as NFMT.Data.Model.DeliverPlace;
                if (deliverPlace == null)
                    Response.Redirect(redirectStr);
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            int pageIndex = 1, pageSize = 10;
            string orderStr = string.Empty, whereStr = string.Empty;

            int areaId = 0;
            if (!string.IsNullOrEmpty(context.Request["a"]))
                int.TryParse(context.Request["a"], out areaId);

            int corpId = 0;
            if (!string.IsNullOrEmpty(context.Request["c"]))
                int.TryParse(context.Request["c"], out corpId);

            string dPName = context.Request["d"];

            int status = 0;
            if (!string.IsNullOrEmpty(context.Request["s"]))
                int.TryParse(context.Request["s"], out status);

            //jqwidgets jqxGrid
            if (!string.IsNullOrEmpty(context.Request.QueryString["pagenum"]))
                int.TryParse(context.Request.QueryString["pagenum"], out pageIndex);
            pageIndex++;
            if (!string.IsNullOrEmpty(context.Request.QueryString["pagesize"]))
                int.TryParse(context.Request.QueryString["pagesize"], out pageSize);

            if (!string.IsNullOrEmpty(context.Request.QueryString["sortdatafield"]) && !string.IsNullOrEmpty(context.Request.QueryString["sortorder"]))
                orderStr = string.Format("{0} {1}", context.Request.QueryString["sortdatafield"].Trim(), context.Request.QueryString["sortorder"].Trim());

            NFMT.Data.BLL.DeliverPlaceBLL bll = new NFMT.Data.BLL.DeliverPlaceBLL();
            NFMT.Common.SelectModel select = bll.GetSelectModel(pageIndex, pageSize, orderStr, areaId, corpId, dPName, status);
            NFMT.Common.ResultModel result = bll.Load(new NFMT.Common.UserModel(), select);

            context.Response.ContentType = "text/plain";
            if (result.ResultStatus != 0)
            {
                context.Response.Write(result.Message);
                context.Response.End();
            }

            int totalRows = result.AffectCount;
            System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
            Dictionary<string, object> dic = new Dictionary<string, object>();

            //jqwidgets
            dic.Add("count", result.AffectCount);
            dic.Add("data", dt);

            string jsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(dic, new Newtonsoft.Json.Converters.DataTableConverter());
            context.Response.Write(jsonStr);
        }
        public void ProcessRequest(HttpContext context)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            context.Response.ContentType = "text/plain";

            int id = 0;
            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.Data.BLL.DeliverPlaceBLL bll = new NFMT.Data.BLL.DeliverPlaceBLL();
            NFMT.Data.Model.DeliverPlace deliverPlace = new NFMT.Data.Model.DeliverPlace()
            {
                DPId = id,
                LastModifyId = user.EmpId
            };

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

            switch (operateEnum)
            {
                case NFMT.Common.OperateEnum.冻结:
                    result = bll.Freeze(user, deliverPlace);
                    break;
                case NFMT.Common.OperateEnum.解除冻结:
                    result = bll.UnFreeze(user, deliverPlace);
                    break;
            }
            if (result.ResultStatus == 0)
                result.Message = string.Format("{0}成功", operateEnum.ToString());

            context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
        }
        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 deliverPlaceStr = context.Request.Form["deliverPlace"];
            if (string.IsNullOrEmpty(deliverPlaceStr))
            {
                context.Response.Write("交货地信息不能为空");
                context.Response.End();
            }

            try
            {
                System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                NFMT.Data.Model.DeliverPlace deliverPlace = serializer.Deserialize<NFMT.Data.Model.DeliverPlace>(deliverPlaceStr);
                if (deliverPlace == null )
                {
                    context.Response.Write("数据错误");
                    context.Response.End();
                }
                NFMT.Data.BLL.DeliverPlaceBLL bll = new NFMT.Data.BLL.DeliverPlaceBLL();
                result = bll.Insert(user, deliverPlace);
                if (result.ResultStatus == 0)
                {
                    result.Message = "交货地新增成功";
                }
            }
            catch (Exception ex)
            {
                result.ResultStatus = -1;
                result.Message = ex.Message;
            }

            context.Response.Write(result.Message);
        }