Sunday, 16 September 2012

Content Editor DL


public class ContentEditorDL

    {

        #region Update Propeller

        public static bool update(ContentEditorBL contBL)

        {

            bool update = false;

            SPSecurity.RunWithElevatedPrivileges(delegate()

            {

                using (VCSBINTRANETDataContext context = new VCSBINTRANETDataContext(SiteHelper.SiteUrl))

                {

                    var itemUpdate = (from r in context.PropellerStudioCE

                                      where r.Id == Convert.ToInt32(contBL.ID)

                                      select r).First();

 

                    itemUpdate.Description = contBL.Desc;

 

                    context.SubmitChanges();

                    update = true;

                }

            });

            return update;

        }

 

      # endregion

# region GetAllListItem

        public static object GetAllListItem(ContentEditorBL conBL)

        {

            string oDesc = null;

            SPSecurity.RunWithElevatedPrivileges(delegate()

            {

 

                SPSite spsite = SPContext.Current.Site;

                SPWeb spWeb = spsite.OpenWeb();

                SPList spList = spWeb.Lists["PropellerStudioCE"];

                SPListItemCollection spListItems = spList.Items;

 

 

                foreach (SPListItem ospListItemCourse in spListItems)

                {

                    oDesc = ospListItemCourse["Description"].ToString();

 

                }

 

            });

            if (oDesc != null)

            {

 

                return conBL.Desc = oDesc;

            }

            else

            {

 

                return conBL.Desc = "There is no item to show.";

 

            }

        }

        # endregion

#region GetSingleRowListItem

        public static System.Data.DataTable GetSingleRowListItem(ContentEditorBL conBL)

        {

 

            DataTable dt = new DataTable();

            //dt.Columns.Add("ID");

 

            dt.Columns.Add("Description");

 

 

            DataRow row;

            SPSecurity.RunWithElevatedPrivileges(delegate()

            {

 

                using (VCSBINTRANETDataContext context = new VCSBINTRANETDataContext(SiteHelper.SiteUrl))

                {

                    var quer = from PropeelerStudioCE in context.PropellerStudioCE

                               select PropeelerStudioCE;

 

                    if (quer != null)

                    {

                        foreach (PropellerStudioCEItem item in quer)

                        {

 

                            conBL.ID = Convert.ToInt32(item.Id);

                            conBL.Desc = Convert.ToString(item.Description);

                        }

                    }

                }

            });

            return dt;

 

        }

        #endregion

}

No comments:

Post a Comment

SharePoint online - Get List-item attachments and Display to div

Step 1 : Create a List ex: TestList and attach few images Step 2 : Copy and Pastet the below coding in App.js var  Items =  null ; ...