public static string Save(DeliverableArtifactDataModel data, string action, RequestProfile requestProfile) { var sql = "EXEC "; switch (action) { case "Create": sql += "dbo.DeliverableArtifactInsert " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId); break; case "Update": sql += "dbo.DeliverableArtifactUpdate " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId); break; default: break; } sql = sql + ", " + ToSQLParameter(data, DeliverableArtifactDataModel.DataColumns.DeliverableArtifactId) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Name) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Description) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.SortOrder); return(sql); }
public static int Create(DeliverableArtifactDataModel data, RequestProfile requestProfile) { var sql = Save(data, "Create", requestProfile); var newId = DBDML.RunScalarSQL("DeliverableArtifact.Insert", sql, DataStoreKey); return(Convert.ToInt32(newId)); }
protected override DataTable UpdateData() { var UpdatedData = new DataTable(); var data = new DeliverableArtifactDataModel(); UpdatedData = DeliverableArtifactDataManager.Search(data, SessionVariables.RequestProfile).Clone(); for (var i = 0; i < SelectedData.Rows.Count; i++) { data.DeliverableArtifactId = Convert.ToInt32(SelectedData.Rows[i][DeliverableArtifactDataModel.DataColumns.DeliverableArtifactId].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()); DeliverableArtifactDataManager.Update(data, SessionVariables.RequestProfile); data = new DeliverableArtifactDataModel(); data.DeliverableArtifactId = Convert.ToInt32(SelectedData.Rows[i][DeliverableArtifactDataModel.DataColumns.DeliverableArtifactId].ToString()); var dt = DeliverableArtifactDataManager.Search(data, SessionVariables.RequestProfile); if (dt.Rows.Count == 1) { UpdatedData.ImportRow(dt.Rows[0]); } } return(UpdatedData); }
public void LoadData(int deliverableArtifactId, bool showId) { Clear(); var data = new DeliverableArtifactDataModel(); data.DeliverableArtifactId = deliverableArtifactId; var items = DeliverableArtifactDataManager.GetEntityDetails(data, SessionVariables.RequestProfile); if (items.Count != 1) { return; } var item = items[0]; SetData(item); if (!showId) { SystemKeyId = item.DeliverableArtifactId; oHistoryList.Setup(PrimaryEntity, deliverableArtifactId, PrimaryEntityKey); } else { CoreSystemKey.Text = String.Empty; } }
public override int?Save(string action) { var data = new DeliverableArtifactDataModel(); data.DeliverableArtifactId = SystemKeyId; data.Name = Name; data.Description = Description; data.SortOrder = SortOrder; if (action == "Insert") { var dtDeliverableArtifact = DeliverableArtifactDataManager.DoesExist(data, SessionVariables.RequestProfile); if (dtDeliverableArtifact.Rows.Count == 0) { DeliverableArtifactDataManager.Create(data, SessionVariables.RequestProfile); } else { throw new Exception("Record with given ID already exists."); } } else { DeliverableArtifactDataManager.Update(data, SessionVariables.RequestProfile); } return(data.DeliverableArtifactId); }
protected override void Clear() { base.Clear(); var data = new DeliverableArtifactDataModel(); SetData(data); }
public static DataSet GetChildren(DeliverableArtifactDataModel data, RequestProfile requestProfile) { var sql = "EXEC dbo.DeliverableArtifactChildrenGet" + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(data, DeliverableArtifactDataModel.DataColumns.DeliverableArtifactId); var oDT = new Framework.Components.DataAccess.DBDataSet("Get Children", sql, DataStoreKey); return(oDT.DBDataset); }
private System.Data.DataTable GetData() { // TODO: on all export pages var data = new DeliverableArtifactDataModel(); var dt = DeliverableArtifactDataManager.Search(data, SessionVariables.RequestProfile); return(dt); }
protected override DataTable GetEntityData(int?entityKey) { var deliverableArtifactdata = new DeliverableArtifactDataModel(); deliverableArtifactdata.DeliverableArtifactId = entityKey; var results = DeliverableArtifactDataManager.Search(deliverableArtifactdata, SessionVariables.RequestProfile); return(results); }
private DataTable GetData(string name) { var data = new DeliverableArtifactDataModel(); data.Name = name; var dt = DeliverableArtifactDataManager.Search(data, SessionVariables.RequestProfile); return(dt); }
protected override void Update(Dictionary <string, string> values) { var data = new DeliverableArtifactDataModel(); // copies properties from values dictionary object to data object PropertyMapper.CopyProperties(data, values); DeliverableArtifactDataManager.Update(data, SessionVariables.RequestProfile); InlineEditingList.Data = GetData(); }
public static bool DoesExist(DeliverableArtifactDataModel data, RequestProfile requestProfile) { var doesExistRequest = new DeliverableArtifactDataModel(); doesExistRequest.ApplicationId = data.ApplicationId; doesExistRequest.Name = data.Name; var list = GetEntityDetails(doesExistRequest, requestProfile, 0); return(list.Count > 0); }
private void UpdateData(ArrayList values) { var data = new DeliverableArtifactDataModel(); data.DeliverableArtifactId = int.Parse(values[0].ToString()); data.Name = values[1].ToString(); data.Description = values[2].ToString(); data.SortOrder = int.Parse(values[3].ToString()); DeliverableArtifactDataManager.Update(data, SessionVariables.RequestProfile); ReBindEditableGrid(); }
public static void Delete(DeliverableArtifactDataModel data, RequestProfile requestProfile) { const string sql = @"dbo.DeliverableArtifactDelete "; var parameters = new { AuditId = requestProfile.AuditId , DeliverableArtifactId = data.DeliverableArtifactId }; using (var dataAccess = new DataAccessBase(DataStoreKey)) { dataAccess.Connection.Execute(sql, parameters, commandType: CommandType.StoredProcedure); } }
protected void btnDelete_Click(object sender, EventArgs e) { try { string[] deleteIndexList = DeleteIds.Split(','); foreach (string index in deleteIndexList) { var data = new DeliverableArtifactDataModel(); data.DeliverableArtifactId = int.Parse(index); DeliverableArtifactDataManager.Delete(data, SessionVariables.RequestProfile); DeleteAndRedirect(); } } catch (Exception ex) { Response.Write(ex.Message); } }
public static bool IsDeletable(DeliverableArtifactDataModel 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 deliverableArtifactdata = new DeliverableArtifactDataModel(); selectedrows = DeliverableArtifactDataManager.GetDetails(deliverableArtifactdata, SessionVariables.RequestProfile).Clone(); if (!string.IsNullOrEmpty(SuperKey)) { var systemEntityTypeId = (int)PrimaryEntity; var lstEntityKeys = ApplicationCommon.GetSuperKeyDetails(systemEntityTypeId, SuperKey); foreach (var entityKey in lstEntityKeys) { deliverableArtifactdata.DeliverableArtifactId = entityKey; var result = DeliverableArtifactDataManager.GetDetails(deliverableArtifactdata, SessionVariables.RequestProfile); selectedrows.ImportRow(result.Rows[0]); } } else { deliverableArtifactdata.DeliverableArtifactId = SetId; var result = DeliverableArtifactDataManager.GetDetails(deliverableArtifactdata, SessionVariables.RequestProfile); selectedrows.ImportRow(result.Rows[0]); } return(selectedrows); } catch (Exception ex) { Response.Write(ex.Message); } return(null); }
protected override void ShowData(int deliverableArtifactId) { base.ShowData(deliverableArtifactId); oDetailButtonPanel.SetId = SetId; Clear(); var data = new DeliverableArtifactDataModel(); data.DeliverableArtifactId = deliverableArtifactId; var items = DeliverableArtifactDataManager.GetEntityDetails(data, SessionVariables.RequestProfile); if (items.Count == 1) { var item = items[0]; SetData(item); oHistoryList.Setup(PrimaryEntity, deliverableArtifactId, "DeliverableArtifact"); } }
public static List <DeliverableArtifactDataModel> GetEntityDetails(DeliverableArtifactDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails) { const string sql = @"dbo.DeliverableArtifactSearch "; var parameters = new { AuditId = requestProfile.AuditId , ApplicationId = requestProfile.ApplicationId , ApplicationMode = requestProfile.ApplicationModeId , ReturnAuditInfo = returnAuditInfo , DeliverableArtifactId = dataQuery.DeliverableArtifactId , Name = dataQuery.Name }; List <DeliverableArtifactDataModel> result; using (var dataAccess = new DataAccessBase(DataStoreKey)) { result = dataAccess.Connection.Query <DeliverableArtifactDataModel>(sql, parameters, commandType: CommandType.StoredProcedure).ToList(); } return(result); }
public static string ToSQLParameter(DeliverableArtifactDataModel data, string dataColumnName) { var returnValue = "NULL"; switch (dataColumnName) { case DeliverableArtifactDataModel.DataColumns.DeliverableArtifactId: if (data.DeliverableArtifactId != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, DeliverableArtifactDataModel.DataColumns.DeliverableArtifactId, data.DeliverableArtifactId); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, DeliverableArtifactDataModel.DataColumns.DeliverableArtifactId); } break; default: returnValue = StandardDataManager.ToSQLParameter(data, dataColumnName); break; } return(returnValue); }
public void SetData(DeliverableArtifactDataModel data) { SystemKeyId = data.DeliverableArtifactId; base.SetData(data); }
public void SetData(DeliverableArtifactDataModel item) { SystemKeyId = item.DeliverableArtifactId; base.SetData(item); }
private void ReBindEditableGrid() { var data = new DeliverableArtifactDataModel(); var dtDeliverableArtifact = DeliverableArtifactDataManager.Search(data, SessionVariables.RequestProfile); }
public static DataTable Search(DeliverableArtifactDataModel data, RequestProfile requestProfile) { var list = GetEntityDetails(data, requestProfile, 0); return(list.ToDataTable()); }
public static DeliverableArtifactDataModel GetDetails(DeliverableArtifactDataModel data, RequestProfile requestProfile) { var list = GetEntityDetails(data, requestProfile, 1); return(list.FirstOrDefault()); }
public static void Update(DeliverableArtifactDataModel data, RequestProfile requestProfile) { var sql = Save(data, "Update", requestProfile); DBDML.RunSQL("DeliverableArtifact.Update", sql, DataStoreKey); }