public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string redirectUrl = string.Format("{0}Default.aspx", NFMT.Common.DefaultValue.NfmtSiteName); string jsString = string.Format(" <script type=\"text/javascript\">window.parent.location.href=\"{0}Login.aspx?redirectUrl={1}\";</script>", NFMT.Common.DefaultValue.NfmtPassPort, redirectUrl); NFMT.Sms.BLL.SmsBLL bll = new NFMT.Sms.BLL.SmsBLL(); NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser; if (user == null || user.EmpId <= 0) { context.Response.Write(jsString); context.Response.Flush(); } NFMT.Common.ResultModel result = new NFMT.Common.ResultModel(); string postData = string.Empty; result = bll.GetCurrentSms(user); if (result.ResultStatus != 0) { postData = Newtonsoft.Json.JsonConvert.SerializeObject(new Sms() { SmsId = 0 }); context.Response.Write(postData); context.Response.End(); } System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable; postData = Newtonsoft.Json.JsonConvert.SerializeObject(dt); context.Response.Write(postData); }
public void ProcessRequest(HttpContext context) { int pageIndex = 1, pageSize = 10; string orderStr = string.Empty, whereStr = string.Empty; NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser; 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"])) { string sortDataField = context.Request.QueryString["sortdatafield"].Trim(); string sortOrder = context.Request.QueryString["sortorder"].Trim(); orderStr = string.Format("{0} {1}", sortDataField, sortOrder); } NFMT.Sms.BLL.SmsBLL bll = new NFMT.Sms.BLL.SmsBLL(); NFMT.Common.SelectModel select = bll.GetSelectModel(pageIndex, pageSize, orderStr, user); NFMT.Common.ResultModel result = bll.Load(user, 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>(); dic.Add("count", totalRows); dic.Add("data", dt); string postData = Newtonsoft.Json.JsonConvert.SerializeObject(dic, new Newtonsoft.Json.Converters.DataTableConverter()); context.Response.Write(postData); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string smsId = context.Request.Form["id"]; if (string.IsNullOrEmpty(smsId)) { context.Response.Write("序号错误"); context.Response.End(); } //if (!int.TryParse(context.Request.Form["id"], out smsId) || smsId <= 0) //{ // context.Response.Write("序号错误"); // context.Response.End(); //} NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser; NFMT.Common.ResultModel result = new NFMT.Common.ResultModel(); NFMT.Sms.BLL.SmsBLL bll = new NFMT.Sms.BLL.SmsBLL(); result = bll.ReadSms(user, smsId); context.Response.Write(result.Message); }