Beispiel #1
0
        public User WS3_P(string userId, string password, string uuid)
        {
            //----------------------
            //lxdlxd
            MLogin.GetExeUname();
            User             NowUser = new User();
            List <puku_user> mp      = GetPUser.PUser(" and USERPU='" + userId.Trim() + "' ");

            if (mp.Count > 0)
            {
                if (BitLock.RealseLock_L(mp[0].MM) == password && uuid == mp[0].UUID)
                {
                    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 (my != "")
                    {
                        string cookies = HttpContext.Current.Request.Cookies["guid"].Value as string;
                        string session = Session.SessionID.ToString();
                        if (!session.Equals(cookies))//有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//没有cookies 增加cookies
                    {
                        HttpCookie objCookie = new HttpCookie("guid", Session.SessionID.ToString());
                        objCookie.Expires = DateTime.MaxValue;
                        System.Web.HttpContext.Current.Response.Cookies.Add(objCookie);
                    }
                    NowUser.userId = userId;

                    NowUser.name       = mp[0].TURENAME;
                    NowUser.dept       = mp[0].DEPT;
                    NowUser.authorised = mp[0].允许管理物料BY仓库名称;
                    NowUser.status     = 10;
                    return(NowUser);
                    //var headers = Context.Request.Headers.GetValues("My-Header");
                }
                else
                {
                    NowUser.status = -1;
                    return(NowUser);
                }
            }
            else
            {
                NowUser.status = -1;
                return(NowUser);
            }
        }
        public string GetLocation(string userId, double x, double y)
        {
            scue_user u        = new scue_user();
            DateTime  datetime = SysTime.GetTime;
            string    code     = GetCode.SetCode(datetime);              //日期段
            string    time_now = datetime.ToString();
            string    poi_time = datetime.ToLongTimeString().ToString(); //该点时间 ,20:16:15
            string    today    = datetime.ToString("yyyyMMdd");

            List <puku_user> pus = GetPUser.PUser(" and USERPU='" + userId + "'  ");
            string           username;

            if (pus.Count > 0)
            {
                username = pus[0].TURENAME;
                if (code != "")//工作时间段
                {
                    List <scue_user> list = u.Select(" and USERPU='" + userId + "' and CODE='" + code + "' and  DATE='" + today + "' ");

                    if (list.Count <= 0)
                    {
                        u.CREATEDATE  = time_now; //创建时间
                        u.OPERATETIME = time_now; //
                        u.DATE        = today;    //日期
                        u.CODE        = code;     //时间段
                        u.USERPU      = userId;   //
                        u.TURENAME    = username;
                        u.POINTS      = x.ToString() + ":" + y.ToString() + ":" + poi_time + ",";
                        u.Insert();
                    }
                    else
                    {
                        u.Reset_scue_user();
                        u.OPERATETIME = time_now;
                        u.POINTS      = list[0].POINTS + x.ToString() + ":" + y.ToString() + ":" + poi_time + ",";
                        u.Updata(" and USERPU='" + userId + "'  and CODE='" + code + "' and  DATE='" + today + "' ");
                    }
                }
            }

            return(u.POINTS);
        }
        public List <Kfkf> Neighbour(string type, double lng, double lat, string userName)
        {
            string cookies = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string;
            string session = Session.SessionID.ToString();

            if (!cookies.Equals(session))
            {
                return(null);
            }
            MLogin.GetExeUname();
            puku_user        p    = new puku_user();
            List <puku_user> list = GetPUser.PUser(" and TURENAME='" + userName + "'  ");
            string           dept = "";

            if (list.Count <= 0)
            {
                dept = "业务员";
            }
            else
            {
                dept = list[0].DEPT;
            }
            DataTable   dt = Function.NeighbourPosition(dept, lng, lat, type, userName);
            List <Kfkf> ks = new List <Kfkf>();

            foreach (DataRow r in dt.Rows)
            {
                Kfkf k = new Kfkf();
                k.name      = r["NAME"].ToString();
                k.type      = r["TRADETYPENAME"].ToString();
                k.contactor = r["CONTACTOR"].ToString();
                k.phone     = r["PHONE"].ToString();
                k.lng       = Convert.ToDouble(r["ZF29"].ToString());
                k.lat       = Convert.ToDouble(r["ZF30"].ToString());
                k.lastVisit = r["INTRODUCERDATE"].ToString();
                k.billman   = r["BILLMAN"].ToString();
                k.remark    = r["NotePre"].ToString();
                ks.Add(k);
            }
            return(ks);
        }
Beispiel #4
0
        private void demo_Load(object sender, EventArgs e)
        {
            List <puku> m = MUser.Get用户("");

            //加载数据区域
            Bform._mTable.数据表名称 = "puku_webservers_list";
            // Bform._mTable. = true;
            Bform._mTable.每页数量 = 300;
            Bform._mTable.ShowList(m);
            Bform._MainPanel.Dock   = DockStyle.Fill;
            Bform._RightPanel.Width = 650;

            Panel p = new Panel();

            p.Dock  = DockStyle.Right;
            p.Width = 650;

            // tb_user.分页 = true;
            tb_user.每页数量  = 200;
            tb_user.数据表名称 = "puku_webservers_list";
            tb_user.Dock  = DockStyle.Right;
            tb_user.Width = 650;


            //Splitter splitter_right = new Splitter();
            //splitter_right.Width = 3;
            //splitter_right.BackColor = Skin.Set_Color(Skin.upBColor);
            //splitter_right.Parent = this;
            //splitter_right.Dock = DockStyle.Right;


            p.Controls.Add(tb_user);
            tb_user.ShowList(GetPUser.PUser());
            Bform._RightPanel.Controls[0].Controls.Add(p);
            Bform._RightPanel.Dock   = DockStyle.Right;
            Bform._RightPanel.Parent = this;
            //List<string> list = new List<string> {"维修员","销售员" };
            //for (int i = 0; i < list.Count; i++)
            //{
            //    CheckBox cb = new CheckBox();
            //    cb.Name = "cb_" + list[i];
            //    cb.Text = list[i];
            //    cb.SetBounds(18, 120+30*i, 70, 30);
            //    Bform._LeftPanel.Controls[0].Controls.Add(cb);
            //}
            Bform._LeftPanel.Controls[1].Height = 30;
            Bform._LeftPanel.Width  = 220;
            Bform._LeftPanel.Dock   = DockStyle.Left;
            Bform._LeftPanel.Parent = this;
            //添加按钮方式
            //添加按钮方式
            btn_refresh        = Skincss.AddButon(Bform._LeftPanel.Controls[0], "刷新数据", "0/560", "210/30", "#255255255", 10, "", 1, -1, false, Skin.upYcolor);
            btn_refresh.Click += btn_refresh_Click;

            btn_rg        = Skincss.AddButon(Bform._LeftPanel.Controls[0], "注册", "0/600", "210/30", "#255255255", 10, "", 1, -1, false, Skin.upBColor);
            btn_rg.Click += Bt_Click;

            btn_del         = Skincss.AddButon(Bform._LeftPanel.Controls[0], "取消注册", "0/640", "210/30", "#255255255", 10, "", 1, -1, false, Skin.upRcolor);
            btn_del.Visible = false;
            btn_del.Click  += _del_Click;
            Label lb1 = Skincss.AddLable(Bform._LeftPanel.Controls[0], "密码:", "0/80", "80/30", "#100100100", 10, "", 1, -1, true);

            TextBox txtbox_pwd = Skincss.AddTxt(Bform._LeftPanel.Controls[0], "password", " ", "90/80", "120/30", "#100100100");

            Label lb2 = Skincss.AddLable(Bform._LeftPanel.Controls[0], "账号:", "0/40", "80/30", "#100100100", 10, "", 1, -1, true);

            TextBox txtbox_user = Skincss.AddTxt(Bform._LeftPanel.Controls[0], "user", " ", "90/40", "120/30", "#100100100");

            Label lb3 = Skincss.AddLable(Bform._LeftPanel.Controls[0], "姓名:", "0/0", "80/30", "#100100100", 10, "", 1, -1, true);

            TextBox txtbox_name = Skincss.AddTxt(Bform._LeftPanel.Controls[0], "truename", " ", "90/0", "120/30", "#100100100");

            Bform._mTable.CellDoubleClick += _mTable_CellDoubleClick;
            tb_user.CellDoubleClick       += _tbuser_CellDoubleClick;
            _Refresh();
        }
Beispiel #5
0
        private void RegistBS(string password, string user, string type)
        {
            string user_mm   = ScueFun.BitLock.GetLock_L(password);
            string str_idept = "";
            string dept      = "";

            foreach (Control ctrl in this.Controls)
            {
                if (ctrl is CheckBox && ((CheckBox)ctrl).Checked)
                {
                    dept = ctrl.Text;
                    if (ctrl.Text == "维修员")
                    {
                        str_idept += "SW0002,FJ0001,";
                    }
                    else if (ctrl.Text == "业务员")
                    {
                        str_idept += "SW0001,SW0002,FJ0001,FJ0002,FJ0003,FJ0004,";
                    }
                    else if (ctrl.Text == "销售内勤")
                    {
                        str_idept += "SW0001,SW0002,FJ0001,FJ0002,FJ0003,FJ0004,AD0003,";
                    }
                    else if (ctrl.Text == "业务经理")
                    {
                        str_idept += "AD0001,AD0002,AD0003,FJ0003";
                    }
                    else if (ctrl.Text == "维修经理")
                    {
                        str_idept += "AD0001,AD0002,AD0003,FJ0003";
                    }
                    else if (ctrl.Text == "总经理")
                    {
                        str_idept += "SW0001,SW0002,FJ0001,FJ0002,FJ0003,FJ0004,AD0001,AD0002,AD0003,";
                    }
                    else if (ctrl.Text == "后台")
                    {
                        str_idept += "SW0001,SW0002,FJ0001,FJ0002,FJ0003,FJ0004,AD0001,AD0002,AD0003,";
                    }
                    else
                    {
                    }
                    ((CheckBox)ctrl).Checked = false;
                }
            }
            if (str_idept.Length > 0)
            {
                str_idept = str_idept.Substring(0, str_idept.Length - 1);//去掉最后一个","
            }
            //---------------------
            // string Mcode = (string)Ifun.IsDBnull(Bform._mTable.SelectedRows[0].Cells["code"].Value.ToString(), "");
            // puku tb_user = new puku();
            //List<puku> lis = tb_user.Select("and code='" + Mcode + "'");
            // puku p = new puku();
            // p.CODE = Bform._mTable.SelectedRows[0].Cells["code"].Value.ToString();
            // p.Insert();
            //-------------------
            if (type.ToUpper().Trim() == "REGIST")
            {
                List <puku> list_puku = MUser.Get用户(" and USERPU='" + user + "'  ");
                //PUKU.Select("and USERPU='" + user + "' and ISSTOP <> '是' ");
                puku_user User = new puku_user();
                User              = ScueFun.ScueMerge.MergeFrom(User, list_puku[0]);
                User.MM           = user_mm;
                User.DEPT         = dept;
                User.允许管理物料BY仓库名称 = str_idept;
                User.Insert();
                Msg msg = new Msg(3, "注册成功!");
            }
            else if (type.ToUpper().Trim() == "MODIFY")
            {
                List <puku_user> list_user = GetPUser.PUser(" and USERPU='" + user + "' ");
                //USER.Select("and USERPU='" + user + "'  and ISSTOP <> '是' ");
                puku_user UU = new puku_user();
                UU.MM           = user_mm;
                UU.允许管理物料BY仓库名称 = str_idept;
                UU.Updata(" and id =" + list_user[0].ID);
                Msg msg = new Msg(3, "修改成功!");
            }
            else if (type.ToUpper().Trim() == "CANCLE")
            {
                List <puku_user> list_user = GetPUser.PUser(" and USERPU='" + user + "' ");

                puku_user m_user = list_user[0];
                m_user.Reset_puku_user();
                m_user.ISSTOP = "是";
                m_user.Updata(" and id =" + list_user[0].ID);
                //  m_user.ScueUpdate(ScueMerge.GetProperties(m_user), " and id =" + list_user[0].ID);
                Msg msg = new Msg(3, "取消注册成功!");
            }
            else
            {
                List <puku> list_puku = MUser.Get用户(" and USERPU='" + user + "'  ");
                puku_user   User      = new puku_user();
                User      = ScueFun.ScueMerge.MergeFrom(User, list_puku[0]);
                User.MM   = user_mm;
                User.DEPT = str_idept;
                User.Insert();
                Msg msg = new Msg(3, "注册成功!");
            }
            Bform._LeftPanel.Controls[0].Controls["password"].Text = "";
            Bform._LeftPanel.Controls[0].Controls["user"].Text     = "";
            Bform._LeftPanel.Controls[0].Controls["truename"].Text = "";
        }