protected void Page_Load(object sender, EventArgs e)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            string redirectUrl = string.Format("{0}Funds/ReceivableList.aspx", NFMT.Common.DefaultValue.NftmSiteName);
            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();

            if (!IsPostBack)
            {
                this.navigation1.Routes.Add("收款登记", redirectUrl);
                this.navigation1.Routes.Add("收款登记明细", string.Empty);

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

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

                NFMT.Funds.BLL.ReceivableBLL bll = new NFMT.Funds.BLL.ReceivableBLL();
                NFMT.Common.ResultModel result = bll.Get(user, receivableId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                receivable = result.ReturnValue as NFMT.Funds.Model.Receivable;
                if (receivable != null)
                {
                    this.dtReceiveDate.InnerText = receivable.ReceiveDate.ToShortDateString();

                    NFMT.User.Model.Corporation innerCorp = NFMT.User.UserProvider.Corporations.SingleOrDefault(a => a.CorpId == receivable.ReceivableCorpId);
                    this.ddlReceivableCorpId.InnerText = innerCorp.CorpName;

                    NFMT.Data.Model.Bank recebank = NFMT.Data.BasicDataProvider.Banks.SingleOrDefault(a => a.BankId == receivable.ReceivableBank);
                    this.ddlReceivableBank.InnerText = recebank.BankName;

                    NFMT.Data.Model.BankAccount receAccount = NFMT.Data.BasicDataProvider.BankAccounts.SingleOrDefault(a => a.BankAccId == receivable.ReceivableAccoontId);
                    this.ddlReceivableAccoontId.InnerText = receAccount.AccountNo;

                    this.nbPayBala.InnerText = receivable.PayBala.ToString();

                    NFMT.Data.Model.Currency currency = NFMT.Data.BasicDataProvider.Currencies.SingleOrDefault(a => a.CurrencyId == receivable.CurrencyId);
                    this.ddlCurrencyId.InnerText = currency.CurrencyName;

                    this.ddlPayCorpId.InnerText = receivable.PayCorpName;

                    this.ddlPayBankId.InnerText = receivable.PayBank;

                    this.ddlPayAccountId.InnerText = receivable.PayAccount;

                    this.txbPayWord.InnerText = receivable.PayWord;

                    this.txtBankLog.InnerText = receivable.BankLog;

                    string json = serializer.Serialize(receivable);
                    this.hidModel.Value = json;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            string redirectUrl = string.Format("{0}Funds/ReceivableList.aspx", NFMT.Common.DefaultValue.NftmSiteName);

            if (!IsPostBack)
            {
                this.navigation1.Routes.Add("收款登记", redirectUrl);
                this.navigation1.Routes.Add("收款登记修改", string.Empty);

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

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

                NFMT.Funds.BLL.ReceivableBLL bll = new NFMT.Funds.BLL.ReceivableBLL();
                NFMT.Common.ResultModel result = bll.Get(user, receivableId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.Funds.Model.Receivable receivable = result.ReturnValue as NFMT.Funds.Model.Receivable;
                if (receivable != null)
                {
                    this.curReceivable = receivable;
                    //this.hidReceiveDate.Value = receivable.ReceiveDate.ToShortDateString();
                    ////NFMT.User.Model.Corporation innerCorp = NFMT.User.UserProvider.Corporations.SingleOrDefault(a => a.CorpId == receivable.ReceivableCorpId);
                    //this.hidReceivableCorpId.Value = receivable.ReceivableCorpId.ToString();
                    ////NFMT.Data.Model.Bank recebank = NFMT.Data.BasicDataProvider.Banks.SingleOrDefault(a => a.BankId == receivable.ReceivableBank);
                    //this.hidReceivableBank.Value = receivable.ReceivableBank.ToString();
                    ////NFMT.Data.Model.BankAccount receAccount = NFMT.Data.BasicDataProvider.BankAccounts.SingleOrDefault(a => a.BankAccId == receivable.ReceivableAccoontId);
                    //this.hidReceivableAccoontId.Value = receivable.ReceivableAccoontId.ToString();
                    //this.hidPayBala.Value = receivable.PayBala.ToString();
                    //this.hidCurrencyId.Value = receivable.CurrencyId.ToString();
                    //this.hidPayCorpId.Value = receivable.PayCorpId.ToString();
                    //this.hidPayBankId.Value = receivable.PayBankId.ToString();
                    //this.hidPayAccountId.Value = receivable.PayAccountId.ToString();
                    //this.txbPayWord.Value = receivable.PayWord;
                    //this.txtBankLog.Value = receivable.BankLog;
                    //this.txtPayAccount.Value = receivable.PayAccount;
                    //this.txtPayBank.Value = receivable.PayBank;
                    //this.txtPayCorp.Value = receivable.PayCorpName;
                }
            }
        }
        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();

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

            NFMT.Funds.BLL.ReceivableBLL bll = new NFMT.Funds.BLL.ReceivableBLL();
            result = bll.Invalid(user, receivableId);

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

            string r = context.Request.Form["Receivable"];
            if (string.IsNullOrEmpty(r))
            {
                context.Response.Write("收款信息不能为空");
                context.Response.End();
            }

            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

            try
            {
                System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                NFMT.Funds.Model.Receivable receivable = serializer.Deserialize<NFMT.Funds.Model.Receivable>(r);
                if (receivable == null)
                {
                    context.Response.Write("收款信息错误");
                    context.Response.End();
                }

                NFMT.Funds.BLL.ReceivableBLL bll = new NFMT.Funds.BLL.ReceivableBLL();
                result = bll.Create(user, receivable);
            }
            catch (Exception e)
            {
                result.ResultStatus=-1;
                result.Message = e.Message;
            }

            if (result.ResultStatus == 0)
                result.Message = "收款登记新增成功";

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

            int pageIndex = 1, pageSize = 10;
            string orderStr = string.Empty, whereStr = string.Empty;

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

            int bank = 0;
            if (!string.IsNullOrEmpty(context.Request.QueryString["b"]))
            {
                if (!int.TryParse(context.Request.QueryString["b"], out bank))
                    bank = 0;
            }

            int empId = 0;
            if (!string.IsNullOrEmpty(context.Request.QueryString["e"]))
            {
                if (!int.TryParse(context.Request.QueryString["e"], out empId))
                    empId = 0;
            }

            DateTime fromDate = NFMT.Common.DefaultValue.DefaultTime;
            if (!string.IsNullOrEmpty(context.Request.QueryString["f"]))
            {
                if (!DateTime.TryParse(context.Request.QueryString["f"], out fromDate))
                    fromDate = NFMT.Common.DefaultValue.DefaultTime;
            }

            DateTime toDate = NFMT.Common.DefaultValue.DefaultTime;
            if (!string.IsNullOrEmpty(context.Request.QueryString["t"]))
            {
                if (!DateTime.TryParse(context.Request.QueryString["t"], out toDate))
                    toDate = NFMT.Common.DefaultValue.DefaultTime;
            }

            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());
            if (!string.IsNullOrEmpty(context.Request.QueryString["sortdatafield"]) && !string.IsNullOrEmpty(context.Request.QueryString["sortorder"]))
            {
                string sortDataField = context.Request.QueryString["sortdatafield"].Trim();
                string sortOrder = context.Request.QueryString["sortorder"].Trim();

                switch (sortDataField)
                {
                    case "ReceivableId":
                        sortDataField = "r.ContractId";
                        break;
                    case "ReceiveDate":
                        sortDataField = "r.ReceiveDate";
                        break;
                    case "InnerCorp":
                        sortDataField = "c.CorpName";
                        break;
                    case "PayBala":
                        sortDataField = "r.PayBala";
                        break;
                    case "BankName":
                        sortDataField = "b.BankName";
                        break;
                    case "OutCorp":
                        sortDataField = "c2.CorpName";
                        break;
                    case "StatusName":
                        sortDataField = "bd.StatusName";
                        break;
                }
                orderStr = string.Format("{0} {1}", sortDataField, sortOrder);
            }

            NFMT.Funds.BLL.ReceivableBLL bll = new NFMT.Funds.BLL.ReceivableBLL();
            NFMT.Common.SelectModel select = bll.GetSelectModel(pageIndex, pageSize, orderStr, fromDate, toDate, empId, bank, status);
            NFMT.Common.ResultModel result = bll.Load(user, select);

            context.Response.ContentType = "application/json; charset=utf-8";
            if (result.ResultStatus != 0)
            {
                context.Response.Write(result.Message);
                context.Response.End();
            }

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

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

            string postData = Newtonsoft.Json.JsonConvert.SerializeObject(dic);

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

            string r = context.Request.Form["Receivable"];
            if (string.IsNullOrEmpty(r))
            {
                context.Response.Write("收款信息不能为空");
                context.Response.End();
            }

            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

            try
            {
                System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                NFMT.Funds.Model.Receivable receivable = serializer.Deserialize<NFMT.Funds.Model.Receivable>(r);
                if (receivable == null)
                {
                    context.Response.Write("收款信息错误");
                    context.Response.End();
                }

                NFMT.User.Model.Corporation innerCorp = NFMT.User.UserProvider.Corporations.SingleOrDefault(a => a.CorpId == receivable.ReceivableCorpId);
                if (innerCorp != null)
                    receivable.ReceivableGroupId = innerCorp.ParentId;

                receivable.ReceiveEmpId = user.EmpId;

                NFMT.User.Model.Corporation outCorp = NFMT.User.UserProvider.Corporations.SingleOrDefault(a => a.CorpId == receivable.PayCorpId);
                if (outCorp != null)
                    receivable.PayGroupId = outCorp.ParentId;

                if (string.IsNullOrEmpty(receivable.PayCorpName))
                {
                    receivable.PayCorpName = outCorp.CorpName;
                }

                if (string.IsNullOrEmpty(receivable.PayBank))
                {
                    NFMT.Data.Model.Bank bank = NFMT.Data.BasicDataProvider.Banks.SingleOrDefault(a => a.BankId == receivable.PayBankId);
                    receivable.PayBank = bank.BankName;
                }

                if (string.IsNullOrEmpty(receivable.PayAccount))
                {
                    NFMT.Data.Model.BankAccount bankAccount = NFMT.Data.BasicDataProvider.BankAccounts.SingleOrDefault(a => a.BankAccId == receivable.PayAccountId);
                    receivable.PayAccount = bankAccount.AccountNo;
                }

                receivable.ReceiveEmpId = user.EmpId;
                NFMT.Funds.BLL.ReceivableBLL bll = new NFMT.Funds.BLL.ReceivableBLL();
                result = bll.Update(user, receivable);
            }
            catch (Exception e)
            {
                result.Message = e.Message;
            }

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