Пример #1
0
        /// <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("【系统错误】:数据库事务处理发生错误,请重新提交!");
            }
        }
Пример #2
0
        //判断用户是否有部门的资产
        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);
        }
Пример #3
0
        /// <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();
        }
Пример #4
0
        /// <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));
        }
Пример #5
0
        //设置角色用户
        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, ',');
            }
        }
Пример #6
0
        //判断是否能浏览档案
        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);
        }
Пример #7
0
        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);
        }
Пример #8
0
        /// <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));
        }