コード例 #1
0
ファイル: CMSHelper.cs プロジェクト: SDRC-India/sdrcdevinfo
    /// <summary>
    /// This methods check in database if tag exist, then returns tag Nid
    /// else add tag to database and return Nid of Newly created tag 
    /// </summary>
    /// <param name="Tag">Input Tag name</param>
    /// <returns>Tag NId</returns>
    public int CreateAndGetTagNid(string Tag)
    {
        CMSHelper ObjCMSHelper = new CMSHelper();
        string ResultNid = string.Empty;
        int RetVal = 0;
        string DBConnectionStatusMessage = string.Empty;
        List<System.Data.Common.DbParameter> DbParams = null;
        DIConnection ObjDIConnection = null;
        int MaxTagId = -1;
        try
        {

            // Call method to get connection object
            ObjDIConnection = ObjCMSHelper.GetConnectionObject(out DBConnectionStatusMessage);
            // Check if connection object is not null
            if (ObjDIConnection == null)
            {
                RetVal = -1;
                return RetVal;
            }
            // Innitilze DbParams object
            DbParams = new List<System.Data.Common.DbParameter>();
            // create tag parameter
            System.Data.Common.DbParameter Param1 = ObjDIConnection.CreateDBParameter();
            Param1.ParameterName = "@Tags";
            Param1.DbType = DbType.String;
            Param1.Value = Tag;
            DbParams.Add(Param1);

            // Execute stored procedure to get tag Nid
            MaxTagId = Convert.ToInt32(ObjDIConnection.ExecuteScalarSqlQuery("sp_CreateAndGetTagNid", CommandType.StoredProcedure, DbParams));
            if (MaxTagId > 0)
            {
                RetVal = MaxTagId;
            }
        }
        catch (Exception Ex)
        {
            RetVal = -1;
            Global.CreateExceptionString(Ex, null);
        }
        finally
        {
            DbParams = null;
            ObjDIConnection = null;
        }
        return RetVal;
    }
コード例 #2
0
    public bool DeleteTagsMappingsByTagId(int Tag)
    {
        CMSHelper ObjCMSHelper = new CMSHelper();
        string ResultNid = string.Empty;
        bool RetVal = false;
        List<System.Data.Common.DbParameter> DbParams = null;
        DIConnection ObjDIConnection = null;
        int RetDelTagId = -1;
        try
        {

            // Call method to get connection object
            ObjDIConnection = ObjCMSHelper.GetConnectionObject();
            // Check if connection object is not null
            if (ObjDIConnection == null)
            {
                RetVal = false;
                return RetVal;
            }
            // Innitilze DbParams object
            DbParams = new List<System.Data.Common.DbParameter>();
            // create tag parameter
            System.Data.Common.DbParameter Param1 = ObjDIConnection.CreateDBParameter();
            Param1.ParameterName = "@TagId";
            Param1.DbType = DbType.Int32;
            Param1.Value = Tag;
            DbParams.Add(Param1);

            // Execute stored procedure to get tag Nid
            RetDelTagId = Convert.ToInt32(ObjDIConnection.ExecuteScalarSqlQuery("sp_DeleteTagsMappingsByTagId", CommandType.StoredProcedure, DbParams));
            if (RetDelTagId > 0)
            {
                RetVal = true;
            }
        }
        catch (Exception Ex)
        {
            RetVal = false;
            Global.CreateExceptionString(Ex, null);
        }
        finally
        {
            DbParams = null;
            ObjDIConnection = null;
        }
        return RetVal;
    }
コード例 #3
0
 /// <summary>
 /// 更新土地信息适量数据
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public string Post(BMSTDXXGeoDataUpdate request)
 {
     try
     {
         using (StreamReader sr = new StreamReader(request.RequestStream))
         {
             var(userName, token, content) = CMSHelper.SerializeText(sr.ReadToEnd());
             IGroup cms = Helper.GetGrain <IGroup>(0);
             Type   t   = request.GetType();
             if (CMSHelper.CheckAPIConfigurable(t) && cms.CheckAPIPermession(userName, token, t.FullName).Result)
             {
                 IBMSHY hybms    = Helper.GetGrain <IBMSHY>(0);
                 string response = hybms.GeoDataTDXXUpdate(content).Result;
                 return(response);
             }
             return(Helper.PermessionError);
         }
     }
     catch
     {
         return(Helper.AbnormalError);
     }
 }
コード例 #4
0
    public bool AddMenuCategory(string CategoryName, string LinkText, string HeaderText, string HeaderDesc,string PageName)
    {
        DIConnection ObjDIConnection = null;
        CMSHelper Helper = new CMSHelper();
        List<System.Data.Common.DbParameter> DbParams = null;
        bool RetVal = false;
        int AddMenuCategory = -1;
        try
        {   //Get Connection Object
            ObjDIConnection = Helper.GetConnectionObject();
            // Checke if Connection  object is null then return null and stop further flow to execute
            if (ObjDIConnection == null)
            { return RetVal; }
            // If Connection object is not null then excute further code
            else
            {
                DbParams = new List<System.Data.Common.DbParameter>();

                // create database parameters
                System.Data.Common.DbParameter Param1 = ObjDIConnection.CreateDBParameter();// create RecordStartPosition parameter
                Param1.ParameterName = "@MenuCategory";
                Param1.DbType = DbType.String;
                Param1.Value = CategoryName;
                DbParams.Add(Param1);

                System.Data.Common.DbParameter Param2 = ObjDIConnection.CreateDBParameter();// create RecordStartPosition parameter
                Param2.ParameterName = "@LinkText";
                Param2.DbType = DbType.String;
                Param2.Value = LinkText;
                DbParams.Add(Param2);
                System.Data.Common.DbParameter Param3 = ObjDIConnection.CreateDBParameter();// create RecordStartPosition parameter
                Param3.ParameterName = "@HeaderText";
                Param3.DbType = DbType.String;
                Param3.Value = HeaderText;
                DbParams.Add(Param3);
                System.Data.Common.DbParameter Param4 = ObjDIConnection.CreateDBParameter();// create RecordStartPosition parameter
                Param4.ParameterName = "@HeaderDesc";
                Param4.DbType = DbType.String;
                Param4.Value = HeaderDesc;
                DbParams.Add(Param4);

                System.Data.Common.DbParameter Param5 = ObjDIConnection.CreateDBParameter();// create RecordStartPosition parameter
                Param5.ParameterName = "@IsVisible";
                Param5.DbType = DbType.String;
                Param5.Value = true;
                DbParams.Add(Param5);

                System.Data.Common.DbParameter Param6 = ObjDIConnection.CreateDBParameter();// create RecordStartPosition parameter
                Param6.ParameterName = "@PageName";
                Param6.DbType = DbType.String;
                Param6.Value = PageName;
                DbParams.Add(Param6);

                // Execute stored procedure to add menu category from database
                AddMenuCategory = Convert.ToInt32(ObjDIConnection.ExecuteNonQuery("sp_AddMenuCategory", CommandType.StoredProcedure, DbParams));
                // Check if return datatable is not null and having atleast 1 record
                if (AddMenuCategory > 0)
                {
                    RetVal = true;
                }
            }
        }
        catch (Exception Ex)
        {
            RetVal = false;
            Global.CreateExceptionString(Ex, null);
        }
        finally
        {
            ObjDIConnection = null;
        }
        return RetVal;
    }
コード例 #5
0
    public bool MoveUpNDownMenuCat(string MenuCategory, bool MoveUp, bool MoveDown,string PageName)
    {
        bool RetVal = false;
        DIConnection ObjDIConnection = null;
        CMSHelper Helper = new CMSHelper();
        List<System.Data.Common.DbParameter> DbParams = null;
        int MenuCateMoved = -1;
        try
        {   //Get Connection Object
            ObjDIConnection = Helper.GetConnectionObject();
            // Checke if Connection  object is null then return null and stop further flow to execute
            if (ObjDIConnection == null)
            { return RetVal; }
            // If Connection object is not null then excute further code
            else
            {
                DbParams = new List<System.Data.Common.DbParameter>();

                // create database parameters
                System.Data.Common.DbParameter Param1 = ObjDIConnection.CreateDBParameter();// create RecordStartPosition parameter
                Param1.ParameterName = "@MenuCategory";
                Param1.DbType = DbType.String;
                Param1.Value = MenuCategory;
                DbParams.Add(Param1);
                // create database parameters
                System.Data.Common.DbParameter Param2 = ObjDIConnection.CreateDBParameter();// create RecordStartPosition parameter
                Param2.ParameterName = "@MoveUp";
                Param2.DbType = DbType.Int16;
                Param2.Value = MoveUp;
                DbParams.Add(Param2);
                // create database parameters
                System.Data.Common.DbParameter Param3 = ObjDIConnection.CreateDBParameter();// create RecordStartPosition parameter
                Param3.ParameterName = "@MoveDown";
                Param3.DbType = DbType.Int16;
                Param3.Value = MoveDown;
                DbParams.Add(Param3);

                System.Data.Common.DbParameter Param4 = ObjDIConnection.CreateDBParameter();// create RecordStartPosition parameter
                Param4.ParameterName = "@PageName";
                Param4.DbType = DbType.String;
                Param4.Value = PageName;
                DbParams.Add(Param4);
                // Execute stored procedure to delete menu category from database

                MenuCateMoved = Convert.ToInt32(ObjDIConnection.ExecuteScalarSqlQuery("sp_MoveUpNDownMenuCat", CommandType.StoredProcedure, DbParams));
                if (MenuCateMoved >= 0)
                {
                    RetVal = true;
                }

            }
        }
        catch (Exception Ex)
        {
            RetVal = false;
            Global.CreateExceptionString(Ex, null);
        }
        finally
        {
            ObjDIConnection = null;
        }
        return RetVal;
    }
コード例 #6
0
    public string GetMenuCategoriesListJson(bool IsCategoryVisible,string PageName)
    {
        System.Web.Script.Serialization.JavaScriptSerializer jSearializer = new System.Web.Script.Serialization.JavaScriptSerializer();
        List<MenuCategories> RetMenuCat = null;
        string RetVal = string.Empty;
        DIConnection ObjDIConnection = null;
        CMSHelper Helper = new CMSHelper();
        List<System.Data.Common.DbParameter> DbParams = null;
        DataTable DtRetData = null;
        try
        {   //Get Connection Object
            ObjDIConnection = Helper.GetConnectionObject();
            // Checke if Connection  object is null then return null and stop further flow to execute
            if (ObjDIConnection == null)
            { return RetVal; }
            // If Connection object is not null then excute further code
            else
            {
                DbParams = new List<System.Data.Common.DbParameter>();

                // create database parameters
                System.Data.Common.DbParameter Param1 = ObjDIConnection.CreateDBParameter();// create RecordStartPosition parameter
                Param1.ParameterName = "@IsVisible";
                Param1.DbType = DbType.Int32;
                Param1.Value = IsCategoryVisible;
                DbParams.Add(Param1);

                System.Data.Common.DbParameter Param2 = ObjDIConnection.CreateDBParameter();// create RecordStartPosition parameter
                Param2.ParameterName = "@PageName";
                Param2.DbType = DbType.String;
                Param2.Value = PageName;
                DbParams.Add(Param2);
                // Execute stored procedure to get Tags From Database
                DtRetData = ObjDIConnection.ExecuteDataTable("sp_GetMenuCategoriesByPageName", CommandType.StoredProcedure, DbParams);
                // Check if return datatable is not null and having atleast 1 record
                if (DtRetData != null && DtRetData.Rows.Count > 0)
                {
                    RetMenuCat = new List<MenuCategories>();
                    // Itterate through loop
                    for (int Icount = 0; Icount < DtRetData.Rows.Count; Icount++)
                    {
                        MenuCategories ObjMenuCat = new MenuCategories();
                        ObjMenuCat.MenuCategory = DtRetData.Rows[Icount]["MenuCategory"].ToString();
                        ObjMenuCat.LinkText = DtRetData.Rows[Icount]["LinkText"].ToString();
                        ObjMenuCat.HeaderText = DtRetData.Rows[Icount]["HeaderText"].ToString();
                        ObjMenuCat.HeaderDesc = DtRetData.Rows[Icount]["HeaderDesc"].ToString();
                        ObjMenuCat.PageName = DtRetData.Rows[Icount]["PageName"].ToString();
                        // assign tag value to list RetVal
                        RetMenuCat.Add(ObjMenuCat);
                    }
                }
                RetVal = jSearializer.Serialize(RetMenuCat);
            }
        }
        catch (Exception Ex)
        {
            RetVal = string.Empty;
            Global.CreateExceptionString(Ex, null);
        }
        finally
        {
            ObjDIConnection = null;
        }
        return RetVal;
    }
コード例 #7
0
    public bool DeleteMenuCategory(string CategoryName)
    {
        bool RetVal = false;
        DIConnection ObjDIConnection = null;
        CMSHelper Helper = new CMSHelper();
        List<System.Data.Common.DbParameter> DbParams = null;
        int DeleteMenuCate = -1;
        try
        {   //Get Connection Object
            ObjDIConnection = Helper.GetConnectionObject();
            // Checke if Connection  object is null then return null and stop further flow to execute
            if (ObjDIConnection == null)
            { return RetVal; }
            // If Connection object is not null then excute further code
            else
            {
                DbParams = new List<System.Data.Common.DbParameter>();

                // create database parameters
                System.Data.Common.DbParameter Param1 = ObjDIConnection.CreateDBParameter();// create RecordStartPosition parameter
                Param1.ParameterName = "@MenuCategory";
                Param1.DbType = DbType.String;
                Param1.Value = CategoryName;
                DbParams.Add(Param1);
                // Execute stored procedure to delete menu category from database

                DeleteMenuCate = Convert.ToInt32(ObjDIConnection.ExecuteScalarSqlQuery("sp_DeleteMenuCategory", CommandType.StoredProcedure, DbParams));
                if (DeleteMenuCate >= 0)
                {
                    RetVal = true;
                }

            }
        }
        catch (Exception Ex)
        {
            RetVal = false;
            Global.CreateExceptionString(Ex, null);
        }
        finally
        {
            ObjDIConnection = null;
        }
        return RetVal;
    }
コード例 #8
0
    //lấy tên đơn vị theo user ID

    public async Task <ReportMonthlyModel> GetReportByMonth(int deviceId, string type, string Date = "")
    {
        var                QICache    = new Cache_Provider();
        string             strSession = "GetReportByMonth_" + deviceId + type + Date;
        ReportMonthlyModel model      = new ReportMonthlyModel();

        if (!QICache.IsSet(strSession))
        {
            double   total1 = 0, total2 = 0, total3 = 0;
            int      count1 = 0, count2 = 0, count3 = 0;
            DateTime date = DateTime.Today;
            if (Date != "")
            {
                try
                {
                    date = Convert.ToDateTime(Date);
                }
                catch { }
            }
            DateTime distance1 = new DateTime(date.Year, date.Month, 1);
            DateTime distance2 = new DateTime(date.Year, date.Month, 10, 23, 59, 59);
            DateTime distance3 = new DateTime(date.Year, date.Month, 11);
            DateTime distance4 = new DateTime(date.Year, date.Month, 20, 23, 59, 59);
            DateTime distance5 = new DateTime(date.Year, date.Month, 21);
            DateTime distance6 = new DateTime(date.Year, date.Month, DateTime.DaysInMonth(date.Year, date.Month), 23, 59, 59);
            var      result    = await Task.WhenAll(dataObservationMongoService.GetDatayDeviceId(distance1, distance2, deviceId)
                                                    , dataObservationMongoService.GetDatayDeviceId(distance3, distance4, deviceId)
                                                    , dataObservationMongoService.GetDatayDeviceId(distance5, distance6, deviceId));

            foreach (var item in result[0].ToList())
            {
                total1 = CMSHelper.Total(item, type.Trim(), total1);
                count1++;
            }
            double tb1 = total1 / count1;
            foreach (var item in result[1].ToList())
            {
                total2 = CMSHelper.Total(item, type.Trim(), total2);
                count2++;
            }
            double tb2 = total2 / count2;
            foreach (var item in result[2].ToList())
            {
                total3 = CMSHelper.Total(item, type.Trim(), total3);
                count3++;
            }
            double     tb3        = total3 / count3;
            ReportType reportType = reportTypeService.GetByCode(type).FirstOrDefault();
            Site       site       = sitesService.GetByDeviceId(deviceId).FirstOrDefault();
            model.Distance1  = tb1;
            model.Distance2  = tb2;
            model.Distance3  = tb3;
            model.Title      = reportType == null ? "" : reportType.Title;
            model.Measure    = reportType == null ? "" : reportType.Measure;
            model.Name       = reportType == null ? "" : reportType.Description + " " + (site == null ? "" : site.Name);
            model.dayInMonth = DateTime.DaysInMonth(date.Year, date.Month);
            QICache.Set(strSession, model, int.Parse(ConfigurationManager.AppSettings["timeout_cacheserver"]));
        }
        else
        {
            try
            {
                model = QICache.Get(strSession) as ReportMonthlyModel;
            }
            catch
            {
                QICache.Invalidate(strSession);
            }
        }
        return(model);
    }
コード例 #9
0
    // Create new content page andd add link on main html page
    private bool AddCMSContentToDB(DataContent CMSDataContent)
    {
        bool RetVal = false;
        string ConnectionMessage = string.Empty;
        List<System.Data.Common.DbParameter> DbParams = new List<System.Data.Common.DbParameter>();
        DIConnection ObjDIConnection = null;
        int DtAddCmsCont = -1;
        try
        {
            CMSHelper ObjCMSHelper = new CMSHelper();
            // call method to get connection object
            ObjDIConnection = ObjCMSHelper.GetConnectionObject(out ConnectionMessage);

            // create database parameters
            System.Data.Common.DbParameter Param1 = ObjDIConnection.CreateDBParameter();
            Param1.ParameterName = "@MenuCategory";
            Param1.DbType = DbType.String;
            Param1.Value = CMSDataContent.MenuCategory;
            DbParams.Add(Param1);

            System.Data.Common.DbParameter Param2 = ObjDIConnection.CreateDBParameter();
            Param2.ParameterName = "@Title";
            Param2.DbType = DbType.String;
            Param2.Value = CMSDataContent.Title;
            DbParams.Add(Param2);

            System.Data.Common.DbParameter Param3 = ObjDIConnection.CreateDBParameter();
            Param3.ParameterName = "@Date";
            Param3.DbType = DbType.DateTime;
            Param3.Value = CMSDataContent.Date;
            DbParams.Add(Param3);

            System.Data.Common.DbParameter Param4 = ObjDIConnection.CreateDBParameter();
            Param4.ParameterName = "@Thumbnail";
            Param4.DbType = DbType.String;
            Param4.Value = CMSDataContent.Thumbnail;
            DbParams.Add(Param4);

            System.Data.Common.DbParameter Param5 = ObjDIConnection.CreateDBParameter();
            Param5.ParameterName = "@Summary";
            Param5.DbType = DbType.String;
            Param5.Value = CMSDataContent.Summary;
            DbParams.Add(Param5);

            System.Data.Common.DbParameter Param6 = ObjDIConnection.CreateDBParameter();
            Param6.ParameterName = "@Description";
            Param6.DbType = DbType.String;
            Param6.Value = CMSDataContent.Description;
            DbParams.Add(Param6);

            System.Data.Common.DbParameter Param7 = ObjDIConnection.CreateDBParameter();
            Param7.ParameterName = "@PDFUpload";
            Param7.DbType = DbType.String;
            Param7.Value = CMSDataContent.PDFUpload;
            DbParams.Add(Param7);

            System.Data.Common.DbParameter Param8 = ObjDIConnection.CreateDBParameter();
            Param8.ParameterName = "@DateAdded";
            Param8.DbType = DbType.DateTime;
            Param8.Value = CMSDataContent.DateAdded;
            DbParams.Add(Param8);

            System.Data.Common.DbParameter Param9 = ObjDIConnection.CreateDBParameter();
            Param9.ParameterName = "@DateModified";
            Param9.DbType = DbType.DateTime;
            Param9.Value = CMSDataContent.DateModified;
            DbParams.Add(Param9);

            System.Data.Common.DbParameter Param10 = ObjDIConnection.CreateDBParameter();
            Param10.ParameterName = "@Archived";
            Param10.DbType = DbType.Boolean;
            Param10.Value = CMSDataContent.Archived;
            DbParams.Add(Param10);

            System.Data.Common.DbParameter Param11 = ObjDIConnection.CreateDBParameter();
            Param11.ParameterName = "@ArticleTagId";
            Param11.DbType = DbType.Int32;
            Param11.Value = CMSDataContent.ArticleTagID;
            DbParams.Add(Param11);

            System.Data.Common.DbParameter Param12 = ObjDIConnection.CreateDBParameter();
            Param12.ParameterName = "@UserNameEmail";
            Param12.DbType = DbType.String;
            Param12.Value = CMSDataContent.UserNameEmail;
            DbParams.Add(Param12);

            System.Data.Common.DbParameter Param14 = ObjDIConnection.CreateDBParameter();
            Param14.ParameterName = "@URL";
            Param14.DbType = DbType.String;
            Param14.Value = CMSDataContent.URL;
            DbParams.Add(Param14);

            System.Data.Common.DbParameter Param15 = ObjDIConnection.CreateDBParameter();
            Param15.ParameterName = "@LngCode";
            Param15.DbType = DbType.String;
            Param15.Value = CMSDataContent.LngCode;
            DbParams.Add(Param15);

            System.Data.Common.DbParameter Param16 = ObjDIConnection.CreateDBParameter();
            Param16.ParameterName = "@IsDeleted";
            Param16.DbType = DbType.Boolean;
            Param16.Value =CMSDataContent.IsDeleted;
            DbParams.Add(Param16);

            System.Data.Common.DbParameter Param17 = ObjDIConnection.CreateDBParameter();
            Param17.ParameterName = "@IsHidden";
            Param17.DbType = DbType.Boolean;
            Param17.Value = CMSDataContent.IsHidden;
            DbParams.Add(Param17);

            System.Data.Common.DbParameter Param18 = ObjDIConnection.CreateDBParameter();
            Param18.ParameterName = "@Fld1";
            Param18.DbType = DbType.String;
            Param18.Value = "";
            DbParams.Add(Param18);

            System.Data.Common.DbParameter Param19 = ObjDIConnection.CreateDBParameter();
            Param19.ParameterName = "@Fld2";
            Param19.DbType = DbType.String;
            Param19.Value = "";
            DbParams.Add(Param19);

            System.Data.Common.DbParameter Param20 = ObjDIConnection.CreateDBParameter();
            Param20.ParameterName = "@Fld3";
            Param20.DbType = DbType.String;
            Param20.Value = "";
            DbParams.Add(Param20);

            System.Data.Common.DbParameter Param21 = ObjDIConnection.CreateDBParameter();
            Param21.ParameterName = "@Fld4";
            Param21.DbType = DbType.String;
            Param21.Value = "";
            DbParams.Add(Param21);

            System.Data.Common.DbParameter Param22 = ObjDIConnection.CreateDBParameter();
            Param22.ParameterName = "@Fld5";
            Param22.DbType = DbType.String;
            Param22.Value = "";
            DbParams.Add(Param22);
            System.Data.Common.DbParameter Param23 = ObjDIConnection.CreateDBParameter();
            Param23.ParameterName = "@Fld6";
            Param23.DbType = DbType.String;
            Param23.Value = "";
            DbParams.Add(Param23);

            System.Data.Common.DbParameter Param24 = ObjDIConnection.CreateDBParameter();
            Param24.ParameterName = "@Fld1Text";
            Param24.DbType = DbType.String;
            Param24.Value = "";
            DbParams.Add(Param24);
            System.Data.Common.DbParameter Param25 = ObjDIConnection.CreateDBParameter();
            Param25.ParameterName = "@Fld2Text";
            Param25.DbType = DbType.String;
            Param25.Value = "";
            DbParams.Add(Param25);
            System.Data.Common.DbParameter Param26 = ObjDIConnection.CreateDBParameter();
            Param26.ParameterName = "@Fld3Text";
            Param26.DbType = DbType.String;
            Param26.Value = "";
            DbParams.Add(Param26);
            System.Data.Common.DbParameter Param27= ObjDIConnection.CreateDBParameter();
            Param27.ParameterName = "@Fld4Text";
            Param27.DbType = DbType.String;
            Param27.Value = "";
            DbParams.Add(Param27);

            System.Data.Common.DbParameter Param28 = ObjDIConnection.CreateDBParameter();
            Param28.ParameterName = "@Fld5Text";
            Param28.DbType = DbType.String;
            Param28.Value = "";
            DbParams.Add(Param28);

            System.Data.Common.DbParameter Param29 = ObjDIConnection.CreateDBParameter();
            Param29.ParameterName = "@Fld6Text";
            Param29.DbType = DbType.String;
            Param29.Value = "";
            DbParams.Add(Param29);

            // Execute stored procedure to Insert CMS Content In Database
            DtAddCmsCont = ObjDIConnection.ExecuteNonQuery("sp_AddCMSContent", CommandType.StoredProcedure, DbParams);
            //To check if records inserted in database,check if count of no of rows effected is greater than 0
            if (DtAddCmsCont > 0)
            {
                RetVal = true;
            }
            // return false
            else
            {
                RetVal = false;
            }
        }
        catch (Exception Ex)
        {
            RetVal = false;
            Global.CreateExceptionString(Ex, null);
        }
        return RetVal;
    }
コード例 #10
0
    //Create Datacontent Object from Input Params
    private DataContent CreateCMSDataContent(string requestParam)
    {
        CMSHelper ObjCMSHelper = new CMSHelper();
        DataContent RetValContent = null;
        string PdfFileUrl = string.Empty;

        string ContentSummary = string.Empty;
        string ContentTitle = string.Empty;
        string ContentDate = string.Empty;
        string ContentImgUrl = string.Empty;
        string ContentPageUrl = string.Empty;
        string UserEmailID = string.Empty;
        string DatabaseLanguage = string.Empty;
        string UserName = string.Empty;
        string CurrentDbLangCode = string.Empty;
        string CountentUrl = string.Empty;
        string ArticleTags = string.Empty;
        string MenuCategory = string.Empty;
        string ContentDescription = string.Empty;
        string ContentTag = string.Empty;
        int ContentTagNid = -1;
        SqlDateTime SqlDtTime = new SqlDateTime();
        string[] Params;
        try
        {
            // split Input Params
            Params = Global.SplitString(requestParam, Constants.Delimiters.ParamDelimiter);
            // Check if session is having nid for loggedin Admin
            if (!string.IsNullOrEmpty(HttpContext.Current.Session[Constants.SessionNames.LoggedAdminUserNId].ToString()))
            {// get user email
                UserEmailID = Global.Get_User_EmailId_ByAdaptationURL(HttpContext.Current.Session[Constants.SessionNames.LoggedAdminUserNId].ToString());
            }
            // Check if session is having username for loggedin Admin
            if (!string.IsNullOrEmpty(HttpContext.Current.Session[Constants.SessionNames.LoggedAdminUser].ToString()))
            { // get user name from session
                UserName = HttpContext.Current.Session[Constants.SessionNames.LoggedAdminUser].ToString();
            }

            // Initlize RetValContent Object
            RetValContent = new DataContent();
            ContentTitle = Params[0].ToString();
            ContentDate = Params[1].ToString();
            ContentSummary = Params[2].ToString();
            ContentSummary = ContentSummary.Replace("\n", "<br/>");
            ContentDescription = Params[3].ToString().Replace("diorg/images", "../libraries/aspx/diorg/images");
            PdfFileUrl = Params[4].ToString().Replace("diorg/", "../libraries/aspx/diorg/");
            MenuCategory = Params[5].ToString();
            ContentImgUrl = Params[6].ToString().Trim().Replace("diorg/","../libraries/aspx/diorg/");
            if (Params.Length > 7)
            {
                ContentTag = Params[7].ToString().Trim();
            }
            UserEmailID = UserName + " [" + UserEmailID + " ]";

            // Create Countent Url From Title
            CountentUrl = ObjCMSHelper.CreateUrlFromInputString(ContentTitle);
            // Getb current database language
            CurrentDbLangCode = Global.GetDefaultLanguageCode();
            //Get Tag Nid
            if (!string.IsNullOrEmpty(ContentTag))
            {
                ContentTagNid = ObjCMSHelper.CreateAndGetTagNid(ContentTag.Trim());
            }
            if(string.IsNullOrEmpty(ContentDate) && MenuCategory.ToLower()!=EnumHelper.PageName.News.ToString().ToLower())
            {

                SqlDtTime=DateTime.Now.AddYears(-100);
            }
            else
            {
            //Convert Date to sql date time
            SqlDtTime = ObjCMSHelper.GetSqlDataTimeFromInptDate(ContentDate);
            }
            // innitlize of members of class Content
            RetValContent.MenuCategory = MenuCategory;
            RetValContent.Date = SqlDtTime;
            RetValContent.DateAdded = new SqlDateTime(DateTime.Now);
            RetValContent.DateModified = new SqlDateTime(DateTime.Now);
            RetValContent.Description = ContentDescription;
            RetValContent.Title = ContentTitle;
            RetValContent.PDFUpload = PdfFileUrl;
            RetValContent.Summary = ContentSummary;
            RetValContent.Thumbnail = ContentImgUrl;
            RetValContent.URL = CountentUrl;
            RetValContent.Archived = false;
            // Username email filed is combination of username and email
            RetValContent.UserNameEmail = UserName + " " + UserEmailID;
            RetValContent.LngCode = CurrentDbLangCode;
            RetValContent.ArticleTagID = ContentTagNid;
            RetValContent.IsDeleted = false;
            RetValContent.IsHidden = false;

            //Extra fields to be used in future
            RetValContent.Fld1 = string.Empty;
            RetValContent.Fld2 = string.Empty;
            RetValContent.Fld3 = string.Empty;
            RetValContent.Fld4 = string.Empty;
            RetValContent.Fld5 = string.Empty;
            RetValContent.Fld6 = string.Empty;
            RetValContent.Fld1Text = string.Empty;
            RetValContent.Fld2Text = string.Empty;
            RetValContent.Fld3Text = string.Empty;
            RetValContent.Fld4Text = string.Empty;
            RetValContent.Fld5Text = string.Empty;
            RetValContent.Fld6Text = string.Empty;
        }
        catch (Exception Ex)
        {
            RetValContent = null;
            Global.CreateExceptionString(Ex, null);
        }
        // return news object
        return RetValContent;
    }
コード例 #11
0
    // Read Action page html Content
    public List<DataContent> ReadActionHtmlContent()
    {
        List<DataContent> ListDC = new List<DataContent>();

        SqlDateTime SqlDtTime = new SqlDateTime();
        CMSHelper ObjCMSHelper = null;
        try
        {
            string PdfFileUrl = string.Empty;
            string RetPageContent = string.Empty;
            string ContentFileFullPath = string.Empty;
            string HtmlPageFullPath = string.Empty;
            string HtmlPageName = string.Empty;
            HtmlDocument document = null;
            string ContentSummary = string.Empty;
            string ContentTitle = string.Empty;
            string ContentDate = string.Empty;
            string ImgUrl = string.Empty;
            string ContentPageUrl = string.Empty;
            string UserEmailID = string.Empty;
            string DatabaseLanguage = string.Empty;
            string UserName = string.Empty;
            string CurrentDbLangCode = string.Empty;
            string CountentUrl = string.Empty;
            string ArticleTags = string.Empty;
            //get name of news html page
            HtmlPageName = this.ActionHtmlFilenamePrefix + ".html";
            document = new HtmlDocument();
            // create html page full path
            HtmlPageFullPath = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, Constants.FolderName.DiorgContent, HtmlPageName);
            if (!File.Exists(HtmlPageFullPath))
            {
                return ListDC;
            }
            // load html page
            document.Load(HtmlPageFullPath);
            // Targets a specific node(since all the page contains parent table tag with width 700)
            HtmlNode content_wrapper = document.DocumentNode.SelectNodes("//table[@width='700']").FirstOrDefault();
            // get html news collection
            HtmlNodeCollection search_results = content_wrapper.SelectNodes("//td[@class='news_space']");
            //itterate through loop
            foreach (HtmlNode result in search_results)
            {
                DataContent Content = new DataContent();

                // get title of news
                if (result.SelectNodes(".//p//span[@class='header']") != null && !string.IsNullOrEmpty(result.SelectNodes(".//p//span[@class='header']").FirstOrDefault().InnerText))
                {
                    ContentTitle = result.SelectNodes(".//p//span[@class='header']").FirstOrDefault().InnerText.Trim();
                }
                else if (result.SelectNodes(".//span//strong//a") != null && !string.IsNullOrEmpty(result.SelectNodes(".//span//strong//a").FirstOrDefault().InnerText))
                {
                    ContentTitle = result.SelectNodes(".//span//strong//a").FirstOrDefault().InnerText.Trim();
                }
                else if (result.SelectNodes(".//p//a//strong") != null && !string.IsNullOrEmpty(result.SelectNodes(".//p//a//strong").FirstOrDefault().InnerText.Trim()))
                {
                    ContentTitle = result.SelectNodes(".//p//a//strong").FirstOrDefault().InnerText.Trim();
                }
                else if (result.SelectNodes(".//p//strong//a") != null && !string.IsNullOrEmpty(result.SelectNodes(".//p//strong//a").FirstOrDefault().InnerText.Trim()))
                {
                    ContentTitle = result.SelectNodes(".//p//strong//a").FirstOrDefault().InnerText.Trim();
                }
                else if (result.SelectNodes(".//p//a") != null && !string.IsNullOrEmpty(result.SelectNodes(".//p//a").FirstOrDefault().InnerText))
                {
                    ContentTitle = result.SelectNodes(".//p//a").FirstOrDefault().InnerText.Trim();
                }
                else if (result.SelectNodes(".//p//strong") != null && !string.IsNullOrEmpty(result.SelectNodes(".//p//strong").FirstOrDefault().InnerText))
                {
                    ContentTitle = result.SelectNodes(".//p//strong").FirstOrDefault().InnerText.Trim();
                }

                // get summary of news
                if (result.SelectNodes(".//td[@width='71%']//tr/td") != null)
                {
                    ContentSummary = result.SelectNodes(".//td[@width='71%']//tr/td").ElementAt(1).InnerText.Trim().ToString();
                }
                // get date created of news
                if (result.SelectSingleNode(".//span[@class='adaptation_italic']") != null)
                {
                    ContentDate = result.SelectSingleNode(".//span[@class='adaptation_italic']").InnerText.Replace("(", "").Replace(")", "").Trim();
                }
                // get Thumbnail url of news
                if (result.SelectNodes(".//img[@class='reflect ropacity30']") != null)
                {
                    ImgUrl = result.SelectNodes(".//img[@class='reflect ropacity30']").FirstOrDefault().GetAttributeValue("src", "").ToString();
                }
                else if (result.SelectNodes(".//td//a//img[@width='140']") != null)
                {
                    ImgUrl = result.SelectNodes(".//td//a//img[@width='140']").FirstOrDefault().GetAttributeValue("src", "").ToString();
                }
                else if (result.SelectNodes(".//img[@class='reflect ropacity30 ']") != null)
                {
                    ImgUrl = result.SelectNodes(".//img[@class='reflect ropacity30 ']").FirstOrDefault().GetAttributeValue("src", "").ToString();
                }
                if (ImgUrl.Contains("diorg/"))
                {
                    ImgUrl = ImgUrl.Replace("diorg/", "../libraries/aspx/diorg/");
                }
                // get content page of url
                if (result.SelectNodes(".//td[@width='29%']//a") != null)
                {
                    ContentPageUrl = result.SelectNodes(".//td[@width='29%']//a").FirstOrDefault().GetAttributeValue("href", "").ToString();
                }
                else if (result.SelectNodes(".//td[@width='29%']//tr/td//a") != null)
                {
                    ContentPageUrl = result.SelectNodes(".//td[@width='29%']//tr/td//a").FirstOrDefault().GetAttributeValue("href", "").ToString();
                }
                else if (result.SelectNodes(".//td[@width='28%']//a") != null)
                {
                    ContentPageUrl = result.SelectNodes(".//td[@width='28%']//a").FirstOrDefault().GetAttributeValue("href", "").ToString();
                }
                //get content of inner html page
                if (ContentPageUrl.Contains("diorg/"))
                {
                    // create full path of inner html page
                    ContentFileFullPath = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, Constants.FolderName.DiorgContent,
                        Global.SplitString(ContentPageUrl, "diorg/")[1].ToString().Replace(@"/", "\\"));
                    // check if file exist
                    if (File.Exists(ContentFileFullPath))
                    {
                        // call method to get content of html page
                        //get pdfurl as out parameter
                        RetPageContent = GetInnerContentNPdfUrl(ContentFileFullPath, out PdfFileUrl);
                    }
                }
                // Initlize object of class cmshelper
                ObjCMSHelper = new CMSHelper();
                // remove space and ;nbsp from date
                ContentDate = ObjCMSHelper.RemoveExtraCharsFromDate(ContentDate);
                // get created date of news
                SqlDtTime = new SqlDateTime(ObjCMSHelper.GetSqlDataTimeFromInptDate(ContentDate));
                // get user email id from session
                if (!string.IsNullOrEmpty(HttpContext.Current.Session[Constants.SessionNames.LoggedAdminUserNId].ToString()))
                {
                    UserEmailID = Global.Get_User_EmailId_ByAdaptationURL(HttpContext.Current.Session[Constants.SessionNames.LoggedAdminUserNId].ToString());
                }
                // get user name from session
                if (!string.IsNullOrEmpty(HttpContext.Current.Session[Constants.SessionNames.LoggedAdminUser].ToString()))
                {
                    UserName = HttpContext.Current.Session[Constants.SessionNames.LoggedAdminUser].ToString();
                }

                // Create url from title
                CountentUrl = ObjCMSHelper.CreateUrlFromInputString(ContentTitle);

                //Get language of current database
                CurrentDbLangCode = Global.GetDefaultLanguageCode();

                // innitlize of members of class Content
                Content.MenuCategory = "Action";
                Content.Date = SqlDtTime;
                Content.DateAdded = new SqlDateTime(DateTime.Now);
                Content.DateModified = new SqlDateTime(DateTime.Now);
                Content.Description = RetPageContent;
                Content.Title = ContentTitle;
                Content.PDFUpload = PdfFileUrl;
                Content.Summary = ContentSummary;
                Content.Thumbnail = ImgUrl;
                Content.URL = CountentUrl;
                Content.Archived = false;
                Content.UserNameEmail = UserName + " " + UserEmailID;
                Content.LngCode = CurrentDbLangCode;
                Content.ArticleTagID = -1;
                Content.IsDeleted = false;
                Content.IsDeleted = false;
                // all class Content to list
                ListDC.Add(Content);
            }
        }
        catch (Exception Ex)
        {
            Global.CreateExceptionString(Ex, null);
        }
        // return list containing all html pages
        return ListDC;
    }
コード例 #12
0
    // Read facts page html content
    public List<DataContent> ReadFactsHtmlContent()
    {
        List<DataContent> ListDC = new List<DataContent>();
        string PdfFileUrl = string.Empty;
        string RetPageContent = string.Empty;
        string NewsContentFullPath = string.Empty;
        string HtmlPageFullPath = string.Empty;
        string HtmlPageName = string.Empty;
        HtmlDocument document = null;
        string NewsSummary = string.Empty;
        string NewsTitle = string.Empty;
        string NewsContentDate = string.Empty;
        string ImgUrl = string.Empty;
        string ContentPageUrl = string.Empty;
        string UserEmailID = string.Empty;
        string DatabaseLanguage = string.Empty;
        string UserName = string.Empty;
        string CurrentDbLangCode = string.Empty;
        string NewsUrl = string.Empty;
        string ArticleTags = string.Empty;
        SqlDateTime SqlDtTime;
        // Initlize object of class cmshelper
        CMSHelper ObjCMSHelper = null;
        try
        {
            //get name of news html page
            HtmlPageName = this.FactsHtmlFilenamePrefix + ".html";
            document = new HtmlDocument();
            // create html page full path
            HtmlPageFullPath = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, Constants.FolderName.DiorgContent, HtmlPageName);
            if (!File.Exists(HtmlPageFullPath))
            {
                return ListDC;
            }
            // load html page
            document.Load(HtmlPageFullPath);
            // Targets a specific node(since all the page contains parent table tag with width 700)
            HtmlNode content_wrapper = document.DocumentNode.SelectNodes("//table[@width='700']//tr//td[@height='450']").FirstOrDefault();
            // get html news collection
            if (content_wrapper.SelectNodes("//table[@width='700']//tr//td") != null)
            {
                HtmlNodeCollection SplitString = content_wrapper.SelectNodes("//div[@class='goal']");
                foreach (HtmlNode HtmlNodResult in SplitString)
                {
                    //HtmlNodResult.se
                    DataContent Content = new DataContent();

                    // Initlize object of class cmshelper
                    ObjCMSHelper = new CMSHelper();
                    // remove space and ;nbsp from date
                    NewsContentDate = ObjCMSHelper.RemoveExtraCharsFromDate(NewsContentDate);
                    // get created date of news
                    SqlDtTime = new SqlDateTime(ObjCMSHelper.GetSqlDataTimeFromInptDate(NewsContentDate));

                    // get user email id from session
                    if (!string.IsNullOrEmpty(HttpContext.Current.Session[Constants.SessionNames.LoggedAdminUserNId].ToString()))
                    {
                        UserEmailID = Global.Get_User_EmailId_ByAdaptationURL(HttpContext.Current.Session[Constants.SessionNames.LoggedAdminUserNId].ToString());
                    }
                    // get user name from session
                    if (!string.IsNullOrEmpty(HttpContext.Current.Session[Constants.SessionNames.LoggedAdminUser].ToString()))
                    {
                        UserName = HttpContext.Current.Session[Constants.SessionNames.LoggedAdminUser].ToString();
                    }

                    // Create url from title
                    NewsUrl = ObjCMSHelper.CreateUrlFromInputString(NewsTitle);

                    //Get language of current database
                    CurrentDbLangCode = Global.GetDefaultLanguageCode();

                    // innitlize of members of class Content
                    Content.Date = SqlDtTime;
                    Content.DateAdded = new SqlDateTime(DateTime.Now);
                    Content.DateModified = new SqlDateTime(DateTime.Now);
                    Content.Description = RetPageContent;
                    Content.Title = NewsTitle;
                    Content.PDFUpload = PdfFileUrl;
                    Content.Summary = NewsSummary;
                    Content.Thumbnail = ImgUrl;
                    Content.URL = NewsUrl;
                    Content.Archived = false;
                    Content.UserNameEmail = UserName + " " + UserEmailID;
                    Content.LngCode = CurrentDbLangCode;
                    Content.ArticleTagID = -1;
                    // all class Content to list
                    ListDC.Add(Content);
                }

            }
        }
        catch (Exception Ex)
        {
            Global.CreateExceptionString(Ex, null);
        }
        // return list containing all html pages
        return ListDC;
    }
コード例 #13
0
    /// Create CMS database for adaptation If Database Not exise
    /// </summary>
    /// <param name="CMSDatabaseName">Name of the created Cms Database</param>
    /// <returns>True if database created or already exist</returns>
    public bool MigratorHtmlContentToDb(List<DataContent> InputListDataContent, out string ContentDbImportMessage)
    {
        bool RetVal = false;
        DIConnection ObjDIConnection = null;
        CMSHelper ObjCmsHelper = new CMSHelper();
        string DbScripts = string.Empty;
        string LngDbScripts = string.Empty;
        string ConnectionMessage = string.Empty;
        string QryStr = string.Empty;
        DataTable DTCounts;

        List<System.Data.Common.DbParameter> DbParams = new List<System.Data.Common.DbParameter>();
        try
        {

            ObjDIConnection = ObjCmsHelper.GetConnectionObject(out ConnectionMessage);
            if (ObjDIConnection == null)
            {
                ContentDbImportMessage = ConnectionMessage;
                RetVal = false;
                return RetVal;
            }
            else
            {
                foreach (DataContent DContent in InputListDataContent)
                {
                    try
                    {
                        if (!string.IsNullOrEmpty(DContent.Title) || !string.IsNullOrEmpty(DContent.Summary.ToString()) || !string.IsNullOrEmpty(DContent.Thumbnail.ToString())
                            || !string.IsNullOrEmpty(DContent.Description.ToString()) || !string.IsNullOrEmpty(DContent.PDFUpload.ToString()))
                        {
                            QryStr = "select * from DataContent where Title='" + DContent.Title.Replace("'", "''") + "'" + "and Date='" + DContent.Date + "' and Summary='" + DContent.Summary.Replace("'", "''") + "'";

                            DTCounts = ObjDIConnection.ExecuteDataTable(QryStr);

                            if (DTCounts.Rows.Count == 0)
                            {

                                QryStr = "INSERT into DataContent (MenuCategory, Title, Date, Thumbnail,  Summary, Description, PDFUpload, DateAdded,DateModified, Archived,  ArticleTagId, UserNameEmail, URL, LngCode, IsDeleted,IsHidden) Values (" + "'" + DContent.MenuCategory + "','" + DContent.Title.Replace("'", "''") + "','" + DContent.Date + "','" + DContent.Thumbnail + "','" + DContent.Summary.Replace("'", "''") + "','" + DContent.Description.Replace("'", "''") + "','" + DContent.PDFUpload + "','" + DContent.DateAdded + "','" + DContent.DateModified + "','" + DContent.Archived + "','" + DContent.ArticleTagID + "','" + DContent.UserNameEmail.Replace("'", "''") + "','" + DContent.URL + "','" + DContent.LngCode + "','" + DContent.IsDeleted + "','" + DContent.IsHidden + "')";

                                ObjDIConnection.ExecuteNonQuery(QryStr);
                            }
                        }
                    }
                    catch (Exception Ex)
                    {
                        string ExceptionMgs = "Exception occured in method ImportHtmlContentToDb while insering records in database,";
                        ExceptionMgs = " Exception message is" + Ex.InnerException.ToString() + "Stack trace is" + Ex.StackTrace.ToString();
                        Global.WriteErrorsInLogFolder(ExceptionMgs);
                        ContentDbImportMessage = "Error occured while importing datavalues to database";
                        RetVal = false;
                    }
                }
            }

            // Set Retval to true
            RetVal = true;
            // Dispose connection object
            ObjDIConnection.Dispose();
        }
        catch (Exception ex)
        {
            ContentDbImportMessage = "Error occured while importing datavalues to database";
            RetVal = false;
            Global.CreateExceptionString(ex, null);
        }

        finally
        { // dispose connection object
            ObjDIConnection = null;
        }
        ContentDbImportMessage = string.Empty;
        return RetVal;
    }
コード例 #14
0
    public bool ShowHideArticlebyContentId(int ContentId, bool IsHidden)
    {
        CMSHelper ObjCMSHelper = new CMSHelper();
        string ResultNid = string.Empty;
        bool RetVal = false;
        List<System.Data.Common.DbParameter> DbParams = null;
        DIConnection ObjDIConnection = null;
        int RetDelTagId = -1;
        try
        {

            // Call method to get connection object
            ObjDIConnection = ObjCMSHelper.GetConnectionObject();
            // Check if connection object is not null
            if (ObjDIConnection == null)
            {
                RetVal = false;
                return RetVal;
            }
            // Innitilze DbParams object
            DbParams = new List<System.Data.Common.DbParameter>();
            System.Data.Common.DbParameter Param1 = ObjDIConnection.CreateDBParameter();
            Param1.ParameterName = "@ContentId";
            Param1.DbType = DbType.Int32;
            Param1.Value = ContentId;
            DbParams.Add(Param1);

            System.Data.Common.DbParameter Param2 = ObjDIConnection.CreateDBParameter();
            Param2.ParameterName = "@IsHidden";
            Param2.DbType = DbType.Boolean;
            Param2.Value = IsHidden;
            DbParams.Add(Param2);

            // Execute stored procedure to get tag Nid
            RetDelTagId = Convert.ToInt32(ObjDIConnection.ExecuteNonQuery("sp_ShowHideArticlesByContentId", CommandType.StoredProcedure, DbParams));
            if (RetDelTagId > 0)
            {
                RetVal = true;
            }
        }
        catch (Exception Ex)
        {
            RetVal = false;
            Global.CreateExceptionString(Ex, null);
        }
        finally
        {
            DbParams = null;
            ObjDIConnection = null;
        }
        return RetVal;
    }
コード例 #15
0
    public bool EditArticleByArticleId(string requestParam,out string OutCurrentPageNo,out string OutCurrentMenuCategory,out string OutCurrentTagNids)
    {
        bool RetVal = false;
        string[] Params;
        CMSHelper Helper = new CMSHelper();
        string ContentSummary = string.Empty;
        string ContentTitle = string.Empty;
        string ContentDate = string.Empty;
        string ContentImgUrl = string.Empty;
        string UserEmailID = string.Empty;
        string DatabaseLanguage = string.Empty;
        string UserName = string.Empty;
        string CurrentDbLangCode = string.Empty;
        string ArticleTags = string.Empty;
        string MenuCategory = string.Empty;
        string ContentDescription = string.Empty;
        string ContentTag = string.Empty;
        DataContent RetValContent = null;
        int ContentId = 0;
        int ContentTagNid = 0;
        int ExistingTagNid = 0;
        string ContentPdfFileUrl = string.Empty;
        CMSHelper ObjCMSHelper = null;
        SqlDateTime SqlDtTime;
        bool IsContentUpdated = false;
        try
        {
            SqlDtTime = new SqlDateTime();
            ObjCMSHelper = new CMSHelper();
            // Check if session is having nid for loggedin Admin
            if (!string.IsNullOrEmpty(HttpContext.Current.Session[Constants.SessionNames.LoggedAdminUserNId].ToString()))
            {// get user email
                UserEmailID = Global.Get_User_EmailId_ByAdaptationURL(HttpContext.Current.Session[Constants.SessionNames.LoggedAdminUserNId].ToString());
            }
            // Check if session is having username for loggedin Admin
            if (!string.IsNullOrEmpty(HttpContext.Current.Session[Constants.SessionNames.LoggedAdminUser].ToString()))
            { // get user name from session
                UserName = HttpContext.Current.Session[Constants.SessionNames.LoggedAdminUser].ToString();
            }
            // split Input Params
            Params = Global.SplitString(requestParam, Constants.Delimiters.ParamDelimiter);

            // Initlize RetValContent Object
            RetValContent = new DataContent();
            ContentId = Convert.ToInt32(Params[0].ToString());
            ContentTitle = Params[1].ToString();
            ContentDate = Params[2].ToString();
            ContentSummary = Params[3].ToString();
            ContentSummary=ContentSummary.Replace("\n","<br/>");
            ContentDescription = Params[4].ToString().Trim().Replace("diorg/images", "../libraries/aspx/diorg/images");

            //remove changes in script tag for ckeditor
            ContentDescription = ContentDescription.Replace("<scrpt", "<script");
            ContentDescription = ContentDescription.Replace("</scrpt", "</script");

            ContentPdfFileUrl = Params[5].ToString().Replace("diorg/", "../libraries/aspx/diorg/"); ;
            MenuCategory = Params[6].ToString();
            ContentImgUrl = Params[7].ToString().Trim().Replace( "diorg/","../libraries/aspx/diorg/");
            if (Params.Length > 8)
            {
                ContentTag = Params[8].ToString().Trim();
            }
            OutCurrentMenuCategory = MenuCategory;
            OutCurrentPageNo = Params[10].ToString().Trim();

            if (Params.Length > 11)
            {
                OutCurrentTagNids = Params[11].ToString().Trim();
            }
            else
            {
                OutCurrentTagNids = string.Empty;
            }

            ExistingTagNid = Convert.ToInt32(Params[9].ToString().Trim());
            // Check if existing tagid exists
            if (ExistingTagNid > 0)
            {
                // Delete existing Tag from mapping table
                DeleteTagsMappingsByTagId(ExistingTagNid);
            }

            UserEmailID = UserName + " [" + UserEmailID + " ]";

            //// Create Countent Url From Title
            //CountentUrl = ObjCMSHelper.CreateUrlFromInputString(ContentTitle);
            // Getb current database language
            CurrentDbLangCode = Global.GetDefaultLanguageCode();

            //Get Tag Nid-- add new tags to database and get nid
            if (!string.IsNullOrEmpty(ContentTag))
            {
                ContentTagNid = ObjCMSHelper.CreateAndGetTagNid(ContentTag);
            }
            //Convert Date to sql date time
            SqlDtTime = ObjCMSHelper.ConvertDataTimeToSQLDateTime(ContentDate);

            // innitlize of members of class Content
            RetValContent.ContentId = ContentId;
            RetValContent.MenuCategory = MenuCategory;
            RetValContent.Date = SqlDtTime;
            RetValContent.DateAdded = new SqlDateTime(DateTime.Now);
            RetValContent.DateModified = new SqlDateTime(DateTime.Now);
            RetValContent.Description = ContentDescription;
            RetValContent.Title = ContentTitle;
            RetValContent.PDFUpload = ContentPdfFileUrl;
            RetValContent.Summary = ContentSummary;
            RetValContent.Thumbnail = ContentImgUrl;
            RetValContent.Archived = false;
            // Username email filed is combination of username and email
            RetValContent.UserNameEmail = UserName + " " + UserEmailID;
            RetValContent.LngCode = CurrentDbLangCode;
            RetValContent.ArticleTagID = ContentTagNid;

          IsContentUpdated= this.UpdateCMSContent(RetValContent);
          if (IsContentUpdated)
          {
              RetVal = true;
              // set session varibles to maintain page no
          }
        }
        catch (Exception Ex)
        {
            OutCurrentMenuCategory = string.Empty;
            OutCurrentPageNo = string.Empty;
            OutCurrentTagNids = string.Empty;
            RetVal = false;
            Global.CreateExceptionString(Ex, null);
        }

        finally
        {
            RetValContent = null;
        }
        return RetVal;
    }