Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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);
        }