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