예제 #1
0
    protected string RenderingLanguage(string content, string userCode, params string[] parameters)
    {
        try
        {
            content = ProcessMessage(content, parameters);
            if (userCode != null && userCode.Trim() != string.Empty)
            {
                User user = TheUserMgr.LoadUser(userCode, true, false);

                if (user != null && user.UserLanguage != null && user.UserLanguage != string.Empty)
                {
                    content = TheLanguageMgr.ProcessLanguage(content, user.UserLanguage);
                }
                else
                {
                    EntityPreference defaultLanguage = TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_DEFAULT_LANGUAGE);
                    content = TheLanguageMgr.ProcessLanguage(content, defaultLanguage.Value);
                }
            }
            else
            {
                EntityPreference defaultLanguage = TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_DEFAULT_LANGUAGE);
                content = TheLanguageMgr.ProcessLanguage(content, defaultLanguage.Value);
            }
        }
        catch (Exception ex)
        {
            return(content);
        }
        return(content);
    }
예제 #2
0
    private void UpdateUserLastModifyDate()
    {
        User user = TheUserMgr.LoadUser(this.lbCode.Text);

        user.LastModifyDate = DateTime.Now;
        user.LastModifyUser = this.CurrentUser;
        TheUserMgr.UpdateUser(user);
    }
예제 #3
0
 private void UpdateUserLastModifyDate(IList <User> userList)
 {
     foreach (User user in userList)
     {
         user.LastModifyDate = DateTime.Now;
         user.LastModifyUser = this.CurrentUser;
         TheUserMgr.UpdateUser(user);
     }
 }
예제 #4
0
    protected void checkUserExists(object source, ServerValidateEventArgs args)
    {
        string code = ((TextBox)(this.FV_User.FindControl("tbCode"))).Text.ToLower();
        User   user = TheUserMgr.LoadUser(code);

        if (user != null)
        {
            args.IsValid = false;
        }
    }
예제 #5
0
    private void UpdateUserLastModifyDate()
    {
        IList <User> userList = TheUserRoleMgr.GetUsersByRoleCode(this.lbCode.Text);

        foreach (User user in userList)
        {
            user.LastModifyDate = DateTime.Now;
            user.LastModifyUser = this.CurrentUser;
            TheUserMgr.UpdateUser(user);
        }
    }
예제 #6
0
 public User LoadUser(string userCode)
 {
     try
     {
         User user = TheUserMgr.LoadUser(userCode, false, false);
         return(user);
     }
     catch (BusinessErrorException ex)
     {
         string exMessage = RenderingLanguage(ex.Message, userCode, ex.MessageParams);
         throw new SoapException(exMessage, SoapException.ServerFaultCode, string.Empty);
     }
 }
예제 #7
0
    protected void FV_User_DataBound(object sender, EventArgs e)
    {
        User            user   = TheUserMgr.LoadUser(this.UserCode);
        RadioButtonList gender = (RadioButtonList)(this.FV_User.FindControl("rblGender"));

        gender.Items[1].Selected = gender.Items[1].Value == user.Gender ? true : false;
        gender.Items[0].Selected = gender.Items[0].Value == user.Gender ? true : false;
        if (IsUserPreference)
        {
            this.FV_User.FindControl("btnBack").Visible   = false;
            this.FV_User.FindControl("btnDelete").Visible = false;
        }
    }
예제 #8
0
 protected void GV_List_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         Literal ltlReleaseUser = (Literal)e.Row.FindControl("ltlReleaseUser");
         if (ltlReleaseUser.Text != string.Empty)
         {
             ltlReleaseUser.Text = TheUserMgr.LoadUser(ltlReleaseUser.Text).CodeName;
         }
         Literal ltlCreateUser = (Literal)e.Row.FindControl("ltlCreateUser");
         ltlCreateUser.Text = TheUserMgr.LoadUser(ltlCreateUser.Text).CodeName;
     }
 }
예제 #9
0
 public Permission[] GetUserPermissions(string categoryCode, string userCode)
 {
     try
     {
         User user = TheUserMgr.LoadUser(userCode);
         return(ThePermissionMgr.GetALlPermissionsByCategory(categoryCode, user).ToArray());
     }
     catch (BusinessErrorException ex)
     {
         string exMessage = RenderingLanguage(ex.Message, userCode, ex.MessageParams);
         throw new SoapException(exMessage, SoapException.ServerFaultCode, string.Empty);
     }
 }
예제 #10
0
    protected void ODS_User_Updating(object sender, ObjectDataSourceMethodEventArgs e)
    {
        User user = (User)e.InputParameters[0];

        RadioButtonList gender = (RadioButtonList)(this.FV_User.FindControl("rblGender"));

        user.Gender         = gender.Items[0].Selected ? gender.Items[0].Value : gender.Items[1].Value;
        user.LastModifyUser = this.CurrentUser;
        user.LastModifyDate = DateTime.Now;

        User oldUser = TheUserMgr.LoadUser(UserCode);

        user.Password = oldUser.Password;
    }
예제 #11
0
    protected void Login_Click(object sender, EventArgs e)
    {
        string ipFilter         = (from en in entityPerferences where en.Code == "isEnableIPFilter" select en.Value).FirstOrDefault();
        bool   isEnableIPFilter = bool.TryParse(ipFilter, out isEnableIPFilter);

        string ipAdd = Request.UserHostAddress.ToString();

        if (isEnableIPFilter && !IPHelper.IsInnerIP(ipAdd))
        {
            return;
        }

        string userCode     = this.txtUsername.Value.Trim().ToLower();
        string password     = this.txtPassword.Value.Trim();
        string tempPassword = password;

        password = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5");

        if (userCode.Equals(string.Empty))
        {
            errorLabel.Text = "Please enter your Account!";
            return;
        }

        User user = TheUserMgr.LoadUser(userCode, false, false);

        if (user == null)
        {
            errorLabel.Text = "Identification failure. Try again!";
        }
        else
        {
            if (password == user.Password && user.IsActive)
            {
                this.Session["Current_User"] = TheUserMgr.LoadUser(userCode, true, true);
                #region   检查密码
                if (user.IsEnforceExpiration)
                {
                    Response.Redirect("~/UpdatePassword.aspx");
                }
                #endregion
                Response.Redirect("~/Default.aspx");
            }
            else
            {
                errorLabel.Text = "Identification failure. Try again!";
            }
        }
    }
예제 #12
0
    protected void lbtnDelete_Click(object sender, EventArgs e)
    {
        string code = ((LinkButton)sender).CommandArgument;

        try
        {
            TheUserMgr.DeleteUser(code);
            ShowSuccessMessage("Security.User.DeleteUser.Successfully", code);
            UpdateView();
        }
        catch (Castle.Facilities.NHibernateIntegration.DataException ex)
        {
            ShowErrorMessage("Security.User.DeleteUser.Fail", code);
        }
    }
예제 #13
0
 public void AddUserFavorite(string userCode, string type, string pageName, string pageUrl, string pageImage, bool hasPermission)
 {
     if (TheFavoritesMgr.CheckFavoritesUniqueExist(userCode, type, pageName))
     {
         TheFavoritesMgr.DeleteFavorites(userCode, type, pageName);
     }
     if (hasPermission)
     {
         Favorites fav = new Favorites();
         fav.User      = TheUserMgr.LoadUser(userCode);
         fav.Type      = type;
         fav.PageName  = pageName;
         fav.PageUrl   = pageUrl;
         fav.PageImage = pageImage;
         TheFavoritesMgr.CreateFavorites(fav);
     }
 }
예제 #14
0
    protected void ToInBT_Click(object sender, EventArgs e)
    {
        List <Permission> pList = new List <Permission>();

        foreach (ListItem item in this.CBL_NotInPermission.Items)
        {
            if (item.Selected)
            {
                pList.Add(ThePermissionMgr.LoadPermission(Convert.ToInt32(item.Value)));
            }
        }
        if (pList.Count > 0)
        {
            TheUserPermissionMgr.CreateUserPermissions(TheUserMgr.LoadUser(this.lbCode.Text), pList);
        }
        this.CBL_NotInPermission.DataBind();
        this.CBL_InPermission.DataBind();
        this.cb_InPermission.Checked    = false;
        this.cb_NotInPermission.Checked = false;
    }
예제 #15
0
    protected void ToInBT_Click(object sender, EventArgs e)
    {
        List <Flow> pList = new List <Flow>();

        foreach (ListItem item in this.CBL_NotInProductLine.Items)
        {
            if (item.Selected)
            {
                ProductLineUser pu = new ProductLineUser();
                pu.DeliveryUser = TheUserMgr.LoadUser(this.tbUser.Text.Trim());
                pu.ProductLine  = TheFlowMgr.LoadFlow(item.Value);
                TheProductLineUserMgr.CreateProductLineUser(pu);
            }
        }

        this.CBL_NotInProductLine.DataBind();
        this.CBL_InProductLine.DataBind();
        this.cb_InProductLine.Checked    = false;
        this.cb_NotInProductLine.Checked = false;
    }
예제 #16
0
    protected void ToInBT_Click(object sender, EventArgs e)
    {
        List <Role> rList = new List <Role>();

        foreach (ListItem item in this.CBL_NotInRole.Items)
        {
            if (item.Selected)
            {
                rList.Add(TheRoleMgr.LoadRole(item.Value));
            }
        }
        if (rList.Count > 0)
        {
            TheUserRoleMgr.CreateUserRoles(TheUserMgr.LoadUser(this.lbCode.Text), rList);
        }
        this.CBL_NotInRole.DataBind();
        this.CBL_InRole.DataBind();
        this.cb_InRole.Checked    = false;
        this.cb_NotInRole.Checked = false;
        UpdateUserLastModifyDate();
    }
예제 #17
0
 public void InitPageParameter(string code)
 {
     this.lbCode.Text        = code;
     this.GV_List.DataSource = (List <Permission>)(TheUserMgr.GetAllPermissions(code));
     this.GV_List.DataBind();
 }
예제 #18
0
 public void TransformationPlan()
 {
     this.TheEDIMgr.TransformationPlan(TheUserMgr.GetMonitorUser());
 }
예제 #19
0
 public void LoadEDI()
 {
     this.TheEDIMgr.LoadEDI(TheUserMgr.GetMonitorUser());
 }
예제 #20
0
 public void RunShipPlan(string userCode)
 {
     GetService <com.Sconit.Service.MRP.IMrpMgr>("MrpMgr.service").RunShipPlan(TheUserMgr.LoadUser(userCode, false, false));
 }
예제 #21
0
    protected void btnUpdatePassword_Click(object sender, EventArgs e)
    {
        try
        {
            User    user       = TheUserMgr.LoadUser(UserCode);
            TextBox tbPassword = (TextBox)(this.divPassword.FindControl("tbPassword"));
            if (user.IsEnforcePolicy)
            {
                if (tbPassword.Text.Trim().Length < 8)
                {
                    throw new Exception("密码长度必须大于等于8,请重新输入。");
                }

                char[] letters  = new char[] { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
                char[] numbers  = new char[] { '1', '2', '3', '4', '5', '6', '7', '8', '9' };
                char[] specials = new char[] { '!', '@', '#', '$', '%', '^', '&', '*', '_' };

                bool existsUpLetter = false;
                bool existsLoLetter = false;
                bool existsNumber   = false;
                bool existsSpecials = false;
                foreach (var letter in tbPassword.Text.Trim())
                {
                    if (letters.Where(l => l == letter).Count() > 0)
                    {
                        existsUpLetter = true;
                        continue;
                    }
                    if (letters.Where(l => Convert.ToChar(l.ToString().ToLower()) == letter).Count() > 0)
                    {
                        existsLoLetter = true;
                        continue;
                    }
                    if (numbers.Where(l => l == letter).Count() > 0)
                    {
                        existsNumber = true;
                        continue;
                    }
                    if (specials.Where(l => l == letter).Count() > 0)
                    {
                        existsSpecials = true;
                        continue;
                    }
                }
                int count = 0;
                if (existsUpLetter)
                {
                    count++;
                }
                if (existsLoLetter)
                {
                    count++;
                }
                if (existsNumber)
                {
                    count++;
                }
                if (existsSpecials)
                {
                    count++;
                }

                if (count < 3)
                {
                    throw new Exception("密码不符合复杂度要求(英大小写、数、特殊字符4取3)");
                }
            }

            user.Password       = FormsAuthentication.HashPasswordForStoringInConfigFile(tbPassword.Text.Trim(), "MD5");
            user.LastModifyDate = DateTime.Now;
            user.LastModifyUser = this.CurrentUser;
            TheUserMgr.UpdateUser(user);
            ShowSuccessMessage("Security.User.UpdateUserPassword.Successfully", UserCode);
            this.divPassword.Visible = false;
        }
        catch (BusinessErrorException ex)
        {
            ShowErrorMessage(ex);
        }
        catch (Exception ex)
        {
            ShowErrorMessage(ex.Message);
        }
    }
예제 #22
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            //string entityCode = TheEntityPreferenceMgr.LoadEntityPreference("CompanyCode").Value;
            string entityCode = TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_PORTAL_PARAM).Value;

            // read config
            string companyCode = string.Empty;
            string redirectUrl = string.Empty;
            string urlLogin    = string.Empty;
            string userCode    = string.Empty;
            string password    = string.Empty;
            string partyCode   = string.Empty;

            //string userCode = "su";
            //string password = "******";
            //string partyCode = "s0000208";
            //?105=201027&language=en&redirectUrl=Main.aspx%3Fmid%3DOrder.OrderIssue__mp--ModuleType-SupplierDistribution_ModuleSubType-Nml&userCode=SupplyUser&password=supplyuser%40sconit.com
            string[] keys = Request.Params.AllKeys;
            foreach (string key in keys)
            {
                if (key.EndsWith(entityCode))
                {
                    partyCode = Request.Params.Get(key).ToLower();
                }
                else if (key.EndsWith("languageId"))
                {
                    language = Request.Params.Get(key);
                    if (language == "zh_CN")
                    {
                        language = "zh-CN";
                    }
                    else if (language == "en_US")
                    {
                        language = "en";
                    }
                    InitializeCulture();
                }
                else if (key.EndsWith("feature"))
                {
                    redirectUrl = Request.Params.Get(key);
                }
                else if (key.EndsWith("urlLogin"))
                {
                    urlLogin = Request.Params.Get(key);
                }
                else if (key.EndsWith("userid"))
                {
                    userCode = Request.Params.Get(key).ToLower();
                }
                else if (key.EndsWith("password"))
                {
                    password = Request.Params.Get(key);
                }
            }
            //LoginPage
            HttpCookie loginPageCookie = new HttpCookie("LoginPage");
            loginPageCookie.Value = urlLogin;
            Response.Cookies.Add(loginPageCookie);

            ////test
            //userCode = "SupplyUser";
            //password = "******";
            //partyCode = "ADKJ";

            //this.message.Text = userCode + "|" + password + "|" + partyCode;
            //return;

            if (userCode != null && userCode.Trim() != string.Empty)
            {
                if ((userCode + password).ToLower() == @"supplyusersconit.yfkey")
                {
                    User user = TheUserMgr.CheckAndLoadUser(partyCode.ToLower());

                    bool isExistUserPreferenceLanguage = false;
                    if (user != null && user.UserPreferences != null)
                    {
                        foreach (UserPreference userPreference in user.UserPreferences)
                        {
                            if (userPreference.Code == BusinessConstants.CODE_MASTER_LANGUAGE)
                            {
                                userPreference.Value          = language;
                                isExistUserPreferenceLanguage = true;
                            }
                        }
                    }
                    if (!isExistUserPreferenceLanguage || user.UserPreferences == null)
                    {
                        UserPreference up = new UserPreference();
                        up.Code  = BusinessConstants.CODE_MASTER_LANGUAGE;
                        up.Value = language;
                        up.User  = user;
                        user.UserPreferences.Add(up);
                    }
                    this.Session["Current_User"]      = user;
                    this.Session["Hiddensmp"]         = "Hiddensmp";
                    this.TreeView1.TreeNodeDataBound += new TreeNodeEventHandler(TreeView1_TreeNodeDataBound);
                    return;
                }
            }
            this.Response.Redirect("about:blank");
        }
        catch (BusinessErrorException ex)
        {
            this.Response.Redirect("about:blank");
        }
    }
예제 #23
0
    protected void Update_Click(object sender, EventArgs e)
    {
        try
        {
            string password        = this.tbPassword.Text.Trim();
            string confirmPassword = this.tbConfirmPassword.Text.Trim();
            if (password != confirmPassword)
            {
                throw new Exception("2次密码输入不一致,请重新输入。");
            }
            if (CurrentUser.IsEnforcePolicy)
            {
                if (tbPassword.Text.Trim().Length < 8)
                {
                    throw new Exception("密码长度必须大于等于8,请重新输入。");
                }

                char[] letters  = new char[] { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
                char[] numbers  = new char[] { '1', '2', '3', '4', '5', '6', '7', '8', '9' };
                char[] specials = new char[] { '!', '@', '#', '$', '%', '^', '&', '*', '_' };

                bool existsUpLetter = false;
                bool existsLoLetter = false;
                bool existsNumber   = false;
                bool existsSpecials = false;
                foreach (var letter in tbPassword.Text.Trim())
                {
                    if (letters.Where(l => l == letter).Count() > 0)
                    {
                        existsUpLetter = true;
                        continue;
                    }
                    if (letters.Where(l => Convert.ToChar(l.ToString().ToLower()) == letter).Count() > 0)
                    {
                        existsLoLetter = true;
                        continue;
                    }
                    if (numbers.Where(l => l == letter).Count() > 0)
                    {
                        existsNumber = true;
                        continue;
                    }
                    if (specials.Where(l => l == letter).Count() > 0)
                    {
                        existsSpecials = true;
                        continue;
                    }
                }
                int count = 0;
                if (existsUpLetter)
                {
                    count++;
                }
                if (existsLoLetter)
                {
                    count++;
                }
                if (existsNumber)
                {
                    count++;
                }
                if (existsSpecials)
                {
                    count++;
                }

                if (count < 3)
                {
                    throw new Exception("密码要求(英大小写、数、特殊字符4取3)");
                }
            }

            CurrentUser.Password            = FormsAuthentication.HashPasswordForStoringInConfigFile(tbPassword.Text.Trim(), "MD5");
            CurrentUser.LastModifyDate      = DateTime.Now;
            CurrentUser.LastModifyUser      = this.CurrentUser;
            CurrentUser.IsEnforceExpiration = false;
            TheUserMgr.UpdateUser(CurrentUser);
            Response.Redirect("~/Default.aspx");
        }
        catch (Exception ex)
        {
            errorLabel.Text = ex.Message;
        }
    }