public LoadModelForm(int aProjectID, int aTypeOfModel) { InitializeComponent(); MainDataSetTableAdapters.MODELTableAdapter adptModel = new Plig.TimeSeries.Client.MainDataSetTableAdapters.MODELTableAdapter(); MainDataSet.MODELDataTable tblModel = adptModel.GetDataBy(aProjectID, aTypeOfModel); grdMain.DataSource = tblModel.DefaultView.ToTable(false, "ID", "DESCRIPTION"); }
protected virtual void SaveModel(string aDescription) { IModelStorage model = ConstructModel(); // Трябва да извлечем сериализирания обект // Запазване в базата данни към текущия проект и за текущия модел System.IO.MemoryStream ms = new System.IO.MemoryStream(); BinaryFormatter bformatter = new BinaryFormatter(); bformatter.Serialize(ms, model); byte[] serialized_model = ms.GetBuffer(); MainDataSetTableAdapters.MODELTableAdapter adptModel = new Plig.TimeSeries.Client.MainDataSetTableAdapters.MODELTableAdapter(); adptModel.Insert(mPROJECT_ID, serialized_model, aDescription, mTypeOfModel); }
protected virtual void LoadModel(int aModelID) { MainDataSetTableAdapters.MODELTableAdapter adptModel = new Plig.TimeSeries.Client.MainDataSetTableAdapters.MODELTableAdapter(); MainDataSet.MODELDataTable tblModel = adptModel.GetDataByID(aModelID); MainDataSet.MODELRow model_row = (MainDataSet.MODELRow)tblModel.Rows[0]; System.IO.MemoryStream ms = new System.IO.MemoryStream(model_row.DATA); BinaryFormatter bformatter = new BinaryFormatter(); IModelStorage model = (IModelStorage)bformatter.Deserialize(ms); ProcessModel(model); }