示例#1
0
 public ActionResult Pending(string cGuid = null)
 {
     if (!string.IsNullOrEmpty(cGuid))
     {
         Session["CurrentCompany"] = cGuid;
         Session["EditThreshold"]  = new Common.DAL.Common().GetEditThreshold(cGuid);
     }
     return(View("Pending"));
 }
        public string AddUser(string loginName)
        {
            bool result = false;


            //0:不存在当前平台中,1:存在平台内但不属于此公司,2:已存在此公司
            string counts = new UserService().GetUserByCguid(loginName, Session["CurrentCompanyGuid"].ToString());

            if (counts == "2")
            {
                //return msg = loginName + General.Resource.Common.Exist + ",请重新输入!";
                return(counts);
            }
            if (counts == "0")
            {
                string guid = Guid.NewGuid().ToString();
                Session["guid"] = guid;
                result          = new Common.DAL.Common().AddUser(guid, Session["CurrentCompanyGuid"].ToString(), loginName, null, "0", "GP010");
                if (result)
                {
                    string iguid = new Common.DAL.Common().AddUserCompany(guid, Session["CurrentCompanyGuid"].ToString(), "0", "GP010", DateTime.Now.ToString(), "");

                    string subject = "旺财 Net-Accounting.cn服务中心";

                    if (loginName.IndexOf('@') > 0)
                    {
                        new Common.CommonController().SendInfoToEmail(loginName, subject, "<a href='http://net-accounting.cn/Common/Activate?guid=" + iguid + "&loginName=" + loginName + "'>" + Session["CompanyName"].ToString() + "的管理员" + Session["NickName"].ToString() + "邀请您成为该公司的旺财用户,请点击确认</a>");
                        //new Common.CommonController().SendInfoToEmail(loginName, subject, "<a href='localhost:41955/Common/Activate?guid=" + guid + "'>点击激活您的账号</a>");
                    }
                    else
                    {
                        new Common.CommonController().SendInfoToPhone(loginName, Session["CompanyName"].ToString() + "的管理员" + Session["NickName"].ToString() + "邀请您成为该公司的旺财用户,请点击确认 http://net-accounting.cn/Common/Activate?guid=" + iguid);
                    }
                }
                return(counts);
            }
            if (counts == "1")
            {
                //string guid1 = Guid.NewGuid().ToString();
                string iguid1  = new Common.DAL.Common().AddUserCompanyLogin(loginName, Session["CurrentCompanyGuid"].ToString(), "0", "GP010", DateTime.Now.ToString());
                string subject = "旺财 Net-Accounting.cn服务中心";

                if (loginName.IndexOf('@') > 0)
                {
                    new Common.CommonController().SendInfoToEmail(loginName, subject, "<a href='http://net-accounting.cn/Common/LoginActivate?guid=" + iguid1 + "&loginName=" + loginName + "'>" + Session["CompanyName"].ToString() + "的管理员" + Session["NickName"].ToString() + "邀请您成为该公司的旺财用户,请点击确认</a>");
                    //new Common.CommonController().SendInfoToEmail(loginName, subject, "<a href='localhost:41955/Common/Activate?guid=" + guid + "'>点击激活您的账号</a>");
                }
                else
                {
                    new Common.CommonController().SendInfoToPhone(loginName, Session["CompanyName"].ToString() + "的管理员" + Session["NickName"].ToString() + "邀请您成为该公司的旺财用户,请点击确认 http://net-accounting.cn/Common/LoginActivate?guid=" + iguid1);
                }
            }

            return(counts);
        }
示例#3
0
        public string Register(RegInfo registerinfo)
        {
            bool   result = false;
            string msg    = "";

            registerinfo.Company.C_GUID            = Guid.NewGuid().ToString();
            registerinfo.User.C_GUID               = registerinfo.Company.C_GUID;
            registerinfo.User.U_GUID               = Guid.NewGuid().ToString();
            registerinfo.Company.MasterCompanyGuid = string.Empty;
            registerinfo.Company.AuditDate         = DateTime.Now.ToString();
            registerinfo.User.State = 0;
            //根据输进的用户名(邮箱)查找数据库是否存在此邮箱注册记录!
            List <FMS.Model.T_User> users = new UserService().GetUsers(registerinfo.User.LoginName);

            //记录为0!
            if (users.Count.Equals(0))
            {
                //根据输进的公司名称查找数据是否存在!
                List <FMS.Model.T_Company> Company = new UserService().GetCompany("", registerinfo.Company.Name);
                //记录为0
                if (Company.Count.Equals(0))
                {
                    //开始注册
                    result = new Common.DAL.Common().UpdRegInfo(registerinfo);
                    if (result)
                    {
                        SendMail(registerinfo.User.LoginName);
                    }
                }
                else
                {
                    result = false;
                    msg    = General.Resource.Common.CompanyName + General.Resource.Common.Exist;
                    return(string.Format("{{\"Result\":{0},\"Msg\":\"{1}\"}}",
                                         result.ToString().ToLower(), msg));
                }
            }
            else
            {
                result = false;
                msg    = registerinfo.User.LoginName + General.Resource.Common.Exist + ",请重新输入!";
                return(string.Format("{{\"Result\":{0},\"Msg\":\"{1}\"}}",
                                     result.ToString().ToLower(), msg));
            }
            msg = result ? "邮件已发送,请前往激活!" : General.Resource.Common.Failed;
            return(string.Format("{{\"Result\":{0},\"Msg\":\"{1}\"}}",
                                 result.ToString().ToLower(), msg));
        }
        public string ExchangeManager(FormCollection form)
        {
            bool   result    = false;
            string msg       = "更改失败";
            string loginName = form["LoginName"];
            string validCode = form["ValidateCode"];

            result = new Common.DAL.Common().CheckValidateCode(loginName, validCode);
            if (result)
            {
                List <FMS.Model.T_User> users = new UserService().GetUserManage(loginName);
                //记录不为0!
                if (users.Count.Equals(1))
                {
                    FMS.Model.R_UserCompany user = new FMS.Model.R_UserCompany();
                    user.U_GUID = users[0].U_GUID;
                    user.C_GUID = Session["CurrentCompanyGuid"].ToString();
                    ////并且与当前用户属同一个公司
                    //if (user.C_GUID == Session["MasterCompanyGuid"].ToString())
                    //{


                    string groupCode = new Common.DAL.Common().GetUserGroup(Session["CurrentCompanyGuid"].ToString(), users.First().U_GUID);


                    if (groupCode != null && groupCode != "")
                    {
                        //1.将其GroupCode置为1
                        user.GroupCode = "GP001";

                        //result = new UserService().UpdUserInf(user);
                        string LoginName = null;
                        if (Session["LoginName"] == null)
                        {
                            LoginName = Session["TelName"].ToString();
                        }
                        else
                        {
                            LoginName = Session["LoginName"].ToString();
                        }

                        //2.将当前用户GroupCode置为0
                        List <FMS.Model.T_User> users2 = new UserService().GetUsers(LoginName);

                        FMS.Model.R_UserCompany UserCompany2 = new FMS.Model.R_UserCompany();

                        UserCompany2.U_GUID = users2[0].U_GUID;
                        UserCompany2.C_GUID = Session["CurrentCompanyGuid"].ToString();

                        List <R_UserCompany> UserCompanyList = new List <R_UserCompany>();

                        UserCompanyList.Add(user);
                        UserCompanyList.Add(UserCompany2);

                        UserCompany2.GroupCode = "GP010";
                        result = new UserService().UpdUserInf(UserCompanyList);

                        //修改成功
                        if (result)
                        {
                            msg = "success";
                            Session["GroupCode"] = UserCompany2.GroupCode;
                            List <string> recs = new UserService().GetUserStateOneModules(Session["CurrentUserGuid"].ToString(), Session["CurrentCompanyGuid"].ToString());
                            Session["ModuleList"] = recs;
                        }
                        else
                        {
                            msg = "变更管理者失败";
                        }
                    }

                    else
                    {
                        msg = "当前公司无此用户,请先增加新用户";
                    }
                }
                else
                {
                    result = false;
                    msg    = "无此邮箱/手机号注册的用户";
                }
            }
            else
            {
                msg = "验证码错误";
            }
            return(msg);
        }