Exemplo n.º 1
0
        public ActionResult EditUserInfo(FormCollection collection)
        {
            RoadFlow.Platform.Users   users  = new RoadFlow.Platform.Users();
            RoadFlow.Data.Model.Users users2 = null;
            Guid currentUserID = RoadFlow.Platform.Users.CurrentUserID;

            users2 = users.Get(currentUserID);
            if (collection != null)
            {
                string tel      = base.Request.Form["Tel"];
                string mobile   = base.Request.Form["MobilePhone"];
                string weiXin   = base.Request.Form["WeiXin"];
                string email    = base.Request.Form["Email"];
                string qQ       = base.Request.Form["QQ"];
                string otherTel = base.Request.Form["OtherTel"];
                string note     = base.Request.Form["Note"];
                users2.Tel      = tel;
                users2.Mobile   = mobile;
                users2.WeiXin   = weiXin;
                users2.Email    = email;
                users2.QQ       = qQ;
                users2.OtherTel = otherTel;
                users2.Note     = note;
                if (false)
                {
                    users.Add(users2);
                }
                else
                {
                    users.Update(users2);
                }
                base.ViewBag.script = "alert('保存成功!');window.location=window.location;";
            }
            return(View(users2));
        }
Exemplo n.º 2
0
        public string ValidateLogin()
        {
            string text  = base.Request.Form["Account"];
            string text2 = base.Request.Form["Password"];

            if (text.IsNullOrEmpty() || text2.IsNullOrEmpty())
            {
                return("{\"id\":\"\",\"status\":0,\"msg\":\"帐号或密码不能为空\"}");
            }
            RoadFlow.Platform.Users   users     = new RoadFlow.Platform.Users();
            RoadFlow.Data.Model.Users byAccount = users.GetByAccount(text.Trim());
            if (byAccount == null || string.Compare(byAccount.Password, users.GetUserEncryptionPassword(byAccount.ID.ToString(), text2.Trim()), false) != 0)
            {
                return("{\"id\":\"\",\"status\":0,\"msg\":\"帐号或密码错误\"}");
            }
            if (byAccount.Status == 1)
            {
                return("{\"id\":\"\",\"status\":0,\"msg\":\"帐号已被冻结\"}");
            }
            base.Session[Keys.SessionKeys.UserID.ToString()]   = byAccount.ID;
            base.Session[Keys.SessionKeys.BaseUrl.ToString()]  = base.Url.Content("~/");
            base.Session[Keys.SessionKeys.UserName.ToString()] = byAccount.Name;
            base.Response.Cookies.Add(new HttpCookie(Keys.SessionKeys.UserID.ToString(), byAccount.ID.ToString())
            {
                Expires = MyController.CurrentDateTime.AddDays(7.0)
            });
            RoadFlow.Platform.Log.Add("用户登录成功-test(帐号:" + text + ")", "", RoadFlow.Platform.Log.Types.用户登录);
            return("{\"id\":\"" + byAccount.ID.ToString() + "\",\"token\":\"" + RoadFlow.Utility.Config.GetTokenByUserId(byAccount.ID) + "\",\"status\":1,\"msg\":\"用户登录成功\"}");
        }
Exemplo n.º 3
0
        public string CheckLogin()
        {
            string name  = Keys.SessionKeys.IsValidateCode.ToString();
            string name2 = Keys.SessionKeys.ValidateCode.ToString();
            string text  = base.Request.Form["Account"];
            string text2 = base.Request.Form["Password"];
            string text3 = base.Request.Form["VCode"];
            string b     = base.Request.Form["Force"];
            string str   = "(帐号:" + text + " 密码:" + text2 + " 验证码:" + text3 + ")";

            if (text.IsNullOrEmpty() || text2.IsNullOrEmpty())
            {
                RoadFlow.Platform.Log.Add("用户登录失败(帐号或密码为空)" + str, "", RoadFlow.Platform.Log.Types.用户登录);
                return("{\"status\":0,\"msg\":\"帐号或密码不能为空!\"}");
            }
            if (base.Session[name] != null && "1" == base.Session[name].ToString() && (base.Session[name2] == null || string.Compare(base.Session[name2].ToString(), text3.Trim1(), true) != 0))
            {
                RoadFlow.Platform.Log.Add("用户登录失败(验证码错误)" + str, "", RoadFlow.Platform.Log.Types.用户登录);
                return("{\"status\":0,\"msg\":\"验证码错误!\"}");
            }
            RoadFlow.Platform.Users   users     = new RoadFlow.Platform.Users();
            RoadFlow.Data.Model.Users byAccount = users.GetByAccount(text.Trim());
            if (byAccount == null || string.Compare(byAccount.Password, users.GetUserEncryptionPassword(byAccount.ID.ToString(), text2.Trim()), false) != 0)
            {
                base.Session[name] = "1";
                RoadFlow.Platform.Log.Add("用户登录失败(帐号或密码错误)" + str, "", RoadFlow.Platform.Log.Types.用户登录);
                return("{\"status\":0,\"msg\":\"帐号或密码错误!\"}");
            }
            if (byAccount.Status == 1)
            {
                base.Session[name] = "1";
                RoadFlow.Platform.Log.Add("用户登录失败(帐号已被冻结)" + str, "", RoadFlow.Platform.Log.Types.用户登录);
                return("{\"status\":0,\"msg\":\"帐号已被冻结!\"}");
            }
            RoadFlow.Platform.OnlineUsers   onlineUsers  = new RoadFlow.Platform.OnlineUsers();
            RoadFlow.Data.Model.OnlineUsers onlineUsers2 = onlineUsers.Get(byAccount.ID);
            if (onlineUsers2 != null && "1" != b)
            {
                string iP = onlineUsers2.IP;
                base.Session.Remove(name);
                return("{\"status\":2,\"msg\":\"当前帐号已经在" + iP + "登录,您要强行登录吗?\"}");
            }
            Guid guid = Guid.NewGuid();

            base.Session[Keys.SessionKeys.UserID.ToString()]       = byAccount.ID;
            base.Session[Keys.SessionKeys.UserUniqueID.ToString()] = guid;
            base.Session[Keys.SessionKeys.BaseUrl.ToString()]      = base.Url.Content("~/");
            base.Session[Keys.SessionKeys.UserName.ToString()]     = byAccount.Name;
            base.Response.Cookies.Add(new HttpCookie(Keys.SessionKeys.UserID.ToString(), byAccount.ID.ToString())
            {
                Expires = MyController.CurrentDateTime.AddDays(7.0)
            });
            onlineUsers.Add(byAccount, guid);
            base.Session.Remove(name);
            RoadFlow.Platform.Log.Add("用户登录成功(帐号:" + text + ")", "", RoadFlow.Platform.Log.Types.用户登录);
            return("{\"status\":1,\"msg\":\"成功!\"}");
        }
Exemplo n.º 4
0
        public string Query()
        {
            RoadFlow.Platform.WorkFlowDelegation workFlowDelegation = new RoadFlow.Platform.WorkFlowDelegation();
            new RoadFlow.Platform.Organize();
            RoadFlow.Platform.Users    users    = new RoadFlow.Platform.Users();
            RoadFlow.Platform.WorkFlow workFlow = new RoadFlow.Platform.WorkFlow();
            string startTime  = base.Request.Form["S_StartTime"];
            string endTime    = base.Request.Form["S_EndTime"];
            string id         = base.Request.Form["S_UserID"];
            string text       = base.Request.Form["sidx"];
            string text2      = base.Request.Form["sord"];
            string text3      = base.Request.Form["typeid"];
            int    pageSize   = Tools.GetPageSize();
            int    pageNumber = Tools.GetPageNumber();
            string order      = (text.IsNullOrEmpty() ? "SenderTime" : text) + " " + (text2.IsNullOrEmpty() ? "asc" : text2);
            long   count;
            IEnumerable <RoadFlow.Data.Model.WorkFlowDelegation> enumerable = (!("1" == base.Request.QueryString["isoneself"])) ? workFlowDelegation.GetPagerData(out count, pageSize, pageNumber, RoadFlow.Platform.Users.RemovePrefix(id), startTime, endTime, order) : workFlowDelegation.GetPagerData(out count, pageSize, pageNumber, MyController.CurrentUserID.ToString(), startTime, endTime, order);
            JsonData jsonData = new JsonData();

            foreach (RoadFlow.Data.Model.WorkFlowDelegation item in enumerable)
            {
                string data = "委托中";
                if (item.StartTime > DateTimeNew.Now)
                {
                    data = "未开始";
                }
                else if (item.EndTime < DateTimeNew.Now)
                {
                    data = "已失效";
                }
                JsonData jsonData2 = new JsonData();
                jsonData2["id"]        = item.ID.ToString();
                jsonData2["UserID"]    = users.GetName(item.UserID);
                jsonData2["ToUserID"]  = users.GetName(item.ToUserID);
                jsonData2["FlowID"]    = (item.FlowID.HasValue ? workFlow.GetFlowName(item.FlowID.Value) : "");
                jsonData2["StartTime"] = item.StartTime.ToDateTimeString();
                jsonData2["EndTime"]   = item.EndTime.ToDateTimeString();
                jsonData2["Note"]      = item.Note;
                jsonData2["Status"]    = data;
                jsonData2["Edit"]      = "<a class=\"editlink\" href=\"javascript:edit('" + item.ID.ToString() + "');\">编辑</a>";
                jsonData.Add(jsonData2);
            }
            return("{\"userdata\":{\"total\":" + count + ",\"pagesize\":" + pageSize + ",\"pagenumber\":" + pageNumber + "},\"rows\":" + jsonData.ToJson() + "}");
        }
Exemplo n.º 5
0
        public string Query()
        {
            new List <RoadFlow.Data.Model.WorkFlow>();
            RoadFlow.Platform.Users    users    = new RoadFlow.Platform.Users();
            RoadFlow.Platform.WorkFlow workFlow = new RoadFlow.Platform.WorkFlow();
            string name   = base.Request.Form["flow_name"];
            string str    = base.Request.Form["typeid"];
            string text   = base.Request.Form["sidx"];
            string text2  = base.Request.Form["sord"];
            bool   flag   = "1" == base.Request.Form["openlist"];
            string typeid = "";

            if (str.IsGuid())
            {
                typeid = new RoadFlow.Platform.Dictionary().GetAllChildsIDString(str.ToGuid());
            }
            int    num        = flag ? 10 : RoadFlow.Utility.Tools.GetPageSize();
            int    pageNumber = RoadFlow.Utility.Tools.GetPageNumber();
            string order      = (text.IsNullOrEmpty() ? "CreateDate" : text) + " " + (text2.IsNullOrEmpty() ? "asc" : text2);
            long   count;
            List <RoadFlow.Data.Model.WorkFlow> pagerData = workFlow.GetPagerData(out count, num, pageNumber, RoadFlow.Platform.Users.CurrentUserID.ToString(), typeid, name, order);
            JsonData jsonData = new JsonData();

            foreach (RoadFlow.Data.Model.WorkFlow item in pagerData)
            {
                JsonData jsonData2 = new JsonData();
                jsonData2["id"]           = item.ID.ToString();
                jsonData2["Name"]         = item.Name;
                jsonData2["CreateDate"]   = item.CreateDate.ToDateTimeString();
                jsonData2["CreateUserID"] = users.GetName(item.CreateUserID);
                jsonData2["Status"]       = workFlow.GetStatusTitle(item.Status);
                if (flag)
                {
                    jsonData2["Edit"] = "<a href=\"javascript:void(0);\" onclick=\"openflow('" + item.ID + "');return false;\"><img src=\"" + base.Url.Content("~/Images/ico/topic_edit.gif") + "\" alt=\"\" style=\"vertical-align:middle; border:0;\" /><span style=\"vertical-align:middle; margin-left:3px;\">编辑</span></a>";
                }
                else
                {
                    jsonData2["Edit"] = "<a class=\"editlink\" href=\"javascript:void(0);\" onclick=\"openflow('" + item.ID + "','" + item.Name + "');return false;\"><span style=\"vertical-align:middle;\">编辑</span></a><a class=\"deletelink\" href=\"javascript:void(0);\" style=\"margin-left:5px\" onclick=\"delflow('" + item.ID + "'); return false;\"><span style=\"vertical-align:middle;\">删除</span></a><a href=\"javascript:void(0);\" style=\"margin-left:5px\" onclick=\"ExportFlow('" + item.ID + "'); return false;\"><span style=\"vertical-align:middle; background:url(../Images/ico/arrow_medium_right.png) no-repeat;padding-left:18px;\">导出</span></a>";
                }
                jsonData.Add(jsonData2);
            }
            return("{\"userdata\":{\"total\":" + count + ",\"pagesize\":" + num + ",\"pagenumber\":" + pageNumber + "},\"rows\":" + jsonData.ToJson() + "}");
        }
Exemplo n.º 6
0
        public void GetUserAccount()
        {
            string text = base.Request.QueryString["code"];

            if (text.IsNullOrEmpty())
            {
                base.Response.Write("身份验证失败");
                base.Response.End();
            }
            else
            {
                string userAccountByCode = new RoadFlow.Platform.WeiXin.Organize().GetUserAccountByCode(text);
                if (userAccountByCode.IsNullOrEmpty())
                {
                    base.Response.Write("身份验证失败");
                    base.Response.End();
                }
                else
                {
                    RoadFlow.Data.Model.Users byAccount = new RoadFlow.Platform.Users().GetByAccount(userAccountByCode);
                    if (byAccount == null)
                    {
                        base.Response.Write("未找到帐号对应的人员");
                        base.Response.End();
                    }
                    else
                    {
                        System.Web.HttpContext.Current.Response.Cookies.Add(new HttpCookie("weixin_userid", byAccount.ID.ToString())
                        {
                            Expires = DateTimeNew.Now.AddYears(10)
                        });
                        System.Web.HttpContext.Current.Session.Add(0.ToString(), byAccount.ID.ToString());
                        HttpCookie httpCookie = base.Request.Cookies.Get("LastURL");
                        string     text2      = (httpCookie == null) ? "" : httpCookie.Value;
                        if (!text2.IsNullOrEmpty())
                        {
                            base.Response.Redirect(text2);
                        }
                    }
                }
            }
        }
Exemplo n.º 7
0
        public string SaveUserHead()
        {
            string str           = base.Request.Form["x"];
            string str2          = base.Request.Form["y"];
            string text3         = base.Request.Form["x2"];
            string text4         = base.Request.Form["y2"];
            string str3          = base.Request.Form["w"];
            string str4          = base.Request.Form["h"];
            string text          = (base.Request.Form["img"] ?? "").DesDecrypt();
            Guid   currentUserID = RoadFlow.Platform.Users.CurrentUserID;

            if (!text.IsNullOrEmpty() && System.IO.File.Exists(text))
            {
                try
                {
                    string text2 = ImgHelper.CutAvatar(text, WebMvc.Common.Tools.BaseUrl + "/Content/UserHeads/" + currentUserID + ".jpg", str.ToInt(), str2.ToInt(), str3.ToInt(), str4.ToInt());
                    if (!text2.IsNullOrEmpty())
                    {
                        RoadFlow.Platform.Users   users  = new RoadFlow.Platform.Users();
                        RoadFlow.Data.Model.Users users2 = users.Get(currentUserID);
                        if (users2 != null)
                        {
                            users2.HeadImg = text2;
                            users.Update(users2);
                        }
                        return("保存成功!");
                    }
                    return("保存失败!");
                }
                catch
                {
                    return("保存失败!");
                }
            }
            return("文件不存在!");
        }
Exemplo n.º 8
0
    public static string GetWildcardValue(string wildcard, string userID = "")
    {
        if (MyExtensions.IsNullOrEmpty(wildcard))
        {
            return("");
        }
        string result = string.Empty;

        switch (wildcard.ToLower())
        {
        case "$userid$":
            result = ((!MyExtensions.IsGuid(userID)) ? RoadFlow.Platform.Users.CurrentUserID.ToString() : userID.ToString());
            break;

        case "$username$":
            if (MyExtensions.IsGuid(userID))
            {
                RoadFlow.Data.Model.Users users2 = new RoadFlow.Platform.Users().Get(MyExtensions.ToGuid(userID));
                result = ((users2 == null) ? "" : users2.Name);
            }
            else
            {
                result = RoadFlow.Platform.Users.CurrentUserName;
            }
            break;

        case "$deptid$":
            if (MyExtensions.IsGuid(userID))
            {
                RoadFlow.Data.Model.Organize deptByUserID2 = new RoadFlow.Platform.Users().GetDeptByUserID(MyExtensions.ToGuid(userID));
                result = ((deptByUserID2 == null) ? "" : deptByUserID2.ID.ToString());
            }
            else
            {
                result = RoadFlow.Platform.Users.CurrentDeptID.ToString();
            }
            break;

        case "$deptname$":
            if (MyExtensions.IsGuid(userID))
            {
                RoadFlow.Data.Model.Organize deptByUserID = new RoadFlow.Platform.Users().GetDeptByUserID(MyExtensions.ToGuid(userID));
                result = ((deptByUserID == null) ? "" : deptByUserID.Name);
            }
            else
            {
                result = RoadFlow.Platform.Users.CurrentDeptName.ToString();
            }
            break;

        case "$unitid$":
            if (MyExtensions.IsGuid(userID))
            {
                RoadFlow.Data.Model.Organize unitByUserID = new RoadFlow.Platform.Users().GetUnitByUserID(MyExtensions.ToGuid(userID));
                result = ((unitByUserID == null) ? "" : unitByUserID.ID.ToString());
            }
            else
            {
                result = RoadFlow.Platform.Users.CurrentUnitID.ToString();
            }
            break;

        case "$unitname$":
            if (MyExtensions.IsGuid(userID))
            {
                RoadFlow.Data.Model.Organize unitByUserID2 = new RoadFlow.Platform.Users().GetUnitByUserID(MyExtensions.ToGuid(userID));
                result = ((unitByUserID2 == null) ? "" : unitByUserID2.Name);
            }
            else
            {
                result = RoadFlow.Platform.Users.CurrentUnitName.ToString();
            }
            break;

        case "$account$":
            if (MyExtensions.IsGuid(userID))
            {
                RoadFlow.Data.Model.Users users = new RoadFlow.Platform.Users().Get(MyExtensions.ToGuid(userID));
                result = ((users == null) ? "" : users.Account);
            }
            else
            {
                result = RoadFlow.Platform.Users.CurrentUserAccount;
            }
            break;
        }
        return(result);
    }