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 Maticsoft.BLL;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
using Ajax;
|
|
|
|
|
|
|
|
|
|
public partial class Wages_browse : CommonPage
|
|
|
|
|
{
|
2024-05-22 11:30:40 +08:00
|
|
|
|
|
2024-05-18 15:28:29 +08:00
|
|
|
|
//创建一个共用的编码bll层
|
|
|
|
|
Maticsoft.BLL.nr_sys_bianma bm = new Maticsoft.BLL.nr_sys_bianma();
|
|
|
|
|
//创建一个共用的类型BLL层
|
|
|
|
|
Maticsoft.BLL.nr_sys_leixing bmlx = new Maticsoft.BLL.nr_sys_leixing();
|
|
|
|
|
//创建一个共用的工价档案bll层
|
|
|
|
|
Maticsoft.BLL.nr_z_cpkc_gj gjdabll = new Maticsoft.BLL.nr_z_cpkc_gj();
|
|
|
|
|
//创建一个共用的工价档案
|
|
|
|
|
Maticsoft.Model.nr_z_cpkc_gj gjdamd = new Maticsoft.Model.nr_z_cpkc_gj();
|
|
|
|
|
//创建一个操作记录bll
|
2024-05-22 11:30:40 +08:00
|
|
|
|
Maticsoft.BLL.nr_sys_rizhi rizhibll = new Maticsoft.BLL.nr_sys_rizhi();
|
2024-05-18 15:28:29 +08:00
|
|
|
|
//创建一个操作记录模板
|
|
|
|
|
Maticsoft.Model.nr_sys_rizhi rizhi = new Maticsoft.Model.nr_sys_rizhi();
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Utility.RegisterTypeForAjax(typeof(Wages_browse));
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
{
|
|
|
|
|
if (Session["user"] == null)
|
|
|
|
|
{
|
|
|
|
|
Response.Redirect("../index.aspx");
|
|
|
|
|
}
|
|
|
|
|
//获取角色权限
|
2024-05-22 11:30:40 +08:00
|
|
|
|
Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]);
|
2024-05-18 15:28:29 +08:00
|
|
|
|
if (Request.QueryString["uid"] != null && Request.QueryString["uid"].ToString().Length > 0)
|
|
|
|
|
{
|
|
|
|
|
pdquanxianbj(user.juese);
|
|
|
|
|
string uid = Request.QueryString["uid"].ToString();
|
|
|
|
|
id.Value = uid;
|
2024-05-22 11:30:40 +08:00
|
|
|
|
initdata(uid);
|
2024-05-18 15:28:29 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2024-05-22 11:30:40 +08:00
|
|
|
|
pdquanxian(user.juese);
|
|
|
|
|
|
2024-05-18 15:28:29 +08:00
|
|
|
|
}
|
2024-05-22 11:30:40 +08:00
|
|
|
|
|
|
|
|
|
|
2024-05-18 15:28:29 +08:00
|
|
|
|
}
|
2024-05-22 11:30:40 +08:00
|
|
|
|
}
|
2024-05-18 15:28:29 +08:00
|
|
|
|
|
|
|
|
|
#region 修改时获取真正数据值
|
|
|
|
|
private void initdata(string did)
|
|
|
|
|
{
|
2024-05-22 11:30:40 +08:00
|
|
|
|
DataSet ds = DBHlper.Execute("select * from view_nr_z_cpkc_gj where id='" + did + "'");
|
2024-05-18 15:28:29 +08:00
|
|
|
|
if (ds != null && ds.Tables[0].Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
cpbh.Value = ds.Tables[0].Rows[0]["cpbh"].ToString();
|
|
|
|
|
cpmc.Value = ds.Tables[0].Rows[0]["cpmc"].ToString();
|
|
|
|
|
cpzl.Value = ds.Tables[0].Rows[0]["zl"].ToString();
|
|
|
|
|
guige.Value = ds.Tables[0].Rows[0]["gg"].ToString();
|
|
|
|
|
zhongliang.Value = ds.Tables[0].Rows[0]["zhongliang"].ToString();
|
|
|
|
|
tiji.Value = ds.Tables[0].Rows[0]["tiji"].ToString();
|
2024-05-22 11:30:40 +08:00
|
|
|
|
DataSet gjds = DBHlper.Execute(" select * from view_bianma where zhonglei='前段工价' or zhonglei='中段工价' or zhonglei='后段工价'");
|
2024-05-18 15:28:29 +08:00
|
|
|
|
if (gjds != null && gjds.Tables[0].Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
//修改页面时,首先吧项目明细的表头加载出来
|
|
|
|
|
string biao = " <table class='tablewk' id='gjfytb'>";
|
2024-05-22 11:30:40 +08:00
|
|
|
|
int x = 0;
|
|
|
|
|
|
|
|
|
|
foreach (DataRow r in gjds.Tables[0].Rows)
|
2024-05-18 15:28:29 +08:00
|
|
|
|
{
|
|
|
|
|
if (x == 0)
|
|
|
|
|
{
|
|
|
|
|
biao += "<tr>";
|
|
|
|
|
}
|
|
|
|
|
x = x + 1;
|
2024-05-22 11:30:40 +08:00
|
|
|
|
string cpgjzhi = DBHlper.getfirstcolmn("select isnull(gjjg,0) from nr_z_cpkc_gj where cpid='" + did + "' and gjmc='" + r["mingcheng"] + "'");
|
|
|
|
|
biao += "<td class='wktblm' ><span>" + r["mingcheng"] + "</span></td><td ><input type='text' id='dhsl' name='" + r["mingcheng"] + "' runat='server' value='" + cpgjzhi + "' class='tbinput' onkeyup='doubleshuru(this)' /> </td>";
|
|
|
|
|
if (x == 6)
|
2024-05-18 15:28:29 +08:00
|
|
|
|
{
|
|
|
|
|
biao += "<td class='tdjj5'>  </td></tr>";
|
|
|
|
|
x = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (x > 0 && x < 6)
|
|
|
|
|
{
|
|
|
|
|
for (int c = 0; c < 6 - x; c++)
|
|
|
|
|
{
|
|
|
|
|
biao += "<td class='wktblm' >" + "</td><td > </td>";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
biao += "<td class='tdjj5'>  </td></tr>";
|
|
|
|
|
}
|
|
|
|
|
gjxx.InnerHtml = biao + "</table>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 获取页面参数赋值model对象
|
|
|
|
|
private void getmd()
|
2024-05-22 11:30:40 +08:00
|
|
|
|
{
|
2024-05-18 15:28:29 +08:00
|
|
|
|
//给日志模板赋值
|
|
|
|
|
rizhi.riqi = DateTime.Now;
|
|
|
|
|
rizhi.leixing = "工价档案";
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
2024-05-22 11:30:40 +08:00
|
|
|
|
|
2024-05-18 15:28:29 +08:00
|
|
|
|
#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_cpkc_gj", "添加") == false)
|
2024-05-18 15:28:29 +08:00
|
|
|
|
{
|
|
|
|
|
Response.Redirect("../Common/nopower.htm");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 编辑权限查看
|
|
|
|
|
void pdquanxianbj(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_cpkc_gj", "编辑全部") == false)
|
2024-05-18 15:28:29 +08:00
|
|
|
|
{
|
|
|
|
|
Response.Redirect("../Common/nopower.htm");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
protected void bt_tj_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string caozuo = "添加";
|
|
|
|
|
getmd();
|
|
|
|
|
//接收成功参数值
|
|
|
|
|
int rtx = 0;
|
|
|
|
|
//判断uid是否存在值,有值为修改,无值为添加
|
|
|
|
|
|
2024-05-22 11:30:40 +08:00
|
|
|
|
DBHlper.excutecmd("delete nr_z_cpkc_gj where cpid='" + id.Value + "'");
|
2024-05-18 15:28:29 +08:00
|
|
|
|
|
|
|
|
|
List<Maticsoft.Model.nr_z_cpkc_gj> gjdads = new List<Maticsoft.Model.nr_z_cpkc_gj>();
|
|
|
|
|
gjdads = DBHlper.ConvertJsonToEntityListEntity<Maticsoft.Model.nr_z_cpkc_gj>(gjxxhd.Value);
|
|
|
|
|
foreach (Maticsoft.Model.nr_z_cpkc_gj gjx in gjdads)
|
2024-05-22 11:30:40 +08:00
|
|
|
|
{
|
|
|
|
|
gjx.cpid = Convert.ToInt32(id.Value);
|
|
|
|
|
rtx = gjdabll.Add(gjx);
|
2024-05-18 15:28:29 +08:00
|
|
|
|
}
|
2024-05-22 11:30:40 +08:00
|
|
|
|
|
|
|
|
|
caozuo = "修改";
|
|
|
|
|
|
2024-05-18 15:28:29 +08:00
|
|
|
|
if (rtx > 0)
|
|
|
|
|
{
|
|
|
|
|
//将session转换对象取值
|
|
|
|
|
Maticsoft.Model.nr_z_yhzh zh = (Maticsoft.Model.nr_z_yhzh)Session["user"];
|
|
|
|
|
//拼接字符串插入日志
|
|
|
|
|
rizhi.jilu = zh.zhanghao + caozuo + "了工价档案,档案编号为:" + cpbh.Value.Trim();
|
|
|
|
|
rizhi.yonghuming = zh.zhanghao;
|
|
|
|
|
rizhibll.Add(rizhi);
|
|
|
|
|
Response.Redirect("Wages_browse.aspx?uid=" + id.Value, false);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Response.Redirect("../Common/error.aspx");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
Response.Redirect("../Common/error.aspx");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//查询客户名称是否重复
|
|
|
|
|
[Ajax.AjaxMethod()]
|
|
|
|
|
public int serchmingcheng(string str)
|
|
|
|
|
{
|
|
|
|
|
string cmd = string.Format("select count(*) from nr_z_cpkc_gj where mingcheng='{0}'", str.Replace(" ", ""));
|
|
|
|
|
int count = DBHlper.getcount(cmd);
|
|
|
|
|
return count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|