Exemplo n.º 1
0
        private void _Refresh()
        {
            List <puku_user> list_user = USER.Select(" and ISSTOP <> '是'  ");
            List <puku>      list_puku = MUser.Get用户("  and USERPU not in (select USERPU from puku_user where ISSTOP <> '是')  ");

            //for (int i = 0; i < list_puku.Count; i++)
            //{
            //    for (int j = 0; j < list_user.Count; j++)
            //    {
            //        if (list_puku[i].USERPU == list_user[j].USERPU)
            //        {
            //            list_puku.Remove(list_puku[i]);
            //        }
            //    }
            //}

            Bform._mTable.ShowList(list_puku);
            tb_user.ShowList(list_user);
        }
Exemplo n.º 2
0
        public User WS2(string userId, string password, string uuid)
        {
            MLogin.GetExeUname();
            User u = new User();

            u.status = -1;
            u.userId = userId.Trim();
            puku_user        p  = new puku_user();
            List <puku_user> mp = p.Select(" and USERPU='" + userId.Trim() + "'  and isstop <> '是' ");

            if (mp.Count > 0)
            {
                if (BitLock.RealseLock_L(mp[0].MM) == password)
                {
                    string sql_uuid = mp[0].UUID == null? "":mp[0].UUID;
                    if (uuid != "web" && sql_uuid == "")
                    {
                        puku_user _User = new puku_user();
                        _User.UUID = uuid;
                        _User.Updata(" and USERPU='" + userId.Trim() + "' and isstop <> '是' and (uuid is null or uuid ='' )");
                    }
                    //UserInfo.UName = mp[0].TURENAME;
                    UserInfo.Uzw = "管理员";
                    u.name       = mp[0].TURENAME;
                    u.dept       = mp[0].DEPT;
                    u.authorised = mp[0].允许管理物料BY仓库名称;
                    u.status     = 10;
                    string my = string.Empty;
                    HttpContext.Current.Session["user"] = userId;
                    my = "没有cookies";
                    //my = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string;

                    if (System.Web.HttpContext.Current.Request.Cookies["guid"] != null && System.Web.HttpContext.Current.Request.Cookies["guid"].ToString().Trim() != "")
                    {
                        string cookies = HttpContext.Current.Request.Cookies["guid"].Value as string;
                        string session = Session.SessionID.ToString();
                        if (!session.Equals(cookies))
                        {
                            HttpCookie objCookie = new HttpCookie("guid", Session.SessionID.ToString());
                            objCookie.Expires = DateTime.MaxValue;
                            System.Web.HttpContext.Current.Response.Cookies.Add(objCookie);
                        }
                        my = System.Web.HttpContext.Current.Request.Cookies["guid"].Value;
                    }
                    else
                    {
                        HttpCookie objCookie = new HttpCookie("guid", Session.SessionID.ToString());
                        objCookie.Expires = DateTime.MaxValue;
                        System.Web.HttpContext.Current.Response.Cookies.Add(objCookie);
                    }

                    u.session = Session.SessionID.ToString();
                    u.cookies = my;
                    //var headers = Context.Request.Headers.GetValues("My-Header");
                }
                else
                {
                    u.status = 5;//密码错误
                }
            }
            else
            {
                u.status = 0;//不存在该用户
            }
            return(u);
        }
Exemplo n.º 3
0
        public static List <puku_user> PUser(string str_where)
        {
            puku_user user = new puku_user();

            return(user.Select(str_where + " and ISSTOP <> '是' "));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 返回 -1:没有该人员  -2:没有任何单子  -3:距离超长  -4:已签到  -5;已签到下班  0:成功
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="lng"></param>
        /// <param name="lat"></param>
        /// <returns></returns>
        public static int SignOut(string userName, string userId, double lng, double lat)
        {
            puku_user        user  = new puku_user();
            List <puku_user> pukus = user.Select(" and USERPU='" + userId + "'  and ISSTOP='否'  and left(ZF4, 10)= CONVERT(varchar(10), GETDATE(), 120)  ");

            if (pukus.Count > 0)
            {
                //double lng_kf = pukus[0].ZF2 == null ? -1 : Convert.ToDouble(pukus[0].ZF2);
                //double lat_kf = pukus[0].ZF3 == null ? -1 : Convert.ToDouble(pukus[0].ZF3);
                //if (lng_kf == -1 || lat_kf == -1)
                //{
                //    return -2;//没有任何单子
                //}
                //else
                //{
                string date = System.DateTime.Now.ToString("yyyy-MM-dd");
                if (MyGlobal.AERA_CHECK)    //是否距离校验
                {
                    if (LngLatDis.GetDistance(lng, lat, Convert.ToDouble(pukus[0].ZF2), Convert.ToDouble(pukus[0].ZF3)) > MyGlobal.VISITAERA)
                    {
                        return(-3);   //距离超长
                    }
                }
                //else
                //{
                L_SIGN        s = new L_SIGN();
                List <L_SIGN> l = s.Select(" AND USERID='" + userId + "'  AND  DATE='" + date + "'  ");
                if (l.Count <= 0)    //今日无签到记录
                {
                    L_SIGN mm = new L_SIGN();
                    mm.USERID     = userId;
                    mm.TURENAME   = pukus[0].TURENAME;
                    mm.DATE       = date;
                    mm.TIME_D     = SysTime.GetTime.ToString("yyyy-MM-dd HH:mm:ss");
                    mm.NAME_D     = pukus[0].ZF1;
                    mm.LAT_D      = lat.ToString();     //签到时 用户的位置
                    mm.LNG_D      = lng.ToString();
                    mm.R_CODE_OUT = pukus[0].REFERCODE; //签到依据的单据
                    mm.Insert();
                    return(0);
                }
                else    //今日记录已存在
                {
                    string sign_out = l[0].TIME_D == null ? "" : l[0].TIME_D;
                    if (sign_out.Trim() != "") //下班已签到
                    {
                        return(-4);            //已签到
                    }
                    else
                    {
                        L_SIGN mm = new L_SIGN();
                        mm.TIME_D     = SysTime.GetTime.ToString("yyyy-MM-dd HH:mm:ss");
                        mm.NAME_D     = pukus[0].ZF1;
                        mm.LAT_D      = lat.ToString();
                        mm.LNG_D      = lng.ToString();
                        mm.R_CODE_OUT = pukus[0].REFERCODE;
                        mm.Updata(" and  id=" + l[0].ID);
                        return(0);
                    }
                }
                //}
            }
            else
            {
                return(-2);//没有该人员
            }
        }
Exemplo n.º 5
0
        public static List <puku_user> PUser()
        {
            puku_user user = new puku_user();

            return(user.Select(" and ISSTOP <> '是' "));
        }