/// <summary> /// 责任人执行【送部门审批】功能 /// </summary> /// <param name="czid">资产包处置ID</param> /// <returns></returns> public string PiYueZcBForDepart(string czid) { string err1 = null; this.tabCommand.TableConnect.BeginTrans(); try { bool flag = this.GetNoEndSPByCZID(czid); if (flag == false) { err1 = "错误提示:存在未处理的批阅环节,不能进行新的审批流程!"; } else { U_UserNameBU user1 = new U_UserNameBU(); string leader = user1.GetDirLeader(); user1.Close(); if (leader == null || leader.Trim() == "") { err1 = "错误信息:你所在的部门没有定义部门主管,无法批阅!"; } else { err1 = this.SendSPPerson(leader, czid, SP.部门审批); } } this.tabCommand.TableConnect.CommitTrans(); return(err1); } catch (Exception errTrans) { this.tabCommand.TableConnect.RollBackTrans(); return("【系统错误】:数据库事务处理发生错误,请重新提交!"); } }
//更新资产包信息 public bool UpdateZcBaoInfo(string id, Hashtable ht) { try { List <SearchField> list1 = new List <SearchField>(); list1.Add(new SearchField("id", id, SearchFieldType.数值型)); this.TabCommand.EditQuickData(list1, ht); //同时更新资产处置表的的 if (ht["Bzeren"] != null) { String zeren = ht["Bzeren"].ToString(); U_UserNameBU un1 = new U_UserNameBU(); string Depart = un1.GetDepartInfo(zeren); if (String.IsNullOrEmpty(zeren) == false && String.IsNullOrEmpty(Depart) == false) { String sql1 = "update u_zc2 set depart='" + Depart + "' ,zeren='" + zeren + "' where zcbid in (" + id + ")"; this.tabCommand.TableComm.ExecuteNoQuery(sql1); } } return(true); } catch { return(false); } }
//判断用户是否有部门的资产 public static bool HaveBuZC() { U_UserNameBU user1 = new U_UserNameBU(); String userName1 = user1.GetSelfAndXiaShu(Comm.CurUser); user1.Close(); bool result = false; CommTable com1 = new CommTable(); com1.TabName = "u_zc"; List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("zeren", userName1, SearchOperator.集合)); DataSet ds = com1.SearchData("count(*) count1", condition); com1.Close(); if (ds != null && ds.Tables[0].Rows.Count > 0) { if (Int32.Parse(ds.Tables[0].Rows[0][0].ToString()) > 0) { result = true; } } return(result); }
/// <summary> /// 功能说明:增加当前用户的登录日志 /// </summary> public void AddLogo(string username) { string depart = ""; //根据当前用户名得到所在的部门 U_UserNameBU user1 = new U_UserNameBU(); depart = user1.GetDepart1(username); user1.Close(); List <SearchField> list1 = new List <SearchField>(); list1.Add(new SearchField("sname", username)); list1.Add(new SearchField("endlogin", "", SearchOperator.空值)); list1.Add(new SearchField("beginlogin", "", SearchOperator.非空值)); DataSet ds = this.tabCommand.SearchData("*", list1); if (ds.Tables[0].Rows.Count == 0) { //表示没有用户登录日志记录,则增加一条新的数据记录; DataRow dr = ds.Tables[0].NewRow(); dr["sname"] = username; dr["depart"] = depart; dr["beginlogin"] = DateTime.Now.ToString(); ds.Tables[0].Rows.Add(dr); } else { //表示存在没有完整的用户日志记录 DateTime dt0 = DateTime.Now; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; DateTime dt1 = DateTime.Parse(dr["beginlogin"].ToString()); if (dt0.Date != dt1.Date) { //日期不相等,则直接修改结束日期为17:30 dr["endlogin"] = dt1.Date.ToString("yyyy-MM-dd") + " 17:30:00"; DateTime dt2 = DateTime.Parse(dr["endlogin"].ToString()); TimeSpan sp1 = dt2 - dt1; dr["time1"] = sp1.Minutes.ToString(); //同时新增一条当他记录 DataRow dr1 = ds.Tables[0].NewRow(); dr1["sname"] = username; dr1["depart"] = depart; dr1["beginlogin"] = DateTime.Now.ToString(); ds.Tables[0].Rows.Add(dr1); } } } this.tabCommand.Update(ds); ds.AcceptChanges(); }
/// <summary> /// 得到我和我下属的资产列表 /// </summary> /// <returns></returns> public DataSet GetShenPiList2() { List <SearchField> condition = new List <SearchField>(); U_UserNameBU user1 = new U_UserNameBU(); String userName1 = user1.GetSelfAndXiaShu(Comm.CurUser); user1.Close(); if (userName1 != String.Empty) { condition.Add(new SearchField("zeren", userName1, SearchOperator.集合)); condition.Add(new SearchField("exists(select * from u_zcsp where czid=u_zc2.id)", "", SearchOperator.用户定义)); } return(this.GetShenPiList(condition)); }
//设置角色用户 public void SetRoleUsers(CheckBoxList chk1, string value1) { U_UserNameBU user1 = new U_UserNameBU(); DataSet ds1 = user1.GetAllUserList(); user1.Close(); for (int i = 0; i < ds1.Tables[0].Rows.Count; i++) { ListItem list1 = new ListItem(ds1.Tables[0].Rows[i]["sname"].ToString(), ds1.Tables[0].Rows[i]["sname"].ToString()); chk1.Items.Add(list1); } if (value1 != "无" && value1 != "") { Util.setListControlByValue(chk1, value1, ','); } }
//判断是否能浏览档案 public static bool isCanSeeFile(String ajnum) { bool result = false; //判断是否为“档案管理员” String[] allowRoles = new String[] { "档案管理员", "公司领导", "评审部角色" }; U_RolesBU role1 = new U_RolesBU(); //判断是否为“公司领导” result = role1.isRole(allowRoles); //判断是否为该资产责任人的 “领导” //判断是否为该资产的责任人或“协办人" if (result == false) { //普通的用户只能查询自己负责(或下属负责的项目) U_UserNameBU user1 = new U_UserNameBU(); String userName1 = user1.GetSelfAndXiaShu(Comm.CurUser); user1.Close(); String[] userArr = userName1.Split(','); CommTable tab1 = new CommTable("U_ZC"); List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("num2", ajnum)); DataSet ds1 = tab1.SearchData("*", condition); if (ds1 != null && ds1.Tables[0].Rows.Count > 0) { DataRow dr1 = ds1.Tables[0].Rows[0]; String u1 = dr1["Zeren"].ToString().Trim(); string u2 = dr1["Zeren1"].ToString().Trim(); if (u1 != String.Empty && Array.IndexOf(userArr, u1) >= 0) { result = true; //判断是否为资产的责任人(或责任人领导) } //判断是否为资产的协办人 if (result == false) { if (u2 != String.Empty && u2 == Comm.CurUser) { result = true; } } } } //判断是否通过了借阅申请 if (result == false) { CommTable comm1 = new CommTable("DA_JyBill"); List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("ajnum", ajnum)); condition.Add(new SearchField("borrow", Comm.CurUser)); condition.Add(new SearchField("status", "1")); condition.Add(new SearchField("time1", DateTime.Now.ToString("yyyy-MM-dd"), SearchOperator.大于等于)); DataSet ds1 = comm1.SearchData("count(*)", condition); if (ds1 != null && ds1.Tables[0].Rows.Count > 0) { DataRow dr1 = ds1.Tables[0].Rows[0]; if (int.Parse(dr1[0].ToString().Trim()) > 0) { result = true; } } comm1.Close(); } return(result); }
public DataSet GetZhiChu(string begintime, string endtime, string depart) { string sql1 = "select zeren from CW_PayView"; if (depart != "" && depart != null) { sql1 = sql1 + " where depart='" + depart + "'"; } sql1 = sql1 + " group by zeren"; DataSet ds1 = this.tabCommand.TableComm.SearchData(sql1); string sql2 = "select bzeren from CW_Pay1View"; if (depart != "" && depart != null) { sql2 = sql2 + " where depart='" + depart + "'"; } sql2 = sql2 + " group by bzeren"; DataSet ds2 = this.tabCommand.TableComm.SearchData(sql2); DataRow dr = ds1.Tables[0].NewRow(); for (int i = 0; i < ds2.Tables[0].Rows.Count; i++) { bool first = false; for (int j = 0; j < ds1.Tables[0].Rows.Count; j++) { if (ds1.Tables[0].Rows[j][0].ToString() == ds2.Tables[0].Rows[i][0].ToString()) { first = true; } } if (first == false) { dr["zeren"] = ds2.Tables[0].Rows[i][0].ToString(); ds1.Tables[0].Rows.Add(dr); } } string sql3 = "select sum(isnull(fee1,0)) as Sumfee1,sum(isnull(fee2,0)) as Sumfee2,sum(isnull(fee3,0)) as Sumfee3,sum(isnull(fee4,0)) as Sumfee4,sum(isnull(fee5,0)) as Sumfee5,sum(isnull(fee6,0)) as Sumfee6,sum(isnull(fee7,0)) as Sumfee7,sum(isnull(fee8,0)) as Sumfee8,sum(isnull(fee9,0)) as Sumfee9,sum(isnull(fee10,0)) as Sumfee10,sum(isnull(fee11,0)) as Sumfee11,sum(isnull(fee12,0)) as Sumfee12,zeren from CW_PAY where 1=1"; if (begintime != "" && begintime != null) { sql3 = sql3 + " and billtime >= '" + begintime + "'"; } if (endtime != "" && endtime != null) { sql3 = sql3 + " and billtime <= '" + endtime + "'"; } sql3 = sql3 + " group by zeren"; DataSet ds3 = this.tabCommand.TableComm.SearchData(sql3); DataSet ds = new DataSet(); DataTable tab1 = new DataTable(); //tab1.Columns.Add("depart"); tab1.Columns.Add("zeren"); tab1.Columns.Add("zcid"); tab1.Columns.Add("bid"); tab1.Columns.Add("Sumfee1"); tab1.Columns.Add("Sumfee2"); tab1.Columns.Add("Sumfee3"); tab1.Columns.Add("Sumfee4"); tab1.Columns.Add("Sumfee5"); tab1.Columns.Add("Sumfee6"); tab1.Columns.Add("Sumfee7"); tab1.Columns.Add("Sumfee8"); tab1.Columns.Add("Sumfee9"); tab1.Columns.Add("Sumfee10"); tab1.Columns.Add("Sumfee11"); tab1.Columns.Add("Sumfee12"); tab1.Columns.Add("Sumfee"); U_UserNameBU user1 = new U_UserNameBU(); DataRow dr1 = null; for (int i = 0; i < ds1.Tables[0].Rows.Count; i++) { dr1 = tab1.NewRow(); dr1["zeren"] = ds1.Tables[0].Rows[i][0].ToString(); Hashtable ht = this.GetZCIDAndBIDByZeren(ds1.Tables[0].Rows[i][0].ToString(), begintime, endtime); dr1["zcid"] = ht["zcid"].ToString(); dr1["bid"] = ht["bid"].ToString(); dr1["Sumfee1"] = "0"; dr1["Sumfee2"] = "0"; dr1["Sumfee3"] = "0"; dr1["Sumfee4"] = "0"; dr1["Sumfee5"] = "0"; dr1["Sumfee6"] = "0"; dr1["Sumfee7"] = "0"; dr1["Sumfee8"] = "0"; dr1["Sumfee9"] = "0"; dr1["Sumfee10"] = "0"; dr1["Sumfee11"] = "0"; dr1["Sumfee12"] = "0"; dr1["Sumfee"] = "0"; for (int j = 0; j < ds3.Tables[0].Rows.Count; j++) { if (ds3.Tables[0].Rows[j]["zeren"].ToString() == ds1.Tables[0].Rows[i][0].ToString()) { for (int k = 1; k < 13; k++) { if (ds3.Tables[0].Rows[j]["Sumfee" + k].ToString() != "" && ds3.Tables[0].Rows[j]["Sumfee" + k] != null) { dr1["Sumfee" + k] = ds3.Tables[0].Rows[j]["Sumfee" + k].ToString(); } dr1["Sumfee"] = double.Parse(dr1["Sumfee"].ToString()) + double.Parse(dr1["Sumfee" + k].ToString()); } } } //dr1["depart"] = user1.GetDepart1(ds1.Tables[0].Rows[i][0].ToString()); tab1.Rows.Add(dr1); } string sql4 = "select sum(isnull(fee1,0)) as Sumfee1,sum(isnull(fee2,0)) as Sumfee2,sum(isnull(fee3,0)) as Sumfee3,sum(isnull(fee4,0)) as Sumfee4,sum(isnull(fee5,0)) as Sumfee5,sum(isnull(fee6,0)) as Sumfee6,sum(isnull(fee7,0)) as Sumfee7,sum(isnull(fee8,0)) as Sumfee8,sum(isnull(fee9,0)) as Sumfee9,sum(isnull(fee10,0)) as Sumfee10,sum(isnull(fee11,0)) as Sumfee11,sum(isnull(fee12,0)) as Sumfee12,bzeren from CW_PAY1 where 1=1"; if (begintime != "" && begintime != null) { sql4 = sql4 + " and billtime >= '" + begintime + "'"; } if (endtime != "" && endtime != null) { sql4 = sql4 + " and billtime <= '" + endtime + "'"; } sql4 = sql4 + " group by bzeren"; DataSet ds4 = this.tabCommand.TableComm.SearchData(sql4); for (int i = 0; i < tab1.Rows.Count; i++) { for (int j = 0; j < ds4.Tables[0].Rows.Count; j++) { if (ds4.Tables[0].Rows[j]["bzeren"].ToString() == tab1.Rows[i]["zeren"].ToString()) { for (int k = 1; k < 13; k++) { if (ds4.Tables[0].Rows[j]["Sumfee" + k].ToString() != "" && ds4.Tables[0].Rows[j]["Sumfee" + k] != null) { tab1.Rows[i]["Sumfee" + k] = double.Parse(tab1.Rows[i]["Sumfee" + k].ToString()) + double.Parse(ds4.Tables[0].Rows[j]["Sumfee" + k].ToString()); } tab1.Rows[i]["Sumfee"] = double.Parse(tab1.Rows[i]["Sumfee"].ToString()) + double.Parse(ds4.Tables[0].Rows[j]["Sumfee" + k].ToString()); } } } } ds.Tables.Add(tab1); return(ds); }
public DataSet GetFASP(string begintime, string endtime, string depart) { string sql1 = "select ZCzeren from ZCSPStatView"; if (depart != "" && depart != null) { sql1 = sql1 + " where depart='" + depart + "'"; } sql1 = sql1 + " group by ZCzeren"; DataSet ds1 = this.tabCommand.TableComm.SearchData(sql1); string sql2 = "select max(id) as mid,zcid,ZCzeren,kind from ZCSPStatView where 1=1"; if (depart != "" && depart != null) { sql2 = sql2 + " and depart='" + depart + "'"; } if (begintime != "" && begintime != null) { sql2 = sql2 + " and time0 > '" + begintime + "'"; } if (endtime != "" && endtime != null) { sql2 = sql2 + " and time0 < '" + endtime + "'"; } sql2 = sql2 + " group by ZCzeren,kind,zcid"; DataSet ds2 = this.tabCommand.TableComm.SearchData(sql2); DataSet ds = new DataSet(); DataTable tab1 = new DataTable(); tab1.Columns.Add("zeren"); tab1.Columns.Add("depart"); tab1.Columns.Add("count1"); tab1.Columns.Add("count2"); tab1.Columns.Add("count3"); tab1.Columns.Add("count4"); tab1.Columns.Add("count5"); tab1.Columns.Add("count6"); tab1.Columns.Add("count7"); U_UserNameBU user1 = new U_UserNameBU(); DataRow dr = null; for (int i = 0; i < ds1.Tables[0].Rows.Count; i++) { dr = tab1.NewRow(); dr["zeren"] = ds1.Tables[0].Rows[i][0].ToString(); dr["count1"] = "0"; dr["count2"] = "0"; dr["count3"] = "0"; dr["count4"] = "0"; dr["count5"] = "0"; dr["count6"] = "0"; for (int j = 0; j < ds2.Tables[0].Rows.Count; j++) { if (ds2.Tables[0].Rows[j]["ZCzeren"].ToString() == ds1.Tables[0].Rows[i][0].ToString()) { if (ds2.Tables[0].Rows[j]["kind"].ToString() == "11") { dr["count1"] = Int32.Parse(dr["count1"].ToString()) + 1; } if (ds2.Tables[0].Rows[j]["kind"].ToString() == "12") { dr["count2"] = Int32.Parse(dr["count2"].ToString()) + 1; } if (ds2.Tables[0].Rows[j]["kind"].ToString() == "13") { dr["count3"] = Int32.Parse(dr["count3"].ToString()) + 1; } if (ds2.Tables[0].Rows[j]["kind"].ToString() == "14") { dr["count4"] = Int32.Parse(dr["count4"].ToString()) + 1; } if (ds2.Tables[0].Rows[j]["kind"].ToString() == "15") { dr["count5"] = Int32.Parse(dr["count5"].ToString()) + 1; } if (ds2.Tables[0].Rows[j]["kind"].ToString() == "16") { dr["count6"] = Int32.Parse(dr["count6"].ToString()) + 1; } } } dr["count7"] = Int32.Parse(dr["count1"].ToString()) + Int32.Parse(dr["count2"].ToString()) + Int32.Parse(dr["count3"].ToString()) + Int32.Parse(dr["count4"].ToString()) + Int32.Parse(dr["count5"].ToString()) + Int32.Parse(dr["count6"].ToString()); dr["depart"] = user1.GetDepart1(ds1.Tables[0].Rows[i][0].ToString()); tab1.Rows.Add(dr); } user1.Close(); ds.Tables.Add(tab1); return(ds); }
/// <summary> /// 根据查询条件,得到查询结果 /// </summary> /// <returns></returns> public DataSet GetShenPiListBySearchCondition( String xmmc, String num1, String danwei, String status, String time0, String time1, String status1, String status2) { List <SearchField> condition = new List <SearchField>(); if (xmmc != String.Empty) { condition.Add(new SearchField("xmmc", xmmc, SearchOperator.包含)); } if (num1 != String.Empty) { condition.Add(new SearchField("num2", num1)); } if (danwei != String.Empty) { condition.Add(new SearchField("danwei", danwei, SearchOperator.包含)); } if (status != String.Empty) { condition.Add(new SearchField("spstatus", status)); } if (time0 != String.Empty) { condition.Add(new SearchField("shijian1", time0, SearchOperator.大于等于)); } if (time1 != String.Empty) { condition.Add(new SearchField("shijian1", time1, SearchOperator.小于等于)); } if (status1 != String.Empty) { condition.Add(new SearchField("status1", status1)); } if (status2 != String.Empty) { condition.Add(new SearchField("status2", status1)); } //设置查询范围 U_RolesBU role1 = new U_RolesBU(); bool isAllCanSee = role1.isRole(new string[] { "公司领导", "评审部角色", "综合管理", "会计", "出纳", "领导秘书" }); role1.Close(); //1)公司领导、会计、出纳、领导秘书 可查询所有的项目 if (isAllCanSee == false) { //普通的用户只能查询自己负责(或下属负责的项目) List <SearchField> condition1 = new List <SearchField>(); U_UserNameBU user1 = new U_UserNameBU(); String userName1 = user1.GetSelfAndXiaShu(Comm.CurUser); user1.Close(); if (userName1 != String.Empty) { condition.Add(new SearchField("zeren", userName1, SearchOperator.集合)); } } return(this.GetShenPiList(condition)); }
public DataSet Gethuikuan(string begintime, string endtime, string depart) { string sql1 = "select zeren from CW_ShouKuanView"; if (depart != "" && depart != null) { sql1 = sql1 + " where depart='" + depart + "'"; } sql1 = sql1 + " group by zeren"; DataSet ds1 = this.tabCommand.TableComm.SearchData(sql1); string sql2 = "select bzeren from CW_ShouKuan1View"; if (depart != "" && depart != null) { sql2 = sql2 + " where depart='" + depart + "'"; } sql2 = sql2 + " group by bzeren"; DataSet ds2 = this.tabCommand.TableComm.SearchData(sql2); DataRow dr = ds1.Tables[0].NewRow(); for (int i = 0; i < ds2.Tables[0].Rows.Count; i++) { bool first = false; for (int j = 0; j < ds1.Tables[0].Rows.Count; j++) { if (ds1.Tables[0].Rows[j][0].ToString() == ds2.Tables[0].Rows[i][0].ToString()) { first = true; } } if (first == false) { dr["zeren"] = ds2.Tables[0].Rows[i][0].ToString(); ds1.Tables[0].Rows.Add(dr); } } string sql3 = "select sum(isnull(pbj,0))+ sum(isnull(plx,0)) as hkje,zeren from CW_ShouKuanView where 1=1"; if (depart != "" && depart != null) { sql3 = sql3 + " and depart = '" + depart + "'"; } if (begintime != "" && begintime != null) { sql3 = sql3 + " and billtime >= '" + begintime + "'"; } if (endtime != "" && endtime != null) { sql3 = sql3 + " and billtime <= '" + endtime + "'"; } sql3 = sql3 + " group by zeren"; DataSet ds3 = this.tabCommand.TableComm.SearchData(sql3); DataSet ds = new DataSet(); DataTable tab1 = new DataTable(); //tab1.Columns.Add("depart"); tab1.Columns.Add("zeren"); tab1.Columns.Add("hkje"); tab1.Columns.Add("zcid"); tab1.Columns.Add("bid"); U_UserNameBU user1 = new U_UserNameBU(); DataRow dr1 = null; for (int i = 0; i < ds1.Tables[0].Rows.Count; i++) { dr1 = tab1.NewRow(); dr1["zeren"] = ds1.Tables[0].Rows[i][0].ToString(); Hashtable ht = this.GetZCIDAndBIDByZeren(ds1.Tables[0].Rows[i][0].ToString(), begintime, endtime); dr1["zcid"] = ht["zcid"].ToString(); dr1["bid"] = ht["bid"].ToString(); dr1["hkje"] = "0"; for (int j = 0; j < ds3.Tables[0].Rows.Count; j++) { if (ds3.Tables[0].Rows[j]["zeren"].ToString() == ds1.Tables[0].Rows[i][0].ToString()) { if (ds3.Tables[0].Rows[j]["hkje"].ToString() != "" && ds3.Tables[0].Rows[j]["hkje"] != null) { dr1["hkje"] = ds3.Tables[0].Rows[j]["hkje"].ToString(); } } } //dr1["depart"] = user1.GetDepart1(ds1.Tables[0].Rows[i][0].ToString()); tab1.Rows.Add(dr1); } string sql4 = "select sum(isnull(pbj,0))+ sum(isnull(plx,0)) as hkje,bzeren from CW_ShouKuan1View where 1=1"; if (depart != "" && depart != null) { sql4 = sql4 + " and depart = '" + depart + "'"; } if (begintime != "" && begintime != null) { sql4 = sql4 + " and billtime >= '" + begintime + "'"; } if (endtime != "" && endtime != null) { sql4 = sql4 + " and billtime <= '" + endtime + "'"; } sql4 = sql4 + " group by bzeren"; DataSet ds4 = this.tabCommand.TableComm.SearchData(sql4); for (int i = 0; i < tab1.Rows.Count; i++) { for (int j = 0; j < ds4.Tables[0].Rows.Count; j++) { if (ds4.Tables[0].Rows[j]["bzeren"].ToString() == tab1.Rows[i]["zeren"].ToString()) { if (ds4.Tables[0].Rows[j]["hkje"].ToString() != "" && ds4.Tables[0].Rows[j]["hkje"] != null) { tab1.Rows[i]["hkje"] = double.Parse(tab1.Rows[i]["hkje"].ToString()) + double.Parse(ds4.Tables[0].Rows[j]["hkje"].ToString()); } } } } ds.Tables.Add(tab1); return(ds); }