예제 #1
0
 public void Save_Metric(MetricDTO metric_dto)
 {
     try
     {
         _dbcontext.tblMetrics.Add(MetricDTO.Convert_DTO_To_Table(metric_dto));
         _dbcontext.SaveChanges();
     }
     catch (Exception ex) { throw ex; }
 }
예제 #2
0
        public bool Save(string row_id, string table_name, string note, string user_id)
        {
            tblNote tblnote = new tblNote {
                Table_Name = table_name, Table_Row_Id = row_id, Comments = note, User_Id = user_id, Last_Updated = System.DateTime.Now
            };

            _dbcontext.tblNotes.Add(tblnote);
            _dbcontext.SaveChanges();
            return(true);
        }
 /// <summary>
 /// Add Widget to homepage
 /// </summary>
 /// <param name="home_page_widget_dto"></param>
 public bool Widget_Pin_To_HomePage(int widget_id, string user_id)
 {
     if (Get_Home_Page_By_ID_And_User_ID(widget_id, user_id) == null)
     {
         try
         {
             tblHomePage_Widget tbl_homepage_widget = HomePage_WidgetDTO_Converter.Convert(Get_Dashboard_Widget_By_Widget_ID_For_Home_Page(widget_id));
             tbl_homepage_widget.User_Id = user_id;
             _dbcontext.tblHomePage_Widget.Add(tbl_homepage_widget);
             _dbcontext.SaveChanges();
             return(true);
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
     else
     {
         throw new Exception(Resources.widget_all_ready_added);
     }
 }
예제 #4
0
 /// <summary>
 /// Update and save the Connection in to the database
 /// </summary>
 private void saveDBConnection()
 {
     try
     {
         //  _dbcontext = new InnonAnalyticsEngineEntities();
         tblConnector objtblConnector = _dbcontext.tblConnectors.SingleOrDefault(t => t.ID == this._connectorDTO.ConnectionID);
         if (objtblConnector == null)
         {
             ConnectorDTO.ConvertDTOToTable(this._connectorDTO, ref objtblConnector);
             _dbcontext.tblConnectors.Add(objtblConnector);
             //ConnectorConvert.ConvertDTOtoTable(this._dataconnector, ref objtblConnector);
             //_dbcontext.tblConnectors.Add(objtblConnector);
         }
         else
         {
             ConnectorDTO.ConvertDTOToTable(this._connectorDTO, ref objtblConnector);
         }
         _dbcontext.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #5
0
 /// <summary>
 /// This save element method will use when only one node add into the tree, Parentid can be null, Becuase node can be add root level (logical {Site, Equipment})
 /// </summary>
 /// <param name="parentId"></param>
 /// <param name="node"></param>
 public void SaveElement(long?parentId, string node, long tagId)
 {
     _dbcontext.tblElements.Add(ElementDTO.ConvertObjectToElementDto(parentId, node, tagId));
     _dbcontext.SaveChanges();
 }
예제 #6
0
 public void Save()
 {
     _dbcontext.SaveChanges();
 }
예제 #7
0
        public int Create_Dashboard(DashboardDTO dashboard, string user_id)
        {
            tblDashboard tbl_dashboard = _dbcontext.tblDashboards.Find(dashboard.Id);

            if (tbl_dashboard == null)
            {
                AspNetUserDashboard aspnetuser_dashbaord = new AspNetUserDashboard()
                {
                    User_Id = user_id
                };
                tbl_dashboard = _dbcontext.tblDashboards.Add(ConvertDashboard.ConvertDashboardDTO_To_Table(dashboard));
                tbl_dashboard.AspNetUserDashboards.Add(aspnetuser_dashbaord);
            }
            else
            {
                tblDashboard tbl_dashboard_new = ConvertDashboard.ConvertDashboardDTO_To_Table(dashboard);
                _dbcontext.Entry(tbl_dashboard).CurrentValues.SetValues(tbl_dashboard_new);
            }



            _dbcontext.SaveChanges();
            return(tbl_dashboard.Id);
        }