Exemplo n.º 1
0
    public string UpdatePassword(string requestParam)
    {
        string RetVal = string.Empty;
        int UserNId;
        string Password, Language, UserName, EmailId;
        string[] Params;
        //Variables for creating XLS Logfile
        string XLSFileMsg = string.Empty;
        try
        {
            Params = Global.SplitString(requestParam, Constants.Delimiters.ParamDelimiter);
            UserNId = int.Parse(Params[0]);
            Password = Params[1].ToString();
            Language = Params[2].ToString();
            UserName = Params[3].ToString();
            EmailId = Params[4].ToString();
            AdaptationUsers.AdaptationUsers UserLoginService = new AdaptationUsers.AdaptationUsers();
            UserLoginService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.AdaptationUserWebService;
            RetVal = UserLoginService.UpdateUserPassword(UserNId, Global.OneWayEncryption(Password)).ToString();
            if (RetVal.ToUpper() == "TRUE")
            {
                Frame_ChangePassword_And_Send_Mail(UserName, EmailId, Language, Password);

                #region "Call method to write log in XLS file"
                XLSFileMsg = string.Format(Constants.CSVLogMessage.ChangePassword, EmailId);
                WriteLogInXLSFile(Constants.AdminModules.UserManagement.ToString(), XLSFileMsg);
                #endregion
            }

        }

        catch (Exception ex)
        {
            Global.CreateExceptionString(ex, null);
        }
        return RetVal;
    }
Exemplo n.º 2
0
    /// <summary>
    /// Set User As Admin for Current Adaptation
    /// </summary>
    /// <param name="requestParam"></param>
    /// <returns></returns>
    public string SetUserAsAdmin(string requestParam)
    {
        string RetVal = string.Empty;
        //string AdptationUrl = string.Empty;
        int UserNId;
        string Language, UserName, EmailId;
        string[] Params;

        //Variables for creating XLS Logfile
        string XLSFileMsg = string.Empty;
        try
        {
            //AdptationUrl = Global.GetAdaptationUrl();
            Params = Global.SplitString(requestParam, Constants.Delimiters.ParamDelimiter);
            UserNId = int.Parse(Params[0]);
            Language = Params[1].ToString();
            UserName = Params[2].ToString();
            EmailId = Params[3].ToString();
            AdaptationUsers.AdaptationUsers UserLoginService = new AdaptationUsers.AdaptationUsers();
            UserLoginService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.AdaptationUserWebService;
            RetVal = UserLoginService.SetUserAsAdmin(UserNId, Global.GetAdaptationGUID()).ToString();

            #region "Call method to write log in XLS file"
            if (RetVal.ToUpper() == "TRUE")
            {

                XLSFileMsg = string.Format(Constants.CSVLogMessage.UserSetAsAdmin, EmailId);
                WriteLogInXLSFile(Constants.AdminModules.UserManagement.ToString(), XLSFileMsg);
            #endregion

                Session[Constants.SessionNames.LoggedAdminUser] = null;
                Session[Constants.SessionNames.LoggedAdminUserNId] = null;
                Frame_Message_And_Send_Mail(UserName, EmailId, UserNId.ToString(), true, true, Language);
                this.Create_MaintenanceAgency_ForAdmin(UserNId.ToString(), UserName, Language);
            }

        }
        catch (Exception ex)
        {
            Global.CreateExceptionString(ex, null);
        }
        return RetVal;
    }
Exemplo n.º 3
0
    ///// <summary>
    ///// Get all users of current Adaptation
    ///// </summary>
    ///// <param name="requestParam"></param>
    ///// <returns></returns>
    //public string GetCurentAdaptationsUser(string requestParam)
    //{
    //    string RetVal = string.Empty;
    //    int AdapNId;
    //    string[] Params;
    //    string sortExp = "";
    //    HTMLTableGenerator TableGenerator;
    //    //string AdaptationURl = string.Empty;
    //    try
    //    {
    //        Params = Global.SplitString(requestParam, Constants.Delimiters.ParamDelimiter);
    //        AdapNId = int.Parse(Params[0]); // Not in use now
    //        int CurrentPage = int.Parse(Params[1]);
    //        if (Params.Length > 1)
    //        {
    //            sortExp = Params[3].ToString() + " " + Params[2].ToString();
    //        }
    //        // Get Adaptation URL
    //        //AdaptationURl = Global.GetAdaptationUrl();
    //        DataSet dsUsers = new DataSet();
    //        AdaptationUsers.AdaptationUsers UserLoginService = new AdaptationUsers.AdaptationUsers();
    //        UserLoginService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.AdaptationUserWebService;
    //        // Get ALL the users of current Adaptation by Adaptation URL
    //        dsUsers = UserLoginService.GetUsersByAdaptationURL(Global.GetAdaptationGUID());
    //        DataTable dtUsers = dsUsers.Tables[0].Clone();
    //        // Set Paging and creatwe data table
    //        for (int i = ((CurrentPage - 1) * Convert.ToInt32(Global.AdapUserPageSize)) + 1; i <= (CurrentPage * Convert.ToInt32(Global.AdapUserPageSize)); i++)
    //        {
    //            if (i <= dsUsers.Tables[0].Rows.Count)
    //            {
    //                DataRow newRow = dsUsers.Tables[0].Rows[i - 1];
    //                dtUsers.ImportRow(newRow);
    //            }
    //            else
    //            {
    //                break;
    //            }
    //        }
    //        // Sort Result
    //        if (sortExp != "")
    //        {
    //            dtUsers.DefaultView.Sort = sortExp;
    //        }
    //        TableGenerator = new HTMLTableGenerator();
    //        TableGenerator.ShowSorting = true;
    //        TableGenerator.RowDisplayType = HTMLTableGenerator.DisplayType.RadioButtonType;
    //        RetVal = TableGenerator.GetTableHmtl(dtUsers.DefaultView.ToTable(), "NId", "AdapUser", true) + Constants.Delimiters.ParamDelimiter + CalPageCount((dsUsers.Tables[0].Rows.Count), Convert.ToInt32(Global.AdapUserPageSize));
    //    }
    //    catch (Exception ex)
    //    {
    //        Global.CreateExceptionString(ex, null);
    //    }
    //    return RetVal;
    //}
    public string GetCurentAdaptationsUser(string requestParam)
    {
        //////string RetVal = string.Empty;
        //////string[] Params;
        //////string sortExp = "";
        //////HTMLTableGenerator TableGenerator;
        //////string SearchStr = string.Empty;
        //////DataView DefDataView = null;
        //////try
        //////{
        //////    Params = Global.SplitString(requestParam, Constants.Delimiters.ParamDelimiter);
        //////    int CurrentPage = int.Parse(Params[1]);
        //////    if (Params.Length > 1)
        //////    {
        //////        sortExp = Params[3].ToString() + " " + Params[2].ToString();
        //////        if (Params.Length > 4)
        //////        {
        //////            SearchStr = Params[4].ToString();
        //////        }
        //////    }
        //////    DataSet dsUsers = new DataSet();
        //////    AdaptationUsers.AdaptationUsers UserLoginService = new AdaptationUsers.AdaptationUsers();
        //////    UserLoginService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.AdaptationUserWebService;
        //////    // Get ALL the users of current Adaptation Guid
        //////    dsUsers = UserLoginService.GetUsersByAdaptationURL(Global.GetAdaptationGUID());
        //////    DataTable DTFullTable = dsUsers.Tables[0];
        //////    DataTable DTFullTableClone = null;
        //////    if (Convert.ToBoolean(Global.ShowWebmasterAccount) == false)
        //////    {
        //////        DTFullTableClone = dsUsers.Tables[0].Clone();
        //////        DataRow[] Drows = DTFullTable.Select("IsMasterAccount <> 'true'");
        //////        foreach (DataRow dr in Drows)
        //////        {
        //////            DTFullTableClone.ImportRow(dr);
        //////        }
        //////    }
        //////    else
        //////    {
        //////        DTFullTableClone = DTFullTable;
        //////    }
        //////    DTFullTableClone.Columns.Remove("IsMasterAccount");
        //////    //dsUsers.Tables[0].Columns.Remove("IsMasterAccount");
        //////    //dsUsers.Tables[0] = DTFullTable;
        //////    DataTable dtUsers = dsUsers.Tables[0].Clone();
        //////    DataTable dtTempUsers = dsUsers.Tables[0].Clone();
        //////    DefDataView = new DataView();

        //////    if (!string.IsNullOrEmpty(SearchStr))
        //////    {
        //////        var FilteredTable = DTFullTableClone.Select(@"UserName like '%" + SearchStr + "%' or EmailId like '%" + SearchStr + "%'", sortExp);
        //////        foreach (DataRow Dr in FilteredTable)
        //////        {
        //////            dtTempUsers.ImportRow(Dr);
        //////        }

        //////        if (dtTempUsers.Rows.Count > 0)
        //////        {
        //////            DefDataView = dtTempUsers.DefaultView;
        //////        }
        //////    }
        //////    else
        //////    {
        //////        DefDataView = DTFullTableClone.DefaultView;
        //////    }
        //////    if (!string.IsNullOrEmpty(sortExp) && DefDataView.Table != null && DefDataView.Table.Rows != null && DefDataView.Table.Rows.Count > 0)
        //////    {
        //////        DefDataView.Sort = sortExp;
        //////        dtTempUsers = DefDataView.ToTable();
        //////    }

        //////    // Set Paging and creatwe data table
        //////    for (int i = ((CurrentPage - 1) * Convert.ToInt32(Global.AdapUserPageSize)) + 1; i <= (CurrentPage * Convert.ToInt32(Global.AdapUserPageSize)); i++)
        //////    {
        //////        if (i <= dtTempUsers.Rows.Count)
        //////        {
        //////            DataRow newRow = dtTempUsers.Rows[i - 1];
        //////            dtUsers.ImportRow(newRow);
        //////        }
        //////        else
        //////        {
        //////            break;
        //////        }
        //////    }

        //////    TableGenerator = new HTMLTableGenerator();
        //////    TableGenerator.ShowSorting = true;
        //////    TableGenerator.RowDisplayType = HTMLTableGenerator.DisplayType.RadioButtonType;
        //////    RetVal = TableGenerator.GetTableHmtl(dtUsers.DefaultView.ToTable(), "NId", "AdapUser", true) + Constants.Delimiters.ParamDelimiter + CalPageCount((dtTempUsers.Rows.Count), Convert.ToInt32(Global.AdapUserPageSize));
        //////}

        //////catch (Exception ex)
        //////{
        //////    Global.CreateExceptionString(ex, null);
        //////}
        //////return RetVal;

        string RetVal = string.Empty;
        string[] Params;
        string sortExp = "";
        HTMLTableGenerator TableGenerator;
        string SearchStr = string.Empty;
        DataView DefDataView = null;
        try
        {
            Params = Global.SplitString(requestParam, Constants.Delimiters.ParamDelimiter);
            int CurrentPage = int.Parse(Params[1]);
            if (Params.Length > 1)
            {
                sortExp = Params[3].ToString() + " " + Params[2].ToString();
                if (Params.Length > 4)
                {
                    SearchStr = Params[4].ToString();
                }
            }
            DataSet dsUsers = new DataSet();
            AdaptationUsers.AdaptationUsers UserLoginService = new AdaptationUsers.AdaptationUsers();
            UserLoginService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.AdaptationUserWebService;
            // Get ALL the users of current Adaptation Guid
            //dsUsers = UserLoginService.GetUsersByAdaptationURL(Global.GetAdaptationGUID());
            DataTable dtUsers = dsUsers.Tables[0].Clone();
            DataTable dtTempUsers = dsUsers.Tables[0].Clone();
            DefDataView = new DataView();
            if (!string.IsNullOrEmpty(SearchStr))
            {
                var FilteredTable = dsUsers.Tables[0].Select(@"UserName like '%" + SearchStr + "%' or EmailId like '%" + SearchStr + "%'", sortExp);
                foreach (DataRow Dr in FilteredTable)
                {
                    dtTempUsers.ImportRow(Dr);
                }

                if (dtTempUsers.Rows.Count > 0)
                {
                    DefDataView = dtTempUsers.DefaultView;
                }
            }
            else
            {
                DefDataView = dsUsers.Tables[0].DefaultView;
            }
            if (!string.IsNullOrEmpty(sortExp) && DefDataView.Table != null && DefDataView.Table.Rows != null && DefDataView.Table.Rows.Count > 0)
            {
                DefDataView.Sort = sortExp;
                dtTempUsers = DefDataView.ToTable();
            }

            // Set Paging and creatwe data table
            for (int i = ((CurrentPage - 1) * Convert.ToInt32(Global.AdapUserPageSize)) + 1; i <= (CurrentPage * Convert.ToInt32(Global.AdapUserPageSize)); i++)
            {
                if (i <= dtTempUsers.Rows.Count)
                {
                    DataRow newRow = dtTempUsers.Rows[i - 1];
                    dtUsers.ImportRow(newRow);
                }
                else
                {
                    break;
                }
            }

            TableGenerator = new HTMLTableGenerator();
            TableGenerator.ShowSorting = true;
            TableGenerator.RowDisplayType = HTMLTableGenerator.DisplayType.RadioButtonType;
            RetVal = TableGenerator.GetTableHmtl(dtUsers.DefaultView.ToTable(), "NId", "AdapUser", true) + Constants.Delimiters.ParamDelimiter + CalPageCount((dtTempUsers.Rows.Count), Convert.ToInt32(Global.AdapUserPageSize));
        }

        catch (Exception ex)
        {
            Global.CreateExceptionString(ex, null);
        }
        return RetVal;
    }
Exemplo n.º 4
0
    public string GetAllUsers(string requestParam)
    {
        string RetVal = string.Empty;
        int AdapNId;
        string[] Params;
        string sortExp = "";
        HTMLTableGenerator TableGenerator;
        try
        {
            Params = Global.SplitString(requestParam, Constants.Delimiters.ParamDelimiter);
            AdapNId = int.Parse(Params[0]);
            int CurrentPage = int.Parse(Params[1]);
            if (Params.Length > 1)
            {
                sortExp = Params[3].ToString() + " " + Params[2].ToString();
            }
            DataSet dsUsers = new DataSet();
            AdaptationUsers.AdaptationUsers UserLoginService = new AdaptationUsers.AdaptationUsers();
            UserLoginService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.AdaptationUserWebService;
            dsUsers = UserLoginService.GetGlobalUsers(AdapNId);
            DataTable dtUsers = dsUsers.Tables[0].Clone();
            for (int i = ((CurrentPage - 1) * Convert.ToInt32(Global.AdapUserPageSize)) + 1; i <= (CurrentPage * Convert.ToInt32(Global.AdapUserPageSize)); i++)
            {
                if (i <= dsUsers.Tables[0].Rows.Count)
                {
                    DataRow newRow = dsUsers.Tables[0].Rows[i - 1];
                    dtUsers.ImportRow(newRow);
                }
                else
                {
                    break;
                }
            }
            if (sortExp != "")
            {
                dtUsers.DefaultView.Sort = sortExp;
            }
            TableGenerator = new HTMLTableGenerator();
            TableGenerator.ShowSorting = true;
            TableGenerator.RowDisplayType = HTMLTableGenerator.DisplayType.RadioButtonType;
            RetVal = TableGenerator.GetTableHmtl(dtUsers.DefaultView.ToTable(), "NId", "AdapUser", true) + Constants.Delimiters.ParamDelimiter + CalPageCount((dsUsers.Tables[0].Rows.Count), Convert.ToInt32(Global.AdapUserPageSize));

        }

        catch (Exception ex)
        {
            Global.CreateExceptionString(ex, null);
        }
        return RetVal;
    }
Exemplo n.º 5
0
    public string GetAllAdaptations()
    {
        string RetVal = string.Empty;
        try
        {

            AdaptationUsers.AdaptationUsers UserLoginService = new AdaptationUsers.AdaptationUsers();
            UserLoginService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.AdaptationUserWebService;
            RetVal = UserLoginService.GetAllAdaptations();
        }

        catch (Exception ex)
        {
            Global.CreateExceptionString(ex, null);
        }
        return RetVal;
    }
Exemplo n.º 6
0
    private void Frame_Message_And_Send_Mail_DPRight(string AdminUser, string AdminUserId, string UserName, string EmailId, string Language, string UserNId)
    {
        string MessageContent = string.Empty;
        string Subject = string.Empty;
        string Body = string.Empty;
        string TamplatePath = string.Empty;
        DIConnection DIConnection;
        string Country = string.Empty;

        AdaptationUsers.AdaptationUsers UserLoginService = new AdaptationUsers.AdaptationUsers();
        UserLoginService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.AdaptationUserWebService;
        if (ConfigurationManager.AppSettings[Constants.WebConfigKey.IsGlobalAllow].ToLower() == "true")
        {
            DataSet dsUsers = new DataSet();
            dsUsers = UserLoginService.GetAreaForUser(Convert.ToInt32(UserNId));
            Country = dsUsers.Tables[0].Rows[0][0].ToString();
        }
        else
        {
            DataTable dtCountryNId = null;
            string AreaNId = string.Empty;
            string Query;
            DIConnection = new DIConnection(DIServerType.MsAccess, string.Empty, string.Empty, Server.MapPath("~//stock//Database.mdb"), string.Empty, string.Empty);
            Query = "SELECT User_Country FROM Users WHERE nid = " + UserNId + ";";
            dtCountryNId = DIConnection.ExecuteDataTable(Query);
            if (dtCountryNId != null && dtCountryNId.Rows.Count > 0)
            {
                AreaNId = dtCountryNId.Rows[0]["User_Country"].ToString().Trim();
            }
            DataSet dsUsers = new DataSet();
            dsUsers = UserLoginService.GetAreaFromAreaNId(Convert.ToInt32(AreaNId));
            Country = dsUsers.Tables[0].Rows[0][0].ToString();

        }
        TamplatePath = Path.Combine(this.Page.Request.PhysicalApplicationPath, Constants.FolderName.EmailTemplates);
        TamplatePath += Language + "\\" + Constants.FileName.RequestDataProviderRights;
        MessageContent = GetEmailTamplate(TamplatePath);
        Subject = MessageContent.Split("\r\n".ToCharArray())[0].ToString();
        Subject = Subject.Replace("[^^^^]", "");
        Subject = Subject.Replace("[****]ADAPTATION_NAME[****]", Global.adaptation_name);
        Body = MessageContent.Replace(MessageContent.Split("\r\n".ToCharArray())[0], "");
        Body = Body.Replace("[****]USER_EMAILID[****]", EmailId);
        Body = Body.Replace("[****]USER_NAME[****]", UserName);
        Body = Body.Replace("[****]COUNTRY[****]", Country);
        Body = Body.Replace("[****]ADAPTATION_NAME[****]", Global.adaptation_name);
        Body = Body.Replace("[****]ADAPTATION_URL[****]", this.Page.Request.Url.AbsoluteUri.Substring(0, this.Page.Request.Url.AbsoluteUri.IndexOf("libraries")));
        this.Send_Email("WebMaster - " + Global.adaptation_name, "*****@*****.**", AdminUserId, Subject, Body, true, AdminUser);
    }