|
using Common;
|
using Dao;
|
using Model;
|
using System;
|
using System.Web;
|
using System.Web.Profile;
|
using System.Web.SessionState;
|
|
public partial class GwRptCodeUpdate : PageBase<SysUser>, IRequiresSessionState
|
{
|
|
|
public RptCode CurrentCode { get; set; }
|
|
public string Action { get; set; }
|
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
if (this.IsPostBack)
|
return;
|
this.Action = this.Request["action"];
|
if (this.Action == "addDeal")
|
{
|
this.CheckRight("1031", FailedOperation.ErrorMsgOnly);
|
this.SaveAddForm();
|
}
|
else if (this.Action == "editDeal")
|
{
|
this.CheckRight("1032", FailedOperation.ErrorMsgOnly);
|
this.SaveEditForm();
|
}
|
else if (this.Action == "edit")
|
{
|
this.CheckRight("1032", FailedOperation.ErrorMsgOnly);
|
using (GwRptCodeDao gwRptCodeDao = new GwRptCodeDao())
|
{
|
string oldCode = Convert.ToString(this.Request["OldCode"]);
|
this.CurrentCode = gwRptCodeDao.GetRptCode(oldCode);
|
}
|
}
|
else if (this.Action == "del")
|
{
|
this.CheckRight("1034", FailedOperation.ErrorMsgOnly);
|
using (GwRptCodeDao gwRptCodeDao = new GwRptCodeDao())
|
{
|
string spid = Convert.ToString(this.Request["Spid"]);
|
if (gwRptCodeDao.DeleteAccount(spid))
|
{
|
this.Response.Write("<script type='text/javascript'>alert('删除成功!');location.href='GwRptAccount.aspx';</script>");
|
this.Response.End();
|
}
|
else
|
{
|
this.Response.Write("<script type='text/javascript'>alert('删除失败!');location.href='GwRptAccount.aspx';</script>");
|
this.Response.End();
|
}
|
}
|
}
|
else if (this.Action == "delSelect")
|
{
|
this.CheckRight("1034", FailedOperation.ErrorMsgOnly);
|
using (GwRptCodeDao gwRptCodeDao = new GwRptCodeDao())
|
{
|
string[] strArray = Convert.ToString(this.Request["OldCode"]).Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
bool flag = false;
|
foreach (string oldCode in strArray)
|
{
|
if (!gwRptCodeDao.DeleteCode(oldCode))
|
flag = true;
|
}
|
if (flag)
|
{
|
this.Response.Write("<script type='text/javascript'>alert('删除成功!');location.href='GwRptCode.aspx';</script>");
|
this.Response.End();
|
}
|
else
|
{
|
this.Response.Write("<script type='text/javascript'>alert('删除失败!');location.href='GwRptCode.aspx';</script>");
|
this.Response.End();
|
}
|
}
|
}
|
else
|
{
|
this.CheckRight("1031", FailedOperation.ErrorMsgOnly);
|
this.CurrentCode = new RptCode();
|
}
|
}
|
|
|
/// <summary>
|
/// 添加
|
/// </summary>
|
protected void SaveAddForm()
|
{
|
RptAccount rc = new RptAccount();
|
rc.Spid = this.Request["Spid"];
|
rc.Proportion = this.Request["Proportion"];
|
rc.TimeSpan = this.Request["TimeSpan"];
|
rc.Threshold = this.Request["Threshold"];
|
rc.WhitePhone = this.Request["WhitePhone"];
|
using (GwRptCodeDao gwRptCodeDao = new GwRptCodeDao())
|
{
|
if (string.IsNullOrEmpty(rc.Proportion) || (string.IsNullOrEmpty(rc.Proportion) ))
|
{
|
this.Response.Write("<script type='text/javascript'>alert('不能为空!');history.go(-1);</script>");
|
this.Response.End();
|
}
|
if (gwRptCodeDao.AddAccountCode(rc))
|
{
|
this.Response.Write("<script type='text/javascript'>alert('添加成功!');location.href='GwRptAccount.aspx';</script>");
|
this.Response.End();
|
}
|
else
|
{
|
this.Response.Write("<script type='text/javascript'>alert('添加失败!');history.go(-1);</script>");
|
this.Response.End();
|
}
|
}
|
}
|
|
protected void SaveEditForm()
|
{
|
RptCode code = new RptCode();
|
code.OldCode = this.Request["OldCode"];
|
code.NewCode = this.Request["NewCode"];
|
code.Remark = this.Request["Remark"];
|
using (GwRptCodeDao gwRptCodeDao = new GwRptCodeDao())
|
{
|
if (gwRptCodeDao.UpdateCode(code))
|
{
|
this.Response.Write("<script type='text/javascript'>alert('修改成功!');location.href='GwRptCode.aspx';</script>;");
|
this.Response.End();
|
}
|
else
|
{
|
this.Response.Write("<script type='text/javascript'>alert('修改失败!');history.go(-1);</script>");
|
this.Response.End();
|
}
|
}
|
}
|
}
|