public int AddWidgetText(int wdgID, TextLocalised textLocalised) { int wdgTextID; try { using (SqlCommand oComm = new SqlCommand()) { if (Sqlconn.State == ConnectionState.Closed) { Sqlconn.Open(); } oComm.Connection = Sqlconn; oComm.CommandType = CommandType.StoredProcedure; oComm.CommandText = "DashBoard.AddWidgetText"; SqlParameter pWdgID = new SqlParameter("@WDG_ID", SqlDbType.Int); pWdgID.Value = wdgID; oComm.Parameters.Add(pWdgID); SqlParameter pTitle = new SqlParameter("@WDG_TEXT_TITLE", SqlDbType.NVarChar); pTitle.Value = textLocalised.title; oComm.Parameters.Add(pTitle); SqlParameter pContent = new SqlParameter("@WDG_TEXT_CONTENT", SqlDbType.NText); pContent.Value = textLocalised.content; oComm.Parameters.Add(pContent); SqlParameter pLocale = new SqlParameter("@WDG_TEXT_LOCALE", SqlDbType.NVarChar); pLocale.Value = textLocalised.locale; oComm.Parameters.Add(pLocale); SqlParameter pWDGTextID = new SqlParameter("@WDG_TEXT_ID", SqlDbType.Int); pWDGTextID.Direction = ParameterDirection.Output; oComm.Parameters.Add(pWDGTextID); oComm.ExecuteNonQuery(); wdgTextID = (int)pWDGTextID.Value; } } catch (Exception ex) { throw ex; } finally { if (Sqlconn.State == ConnectionState.Open) { Sqlconn.Close(); } } return(wdgTextID); }
public List <TextLocalised> GetDashBoardWidgetText(int wdgId) { List <TextLocalised> lWidgetTexts = new List <TextLocalised>(); SqlDataReader oReader; try { using (SqlCommand oComm = new SqlCommand()) { if (Sqlconn.State == ConnectionState.Closed) { Sqlconn.Open(); } oComm.Connection = Sqlconn; oComm.CommandType = CommandType.StoredProcedure; oComm.CommandText = "DashBoard.GetDashBoardWidgetText"; SqlParameter pWdgID = new SqlParameter("@WDGID", SqlDbType.Int); pWdgID.Value = wdgId; oComm.Parameters.Add(pWdgID); oReader = oComm.ExecuteReader(); while (oReader.Read()) { TextLocalised widgetText = new TextLocalised() { content = oReader["wdg_text_Content"] != DBNull.Value ? oReader["wdg_text_Content"].ToString() : string.Empty, title = oReader["wdg_text_Title"] != DBNull.Value ? oReader["wdg_text_Title"].ToString() : string.Empty, locale = oReader["wdg_text_Locale"] != DBNull.Value ? oReader["wdg_text_Locale"].ToString() : string.Empty }; lWidgetTexts.Add(widgetText); } } } catch (Exception ex) { throw ex; } finally { if (Sqlconn.State == ConnectionState.Open) { Sqlconn.Close(); } } return(lWidgetTexts); }
public List <TextLocalised> GetDashBoardTexts(int dashboardId) { List <TextLocalised> lTexts = new List <TextLocalised>(); SqlDataReader oReader; try { using (SqlCommand oComm = new SqlCommand()) { if (Sqlconn.State == ConnectionState.Closed) { Sqlconn.Open(); } oComm.Connection = Sqlconn; oComm.CommandType = CommandType.StoredProcedure; oComm.CommandText = "DashBoard.GetDashBoardText"; SqlParameter pDashBoardID = new SqlParameter("@IDDASHBOARD", SqlDbType.Int); pDashBoardID.Value = dashboardId; oComm.Parameters.Add(pDashBoardID); oReader = oComm.ExecuteReader(); while (oReader.Read()) { TextLocalised textsLocalised = new TextLocalised() { title = oReader["dsb_text_Title"] != DBNull.Value ? oReader["dsb_text_Title"].ToString() : string.Empty, locale = oReader["dsb_text_Locale"] != DBNull.Value ? oReader["dsb_text_Locale"].ToString() : string.Empty, }; lTexts.Add(textsLocalised); } } } catch (Exception ex) { throw ex; } finally { if (Sqlconn.State == ConnectionState.Open) { Sqlconn.Close(); } } return(lTexts); }
public ActionResult AddWidgetText(int wdgID, TextLocalised textLocalised) { throw new NotImplementedException(); }