protected override DataTable UpdateData() { var UpdatedData = new DataTable(); var data = new UseCaseDataModel(); UpdatedData = TaskTimeTracker.Components.BusinessLayer.RequirementAnalysis.UseCaseDataManager.Search(data, SessionVariables.RequestProfile).Clone(); for (var i = 0; i < SelectedData.Rows.Count; i++) { data.UseCaseId = Convert.ToInt32(SelectedData.Rows[i][UseCaseDataModel.DataColumns.UseCaseId].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()); TaskTimeTracker.Components.BusinessLayer.RequirementAnalysis.UseCaseDataManager.Update(data, SessionVariables.RequestProfile); data = new UseCaseDataModel(); data.UseCaseId = Convert.ToInt32(SelectedData.Rows[i][UseCaseDataModel.DataColumns.UseCaseId].ToString()); var dt = TaskTimeTracker.Components.BusinessLayer.RequirementAnalysis.UseCaseDataManager.Search(data, SessionVariables.RequestProfile); if (dt.Rows.Count == 1) { UpdatedData.ImportRow(dt.Rows[0]); } } return(UpdatedData); }
public static string Save(UseCaseDataModel data, string action, RequestProfile requestProfile) { var sql = "EXEC "; switch (action) { case "Create": sql += "dbo.UseCaseInsert " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId); break; case "Update": sql += "dbo.UseCaseUpdate " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId); break; default: break; } sql = sql + ", " + ToSQLParameter(data, UseCaseDataModel.DataColumns.UseCaseId) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Name) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Description) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.SortOrder); return(sql); }
protected override void ShowData(int useCaseId) { base.ShowData(useCaseId); oDetailButtonPanel.SetId = SetId; Clear(); var data = new UseCaseDataModel(); data.UseCaseId = useCaseId; var items = TaskTimeTracker.Components.BusinessLayer.RequirementAnalysis.UseCaseDataManager.GetEntityDetails(data, SessionVariables.RequestProfile); if (items.Count == 1) { var item = items[0]; lblCreatedByAuditId.Text = item.CreatedByAuditId.ToString(); lblModifiedByAuditId.Text = item.ModifiedByAuditId.ToString(); lblCreatedDate.Text = item.CreatedDate.Value.ToString(SessionVariables.UserDateFormat); lblModifiedDate.Text = item.ModifiedDate.Value.ToString(SessionVariables.UserDateFormat); SetData(item); oUpdateInfo.LoadText(item.UpdatedDate, item.UpdatedBy, item.LastAction); oHistoryList.Setup(PrimaryEntity, useCaseId, "UseCase"); } }
public void LoadData(int useCaseId, bool showId) { Clear(); var data = new UseCaseDataModel(); data.UseCaseId = useCaseId; var items = TaskTimeTracker.Components.BusinessLayer.RequirementAnalysis.UseCaseDataManager.GetEntityDetails(data, SessionVariables.RequestProfile); if (items.Count != 1) { return; } var item = items[0]; SetData(item); if (!showId) { SystemKeyId = item.UseCaseId; oHistoryList.Setup(PrimaryEntity, useCaseId, PrimaryEntityKey); } else { CoreSystemKey.Text = String.Empty; } }
public override int?Save(string action) { var data = new UseCaseDataModel(); data.UseCaseId = SystemKeyId; data.Name = Name; data.Description = Description; data.SortOrder = SortOrder; if (action == "Insert") { var dtUseCase = TaskTimeTracker.Components.BusinessLayer.RequirementAnalysis.UseCaseDataManager.DoesExist(data, SessionVariables.RequestProfile); if (dtUseCase.Rows.Count == 0) { TaskTimeTracker.Components.BusinessLayer.RequirementAnalysis.UseCaseDataManager.Create(data, SessionVariables.RequestProfile); } else { throw new Exception("Record with given ID already exists."); } } else { TaskTimeTracker.Components.BusinessLayer.RequirementAnalysis.UseCaseDataManager.Update(data, SessionVariables.RequestProfile); } return(data.UseCaseId); }
public static int Create(UseCaseDataModel data, RequestProfile requestProfile) { var sql = Save(data, "Create", requestProfile); var newId = DBDML.RunScalarSQL("UseCase.Insert", sql, DataStoreKey); return(Convert.ToInt32(newId)); }
private System.Data.DataTable GetData() { var data = new UseCaseDataModel(); var dt = TaskTimeTracker.Components.BusinessLayer.RequirementAnalysis.UseCaseDataManager.Search(data, SessionVariables.RequestProfile); return(dt); }
protected override void Clear() { base.Clear(); var data = new UseCaseDataModel(); SetData(data); }
public static DataSet GetChildren(UseCaseDataModel data, RequestProfile requestProfile) { var sql = "EXEC dbo.UseCaseChildrenGet" + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(data, UseCaseDataModel.DataColumns.UseCaseId); var oDT = new Framework.Components.DataAccess.DBDataSet("Get Children", sql, DataStoreKey); return(oDT.DBDataset); }
protected override DataTable GetEntityData(int?entityKey) { var useCasedata = new UseCaseDataModel(); useCasedata.UseCaseId = entityKey; var results = TaskTimeTracker.Components.BusinessLayer.RequirementAnalysis.UseCaseDataManager.Search(useCasedata, SessionVariables.RequestProfile); return(results); }
protected override void Update(Dictionary <string, string> values) { var data = new UseCaseDataModel(); // copies properties from values dictionary object to data object PropertyMapper.CopyProperties(data, values); TaskTimeTracker.Components.BusinessLayer.RequirementAnalysis.UseCaseDataManager.Update(data, SessionVariables.RequestProfile); base.Update(values); }
private void UpdateData(ArrayList values) { var data = new UseCaseDataModel(); data.UseCaseId = int.Parse(values[0].ToString()); data.Name = values[1].ToString(); data.Description = values[2].ToString(); data.SortOrder = int.Parse(values[3].ToString()); TaskTimeTracker.Components.BusinessLayer.RequirementAnalysis.UseCaseDataManager.Update(data, SessionVariables.RequestProfile); ReBindEditableGrid(); }
public static bool DoesExist(UseCaseDataModel data, RequestProfile requestProfile) { var doesExistRequest = new UseCaseDataModel(); doesExistRequest.ApplicationId = data.ApplicationId; doesExistRequest.Name = data.Name; var list = GetEntityDetails(doesExistRequest, requestProfile, 0); return(list.Count > 0); }
public static void Delete(UseCaseDataModel data, RequestProfile requestProfile) { const string sql = @"dbo.UseCaseDelete "; var parameters = new { AuditId = requestProfile.AuditId , UseCaseId = data.UseCaseId }; 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 UseCaseDataModel(); data.UseCaseId = int.Parse(index); TaskTimeTracker.Components.BusinessLayer.RequirementAnalysis.UseCaseDataManager.Delete(data, SessionVariables.RequestProfile); DeleteAndRedirect(); } } catch (Exception ex) { Response.Write(ex.Message); } }
public static bool IsDeletable(UseCaseDataModel 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 useCasedata = new UseCaseDataModel(); selectedrows = TaskTimeTracker.Components.BusinessLayer.RequirementAnalysis.UseCaseDataManager.GetDetails(useCasedata, SessionVariables.RequestProfile).Clone(); if (!string.IsNullOrEmpty(SuperKey)) { var systemEntityTypeId = (int)PrimaryEntity; var lstEntityKeys = ApplicationCommon.GetSuperKeyDetails(systemEntityTypeId, SuperKey); foreach (var entityKey in lstEntityKeys) { useCasedata.UseCaseId = entityKey; var result = TaskTimeTracker.Components.BusinessLayer.RequirementAnalysis.UseCaseDataManager.GetDetails(useCasedata, SessionVariables.RequestProfile); selectedrows.ImportRow(result.Rows[0]); } } else { useCasedata.UseCaseId = SetId; var result = TaskTimeTracker.Components.BusinessLayer.RequirementAnalysis.UseCaseDataManager.GetDetails(useCasedata, SessionVariables.RequestProfile); selectedrows.ImportRow(result.Rows[0]); } return(selectedrows); } catch (Exception ex) { Response.Write(ex.Message); } return(null); }
public static List <UseCaseDataModel> GetEntityDetails(UseCaseDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails) { const string sql = @"dbo.UseCaseSearch "; var parameters = new { AuditId = requestProfile.AuditId , ApplicationId = requestProfile.ApplicationId , ApplicationMode = requestProfile.ApplicationModeId , ReturnAuditInfo = returnAuditInfo , UseCaseId = dataQuery.UseCaseId , Name = dataQuery.Name }; List <UseCaseDataModel> result; using (var dataAccess = new DataAccessBase(DataStoreKey)) { result = dataAccess.Connection.Query <UseCaseDataModel>(sql, parameters, commandType: CommandType.StoredProcedure).ToList(); } return(result); }
public static string ToSQLParameter(UseCaseDataModel data, string dataColumnName) { var returnValue = "NULL"; switch (dataColumnName) { case UseCaseDataModel.DataColumns.UseCaseId: if (data.UseCaseId != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, UseCaseDataModel.DataColumns.UseCaseId, data.UseCaseId); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, UseCaseDataModel.DataColumns.UseCaseId); } break; default: returnValue = StandardDataManager.ToSQLParameter(data, dataColumnName); break; } return(returnValue); }
public void SetData(UseCaseDataModel data) { SystemKeyId = data.UseCaseId; base.SetData(data); }
public void SetData(UseCaseDataModel item) { SystemKeyId = item.UseCaseId; base.SetData(item); }
public static UseCaseDataModel GetDetails(UseCaseDataModel data, RequestProfile requestProfile) { var list = GetEntityDetails(data, requestProfile, 1); return(list.FirstOrDefault()); }
protected override void OnInit(EventArgs e) { try { var superKey = ""; var newId = Framework.Components.Core.SystemEntityTypeDataManager.GetNextSequence("UseCase", (int)Framework.Components.DataAccess.SystemEntity.UseCase, SessionVariables.RequestProfile); var UseCasedata = new UseCaseDataModel(); var systemdevdata = new SystemDevNumbersDataModel(); systemdevdata.ApplicationUserId = SessionVariables.RequestProfile.AuditId; var dtnumbers = Framework.Components.Core.SystemDevNumbersDataManager.Search(systemdevdata, SessionVariables.RequestProfile); var rangefrom = Convert.ToInt32(dtnumbers.Rows[0][SystemDevNumbersDataModel.DataColumns.RangeFrom].ToString()); var rangeto = Convert.ToInt32(dtnumbers.Rows[0][SystemDevNumbersDataModel.DataColumns.RangeTo].ToString()); if (Request.QueryString["SuperKey"] != null) { superKey = Request.QueryString["SuperKey"].ToString(); var data = new SuperKeyDetailDataModel(); data.SuperKeyId = Convert.ToInt32(superKey); data.SystemEntityTypeId = (int)Framework.Components.DataAccess.SystemEntity.UseCase; var dt = Framework.Components.Core.SuperKeyDetailDataManager.Search(data, SessionVariables.RequestProfile); if (dt != null && dt.Rows.Count > 0) { foreach (System.Data.DataRow dr in dt.Rows) { var key = Convert.ToInt32(dr[SuperKeyDetailDataModel.DataColumns.EntityKey]); UseCasedata.UseCaseId = key; var UseCasedt = TaskTimeTracker.Components.BusinessLayer.RequirementAnalysis.UseCaseDataManager.GetDetails(UseCasedata, SessionVariables.RequestProfile); if (UseCasedt.Rows.Count == 1) { var row = UseCasedt.Rows[0]; if (Request.QueryString["Mode"].ToString().Equals("Test")) { UseCasedata.UseCaseId = GetNextValidId(rangefrom); } UseCasedata.Name = Convert.ToString(row[StandardDataModel.StandardDataColumns.Name]); UseCasedata.Description = Convert.ToString(row[StandardDataModel.StandardDataColumns.Description]); UseCasedata.SortOrder = Convert.ToInt32(row[StandardDataModel.StandardDataColumns.SortOrder]); TaskTimeTracker.Components.BusinessLayer.RequirementAnalysis.UseCaseDataManager.Create(UseCasedata, SessionVariables.RequestProfile); } } } } else if (Request.QueryString["SetId"] != null) { var key = int.Parse(Request.QueryString["SetId"]); UseCasedata.UseCaseId = key; var UseCasedt = TaskTimeTracker.Components.BusinessLayer.RequirementAnalysis.UseCaseDataManager.GetDetails(UseCasedata, SessionVariables.RequestProfile); if (UseCasedt.Rows.Count == 1) { var row = UseCasedt.Rows[0]; var newUseCasedata = new UseCaseDataModel(); if (Request.QueryString["Mode"].ToString().Equals("Test")) { newUseCasedata.UseCaseId = newId = (int)GetNextValidId(rangefrom); } newUseCasedata.Name = Convert.ToString(row[StandardDataModel.StandardDataColumns.Name]); newUseCasedata.Description = Convert.ToString(row[StandardDataModel.StandardDataColumns.Description]); newUseCasedata.SortOrder = Convert.ToInt32(row[StandardDataModel.StandardDataColumns.SortOrder]); UpdatedFKDepenedencies(key, newId); TaskTimeTracker.Components.BusinessLayer.RequirementAnalysis.UseCaseDataManager.Delete(UseCasedata, SessionVariables.RequestProfile); TaskTimeTracker.Components.BusinessLayer.RequirementAnalysis.UseCaseDataManager.Create(newUseCasedata, SessionVariables.RequestProfile); } } else if (Request.QueryString["Mode"].ToString().Equals("Renumber")) { var seed = int.Parse(Request.QueryString["Seed"].ToString()); //ApplicationVariables.Seed; var increment = int.Parse(Request.QueryString["Increment"].ToString()); //ApplicationVariables.Increment; TaskTimeTracker.Components.BusinessLayer.RequirementAnalysis.UseCaseDataManager.Renumber(seed, increment, SessionVariables.RequestProfile); } base.OnInit(e); Response.Redirect("Default.aspx?Added=true", false); } catch (Exception ex) { Response.Write(ex.Message); } }
public static DataTable Search(UseCaseDataModel data, RequestProfile requestProfile) { var list = GetEntityDetails(data, requestProfile, 0); return(list.ToDataTable()); }
private void ReBindEditableGrid() { var data = new UseCaseDataModel(); var dtUseCase = TaskTimeTracker.Components.BusinessLayer.RequirementAnalysis.UseCaseDataManager.Search(data, SessionVariables.RequestProfile); }
public static void Update(UseCaseDataModel data, RequestProfile requestProfile) { var sql = Save(data, "Update", requestProfile); DBDML.RunSQL("UseCase.Update", sql, DataStoreKey); }