CeramicProject/newyt/Module_data/CustomerRetention_browse.as...

174 lines
6.7 KiB
C#
Raw Normal View History

2024-05-18 15:28:29 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class CustomerRetention_browse : System.Web.UI.Page
{
Maticsoft.BLL.nr_z_khyck qtsrbll = new Maticsoft.BLL.nr_z_khyck();
Maticsoft.Model.nr_z_khyck qtsrmodel = new Maticsoft.Model.nr_z_khyck();
Maticsoft.BLL.nr_sys_rizhi rizhibll = new Maticsoft.BLL.nr_sys_rizhi();
Maticsoft.Model.nr_sys_rizhi rizhimodel = new Maticsoft.Model.nr_sys_rizhi();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Session["user"] == null)
{
Response.Redirect("../index.aspx");
}
Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]);
if (Request.QueryString["uid"] != null && Request.QueryString["uid"].ToString().Length > 0)
{
string uid = Request.QueryString["uid"].ToString();
id.Value = uid;
}
initdata(id.Value);
pdquanxian(user.juese);
}
}
#region
private void initdata(string did)
{
DataTable dt = DBHlper.Execute("select * from view_nr_z_khyck where id=" + did).Tables[0];
kh_bh.Text = dt.Rows[0]["kh_bh"].ToString();
rq.Text = DateTime.Parse(dt.Rows[0]["rq"].ToString()).ToString("yyyy-MM-dd");
ycje.Text = dt.Rows[0]["ycje"].ToString();
skr.Text = dt.Rows[0]["skr"].ToString();
fkfs.Text = dt.Rows[0]["fkfs"].ToString();
fkr.Text = dt.Rows[0]["fkr"].ToString();
shzt.Text = dt.Rows[0]["shzt"].ToString();
kh_mc.Text = dt.Rows[0]["kh_mc"].ToString();
bz.Text = dt.Rows[0]["bz"].ToString();
if (shzt.Text == "通过")
{
btn_tongguo.Enabled = false;
btn_tongguo.BackColor = System.Drawing.Color.Gray;
shanchu.Enabled = false;
shanchu.BackColor = System.Drawing.Color.Gray;
btn_bj.Enabled = false;
btn_bj.BackColor = System.Drawing.Color.Gray;
}
if (shzt.Text == "不过")
{
btn_butongguo.Enabled = false;
btn_butongguo.BackColor = System.Drawing.Color.Gray;
shanchu.Enabled = false;
shanchu.BackColor = System.Drawing.Color.Gray;
}
}
#endregion
#region
void pdquanxian(int juese)
{
Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]);
if (DBHlper.getzt(user.id) != 1)
{
Response.Redirect("../index.aspx");
}
2024-05-21 15:05:24 +08:00
if (DBHlper.GetPermission(juese, "客户预存款", "nr_z_khyck", "查看全部") == false && DBHlper.GetPermission(juese, "客户预存款", "nr_z_khyck", "查看个人") == false)
2024-05-18 15:28:29 +08:00
{
Response.Redirect("../Common/nopower.htm");
}
2024-05-21 15:05:24 +08:00
if (DBHlper.GetPermission(juese, "客户预存款", "nr_z_khyck", "编辑个人") && skr.Text == user.zhanghao)
2024-05-18 15:28:29 +08:00
{
btn_bj.Visible = true;
}
2024-05-21 15:05:24 +08:00
if (DBHlper.GetPermission(juese, "客户预存款", "nr_z_khyck", "编辑全部"))
2024-05-18 15:28:29 +08:00
{
btn_bj.Visible = true;
}
2024-05-21 15:05:24 +08:00
if (DBHlper.GetPermission(juese, "客户预存款", "nr_z_khyck", "删除个人") && skr.Text == user.zhanghao)
2024-05-18 15:28:29 +08:00
{
shanchu.Visible = true;
}
2024-05-21 15:05:24 +08:00
if (DBHlper.GetPermission(juese, "客户预存款", "nr_z_khyck", "删除全部"))
2024-05-18 15:28:29 +08:00
{
shanchu.Visible = true;
}
2024-05-21 15:05:24 +08:00
if (DBHlper.GetPermission(juese, "客户预存款", "nr_z_khyck", "审核通过"))
2024-05-18 15:28:29 +08:00
{
btn_tongguo.Visible = true;
2024-05-21 15:05:24 +08:00
} if (DBHlper.GetPermission(juese, "客户预存款", "nr_z_khyck", "审核不过"))
2024-05-18 15:28:29 +08:00
{
btn_butongguo.Visible = true;
}
}
#endregion
//删除
protected void btn_delete(object o, EventArgs e)
{
int qtskid = Convert.ToInt32(id.Value);
if (qtsrbll.Delete(qtskid))
{
Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]);
rizhimodel.leixing = "客户预存款";
rizhimodel.yonghuming = user.zhanghao;
rizhimodel.riqi = DateTime.Now;
rizhimodel.jilu = rizhimodel.yonghuming+"删除了客户预存款;客户编号为:"+kh_bh.Text;
rizhibll.Add(rizhimodel);
Response.Redirect("CustomerRetention_list.aspx");
}
}
//审核通过
protected void btntongguo_Click(object sender, EventArgs e)
{
DBHlper.excutecmd("update nr_z_khyck set shzt='通过' where id=" + id.Value);
Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]);
rizhimodel.leixing = "客户预存款";
rizhimodel.yonghuming = user.zhanghao;
rizhimodel.riqi = DateTime.Now;
rizhimodel.jilu = rizhimodel.yonghuming + "审核通过了客户预存款;客户编号为:" + kh_bh.Text;
rizhibll.Add(rizhimodel);
Response.Redirect("CustomerRetention_browse.aspx?uid=" + id.Value);
}
//审核不通过
protected void btn_butong_Click(object sender, EventArgs e)
{
try
{
if (shzt.Text == "通过")
{
string yczje = DBHlper.getfirstcolmn("select isnull(sum(ycje),0) from nr_z_khyck where kh_bh='" + kh_bh.Text + "'");
string syje = DBHlper.getfirstcolmn("select isnull(sum(syycje),0) from view_z_dd_skjl where kh_bh='" + kh_bh.Text + "' and zt='已确认'");
if (Convert.ToDecimal(yczje) - Convert.ToDecimal(ycje.Text) < Convert.ToDecimal(syje))
{
z_error.Text = "冲红失败,预存金额不能小于已使用预存款金额";
return;
}
DBHlper.excutecmd("update nr_z_khyck set shzt='不过' where id=" + id.Value);
Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]);
rizhimodel.leixing = "客户预存款";
rizhimodel.yonghuming = user.zhanghao;
rizhimodel.riqi = DateTime.Now;
rizhimodel.jilu = rizhimodel.yonghuming + "审核不过了客户预存款;客户编号为:" + kh_bh.Text;
rizhibll.Add(rizhimodel);
Response.Redirect("CustomerRetention_browse.aspx?uid=" + id.Value);
}
}
catch
{
z_error.Text = "审核失败!";
}
}
protected void bt_tj_Click(object sender, EventArgs e)
{
Response.Redirect("CustomerRetention_Form.aspx?uid=" + id.Value);
}
}