You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
334 lines
13 KiB
C#
334 lines
13 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using BLL.CardBill;
|
|
using BLL.Sys;
|
|
using CPCBILLSYS.Common;
|
|
using Ext.Net;
|
|
using Model;
|
|
|
|
namespace CPCBILLSYS
|
|
{
|
|
public partial class CPCInfoMg : System.Web.UI.Page
|
|
{
|
|
LogClass log = new LogClass();
|
|
/// <summary>
|
|
/// 基础
|
|
/// </summary>
|
|
DictionaryBLL dicbll = new DictionaryBLL(CommonHelper._dbType, CommonHelper.DbConStr);
|
|
/// <summary>
|
|
/// cpc
|
|
/// </summary>
|
|
CPCCardBLL cpcbll = new CPCCardBLL(CommonHelper._dbType, CommonHelper.DbConStr);
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
if (CommonHelper._userType == "3")
|
|
{
|
|
if (string.IsNullOrEmpty(Request.QueryString["userId"]) || string.IsNullOrEmpty(Request.QueryString["userName"]))
|
|
{
|
|
Response.Write("<script>alert('错误的访问!');window.location.href='http://10.15.0.36:9996'</script>");
|
|
return;
|
|
}
|
|
try
|
|
{
|
|
hdUserId.Value = Request.QueryString["userId"].ToString();
|
|
hdMan.Value = HttpUtility.UrlDecode(Request.QueryString["userName"].ToString());
|
|
}
|
|
catch
|
|
{
|
|
Response.Write("<script>alert('数据库访问异常!');window.location.href='http://10.15.0.36:9996'</script>");
|
|
return;
|
|
}
|
|
|
|
//hdUserId.Value = "1";
|
|
//hdMan.Value = "武俊涛";
|
|
}
|
|
else
|
|
{
|
|
if (Session["UserID"] == null || Session["SysID"] == null || Session["MAN"] == null)
|
|
{
|
|
Response.Write("<script>alert('错误的访问!');window.location.href='../Default.aspx'</script>");
|
|
return;
|
|
}
|
|
hdUserId.Value = Session["UserID"].ToString();
|
|
hdMan.Value = Session["MAN"].ToString();
|
|
}
|
|
txtAdMan.Text = hdMan.Value.ToString();
|
|
txtAdMan.Disabled = true;
|
|
s_txtStartDt.Value = DateTime.Now;
|
|
s_txtEndDt.Value = DateTime.Now.AddDays(1);
|
|
StCardInfo.AutoLoadParams.Add(new Ext.Net.Parameter("Start", "0"));
|
|
StCardInfo.AutoLoadParams.Add(new Ext.Net.Parameter("Limit", Paging.PageSize.ToString()));
|
|
BindSub();
|
|
BindCardType();
|
|
BindStateId();
|
|
}
|
|
}
|
|
#region 绑定数据
|
|
/// <summary>
|
|
/// 绑定站
|
|
/// </summary>
|
|
public void BindSub()
|
|
{
|
|
if (CommonHelper._userType == "1")
|
|
{
|
|
//s_cmbSubcom.Disabled = true;
|
|
//s_cmbSta.Disabled = true;
|
|
s_cmbSubcom.Hidden = true;
|
|
s_cmbSta.Hidden = true;
|
|
}
|
|
else
|
|
{
|
|
DataTable dt = dicbll.GetSubCompany("");
|
|
DataRow dr = dt.NewRow();
|
|
dr["SUBCOMNO"] = 1;
|
|
dr["SUBCOMNAME"] = "总中心";
|
|
dt.Rows.Add(dr);
|
|
storeSubCompany.DataSource = dt;
|
|
}
|
|
storeSubCompany.DataBind();
|
|
}
|
|
|
|
protected void s_cmbSubcom_Select(object sender, Ext.Net.DirectEventArgs e)
|
|
{
|
|
if (s_cmbSubcom.SelectedItem.Value == "1")
|
|
{
|
|
DataTable dt = new DataTable();
|
|
dt.Columns.Add("STANO", typeof(int));
|
|
dt.Columns.Add("STANAME", typeof(string));
|
|
DataRow dr = dt.NewRow();
|
|
dr["STANO"] = 1;
|
|
dr["STANAME"] = "总中心";
|
|
dt.Rows.Add(dr);
|
|
stSta.DataSource = dt;
|
|
}
|
|
else
|
|
{
|
|
stSta.DataSource = dicbll.GetStaAllInfo(" and SUBCOMNO='" + s_cmbSubcom.SelectedItem.Value + "'");
|
|
}
|
|
stSta.DataBind();
|
|
}
|
|
public void BindCardType()
|
|
{
|
|
DataTable dt = new DataTable();
|
|
dt.Columns.Add("VALUE", typeof(int));
|
|
dt.Columns.Add("TEXT", typeof(string));
|
|
|
|
DataRow dr = dt.NewRow();
|
|
dr["VALUE"] = 1;
|
|
dr["TEXT"] = "通行卡";
|
|
dt.Rows.Add(dr);
|
|
DataRow dr1 = dt.NewRow();
|
|
dr1["VALUE"] = 2;
|
|
dr1["TEXT"] = "CPC通行卡";
|
|
dt.Rows.Add(dr1);
|
|
stCardType.DataSource = dt;
|
|
stCardType.DataBind();
|
|
}
|
|
public void BindStateId()
|
|
{
|
|
DataTable dt = dicbll.GetCBCardType(" and VALUE IN(6,7)");
|
|
stCardStateId.DataSource = dt;
|
|
stCardStateId.DataBind();
|
|
}
|
|
#endregion 绑定数据
|
|
/// <summary>
|
|
/// 查询
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSearch_Click(object sender, Ext.Net.DirectEventArgs e)
|
|
{
|
|
Paging.SetPageIndex(1);
|
|
StCardInfo.DataBind();
|
|
}
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void StCardInfo_RefreshData(object sender, Ext.Net.StoreRefreshDataEventArgs e)
|
|
{
|
|
int start; int limit;
|
|
if (!string.IsNullOrEmpty(e.Parameters["Start"]) && !string.IsNullOrEmpty(e.Parameters["Limit"]))
|
|
{
|
|
start = int.Parse(e.Parameters["Start"]);
|
|
limit = int.Parse(e.Parameters["Limit"]);
|
|
}
|
|
else
|
|
{
|
|
start = e.Start;
|
|
limit = e.Limit;
|
|
}
|
|
if (s_txtStartDt.Value == null || string.IsNullOrEmpty(s_txtStartDt.Value.ToString()) || s_txtEndDt.Value == null)
|
|
{
|
|
CommonHelper.MsgShowInfo("请选择查询日期!");
|
|
return;
|
|
}
|
|
string sqlwhere = string.Empty;
|
|
TimeSpan ts = Convert.ToDateTime(s_txtEndDt.Value) - Convert.ToDateTime(s_txtStartDt.Value);
|
|
if (ts.Days < 0)
|
|
{
|
|
CommonHelper.MsgShowInfo("开始日期不大于结束日期!");
|
|
return;
|
|
}
|
|
if (CommonHelper._dbType == "1")
|
|
{
|
|
sqlwhere += " and DATEMARK>='" + Convert.ToDateTime(s_txtStartDt.Value).ToString("yyyy-MM-dd ") + "' and DATEMARK<='" + Convert.ToDateTime(s_txtEndDt.Value).AddDays(1).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss") + "'";
|
|
}
|
|
else if (CommonHelper._dbType == "4")
|
|
{
|
|
sqlwhere += " and DATEMARK>=DATE_FORMAT('" + Convert.ToDateTime(s_txtStartDt.Value).ToString("yyyy-MM-dd HH:mm:ss") + "','%Y-%m-%d') and DATEMARK<=DATE_FORMAT('" + Convert.ToDateTime(s_txtEndDt.Value).AddDays(1).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss") + "','%Y-%m-%d %H:%i:%s')";
|
|
}
|
|
else
|
|
{
|
|
sqlwhere += " and DATEMARK>=to_date('" + Convert.ToDateTime(s_txtStartDt.Value).ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-MM-dd') and DATEMARK<=to_date('" + Convert.ToDateTime(s_txtEndDt.Value).AddDays(1).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-MM-dd HH24:mi:ss')";
|
|
}
|
|
if (!string.IsNullOrEmpty(s_cmbSubcom.SelectedItem.Value))
|
|
{
|
|
sqlwhere += " and SUBCOMNO='" + s_cmbSubcom.SelectedItem.Value + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(s_cmbSta.SelectedItem.Value))
|
|
{
|
|
sqlwhere += " and STANO='" + s_cmbSta.SelectedItem.Value + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(s_txtCardNo.Text.Trim()))
|
|
{
|
|
sqlwhere += " and CARDNO like '%" + s_txtCardNo.Text.Trim() + "%'";
|
|
}
|
|
int ct = 0;
|
|
DataTable dt = cpcbll.GetCardInfoLst(sqlwhere, start, start + limit, out ct);
|
|
e.Total = ct;
|
|
StCardInfo.DataSource = dt;
|
|
StCardInfo.DataBind();
|
|
}
|
|
/// <summary>
|
|
/// 增加
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnAdd_Click(object sender, Ext.Net.DirectEventArgs e)
|
|
{
|
|
if (hdUserId.Value.ToString().ToLower() == "admin")
|
|
{
|
|
CommonHelper.MsgShowInfo("ADMIN禁止更改卡信息...");
|
|
return;
|
|
}
|
|
if (string.IsNullOrEmpty(txtCardNo.Text) || txtCardNo.Text.Length < 15)
|
|
{
|
|
CommonHelper.MsgShowInfo("请输入正确卡号...");
|
|
return;
|
|
}
|
|
if (string.IsNullOrEmpty(cmbCardType.SelectedItem.Value) || string.IsNullOrEmpty(cmbCardState.SelectedItem.Value))
|
|
{
|
|
CommonHelper.MsgShowInfo("请选择卡类型或者卡状态...");
|
|
return;
|
|
}
|
|
try
|
|
{
|
|
CardInfoModel mdl = new CardInfoModel();
|
|
if (CommonHelper._userType == "3" || CommonHelper._userType == "4")
|
|
{
|
|
mdl.SUBCOMNO = 1;
|
|
}
|
|
else
|
|
{
|
|
DataTable dtSta = dicbll.GetStaAllInfo(" and STANO=" + CommonHelper._userStaNo + "");
|
|
mdl.SUBCOMNO = int.Parse(dtSta.Rows[0]["SUBCOMNO"].ToString());
|
|
}
|
|
mdl.STANO = int.Parse(CommonHelper._userStaNo);
|
|
mdl.TYPE = int.Parse(cmbCardType.SelectedItem.Value);
|
|
mdl.STATEID = int.Parse(cmbCardState.SelectedItem.Value);
|
|
mdl.CARDNO = txtCardNo.Text.Trim();
|
|
mdl.ADMANNO = int.Parse(hdUserId.Value.ToString());
|
|
mdl.ADMAN = hdMan.Value.ToString();
|
|
mdl.DATEMARK = DateTime.Now;
|
|
mdl.MKDT = DateTime.Now;
|
|
mdl.REMARK = txtRemark.Text;
|
|
mdl.USERTYPE = int.Parse(CommonHelper._userType);
|
|
if (cpcbll.AddCardInfo(mdl))
|
|
{
|
|
CommonHelper.MsgShowInfo("卡信息录入成功");
|
|
}
|
|
else
|
|
{
|
|
CommonHelper.MsgShowInfo("卡信息录入失败,请重新操作...");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
CommonHelper.MsgShowInfo("卡信息录入异常:" + ex.Message);
|
|
}
|
|
StCardInfo.DataBind();
|
|
wdEdit.Hide();
|
|
}
|
|
/// <summary>
|
|
/// 修改
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnEdit_Click(object sender, Ext.Net.DirectEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (hdSubCmno.Value == null || hdStano.Value == null || hdCardNo.Value == null)
|
|
{
|
|
CommonHelper.MsgShowInfo("请重新选择要操作的行...");
|
|
return;
|
|
}
|
|
if (string.IsNullOrEmpty(cmbCardType.SelectedItem.Value) || string.IsNullOrEmpty(cmbCardState.SelectedItem.Value))
|
|
{
|
|
CommonHelper.MsgShowInfo("请选择卡类型或者卡状态...");
|
|
return;
|
|
}
|
|
string setStr = " TYPE=" + cmbCardType.SelectedItem.Value + ",STATEID=" + cmbCardState.SelectedItem.Value + ",REMARK='" + txtRemark.Text.Trim() + "'";
|
|
string sqlwhere = " and SUBCOMNO='" + hdSubCmno.Value + "' and STANO='" + hdStano.Value + "' and CARDNO='" + hdCardNo.Value + "'";
|
|
if (cpcbll.UpdateCardInfo(setStr, sqlwhere))
|
|
{
|
|
CommonHelper.MsgShowInfo("卡信息修改成功");
|
|
}
|
|
else
|
|
{
|
|
CommonHelper.MsgShowInfo("卡信息修改失败,请重新操作...");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
CommonHelper.MsgShowInfo("卡信息修改异常:" + ex.Message);
|
|
}
|
|
StCardInfo.DataBind();
|
|
wdEdit.Hide();
|
|
}
|
|
/// <summary>
|
|
/// 删除
|
|
/// </summary>
|
|
[DirectMethod]
|
|
public void Delete(string subcomno, string stano, string cardno)
|
|
{
|
|
try
|
|
{
|
|
string sql = "delete from CB_CARDINFO_TABLE where 1=1 and SUBCOMNO='" + subcomno + "' and STANO='" + stano + "' and CARDNO='" + cardno + "'";
|
|
if (cpcbll.MyExcuteSql(sql))
|
|
{
|
|
CommonHelper.MsgShowInfo("卡信息删除成功");
|
|
}
|
|
else
|
|
{
|
|
CommonHelper.MsgShowInfo("卡信息删除失败,请重新操作...");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
CommonHelper.MsgShowInfo("卡信息删除异常:" + ex.Message);
|
|
}
|
|
StCardInfo.DataBind();
|
|
}
|
|
|
|
}
|
|
} |