Ejemplo n.º 1
0
 /// <summary>
 /// Updates the list item.
 /// </summary>
 /// <param name="listValues">The list values.</param>
 /// <param name="listName">Name of the list.</param>
 public string UpdateListItem(Dictionary<string, string> listValues, string listName)
 {
     Common objCommon = null;
     try
     {
         objCommon = new Common();
         return objCommon.UpdateListItem(listValues, listName);
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Reads the XML file from share point.
 /// </summary>
 /// <param name="currentSiteUrl">The current site URL.</param>
 /// <param name="listName">Name of the list.</param>
 /// <param name="query">The query.</param>
 /// <returns></returns>
 public XmlDocument ReadXmlFileFromSharePoint(string currentSiteUrl, string listName, string query)
 {
     Common objCommon = null;
     try
     {
         objCommon = new Common();
         return objCommon.ReadXmlFileFromSharePoint(currentSiteUrl, listName, query);
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Saves the date format.
 /// </summary>
 /// <param name="key">The key.</param>
 /// <param name="value">The value.</param>
 public void SaveDateFormat(string key, string value, Dictionary<string, string> configItems)
 {
     Common objCommon = null;
     try
     {
         objCommon = new Common();
         objCommon.SaveDateFormat(key, value, configItems);
     }
     catch(Exception)
     {
         throw;
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Reads the list.
 /// </summary>
 /// <param name="parentSiteUrl">The parent site URL.</param>
 /// <param name="listName">Name of the list.</param>
 /// <param name="queryString">The query string.</param>
 /// <param name="viewFields">The view fields.</param>
 /// <returns></returns>
 public DataTable ReadList(String parentSiteUrl, String listName, String queryString, string viewFields)
 {
     DataTable objDataTable = null;
     Common objCommon = null;
     try
     {
         objDataTable = new DataTable();
         objCommon = new Common();
         //Reads the sharepoint List
         if(queryString.Length == 0)
         {
             objDataTable = objCommon.ReadList(parentSiteUrl, listName);
         }
         else
         {
             objDataTable = objCommon.ReadList(parentSiteUrl, listName, queryString, viewFields);
         }
     }
     catch(Exception)
     {
         throw;
     }
     finally
     {
         if(objDataTable != null)
             objDataTable.Dispose();
     }
     return objDataTable;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Deletes the list item.
 /// </summary>
 /// <param name="listName">Name of the list.</param>
 /// <param name="itemId">The item id.</param>
 public void DeleteListItem(string listName, string itemId)
 {
     Common objCommon = null;
     try
     {
         objCommon = new Common();
         objCommon.DeleteListItem(listName, itemId);
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Determines whether [is request exist] [the specified parent site URL].
        /// </summary>
        /// <param name="parentSiteURL">The parent site URL.</param>
        /// <param name="strUserID">The STR user ID.</param>
        /// <returns>
        /// 	<c>true</c> if [is request exist] [the specified parent site URL]; otherwise, <c>false</c>.
        /// </returns>
        public bool IsRequestExist(string parentSiteURL, string userID)
        {
            DataTable objListData = null;
            string strCamlQuery = string.Empty;
            Common objCommon = null;
            try
            {
                objCommon = new Common();
                strCamlQuery = "<OrderBy><FieldRef Name=\"LinkTitleNoMenu\" /></OrderBy><Where><And><Eq><FieldRef Name=\"LinkTitle\" /><Value Type=\"Computed\">" + userID + "</Value></Eq><Eq><FieldRef Name=\"Access_x0020_Approval_x0020_Stat\" /><Value Type=\"Choice\">Approved</Value></Eq></And></Where>";
                objListData = objCommon.ReadList(parentSiteURL, "User Access Request", strCamlQuery);

                if(objListData.Rows.Count > 0)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch(Exception)
            {
                throw;
            }
            finally
            {
                if(objListData != null)
                    objListData.Dispose();
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Reads the list.
 /// </summary>
 /// <param name="parentSiteUrl">The parent site URL.</param>
 /// <param name="listName">Name of the list.</param>
 /// <param name="queryString">The query string.</param>
 /// <returns>Gives the filtered row of a list</returns>
 public DataTable ReadFolderList(String parentSiteUrl, String listName, String queryString)
 {
     DataTable objDataTable = null;
     Common objCommon = null;
     try
     {
         objDataTable = new DataTable();
         objCommon = new Common();
         //Reads the sharepoint List
         if(queryString.Length == 0)
         {
             objDataTable = objCommon.ReadFolderList(parentSiteUrl, listName, queryString);
         }
         else
         {
             objDataTable = objCommon.ReadFolderList(parentSiteUrl, listName, queryString);
         }
     }
     catch(Exception)
     {
         throw;
     }
     return objDataTable;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Gets the XSL template.
 /// </summary>
 /// <param name="strType">type</param>
 /// <param name="strParentSiteUrl">parent site url.</param>
 /// <returns></returns>
 public XmlTextReader GetXSLTemplate(string type, string parentSiteUrl)
 {
     XmlTextReader objXmlTextReader = null;
     Common objCommon = null;
     try
     {
         objCommon = new Common();
         //Get the XSLTemplate from sharepoint list
         objXmlTextReader = objCommon.GetXSLTemplate(type, parentSiteUrl);
     }
     catch(Exception)
     {
         throw;
     }
     return objXmlTextReader;
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Gets the userpreferences value.
        /// </summary>
        /// <returns></returns>
        public UserPreferences GetUserPreferencesValue(string userID, string parentSiteURL)
        {
            Common objCommon = null;
            UserPreferences objPreferences = null;
            UserPreferenceHandler objUserPreferenceHandler = null;
            DataTable objDefaultPreferences = null;
            try
            {
                objCommon = new Common();
                objPreferences = new UserPreferences();
                objUserPreferenceHandler = new UserPreferenceHandler();

                objPreferences = objUserPreferenceHandler.GetUserPreferences(userID);
                if(objPreferences != null)
                {
                    return objPreferences;
                }
                else
                {
                    //Read 'Default Preferences' list and set to the object
                    objDefaultPreferences = new DataTable();
                    objPreferences = new UserPreferences();
                    objDefaultPreferences = objCommon.ReadList(parentSiteURL, DEFAULTPREFERENCESLIST);
                    foreach(DataRow objDataRow in objDefaultPreferences.Rows)
                    {
                        if(string.Equals(objDataRow["Title"].ToString(), "Display"))
                        {
                            objPreferences.Display = objDataRow["Default_x0020_Value"].ToString();
                        }
                        else if(string.Equals(objDataRow["Title"].ToString(), "DepthUnits"))
                        {
                            objPreferences.DepthUnits = objDataRow["Default_x0020_Value"].ToString();
                        }
                        else if(string.Equals(objDataRow["Title"].ToString(), "RecordsPerPage"))
                        {
                            objPreferences.RecordsPerPage = objDataRow["Default_x0020_Value"].ToString();
                        }
                    }
                    return objPreferences;
                }
            }
            catch(Exception)
            {
                throw;
            }
            finally
            {
                if(objDefaultPreferences != null)
                    objDefaultPreferences.Dispose();
            }
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Gets the chached list items.
 /// </summary>
 /// <param name="currentSiteUrl">The current site URL.</param>
 /// <param name="listName">Name of the list.</param>
 /// <param name="spQuery">The sp query.</param>
 /// <returns></returns>
 public SiteMapNodeCollection GetChachedListItems(string currentSiteUrl, string listName, SPQuery spQuery)
 {
     Common objCommon = new Common();
     return objCommon.GetChachedListItems(currentSiteUrl, listName, spQuery);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Deletes the file.
 /// </summary>
 /// <param name="currentSiteUrl">The current site URL.</param>
 /// <param name="docLibName">Name of the doc lib.</param>
 /// <param name="fileName">Name of the file.</param>
 /// <returns></returns>
 public bool DeleteXMLFile(string currentSiteUrl, string docLibName, string fileName)
 {
     Common objCommon = new Common();
     return objCommon.DeleteXMLFile(currentSiteUrl, docLibName, fileName);
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Determines whether the logged in user is a valid user or not.
        /// </summary>
        /// <param name="parentSiteURL">The parent site URL.</param>
        /// <param name="strUserID">Logged in userID.</param>
        /// <returns>
        /// 	<c>true</c> if the logged in user is a valid User; otherwise, <c>false</c>.
        /// </returns>
        public bool IsValidUser(string parentSiteURL, string userID)
        {
            #region Method Variables
            string strCompanyCode = string.Empty;
            string strCountryCode = string.Empty;
            string[] arrUserDetails = new string[2];
            string strCAMLQuery = string.Empty;
            string strCompanyCountryCode = string.Empty;
            bool blnStatus = false;

            DataTable objListData = null;
            DataTable objCompanyList = null;
            Common objCommon = null;
            #endregion
            try
            {
                objListData = new DataTable();
                objCompanyList = new DataTable();
                objCommon = new Common();

                userID = objUtility.GetUserName();
                try
                {
                    strCompanyCountryCode = objADService.GetCompanyCountryCode(userID).ToString();
                    if (strCompanyCountryCode.Length > 0)
                        arrUserDetails = strCompanyCountryCode.Split('|');
                    else
                        arrUserDetails = null;
                }
                catch (Exception Ex)
                {
                    CommonUtility.HandleException(HttpContext.Current.Request.Url.ToString(), Ex, 5);
                }
                if (arrUserDetails != null)
                {
                    if (arrUserDetails[0] != null)
                        strCountryCode = arrUserDetails[0];
                    if (arrUserDetails[1] != null)
                        strCompanyCode = arrUserDetails[1];

                    strCAMLQuery = "<OrderBy><FieldRef Name=\"Title\" /></OrderBy><Where><Eq>"
                                      + "<FieldRef Name=\"Title\" /><Value Type=\"Text\">" + strCountryCode
                                      + "</Value></Eq></Where>";
                    objListData = objCommon.ReadList(parentSiteURL, COUNTRYCODELIST, strCAMLQuery);

                    strCAMLQuery = "<OrderBy><FieldRef Name=\"Title\" /></OrderBy><Where><Eq>"
                                      + "<FieldRef Name=\"Title\"/><Value Type=\"Text\">" + strCompanyCode
                                      + "</Value></Eq></Where>";
                    objCompanyList = objCommon.ReadList(parentSiteURL, COMPANYCODELIST, strCAMLQuery);

                    //if both the Country & Company code of logged in user's exist in SP list..
                    if ((objListData.Rows.Count > 0) && (objCompanyList.Rows.Count > 0))
                    {
                        blnStatus = true;
                    }
                    else
                    {
                        objListData.Clear();
                        strCAMLQuery = "<OrderBy><FieldRef Name=\"Title\" /></OrderBy><Where><And><And><Eq>"
                                          + "<FieldRef Name=\"Active\" /><Value Type=\"Text\">Yes</Value></Eq>"
                                          + "<Eq><FieldRef Name=\"Title\" /><Value Type=\"Text\">"
                                          + userID + "</Value></Eq></And><Eq><FieldRef Name=\"Access_x0020_Approval_x0020_Stat\" /><Value Type=\"Choice\">Approved</Value></Eq></And></Where>";

                        objListData = objCommon.ReadList(parentSiteURL, USERACCESSREQUESTLIST, strCAMLQuery);
                        if (objListData.Rows.Count > 0)
                        {
                            blnStatus = true;
                        }
                        else
                        {
                            blnStatus = false;
                        }
                    }
                }
                else
                {
                    objListData.Clear();
                    strCAMLQuery = "<OrderBy><FieldRef Name=\"Title\" /></OrderBy><Where><And><And><Eq>"
                                      + "<FieldRef Name=\"Active\" /><Value Type=\"Text\">Yes</Value></Eq>"
                                      + "<Eq><FieldRef Name=\"Title\" /><Value Type=\"Text\">"
                                      + userID + "</Value></Eq></And><Eq><FieldRef Name=\"Access_x0020_Approval_x0020_Stat\" /><Value Type=\"Choice\">Approved</Value></Eq></And></Where>";

                    objListData = objCommon.ReadList(parentSiteURL, USERACCESSREQUESTLIST, strCAMLQuery);
                    if (objListData.Rows.Count > 0)
                    {
                        blnStatus = true;
                    }
                    else
                    {
                        blnStatus = false;
                    }
                }
                return blnStatus;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (objListData != null)
                    objListData.Dispose();
                if (objCompanyList != null)
                    objCompanyList.Dispose();
            }
        }