示例#1
0
    private static string GetUserEmailByAdaptationUrl(string requestParam)
    {
        string RetVal;
        string[] Params, UserDetails;
        DataTable DtUser;
        string UserNId, UserEmailId;
        diworldwide_userinfo.UserLoginInformation Service;

        try
        {
            RetVal = string.Empty;
            Params = Global.SplitString(requestParam, Constants.Delimiters.ParamDelimiter);
            UserNId = Params[0].ToString().Trim();
            Service = new diworldwide_userinfo.UserLoginInformation();
            Service.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.UserLoginService;

            if (ConfigurationManager.AppSettings[Constants.WebConfigKey.IsGlobalAllow].ToLower() == "true")
            {
                RetVal = Service.GetUserDetails(UserNId, Global.GetAdaptationGUID());
                if (!string.IsNullOrEmpty(RetVal))
                {
                    UserDetails = RetVal.Split(new string[] { Constants.Delimiters.ParamDelimiter }, StringSplitOptions.None);
                    UserEmailId = UserDetails[0];
                    RetVal = UserEmailId;
                }
            }
            else
            {
                DtUser = Get_User(Convert.ToInt32(UserNId));

                if (DtUser != null && DtUser.Rows.Count > 0)
                {
                    RetVal = DtUser.Rows[0]["User_Email_id"].ToString();
                }
            }
        }
        catch (Exception ex)
        {
            Global.CreateExceptionString(ex, null);
            RetVal = ex.Message;
        }
        finally
        {
        }

        return RetVal;
    }
示例#2
0
    /// <summary>
    /// Is user admin
    /// </summary>
    /// <param name="usernid">user nid</param>
    /// <returns>true if user is admin else false</returns>    
    private bool isUserAdmin(string usernid)
    {
        bool isAdmin = false;
        string Query = string.Empty;
        DataTable dtUsers = null;
        DIConnection DIConnection = null;
        diworldwide_userinfo.UserLoginInformation Service;

        if (ConfigurationManager.AppSettings[Constants.WebConfigKey.IsGlobalAllow].ToLower() == "true")
        {
            Service = new diworldwide_userinfo.UserLoginInformation();
            Service.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.UserLoginService;
            isAdmin = Service.IsUserAdmin(usernid, Global.GetAdaptationGUID());
        }
        else
        {
            DIConnection = new DIConnection(DIServerType.MsAccess, string.Empty, string.Empty, Server.MapPath("~//stock//Database.mdb"),
                          string.Empty, string.Empty);
            Query = "Select user_is_admin from Users where nid =" + usernid + ";";
            dtUsers = DIConnection.ExecuteDataTable(Query);
            if (dtUsers.Rows.Count > 0)
            {
                if (dtUsers.Rows[0][0].ToString().ToLower() == "true")
                {
                    isAdmin = true;
                }
            }
        }

        return isAdmin;
    }
示例#3
0
    private static string GetUserDetails(string requestParam)
    {
        string RetVal;
        string[] Params, UserDetails;
        DataTable DtUser;
        string UserNId, UserEmailId, UserPwd, UserFirstName, UserLastName, AreaNid, IsProvider, IsAdmin;
        diworldwide_userinfo.UserLoginInformation Service;

        try
        {
            RetVal = string.Empty;
            Params = Global.SplitString(requestParam, Constants.Delimiters.ParamDelimiter);
            UserNId = Params[0].ToString().Trim();
            Service = new diworldwide_userinfo.UserLoginInformation();
            Service.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.UserLoginService;
            if (ConfigurationManager.AppSettings[Constants.WebConfigKey.IsGlobalAllow].ToLower() == "true")
            {
                RetVal = Service.GetUserDetails(UserNId, Global.GetAdaptationGUID());
                if (!string.IsNullOrEmpty(RetVal))
                {
                    UserDetails = RetVal.Split(new string[] { Constants.Delimiters.ParamDelimiter }, StringSplitOptions.None);
                    UserEmailId = UserDetails[0];
                    UserPwd = UserDetails[1];
                    UserFirstName = UserDetails[2];
                    UserLastName = UserDetails[3];
                    AreaNid = UserDetails[4];
                    IsProvider = UserDetails[5];
                    IsAdmin = UserDetails[6];
                    RetVal = UserEmailId + Constants.Delimiters.ParamDelimiter + UserPwd + Constants.Delimiters.ParamDelimiter +
                    UserFirstName + Constants.Delimiters.ParamDelimiter + UserLastName + Constants.Delimiters.ParamDelimiter + AreaNid + Constants.Delimiters.ParamDelimiter + IsProvider + Constants.Delimiters.ParamDelimiter + IsAdmin;
                }
            }
            else
            {
                DtUser = Get_User(Convert.ToInt32(UserNId));

                if (DtUser != null && DtUser.Rows.Count > 0)
                {
                    RetVal = DtUser.Rows[0]["User_Email_id"].ToString() + Constants.Delimiters.ParamDelimiter + DtUser.Rows[0]["User_Password"].ToString() + Constants.Delimiters.ParamDelimiter + DtUser.Rows[0]["User_First_Name"].ToString() + Constants.Delimiters.ParamDelimiter + DtUser.Rows[0]["User_Last_Name"].ToString() + Constants.Delimiters.ParamDelimiter + DtUser.Rows[0]["User_Country"].ToString() + Constants.Delimiters.ParamDelimiter + DtUser.Rows[0]["User_Is_Provider"].ToString() + Constants.Delimiters.ParamDelimiter + DtUser.Rows[0]["User_Is_Admin"].ToString();
                }
            }
        }
        catch (Exception ex)
        {
            Global.CreateExceptionString(ex, null);
            RetVal = ex.Message;
        }
        finally
        {
        }

        return RetVal;
    }
示例#4
0
    public static bool isMasterAccount(string usernid)
    {
        bool isAdmin = false;
        string Query = string.Empty;
        diworldwide_userinfo.UserLoginInformation Service;

        if (ConfigurationManager.AppSettings[Constants.WebConfigKey.IsGlobalAllow].ToLower() == "true")
        {
            Service = new diworldwide_userinfo.UserLoginInformation();
            Service.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.UserLoginService;
            isAdmin = Service.IsMasterAccount(usernid);
        }
        return isAdmin;
    }
示例#5
0
    public string GetAllUsersHTMLForAdmin()
    {
        string RetVal;
        int Counter;
        diworldwide_userinfo.UserLoginInformation Service;
        DIConnection DIConnection = null;
        DataTable DtUsers = null;

        RetVal = string.Empty;
        Counter = 0;

        try
        {
            if (ConfigurationManager.AppSettings[Constants.WebConfigKey.IsGlobalAllow].ToLower() == "true")
            {
                Service = new diworldwide_userinfo.UserLoginInformation();
                Service.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.UserLoginService;
                DtUsers = Service.GetAllUsersGridHTML(Global.GetAdaptationGUID());
            }
            else
            {
                DIConnection = new DIConnection(DIServerType.MsAccess, string.Empty, string.Empty, Server.MapPath("~//stock//Database.mdb"),
                          string.Empty, string.Empty);

                DtUsers = DIConnection.ExecuteDataTable("SELECT NId, User_Email_Id as Email, User_First_Name as [First Name], User_Country as [User Country], User_Is_Admin as [Admin User], User_Is_Provider as [Provider User] FROM Users Where User_Is_Admin = 'False'");
            }

            DtUsers = this.Replace_AreaNIds_With_Names(DtUsers);

            RetVal = "<table id=\"tblUsers\" style=\"width:100%;float:left\" border=\"0\" cellSpacing=\"0\" cellPadding=\"0\" class=\"roundedcorners\">";
            RetVal += "<tbody>";

            RetVal += "<tr class=\"HeaderRowStyle\">";

            RetVal += "<td class=\"HeaderColumnStyle\"><span id=\"spanEmail\"></span></td>";
            RetVal += "<td class=\"HeaderColumnStyle\"><span id=\"spanName\"></span></td>";
            RetVal += "<td class=\"HeaderColumnStyle\"><span id=\"spanCountry\"></span></td>";
            RetVal += "<td class=\"HeaderColumnStyle\"><span id=\"spanProvider\"></span></td>";

            RetVal += "</tr>";

            foreach (DataRow DrUsers in DtUsers.Rows)
            {
                Counter++;

                if (Counter % 2 == 0)
                {
                    RetVal += "<tr class=\"SelectedDataRowStyle\">";
                }
                else
                {
                    RetVal += "<tr class=\"DataRowStyle\">";
                }

                RetVal += "<td class=\"DataColumnStyle\">" + DrUsers["Email"].ToString() + "</td>";
                RetVal += "<td class=\"DataColumnStyle\">" + DrUsers["First Name"].ToString() + "</td>";
                RetVal += "<td class=\"DataColumnStyle\">" + DrUsers["User Country"].ToString() + "</td>";

                if (DrUsers["Provider User"].ToString().ToLower() == "true")
                {
                    RetVal += "<td class=\"CheckBoxDataColumnStyle\"><input type=\"checkbox\" id=\"chkUser_" + DrUsers["NId"].ToString() + "\" value=\"" + DrUsers["NId"].ToString() + "\" checked=\"checked\"/></td>";
                }
                else
                {
                    RetVal += "<td class=\"CheckBoxDataColumnStyle\"><input type=\"checkbox\" id=\"chkUser_" + DrUsers["NId"].ToString() + "\" value=\"" + DrUsers["NId"].ToString() + "\"/></td>";
                }

                RetVal += "</tr>";
            }

            RetVal += "</tbody>";
            RetVal += "</table>";
        }
        catch (Exception ex)
        {
            Global.CreateExceptionString(ex, null);
            throw ex;
        }
        finally
        {
        }

        return RetVal;
    }
示例#6
0
    private string Get_AdminNId()
    {
        string RetVal;
        diworldwide_userinfo.UserLoginInformation Service;
        DIConnection DIConnection;
        DataTable DtAdmin;

        RetVal = string.Empty;
        Service = null;
        DIConnection = null;
        DtAdmin = null;

        try
        {
            if (ConfigurationManager.AppSettings[Constants.WebConfigKey.IsGlobalAllow].ToLower() == "true")
            {
                Service = new diworldwide_userinfo.UserLoginInformation();
                Service.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.UserLoginService;
                RetVal = Service.GetAdminNid(Global.GetAdaptationGUID());
            }
            else
            {
                DIConnection = new DIConnection(DIServerType.MsAccess, string.Empty, string.Empty, Server.MapPath("~//stock//Database.mdb"), string.Empty, string.Empty);
                DtAdmin = DIConnection.ExecuteDataTable("SELECT NId FROM Users WHERE User_Is_Admin = 'True'");

                if (DtAdmin != null && DtAdmin.Rows.Count > 0)
                {
                    RetVal = DtAdmin.Rows[0]["NId"].ToString().Trim();
                }
            }
        }
        catch (Exception ex)
        {
            Global.CreateExceptionString(ex, null);

            throw ex;
        }
        finally
        {
        }

        return RetVal;
    }
示例#7
0
    public string BindDataProviders(string requestParam)
    {
        string RetVal;
        DIConnection DIConnection;
        int NoOfDPs;
        StringBuilder sb;
        string PAPath = string.Empty;
        string PAViewPath = string.Empty;
        DataTable dt = new DataTable();
        bool IsAdminUploadedDSD;
        SDMXApi_2_0.Message.StructureType SummaryStructureFor2_0 = new SDMXApi_2_0.Message.StructureType();
        SDMXObjectModel.Message.StructureType SummaryStructureFor2_1 = new SDMXObjectModel.Message.StructureType();
        Dictionary<string, bool> DictColumns;

        DataTable DtDFD;
        DataTable DtMFDs;
        string Query = string.Empty;
        string DFDPath = string.Empty;
        string MFDPath = string.Empty;

        DIConnection = null;
        RetVal = string.Empty;
        string hdbnid = string.Empty;
        string hlngcodedb = string.Empty;
        string hlngcode = string.Empty;
        string[] Params = Global.SplitString(requestParam, Constants.Delimiters.ParamDelimiter);
        int i;

        hdbnid = Params[0];
        hlngcodedb = Params[1];
        hlngcode = Params[2];
        IsAdminUploadedDSD = false;

        try
        {
            DIConnection = new DIConnection(DIServerType.MsAccess, string.Empty, string.Empty, Server.MapPath("~//stock//Database.mdb"),
                        string.Empty, string.Empty);
            Query = "SELECT * FROM Artefacts WHERE DBNId = " + Convert.ToInt32(hdbnid) + " AND Type=4;";
            DtDFD = DIConnection.ExecuteDataTable(Query);

            Query = "SELECT * FROM Artefacts WHERE DBNId = " + Convert.ToInt32(hdbnid) + " AND Type=16;";
            DtMFDs = DIConnection.ExecuteDataTable(Query);

            IsAdminUploadedDSD = Global.IsDSDUploadedFromAdmin(Convert.ToInt32(hdbnid));

            if (IsAdminUploadedDSD == false)
            {
                SummaryStructureFor2_1 = (SDMXObjectModel.Message.StructureType)SDMXObjectModel.Deserializer.LoadFromFile(typeof(SDMXObjectModel.Message.StructureType), Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, Constants.FolderName.Data + hdbnid + "\\sdmx\\Summary" + DevInfo.Lib.DI_LibSDMX.Constants.XmlExtension));

            }

            sb = new StringBuilder();
            sb.Append(GetlanguageBasedValueOfKey("langFirstName", hlngcode, "RegProviders.xml"));
            sb.Append("~");
            sb.Append(GetlanguageBasedValueOfKey("langLastName", hlngcode, "RegProviders.xml"));
            sb.Append("~");
            sb.Append(GetlanguageBasedValueOfKey("langCountry", hlngcode, "RegProviders.xml"));
            sb.Append("~");
            sb.Append(GetlanguageBasedValueOfKey("langEmail", hlngcode, "RegProviders.xml"));
            sb.Append("~");

            DictColumns = new Dictionary<string, bool>();
            if (IsAdminUploadedDSD == true)
            {

                if (DtDFD != null && DtDFD.Rows.Count > 0)
                {
                    DFDPath = DtDFD.Rows[0]["FileLocation"].ToString();
                    SDMXObjectModel.Message.StructureType DFD = new SDMXObjectModel.Message.StructureType();
                    DFD = (SDMXObjectModel.Message.StructureType)Deserializer.LoadFromFile(typeof(SDMXObjectModel.Message.StructureType), DFDPath);
                    DictColumns.Add(DFD.Structures.Dataflows[0].id, false);
                    sb.Append(GetlanguageBasedValueOfKey("langProvisionAgreementFor", hlngcode, "RegProviders.xml") + GetLangSpecificValue_For_Version_2_1(DFD.Structures.Dataflows[0].Name, hlngcodedb));
                    sb.Append("~");

                }

                if (DtMFDs != null && DtMFDs.Rows.Count > 0)
                {
                    for (i = 0; i < DtMFDs.Rows.Count; i++)
                    {
                        MFDPath = DtMFDs.Rows[i]["FileLocation"].ToString();
                        SDMXObjectModel.Message.StructureType MFD = new SDMXObjectModel.Message.StructureType();
                        MFD = (SDMXObjectModel.Message.StructureType)Deserializer.LoadFromFile(typeof(SDMXObjectModel.Message.StructureType), MFDPath);
                        DictColumns.Add(MFD.Structures.Metadataflows[i].id, false);
                        sb.Append(GetlanguageBasedValueOfKey("langProvisionAgreementFor", hlngcode, "RegProviders.xml") + GetLangSpecificValue_For_Version_2_1(MFD.Structures.Metadataflows[i].Name, hlngcodedb));
                        sb.Append("~");
                    }
                }

            }
            else
            {
                foreach (SDMXObjectModel.Structure.DataflowType DFD in SummaryStructureFor2_1.Structures.Dataflows)
                {
                    DictColumns.Add(DFD.id, false);
                    sb.Append(GetlanguageBasedValueOfKey("langProvisionAgreementFor", hlngcode, "RegProviders.xml") + GetLangSpecificValue_For_Version_2_1(DFD.Name, hlngcodedb));
                    sb.Append("~");
                }

                foreach (SDMXObjectModel.Structure.MetadataflowType MFD in SummaryStructureFor2_1.Structures.Metadataflows)
                {
                    DictColumns.Add(MFD.id, true);
                    sb.Append(GetlanguageBasedValueOfKey("langProvisionAgreementFor", hlngcode, "RegProviders.xml") + GetLangSpecificValue_For_Version_2_1(MFD.Name, hlngcodedb));
                    sb.Append("~");
                }

            }

            sb.Remove(sb.Length - 1, 1);
            sb.Append(Constants.Delimiters.ParamDelimiter);

            if (ConfigurationManager.AppSettings[Constants.WebConfigKey.IsGlobalAllow].ToLower() == "true")
            {
                diworldwide_userinfo.UserLoginInformation Service = new diworldwide_userinfo.UserLoginInformation();
                Service.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.UserLoginService;
                dt = Service.GetAllDataProviders(Global.GetAdaptationGUID());
            }
            else
            {
                Query = "Select NId,User_First_Name,User_Last_Name,User_Country as [User Country],User_Email_Id from Users where User_Is_Provider='True';";
                dt = DIConnection.ExecuteDataTable(Query);
            }

            dt = this.Replace_AreaNIds_With_Names(dt);

            NoOfDPs = dt.Rows.Count;

            // Binding Data Providers
            for (i = 0; i < NoOfDPs; i++)
            {
                if (Global.Is_Already_Existing_Provider(dt.Rows[i]["NId"].ToString()))
                {
                    sb.Append("" + dt.Rows[i]["User_First_Name"] + "");
                    sb.Append("~");
                    sb.Append("" + dt.Rows[i]["User_Last_Name"] + "");
                    sb.Append("~");
                    sb.Append("" + dt.Rows[i]["User Country"] + "");
                    sb.Append("~");
                    sb.Append("" + dt.Rows[i]["User_Email_Id"] + "");
                    sb.Append("~");

                    foreach (string Id in DictColumns.Keys)
                    {
                        PAPath = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, Constants.FolderName.Data + hdbnid + "\\sdmx\\Provisioning Metadata\\PAs\\" + "PA_" + dt.Rows[i]["NId"] + "_" + Id + DevInfo.Lib.DI_LibSDMX.Constants.XmlExtension);
                        PAViewPath = "../../" + PAPath.Substring(PAPath.LastIndexOf("stock")).Replace("\\", "/");

                        sb.Append("<a href=\" " + PAViewPath + "\"  ");
                        sb.Append(" target=\"_blank\" name=\"lang_View\"></a> | ");
                        sb.Append("<a href='Download.aspx?fileId=" + PAPath + "' name=\"lang_Download\"></a>");
                        sb.Append("~");
                    }

                    sb.Remove(sb.Length - 1, 1);

                    sb.Append(Constants.Delimiters.PivotRowDelimiter);
                }
            }

            sb.Remove(sb.Length - 1, 1);

            RetVal = sb.ToString();
        }
        catch (Exception ex)
        {
            Global.CreateExceptionString(ex, null);
            throw ex;

        }
        finally
        {
            if (DIConnection != null)
            {
                DIConnection.Dispose();
            }
        }

        return RetVal;
    }