Esempio n. 1
0
        public static ArrayList QueryList()
        {
            ArrayList           r   = new ArrayList();
            Sys_UserBll         sub = new Sys_UserBll();
            SqlCondtion         sc  = new SqlCondtion();
            Sys_EmployeeBll     seb = new Sys_EmployeeBll();
            Sys_RoleBll         srb = new Sys_RoleBll();
            SessionUserValidate iv  = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                r.Add(iv.badstr);
                StringBuilder where = new StringBuilder();
                //where.Append(sc.GetSqlWhere(" ulogin ", "true", "", ""));
                if (iv.u.rcode == "xtgl")
                {
                }
                else
                {
                    where.Append(" and eno in (select eno from  Sys_Employee where dcode like '" + iv.u.dcode.Substring(0, 8) + "%')");
                }
                List <Sys_User> ls = sub.QueryList(where.ToString());
                if (ls != null)
                {
                    foreach (Sys_User s in ls)
                    {
                        Sys_Employee sr = seb.Query(" and eno='" + s.eno + "'");
                        ArrayList    al = new ArrayList();
                        if (sr != null)
                        {
                            Sys_Role srs = srb.Query(" and rcode='" + sr.rcode + "'");
                            al.Add(sr.eno);
                            al.Add(s.uname);
                            al.Add(sr.ename);
                            al.Add(sr.dname);
                            al.Add(srs == null ? "" : srs.rname);
                            al.Add(s.ulogin == true ? "<span style='color:green'>正常</span>" : "<span style='color:red'>停用</span>");
                            r.Add(al);
                        }
                    }
                }
            }
            else
            {
                r.Add(iv.badstr);
            }
            return(r);
        }
Esempio n. 2
0
        public static string LoginSystem(string iuname, string iupwd)
        {
            string       r   = "";
            SysExpireBll seb = new SysExpireBll();
            //if (seb.SysExpire())
            //{
            string jmsz = DES.EncryptDES(iupwd);

            if (!string.IsNullOrEmpty(iuname) && !string.IsNullOrEmpty(iupwd))
            {
                Sys_User        model = new Sys_User();
                Sys_Employee    ee    = new Sys_Employee();
                Sys_EmployeeDpt eed   = new Sys_EmployeeDpt();
                Sys_UserBll     sub   = new Sys_UserBll();
                Sys_EmployeeBll eb    = new Sys_EmployeeBll();
                model = sub.Query(" and uname='" + iuname + "' and upass='******' and ulogin='******'");
                if (model == null)
                {
                    r = "F";
                }
                else
                {
                    r  = "S";
                    ee = eb.Query(" and eno='" + model.eno + "'");
                    if (ee.dcode != "")
                    {
                        Sys_Depment sd = sdb.Query(" and dcode='" + ee.dcode + "'");
                        ee.dname = sd != null ? sd.dname : "";
                    }
                    eed = sedb.Query(" and eno='" + ee.eno + "'");
                    if (eed != null)
                    {
                        ee.etelephone = eed.etelephone;
                    }
                    ee.elname = iuname;
                    HttpContext.Current.Session["LUser"] = ee;
                    Guid       uniqueID = Guid.NewGuid();
                    OnLineUser olu      = new OnLineUser();
                    olu.Gid      = uniqueID;
                    olu.Zt       = 0;
                    olu.Username = model.uname;
                    UserCacheImp uci = new UserCacheImp();
                    if (HttpContext.Current.Request.Cookies["Cuser"] != null)
                    {
                        HttpCookie c*k = HttpContext.Current.Request.Cookies["Cuser"];
                        c*k.Values["cuser"] = System.Web.HttpUtility.UrlEncode(model.uname);
                        HttpContext.Current.Response.AppendCookie(c*k);
                    }
                    else
                    {
                        HttpCookie cookie = new HttpCookie("Cuser");
                        cookie.Values.Add("cuser", System.Web.HttpUtility.UrlEncode(model.uname));
                        HttpContext.Current.Response.AppendCookie(cookie);
                    }
                    uci.Add(olu, "U");
                }
            }
            else
            {
                HttpContext.Current.Session["LUser"] = null;
                r = "F";
            }
            // }
            //else
            //{
            //    r = "F";
            //}
            return(r);
        }
Esempio n. 3
0
        public static string SaveEmploee(string account, string depcode, string depname, string duty,
                                         string eaddress, string eage, string eemail, string egradute, string eid, string elogin, string ename, string eno,
                                         string epwd, string esex, string esfz, string estate, string etelephone, string eworkdate, string role)
        {
            string              r    = "";
            Sys_Employee        se   = new Sys_Employee();
            Sys_User            su   = new Sys_User();
            Sys_EmployeeDpt     sed  = new Sys_EmployeeDpt();
            Sys_EmployeeBll     seb  = new Sys_EmployeeBll();
            Sys_UserBll         sub  = new Sys_UserBll();
            Sys_Employee        cse  = new Sys_Employee();
            Sys_DepmentBll      sdb  = new Sys_DepmentBll();
            Sys_EmployeeDptBll  sedb = new Sys_EmployeeDptBll();
            SessionUserValidate iv   = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                Sys_Depment sd = sdb.Query(" and dcode='" + depcode.Substring(0, 8) + "'");
                se.dname  = depname;
                se.dcode  = depcode;
                se.eno    = eno;
                se.ename  = ename;
                se.estate = estate == "1"?true:false;
                se.dtcode = "";
                se.elogin = elogin == "1" ? true : false;
                se.ecdate = DateTime.Now.ToString();
                se.emaker = iv.u.ename;
                se.rcode  = role;

                sed.eaddress     = eaddress;
                sed.eage         = Convert.ToInt32(eage);
                sed.eeducation   = egradute;
                sed.eemail       = eemail;
                sed.eheadimage   = "";
                sed.eidentity    = esfz;
                sed.enativeplace = "";
                sed.eno          = eno;
                sed.esex         = esex == "1" ? true : false;
                sed.etelephone   = etelephone;
                sed.eworkdate    = eworkdate;

                su.eno   = eno;
                su.upass = DES.EncryptDES(epwd);
                if (sd.dabc != "")
                {
                    su.uname = sd.dabc + "_" + account;
                }
                else
                {
                    su.uname = account;
                }
                su.ulogin     = elogin == "1"?true:false;
                su.uip        = "";
                su.ulogintime = "";
                if (eid == "0")
                {
                    if (!seb.Exists(" and eno='" + eno + "'"))
                    {
                        if (!sub.Exists(" and uname='" + su.uname + "'"))
                        {
                            if (seb.AddList(se, sed, su) > 0)
                            {
                                r = "S";
                            }
                            else
                            {
                                r = "F";
                            }
                        }
                        else
                        {
                            r = "TA";
                        }
                    }
                    else
                    {
                        r = "T";
                    }
                }
                else
                {
                    if (!seb.Exists(" and eno='" + eno + "' and id<>" + eid + ""))
                    {
                        if (!sub.Exists(" and uname='" + su.uname + "' and eno<>'" + eno + "'"))
                        {
                            cse = seb.Query(" and id=" + eid + "");
                            if (cse != null)
                            {
                                if (seb.UpdateList(cse.eno, se, sed, su) > 0)
                                {
                                    r = "S";
                                }
                                else
                                {
                                    r = "F";
                                }
                            }
                            else
                            {
                                r = "F";
                            }
                        }
                        else
                        {
                            r = "TA";
                        }
                    }
                    else
                    {
                        r = "T";
                    }
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Esempio n. 4
0
        public static string QueryEmploee(string eno)
        {
            string              r    = "";
            VEmploee            ve   = new VEmploee();
            Sys_Employee        se   = new Sys_Employee();
            Sys_User            su   = new Sys_User();
            Sys_EmployeeDpt     sed  = new Sys_EmployeeDpt();
            Sys_EmployeeBll     seb  = new Sys_EmployeeBll();
            Sys_UserBll         sub  = new Sys_UserBll();
            Sys_EmployeeDptBll  sedb = new Sys_EmployeeDptBll();
            SessionUserValidate iv   = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                if (eno == "")
                {
                    ve.eno          = "E" + seb.GetEno().ToString().PadLeft(8, '0');
                    ve.eaddress     = "";
                    ve.eage         = "0";
                    ve.eeducation   = "";
                    ve.eemail       = "";
                    ve.eheadimage   = "";
                    ve.eidentity    = "";
                    ve.enativeplace = "";
                    ve.esex         = "0";
                    ve.etelephone   = "";
                    ve.eworkdate    = "";
                    ve.estate       = "1";
                    ve.elogin       = "******";
                    ve.id           = 0;
                }
                else
                {
                    se        = seb.Query(" and eno='" + eno + "'");
                    sed       = sedb.Query(" and eno='" + eno + "'");
                    su        = sub.Query(" and eno='" + eno + "'");
                    ve.dname  = se.dname;
                    ve.dcode  = se.dcode;
                    ve.eno    = se.eno;
                    ve.ename  = se.ename;
                    ve.estate = se.estate == true ? "1" : "0";
                    ve.dtcode = "";
                    ve.elogin = se.elogin == true ? "1" : "0";
                    ve.rcode  = se.rcode;
                    if (sed != null)
                    {
                        ve.eaddress     = sed.eaddress;
                        ve.eage         = sed.eage.ToString();
                        ve.eeducation   = sed.eeducation;
                        ve.eemail       = sed.eemail;
                        ve.eheadimage   = sed.eheadimage;
                        ve.eidentity    = sed.eidentity;
                        ve.enativeplace = sed.enativeplace;
                        ve.esex         = sed.esex == true ? "1" : "0";
                        ve.etelephone   = sed.etelephone;
                        ve.eworkdate    = sed.eworkdate;
                    }
                    else
                    {
                        ve.eaddress     = "";
                        ve.eage         = "";
                        ve.eeducation   = "";
                        ve.eemail       = "";
                        ve.eheadimage   = "";
                        ve.eidentity    = "";
                        ve.enativeplace = "";
                        ve.esex         = "0";
                        ve.etelephone   = "";
                        ve.eworkdate    = "";
                    }
                    if (su != null)
                    {
                        ve.upass = DES.DecryptDES(su.upass);
                        ve.uname = su.uname;
                    }

                    ve.id = se.id;
                }

                r = js.Serialize(ve);
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }