public void LoadData(int SystemForeignRelationshipTypeId, bool showId) { Clear(); var data = new SystemForeignRelationshipTypeDataModel(); data.SystemForeignRelationshipTypeId = SystemForeignRelationshipTypeId; var items = Framework.Components.Core.SystemForeignRelationshipTypeDataManager.GetEntityDetails(data, SessionVariables.RequestProfile); if (items.Count != 1) { return; } var item = items[0]; SetData(item); if (!showId) { SystemKeyId = item.SystemForeignRelationshipTypeId; oHistoryList.Setup(PrimaryEntity, SystemForeignRelationshipTypeId, PrimaryEntityKey); } else { CoreSystemKey.Text = String.Empty; } }
public static int Create(SystemForeignRelationshipTypeDataModel data, RequestProfile requestProfile) { var sql = Save(data, "Create", requestProfile); var newId = DBDML.RunScalarSQL("SystemForeignRelationshipType.Insert", sql, DataStoreKey); return(Convert.ToInt32(newId)); }
public override int?Save(string action) { var data = new SystemForeignRelationshipTypeDataModel(); data.SystemForeignRelationshipTypeId = SystemKeyId; data.Name = Name; data.Description = Description; data.SortOrder = SortOrder; if (action == "Insert") { var dtSystemForeignRelationshipType = Framework.Components.Core.SystemForeignRelationshipTypeDataManager.DoesExist(data, SessionVariables.RequestProfile); if (dtSystemForeignRelationshipType.Rows.Count == 0) { Framework.Components.Core.SystemForeignRelationshipTypeDataManager.Create(data, SessionVariables.RequestProfile); } else { throw new Exception("Record with given ID already exists."); } } else { Framework.Components.Core.SystemForeignRelationshipTypeDataManager.Update(data, SessionVariables.RequestProfile); } // not correct ... when doing insert, we didn't get/change the value of ClientID ? return(data.SystemForeignRelationshipTypeId); }
public static DataTable DoesExist(SystemForeignRelationshipTypeDataModel data, RequestProfile requestProfile) { var doesExistRequest = new SystemForeignRelationshipTypeDataModel(); doesExistRequest.Name = data.Name; return(Search(doesExistRequest, requestProfile)); }
protected override DataTable UpdateData() { var UpdatedData = new DataTable(); var data = new SystemForeignRelationshipTypeDataModel(); UpdatedData = Framework.Components.Core.SystemForeignRelationshipTypeDataManager.Search(data, SessionVariables.RequestProfile).Clone(); for (var i = 0; i < SelectedData.Rows.Count; i++) { data.SystemForeignRelationshipTypeId = Convert.ToInt32(SelectedData.Rows[i][SystemForeignRelationshipTypeDataModel.DataColumns.SystemForeignRelationshipTypeId].ToString()); data.Name = SelectedData.Rows[i][StandardDataModel.StandardDataColumns.Name].ToString(); data.Description = !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.Description)) ? CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.Description) : SelectedData.Rows[i][StandardDataModel.StandardDataColumns.Description].ToString(); data.SortOrder = !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.SortOrder)) ? int.Parse(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.SortOrder).ToString()) : int.Parse(SelectedData.Rows[i][StandardDataModel.StandardDataColumns.SortOrder].ToString()); Framework.Components.Core.SystemForeignRelationshipTypeDataManager.Update(data, SessionVariables.RequestProfile); data = new SystemForeignRelationshipTypeDataModel(); data.SystemForeignRelationshipTypeId = Convert.ToInt32(SelectedData.Rows[i][SystemForeignRelationshipTypeDataModel.DataColumns.SystemForeignRelationshipTypeId].ToString()); var dt = Framework.Components.Core.SystemForeignRelationshipTypeDataManager.Search(data, SessionVariables.RequestProfile); if (dt.Rows.Count == 1) { UpdatedData.ImportRow(dt.Rows[0]); } } return(UpdatedData); }
public static string Save(SystemForeignRelationshipTypeDataModel data, string action, RequestProfile requestProfile) { var sql = "EXEC "; switch (action) { case "Create": sql += "dbo.SystemForeignRelationshipTypeInsert " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId); break; case "Update": sql += "dbo.SystemForeignRelationshipTypeUpdate " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId); break; default: break; } sql = sql + ", " + ToSQLParameter(data, SystemForeignRelationshipTypeDataModel.DataColumns.SystemForeignRelationshipTypeId) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Name) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Description) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.SortOrder); return(sql); }
protected override void Clear() { base.Clear(); var data = new SystemForeignRelationshipTypeDataModel(); SetData(data); }
private DataTable GetData(string name) { var data = new SystemForeignRelationshipTypeDataModel(); data.Name = name; var dt = Framework.Components.Core.SystemForeignRelationshipTypeDataManager.Search(data, SessionVariables.RequestProfile); return(dt); }
public static DataSet GetChildren(SystemForeignRelationshipTypeDataModel data, RequestProfile requestProfile) { var sql = "EXEC dbo.SystemForeignRelationshipTypeChildrenGet" + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(data, SystemForeignRelationshipTypeDataModel.DataColumns.SystemForeignRelationshipTypeId); var oDT = new Framework.Components.DataAccess.DBDataSet("Get Children", sql, DataStoreKey); return(oDT.DBDataset); }
protected override DataTable GetEntityData(int?entityKey) { var SystemForeignRelationshipTypedata = new SystemForeignRelationshipTypeDataModel(); SystemForeignRelationshipTypedata.SystemForeignRelationshipTypeId = entityKey; var results = Framework.Components.Core.SystemForeignRelationshipTypeDataManager.Search(SystemForeignRelationshipTypedata, SessionVariables.RequestProfile); return(results); }
protected override void Update(Dictionary <string, string> values) { var data = new SystemForeignRelationshipTypeDataModel(); // copies properties from values dictionary object to data object PropertyMapper.CopyProperties(data, values); Framework.Components.Core.SystemForeignRelationshipTypeDataManager.Update(data, SessionVariables.RequestProfile); base.Update(values); }
public static bool DoesExist(SystemForeignRelationshipTypeDataModel data, RequestProfile requestProfile) { var doesExistRequest = new SystemForeignRelationshipTypeDataModel(); doesExistRequest.ApplicationId = data.ApplicationId; doesExistRequest.Name = data.Name; var list = GetEntityDetails(doesExistRequest, requestProfile, 0); return(list.Count > 0); }
protected void btnDelete_Click(object sender, EventArgs e) { string[] deleteIndexList = DeleteIds.Split(','); foreach (string index in deleteIndexList) { var data = new SystemForeignRelationshipTypeDataModel(); data.SystemForeignRelationshipTypeId = int.Parse(index); Framework.Components.Core.SystemForeignRelationshipTypeDataManager.Delete(data, SessionVariables.RequestProfile); } DeleteAndRedirect(); }
public static void Delete(SystemForeignRelationshipTypeDataModel data, RequestProfile requestProfile) { const string sql = @"dbo.SystemForeignRelationshipTypeDelete "; var parameters = new { AuditId = requestProfile.AuditId , SystemForeignRelationshipTypeId = data.SystemForeignRelationshipTypeId }; using (var dataAccess = new DataAccessBase(DataStoreKey)) { dataAccess.Connection.Execute(sql, parameters, commandType: CommandType.StoredProcedure); } }
public static bool IsDeletable(SystemForeignRelationshipTypeDataModel data, RequestProfile requestProfile) { var isDeletable = true; var ds = GetChildren(data, requestProfile); if (ds != null && ds.Tables.Count > 0) { foreach (DataTable dt in ds.Tables) { if (dt.Rows.Count > 0) { isDeletable = false; break; } } } return(isDeletable); }
protected override DataTable GetData() { try { SuperKey = ApplicationCommon.GetSuperKey(); SetId = ApplicationCommon.GetSetId(); var selectedrows = new DataTable(); var systemForeignRelationshipTypedata = new SystemForeignRelationshipTypeDataModel(); selectedrows = Framework.Components.Core.SystemForeignRelationshipTypeDataManager.GetDetails(systemForeignRelationshipTypedata, SessionVariables.RequestProfile).Clone(); if (!string.IsNullOrEmpty(SuperKey)) { var systemEntityTypeId = (int)PrimaryEntity; var lstEntityKeys = ApplicationCommon.GetSuperKeyDetails(systemEntityTypeId, SuperKey); foreach (var entityKey in lstEntityKeys) { systemForeignRelationshipTypedata.SystemForeignRelationshipTypeId = entityKey; var result = Framework.Components.Core.SystemForeignRelationshipTypeDataManager.GetDetails(systemForeignRelationshipTypedata, SessionVariables.RequestProfile); selectedrows.ImportRow(result.Rows[0]); } } else { systemForeignRelationshipTypedata.SystemForeignRelationshipTypeId = SetId; var result = Framework.Components.Core.SystemForeignRelationshipTypeDataManager.GetDetails(systemForeignRelationshipTypedata, SessionVariables.RequestProfile); selectedrows.ImportRow(result.Rows[0]); } return(selectedrows); } catch (Exception ex) { Response.Write(ex.Message); } return(null); }
public static List <SystemForeignRelationshipTypeDataModel> GetEntityDetails(SystemForeignRelationshipTypeDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails) { const string sql = @"dbo.SystemForeignRelationshipTypeSearch "; var parameters = new { AuditId = requestProfile.AuditId , ApplicationId = requestProfile.ApplicationId , ApplicationMode = requestProfile.ApplicationModeId , ReturnAuditInfo = returnAuditInfo , SystemForeignRelationshipTypeId = dataQuery.SystemForeignRelationshipTypeId , Name = dataQuery.Name }; List <SystemForeignRelationshipTypeDataModel> result; using (var dataAccess = new DataAccessBase(DataStoreKey)) { result = dataAccess.Connection.Query <SystemForeignRelationshipTypeDataModel>(sql, parameters, commandType: CommandType.StoredProcedure).ToList(); } return(result); }
public static string ToSQLParameter(SystemForeignRelationshipTypeDataModel data, string dataColumnName) { var returnValue = "NULL"; switch (dataColumnName) { case SystemForeignRelationshipTypeDataModel.DataColumns.SystemForeignRelationshipTypeId: if (data.SystemForeignRelationshipTypeId != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, SystemForeignRelationshipTypeDataModel.DataColumns.SystemForeignRelationshipTypeId, data.SystemForeignRelationshipTypeId); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, SystemForeignRelationshipTypeDataModel.DataColumns.SystemForeignRelationshipTypeId); } break; default: returnValue = StandardDataManager.ToSQLParameter(data, dataColumnName); break; } return(returnValue); }
protected override void ShowData(int systemForeignRelationshipTypeId) { base.ShowData(systemForeignRelationshipTypeId); oDetailButtonPanel.SetId = SetId; Clear(); var data = new SystemForeignRelationshipTypeDataModel(); data.SystemForeignRelationshipTypeId = systemForeignRelationshipTypeId; var items = Framework.Components.Core.SystemForeignRelationshipTypeDataManager.GetEntityDetails(data, SessionVariables.RequestProfile); // should only have single match if (items.Count == 1) { var item = items[0]; SetData(item); oHistoryList.Setup(PrimaryEntity, systemForeignRelationshipTypeId, "SystemForeignRelationshipType"); } }
public static DataTable Search(SystemForeignRelationshipTypeDataModel data, RequestProfile requestProfile) { var list = GetEntityDetails(data, requestProfile, 0); return(list.ToDataTable()); }
public void SetData(SystemForeignRelationshipTypeDataModel item) { SystemKeyId = item.SystemForeignRelationshipTypeId; base.SetData(item); }
public static void Update(SystemForeignRelationshipTypeDataModel data, RequestProfile requestProfile) { var sql = Save(data, "Update", requestProfile); DBDML.RunSQL("SystemForeignRelationshipType.Update", sql, DataStoreKey); }
public void SetData(SystemForeignRelationshipTypeDataModel data) { SystemKeyId = data.SystemForeignRelationshipTypeId; base.SetData(data); }
public static SystemForeignRelationshipTypeDataModel GetDetails(SystemForeignRelationshipTypeDataModel data, RequestProfile requestProfile) { var list = GetEntityDetails(data, requestProfile, 1); return(list.FirstOrDefault()); }