//得到案卷的综合查询结果 public DataSet GetSearchResult(List <SearchField> list1) { U_RolesBU role1 = new U_RolesBU(); String sql = null; String condition = SearchField.GetSearchCondition(list1); if (role1.isRole(new string[] { "公司领导", "评审部角色", "会计", "出纳", "档案管理员" })) { sql = "select * from DA_AnJuan "; if (condition != null && condition.Trim() != String.Empty) { sql = sql + " where " + condition; } } else { sql = @"select DA_AnJuan.* from DA_AnJuan inner join U_ZC on DA_AnJuan.ajnum=U_ZC.num2 where U_ZC.zeren='" + Comm.CurUser + "'"; if (condition != null && condition.Trim() != String.Empty) { sql = sql + " and " + condition; } } DataSet ds1 = this.tabCommand.TableComm.SearchData(sql); return(ds1); }
//得到所有资产清收人员所在的部门列表 public string[] GetZcJobDepart() { string[] result = null; U_RolesBU role1 = new U_RolesBU(); string roleUsers = role1.GetRoleAllUsers("资产清收人员"); role1.Close(); if (roleUsers != "") { string[] temp = roleUsers.Split(','); string temp1 = Util.sqlValue(temp); string str1 = "select depart from U_depart where depart in ( select depart from " + this.tabCommand.TabName + " where sname in ( " + temp1 + " ) group by depart ) order by num"; DataSet ds1 = this.tabCommand.TableComm.SearchData(str1); if (ds1.Tables[0].Rows.Count > 0) { result = new string[ds1.Tables[0].Rows.Count]; } for (int i = 0; i < ds1.Tables[0].Rows.Count; i++) { result[i] = ds1.Tables[0].Rows[i]["depart"].ToString(); } } return(result); }
/// <summary> /// 批阅资产(办公室主任执行批阅) /// </summary> /// <param name="spid"></param> /// <param name="ht"></param> /// <returns></returns> public string PiYueZcForSHWeiYuan(string spid, Hashtable ht) { this.tabCommand.TableConnect.BeginTrans(); try { //修改资产审批表中的“项目申报号” string xmsbh = ht["xmsbh"].ToString(); //项目申报号; string czid1 = ht["czid"].ToString(); //资产处置Id this.tabCommand.TabName = "U_Zc2"; List <SearchField> list0 = new List <SearchField>(); list0.Add(new SearchField("id", czid1, SearchFieldType.数值型)); Hashtable ht0 = new Hashtable(); ht0["xmsbh"] = xmsbh; this.tabCommand.EditQuickData(list0, ht0); this.tabCommand.TabName = TabName; ht.Remove("xmsbh"); ht.Remove("czid"); string info1 = null; U_RolesBU role1 = new U_RolesBU(); string sname1 = role1.GetRoleAllUsers("资产审核委员会"); string sname2 = role1.GetRoleAllUsers("审核委员会主席"); role1.Close(); if (sname1.Trim() == "无" || sname2.Trim() == "无") { info1 = "提示:批阅资产失败,没有定义【资产审核委员会】和【审核委员会主席】的人选!"; } else { string zeren = sname1 + "," + sname2; string czid = this.PiYue(spid, ht); if (ht["ps"].ToString() == "同意") { string temp = this.SendSPPerson(zeren, czid, SP.审核委员会审批); if (temp == null) { info1 = "提示:批阅资产完成,已转审核委员会审批!"; } else { info1 = "提示:操作失败,请重新提交审批!"; } } else { info1 = " 提示:批阅资产完成,已退回责任人!"; } } this.tabCommand.TableConnect.CommitTrans(); return(info1); } catch (Exception errTrans) { this.tabCommand.TableConnect.RollBackTrans(); return("【系统错误】:数据库事务处理发生错误,请重新提交!"); } }
//批阅资产(部门经理执行审批) public string PiYueZcForOffice(string spid, Hashtable ht, string bid) { this.tabCommand.TableConnect.BeginTrans(); try { string info1 = null; U_RolesBU role1 = new U_RolesBU(); string zeren = role1.GetRoleAllUsers("机要室登记人员"); role1.Close(); if (zeren.Trim() != "无") { string czid = this.PiYue(spid, ht); this.CopySPInfoToZC(bid, spid); if (ht["ps"].ToString() == "同意") { string temp = this.SendSPPerson((zeren.Split(','))[0], czid, SP.机要室编号); if (temp == null) { info1 = "提示:批阅资产完成,已转办公室审批!"; } else { info1 = "提示:操作失败,请重新提交审批!"; } } else { info1 = " 提示:批阅资产完成,已退回责任人!"; } } else { info1 = "提示:批阅资产失败,没有定义【机要室登记人员】的人选!"; } this.tabCommand.TableConnect.CommitTrans(); return(info1); } catch (Exception errTrans) { this.tabCommand.TableConnect.RollBackTrans(); return("【系统错误】:数据库事务处理发生错误,请重新提交!"); } }
/// <summary> /// 得到公司的项目列表 /// "公司领导", "会计", "会计" /// </summary> /// <returns></returns> public DataSet GetShenPiList3() { U_RolesBU role1 = new U_RolesBU(); bool isAllCanSee = role1.isRole(new string[] { "公司领导", "综合管理", "评审部角色", "会计", "出纳", "领导秘书" }); role1.Close(); List <SearchField> condition = new List <SearchField>(); if (isAllCanSee) { condition.Add(new SearchField("id>1", "", SearchOperator.用户定义)); } else { condition.Add(new SearchField("id", "-1")); } //增加了方案提交审批的要求(11年7月5日调整) condition.Add(new SearchField("exists(select * from u_zcsp where czid=u_zc2.id)", "", SearchOperator.用户定义)); return(this.GetShenPiList(condition)); }
//批阅资产(决策委员会和决策委员会主席执行批阅) public string PiYueZcForSH2(string spid, Hashtable ht, string bid) { this.tabCommand.TableConnect.BeginTrans(); try { string info1 = null; U_RolesBU role1 = new U_RolesBU(); string zx1 = role1.GetRoleAllUsers("决策委员会主席"); role1.Close(); string czid = this.PiYue(spid, ht); this.CopySPInfoToZC(bid, spid); if (ht["zeren"].ToString() == zx1) { if (ht["ps"].ToString() == "同意") { info1 = " 提示:批阅资产已完成!"; } else { info1 = " 提示:批阅资产完成,已退回责任人!"; } } else { info1 = "提示:批阅资产完成,等待【决策委员会主席】裁决!"; } this.tabCommand.TableConnect.CommitTrans(); return(info1); } catch (Exception errTrans) { this.tabCommand.TableConnect.RollBackTrans(); return("【系统错误】:数据库事务处理发生错误,请重新提交!"); } }
//设置资产责任人(支持单选和多选) public void SetZcZeren(ListControl listcontrol) { U_RolesBU role1 = new U_RolesBU(); string roleUsers = role1.GetRoleAllUsers("资产清收人员"); role1.Close(); if (roleUsers != "") { string[] temp = roleUsers.Split(','); string temp1 = Util.sqlValue(temp); string sql = "select depart,sname from " + this.tabCommand.TabName + " where sname in (" + temp1 + ") order by num"; DataSet ds = this.tabCommand.TableComm.SearchData(sql); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string text1 = ds.Tables[0].Rows[i]["sname"].ToString(); string value1 = ds.Tables[0].Rows[i]["depart"].ToString(); ListItem list1 = new ListItem(text1 + "—" + value1, text1); listcontrol.Items.Add(list1); } } }
//判断是否能浏览档案 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); }
/// <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)); }
/// <summary> /// 核心方法1-批阅资产(调用时,必须起用事务) /// </summary> /// <param name="spid"></param> /// <param name="ht"></param> /// <returns></returns> private string PiYue(string spid, Hashtable ht) { string zcspstatus = ""; string czid = ""; List <SearchField> list1 = new List <SearchField>(); //修改批阅数据中的相关信息 list1.Add(new SearchField("id", spid, SearchFieldType.数值型)); DataSet ds1 = this.tabCommand.SearchData("*", list1); czid = ds1.Tables[0].Rows[0]["czid"].ToString(); if (ds1.Tables[0].Rows.Count > 0) { foreach (DictionaryEntry item in ht) { ds1.Tables[0].Rows[0][item.Key.ToString()] = item.Value; } this.tabCommand.Update(ds1); } //修改资产中相关的数据 int NewStatus = 0; //表示资产调整后的状态; list1.Clear(); string bid = ds1.Tables[0].Rows[0]["bID"].ToString(); this.tabCommand.TabName = "U_ZCBAO"; list1.Add(new SearchField("id", bid, SearchFieldType.数值型)); DataSet ds2 = this.tabCommand.SearchData("id,bstatus", list1); if (ds2.Tables[0].Rows.Count > 0) { int curStatus = Int32.Parse(ds2.Tables[0].Rows[0]["bstatus"].ToString());//表示资产的当前状态; NewStatus = curStatus; SP curSP = (SP)curStatus; //资产当前状态的枚举值 if (curStatus == 4) { curStatus = 10; } int NextStatus = curStatus + 1; //表示资产的下一个状态 int BeginStatus = (int)SP.开始审批; //表示资产审批的开始状态 //处理审核委员会和决策委员会主席的情况 U_RolesBU role1 = new U_RolesBU(); string zxname1 = role1.GetRoleAllUsers("审核委员会主席"); bool zx1 = false; if (ht["zeren"].ToString() == zxname1) { zx1 = true; } string zxname2 = role1.GetRoleAllUsers("决策委员会主席"); bool zx2 = false; if (ht["zeren"].ToString() == zxname2) { zx2 = true; } role1.Close(); //根据资产的当前状况进行不同的处理 if (ht["ps"].ToString() == "不同意") { if (curSP == SP.部门审批 || (curSP == SP.审核委员会审批 && zx1) || (curSP == SP.决策委员会审批 && zx2) ) { NewStatus = BeginStatus; //回到原来的状态 } } else if (ht["ps"].ToString() == "同意") { if (curSP == SP.部门审批 || curSP == SP.机要室编号 || (curSP == SP.审核委员会审批 && zx1) || (curSP == SP.决策委员会审批 && zx2) ) { NewStatus = curStatus + 1; //前进到下一个状态 } } else { if (curSP == SP.审核委员会审批 && zx1) { NewStatus = curStatus + 1; //前进到"决策委员会审批" } } string sp1 = NewStatus + ""; ds2.Tables[0].Rows[0]["bstatus"] = sp1.PadLeft(2, '0'); this.tabCommand.Update(ds2); } this.tabCommand.TabName = TabName; //修改资产审批的状态 zcspstatus = NewStatus + ""; zcspstatus = zcspstatus.PadLeft(2, '0'); list1.Clear(); if (bid != "" && zcspstatus != "") { this.tabCommand.TabName = "U_ZCB2"; list1.Add(new SearchField("id", czid, SearchFieldType.数值型)); Hashtable ht0 = new Hashtable(); ht0["status"] = zcspstatus; this.tabCommand.EditQuickData(list1, ht0); this.tabCommand.TabName = TabName; } U_ZCBAOBU zc1 = new U_ZCBAOBU(); zc1.UpdateZcstatus(bid, zcspstatus, "0"); zc1.Close(); return(czid); }
//批阅资产(审核委员会和审核委员会主席执行批阅) public string PiYueZcForSH1(string spid, Hashtable ht, string bid) { this.tabCommand.TableConnect.BeginTrans(); try { string info1 = null; U_RolesBU role1 = new U_RolesBU(); string sname1 = role1.GetRoleAllUsers("公司决策委员会"); string sname2 = role1.GetRoleAllUsers("决策委员会主席"); string zx1 = role1.GetRoleAllUsers("审核委员会主席"); role1.Close(); if (sname1.Trim() == "无" || sname2.Trim() == "无") { info1 = "提示:批阅资产失败,没有定义【公司决策委员会】和【决策委员会主席】的人选!"; } else { string zeren = sname1 + "," + sname2; string czid = this.PiYue(spid, ht); this.CopySPInfoToZC(bid, spid); if (ht["zeren"].ToString() == zx1) { if (ht["ps"].ToString() == "送决策委员会") { string temp = this.SendSPPerson(zeren, czid, SP.决策委员会审批); if (temp == null) { info1 = "提示:批阅资产完成,已转审核委员会审批!"; } else { info1 = "提示:操作失败,请重新提交审批!"; } } else if (ht["ps"].ToString() == "同意") { info1 = " 提示:批阅资产已完成!"; } else { info1 = " 提示:批阅资产完成,已退回责任人!"; } } else { info1 = "提示:批阅资产完成,等待【审核委员会主席】裁决!"; } } this.tabCommand.TableConnect.CommitTrans(); return(info1); } catch (Exception errTrans) { this.tabCommand.TableConnect.RollBackTrans(); return("【系统错误】:数据库事务处理发生错误,请重新提交!"); } }
private void SaveSP(Hashtable ht) { string bid = ht["bid"].ToString(); string[] zeren = (string[])ht["zeren"]; string kind = ht["kind"].ToString(); SP SP1 = (SP)Int32.Parse(kind); //更改资产的最新状态 List <SearchField> list1 = new List <SearchField>(); list1.Add(new SearchField("id", bid, SearchFieldType.数值型)); this.tabCommand.TabName = "U_ZCBAO"; DataSet ds = this.tabCommand.SearchData("id,bstatus", list1); if (ds.Tables[0].Rows.Count > 0) { string status1 = ds.Tables[0].Rows[0]["bstatus"].ToString(); if (kind.CompareTo(status1) > 0) { ds.Tables[0].Rows[0]["bstatus"] = kind; this.tabCommand.Update(ds); } } //审核委员会主席和决策委员会主席只允许有一个人(否则会有问题) U_RolesBU role1 = new U_RolesBU(); string sname1 = role1.GetRoleAllUsers("决策委员会主席"); string sname2 = role1.GetRoleAllUsers("审核委员会主席"); role1.Close(); this.tabCommand.TabName = TabName; //增加审批的数据 Hashtable ht0 = new Hashtable(); for (int i = 0; i < zeren.Length; i++) { list1.Clear(); ds.Clear(); list1.Add(new SearchField("bid", bid, SearchFieldType.数值型)); list1.Add(new SearchField("zeren", zeren[i])); list1.Add(new SearchField("time1", "null", SearchOperator.空值)); list1.Add(new SearchField("kind", kind)); ds = this.tabCommand.SearchData("*", list1); if (ds.Tables[0].Rows.Count <= 0) { DataRow dr = ds.Tables[0].NewRow(); dr["bid"] = bid; dr["czid"] = ht["czid"]; dr["time0"] = DateTime.Now.ToString(); dr["kind"] = kind; dr["zeren"] = zeren[i]; //dr["pscount"] = pscount; if ((zeren[i] == sname1 && SP1 == SP.决策委员会审批) || zeren[i] == sname2 && SP1 == SP.审核委员会审批) { dr["zx"] = "1"; } ds.Tables[0].Rows.Add(dr); //ht0["czid"] = ht["czid"]; //ht0["bid"] = bid; //ht0["time0"] = DateTime.Now.ToString(); //ht0["kind"] = kind; //ht0["zeren"] = zeren[i]; //if ((zeren[i] == sname1 && SP1 == SP.决策委员会审批) || zeren[i] == sname2 && SP1 == SP.审核委员会审批) //{ // ht0["zx"] = "1"; //} //this.tabCommand.InsertData(ht0); } this.tabCommand.Update(ds); ds.AcceptChanges(); } }
/// <summary> /// 核心方法2-保存审批数据(调用时,必须起用事务) /// </summary> /// <param name="ht"></param> private void SaveSP(Hashtable ht) { //string zcid = ht["zcid"].ToString(); string[] zeren = (string[])ht["zeren"]; string kind = ht["kind"].ToString(); SP SP1 = (SP)Int32.Parse(kind); //审核委员会主席和决策委员会主席只允许有一个人(否则会有问题) U_RolesBU role1 = new U_RolesBU(); List <String> sname1 = role1.GetRoleAllUsersList1("决策委员会主席"); List <String> sname2 = role1.GetRoleAllUsersList1("审核委员会主席"); role1.Close(); /*得到当前审批的“批次” * 审批的“批次”按当前“部门审批”的“批次”为准 * 第一次部门审批时的批次为1 */ this.tabCommand.TabName = TabName; List <SearchField> list2 = new List <SearchField>(); list2.Add(new SearchField("czid", ht["czid"].ToString(), SearchFieldType.数值型)); string temp1 = (int)SP.部门审批 + ""; list2.Add(new SearchField("kind", temp1.PadLeft(2, '0'))); DataSet dstemp = this.tabCommand.SearchData("pscount", list2, "id desc"); int pscount = 0; if (dstemp.Tables[0].Rows.Count > 0) { if (dstemp.Tables[0].Rows[0]["pscount"] != DBNull.Value) { pscount = (int)dstemp.Tables[0].Rows[0]["pscount"]; } } if (kind == temp1) { pscount++; //当前的批阅次数; } //增加审批的数据 List <SearchField> list1 = new List <SearchField>(); list1.Add(new SearchField("czid", ht["czid"].ToString(), SearchFieldType.数值型)); list1.Add(new SearchField("time1", "null", SearchOperator.空值)); list1.Add(new SearchField("kind", kind)); DataSet ds = this.tabCommand.SearchData("*", list1); Hashtable ht1 = new Hashtable(); for (int i = 0; i < zeren.Length; i++) { if (ht1.ContainsKey(zeren[i]) == false) { DataRow dr = ds.Tables[0].NewRow(); dr["czid"] = ht["czid"]; if (ht.ContainsKey("zcid")) { dr["zcid"] = ht["zcid"].ToString(); } if (ht.ContainsKey("zcbid")) { dr["zcbid"] = ht["zcbid"].ToString(); } dr["time0"] = DateTime.Now.ToString(); dr["kind"] = kind; dr["zeren"] = zeren[i]; dr["pscount"] = pscount; if ((sname1.Contains(zeren[i]) && SP1 == SP.决策委员会审批) || sname2.Contains(zeren[i]) && SP1 == SP.审核委员会审批) { dr["zx"] = "1"; //设置主席的标识 } ds.Tables[0].Rows.Add(dr); ht1.Add(zeren[i], zeren[i]); //去掉重复的人选 } } this.tabCommand.Update(ds); ds.AcceptChanges(); }