public AddFolderCommand(string listName, string folderName, SP.SPWeb web)
     : base(web)
 {
     _folderName = folderName;
     _list = _web.Lists.TryGetList(listName);
     if (_list == default(SP.SPList)) { throw new Exception(string.Format("Could not find any list with the name {0}", listName)); }
 }
 public DeleteFolderCommand(string folderUrl, SP.SPWeb web)
     : base(web)
 {
     SP.SPFolder folder = _web.GetFolder(folderUrl);
     if (!folder.Exists) { throw new Exception(string.Format("Could not find any folder with the url {0}", folder)); }
     _item = folder.Item;
 }
 public AddFolderCommand(SP.SPList list, string folderName, SP.SPWeb web)
     : base(web)
 {
     _listName = list.Title;
     _list = list;
     _folderName = folderName;
 }
 public DeleteFolderCommand(int itemID, string listName, SP.SPWeb web)
     : base(web)
 {
     SP.SPList targetList = _web.Lists.TryGetList(listName);
     if (targetList == default(SP.SPList)) { throw new Exception(string.Format("Could not find any list with the name {0}", listName)); }
     _item = targetList.GetItemByIdSelectedFields(itemID);
 }
 public AddItemCommand(SP.SPList list, string subfolder,SP.SPWeb web)
     : base(web)
 {
     _listName = list.Title;
     _list = list;
     _subfolder = subfolder;
 }
 public UpdateItemCommand(int itemID, string listName, Dictionary<string, object> properties, SP.SPWeb web)
     : base(web)
 {
     SP.SPList targetList = _web.Lists.TryGetList(listName);
     if (targetList == default(SP.SPList)) { throw new Exception(string.Format("Could not find any list with the name {0}", listName)); }
     _item = targetList.GetItemByIdSelectedFields(itemID, properties.Keys.ToArray());
     BackUpOldPropertiesValues();
 }
 public UpdateItemCommand(SP.SPListItem item, Dictionary<string, object> properties)
     : base()
 {
     _web = item.Web;
     _item = item;
     _newPropertiesValues = properties;
     BackUpOldPropertiesValues();
 }
 public UpdateFolderCommand(string folderUrl, Dictionary<string, object> properties, SP.SPWeb web)
     : base(web)
 {
     SP.SPFolder folder = _web.GetFolder(folderUrl);
     if (!folder.Exists) { throw new Exception(string.Format("Could not find any folder with the url {0}", folder)); }
     _item = folder.Item;
     BackUpOldPropertiesValues();
 }
 public UpdateFolderCommand(SP.SPFolder folder, Dictionary<string, object> properties)
     : base()
 {
     _web = folder.ParentWeb;
     _item = folder.Item;
     _newPropertiesValues = properties;
     BackUpOldPropertiesValues();
 }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                var pattern1 = new[] { "~|~" };
                var pattern2 = new[] { "*|*" };

                string contactListStr = this.hdnContactList.Value;
                string recommendationListStr = this.hdnRecommendationList.Value;

                var contactList = this.GetFormattedContacts(contactListStr, pattern1, pattern2);
                var recommendationList = this.GetFormattedRecommendations(recommendationListStr, pattern1, pattern2);

                bool isSaved = false;
                if (contactList != null && recommendationList != null)
                {
                    if (!String.IsNullOrEmpty(this.hdnMSAId.Value))
                    {
                        isSaved = SaveMSADetails(contactList, recommendationList, false, pattern1, pattern2, Convert.ToInt32(this.hdnMSAId.Value));
                    }
                    else
                    {
                        isSaved = SaveMSADetails(contactList, recommendationList, false, pattern1, pattern2);
                    }
                }

                if (isSaved)
                {
                    string redirectUrl = Utility.GetRedirectUrl("MSAForm_Save_Redirect");

                    if (!String.IsNullOrEmpty(redirectUrl))
                    {
                        DisableControls();
                        Page.Response.Redirect(redirectUrl, false);
                    }
                }
                else
                {
                    if (String.IsNullOrEmpty(message_div.InnerHtml.Replace("\r", " ").Replace("\n", " ").Trim()))
                    {
                        message_div.InnerHtml = "Operation Save Failed. Kindly verify that you provide valid information.";
                        DisableControls();
                    }
                }
            }
            catch (Exception ex)
            {
                SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory("SL.FG.FFL(MSAForm->btnSave_Click)", TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, ex.Message, ex.StackTrace);

                message_div.InnerHtml = "Something went wrong!!! Please Contact the administrator.";
                DisableControls();
            }
        }
 public DeleteFolderCommand(SP.SPListItem item)
     : base()
 {
     _web = item.Web;
     _item = item;
 }
Example #12
0
        public static List<string> GetFormattedDataList(string data, string pattern, bool isSorted)
        {
            List<string> lstData = null;

            try
            {
                var tempPattern = new[] { pattern };

                if (!String.IsNullOrEmpty(data) && !String.IsNullOrEmpty(pattern))
                {
                    lstData = new List<string>();

                    var tempData = data.Split(tempPattern, StringSplitOptions.None);

                    if (tempData.Length > 0 && isSorted == false)
                    {
                        var tempDataReverse = tempData.Reverse();

                        foreach (var item in tempDataReverse)
                        {
                            if (!String.IsNullOrEmpty(item))
                            {
                                lstData.Add(item);
                            }
                        }
                    }
                    else
                    {
                        foreach (var item in tempData)
                        {
                            if (!String.IsNullOrEmpty(item))
                            {
                                lstData.Add(item);
                            }
                        }
                    }
                }

            }
            catch (Exception ex)
            {
                SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory("SL.FG.FFL(Utility->GetFormattedDataList)", TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, ex.Message, ex.StackTrace);
            }
            return lstData;
        }
 public AddItemCommand(SP.SPList list, SP.SPWeb web)
     : base(web)
 {
     _listName = list.Title;
     _list = list;
 }