protected override void ShowData(int functionalityActiveStatusId) { oDetailButtonPanel.SetId = SetId; var data = new WorkTicketDataModel(); data.WorkTicketId = functionalityActiveStatusId; var items = TaskTimeTracker.Components.Module.ApplicationDevelopment.WorkTicketDataManager.GetEntityDetails(data, SessionVariables.RequestProfile); if (items.Count == 1) { var item = items[0]; lblWorkTicketId.Text = item.WorkTicketId.ToString(); lblName.Text = item.Name; lblDescription.Text = item.Description; lblSortOrder.Text = item.SortOrder.ToString(); oUpdateInfo.LoadText(item.UpdatedDate, item.UpdatedBy, item.LastAction); oHistoryList.Setup(PrimaryEntity, functionalityActiveStatusId, "WorkTicket"); } else { Clear(); } }
public static int Create(WorkTicketDataModel data, RequestProfile requestProfile) { var sql = Save(data, "Create", requestProfile); var newId = DBDML.RunScalarSQL("WorkTicket.Insert", sql, DataStoreKey); return(Convert.ToInt32(newId)); }
public void LoadData(int functionalityActiveStatusId, bool showId) { Clear(); var data = new WorkTicketDataModel(); data.WorkTicketId = functionalityActiveStatusId; var items = TaskTimeTracker.Components.Module.ApplicationDevelopment.WorkTicketDataManager.GetEntityDetails(data, SessionVariables.RequestProfile); if (items.Count != 1) { return; } var item = items[0]; SetData(item); if (!showId) { SystemKeyId = item.WorkTicketId; oHistoryList.Setup(PrimaryEntity, functionalityActiveStatusId, PrimaryEntityKey); } else { CoreSystemKey.Text = String.Empty; } }
protected override DataTable UpdateData() { var UpdatedData = new DataTable(); var data = new WorkTicketDataModel(); UpdatedData = TaskTimeTracker.Components.Module.ApplicationDevelopment.WorkTicketDataManager.Search(data, SessionVariables.RequestProfile).Clone(); for (var i = 0; i < SelectedData.Rows.Count; i++) { data.WorkTicketId = Convert.ToInt32(SelectedData.Rows[i][WorkTicketDataModel.DataColumns.WorkTicketId].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.Module.ApplicationDevelopment.WorkTicketDataManager.Update(data, SessionVariables.RequestProfile); data = new WorkTicketDataModel(); data.WorkTicketId = Convert.ToInt32(SelectedData.Rows[i][WorkTicketDataModel.DataColumns.WorkTicketId].ToString()); var dt = TaskTimeTracker.Components.Module.ApplicationDevelopment.WorkTicketDataManager.Search(data, SessionVariables.RequestProfile); if (dt.Rows.Count == 1) { UpdatedData.ImportRow(dt.Rows[0]); } } return(UpdatedData); }
public static string Save(WorkTicketDataModel data, string action, RequestProfile requestProfile) { var sql = "EXEC "; switch (action) { case "Create": sql += "dbo.WorkTicketInsert " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId); break; case "Update": sql += "dbo.WorkTicketUpdate " + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId); break; default: break; } sql = sql + ", " + ToSQLParameter(data, WorkTicketDataModel.DataColumns.WorkTicketId) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Name) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Description) + ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.SortOrder); return(sql); }
public override int?Save(string action) { var data = new WorkTicketDataModel(); data.WorkTicketId = SystemKeyId; data.Name = Name; data.Description = Description; data.SortOrder = SortOrder; if (action == "Insert") { var dtWorkTicket = TaskTimeTracker.Components.Module.ApplicationDevelopment.WorkTicketDataManager.DoesExist(data, SessionVariables.RequestProfile); if (dtWorkTicket.Rows.Count == 0) { TaskTimeTracker.Components.Module.ApplicationDevelopment.WorkTicketDataManager.Create(data, SessionVariables.RequestProfile); } else { throw new Exception("Record with given ID already exists."); } } else { TaskTimeTracker.Components.Module.ApplicationDevelopment.WorkTicketDataManager.Update(data, SessionVariables.RequestProfile); } return(data.WorkTicketId); }
protected override void Clear() { base.Clear(); var data = new WorkTicketDataModel(); SetData(data); }
private System.Data.DataTable GetData() { // TODO: on all export pages var data = new WorkTicketDataModel(); var dt = TaskTimeTracker.Components.Module.ApplicationDevelopment.WorkTicketDataManager.Search(data, SessionVariables.RequestProfile); return(dt); }
public static DataSet GetChildren(WorkTicketDataModel data, RequestProfile requestProfile) { var sql = "EXEC dbo.WorkTicketChildrenGet" + " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) + ", " + ToSQLParameter(data, WorkTicketDataModel.DataColumns.WorkTicketId); var oDT = new Framework.Components.DataAccess.DBDataSet("Get Children", sql, DataStoreKey); return(oDT.DBDataset); }
protected override DataTable GetEntityData(int?entityKey) { var WorkTicketdata = new WorkTicketDataModel(); WorkTicketdata.WorkTicketId = entityKey; var results = TaskTimeTracker.Components.Module.ApplicationDevelopment.WorkTicketDataManager.Search(WorkTicketdata, SessionVariables.RequestProfile); return(results); }
protected override void Update(Dictionary <string, string> values) { var data = new WorkTicketDataModel(); // copies properties from values dictionary object to data object PropertyMapper.CopyProperties(data, values); TaskTimeTracker.Components.Module.ApplicationDevelopment.WorkTicketDataManager.Update(data, SessionVariables.RequestProfile); base.Update(values); }
public static bool DoesExist(WorkTicketDataModel data, RequestProfile requestProfile) { var doesExistRequest = new WorkTicketDataModel(); doesExistRequest.ApplicationId = data.ApplicationId; doesExistRequest.Name = data.Name; var list = GetEntityDetails(doesExistRequest, requestProfile, 0); return(list.Count > 0); }
public static void Delete(WorkTicketDataModel data, RequestProfile requestProfile) { const string sql = @"dbo.WorkTicketDelete "; var parameters = new { AuditId = requestProfile.AuditId , WorkTicketId = data.WorkTicketId }; using (var dataAccess = new DataAccessBase(DataStoreKey)) { dataAccess.Connection.Execute(sql, parameters, commandType: CommandType.StoredProcedure); } }
public static bool IsDeletable(WorkTicketDataModel 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 functionalityActiveStatusdata = new WorkTicketDataModel(); selectedrows = TaskTimeTracker.Components.Module.ApplicationDevelopment.WorkTicketDataManager.GetDetails(functionalityActiveStatusdata, SessionVariables.RequestProfile).Clone(); if (!string.IsNullOrEmpty(SuperKey)) { var systemEntityTypeId = (int)PrimaryEntity; var lstEntityKeys = ApplicationCommon.GetSuperKeyDetails(systemEntityTypeId, SuperKey); foreach (var entityKey in lstEntityKeys) { functionalityActiveStatusdata.WorkTicketId = entityKey; var result = TaskTimeTracker.Components.Module.ApplicationDevelopment.WorkTicketDataManager.GetDetails(functionalityActiveStatusdata, SessionVariables.RequestProfile); selectedrows.ImportRow(result.Rows[0]); } } else { functionalityActiveStatusdata.WorkTicketId = SetId; var result = TaskTimeTracker.Components.Module.ApplicationDevelopment.WorkTicketDataManager.GetDetails(functionalityActiveStatusdata, SessionVariables.RequestProfile); selectedrows.ImportRow(result.Rows[0]); } return(selectedrows); } catch (Exception ex) { Response.Write(ex.Message); } return(null); }
protected void btnDelete_Click(object sender, EventArgs e) { try { var notDeletableIds = new List <int>(); string[] deleteIndexList = DeleteIds.Split(','); if (notDeletableIds.Count == 0) { foreach (string index in deleteIndexList) { var data = new WorkTicketDataModel(); data.WorkTicketId = int.Parse(index); TaskTimeTracker.Components.Module.ApplicationDevelopment.WorkTicketDataManager.Delete(data, SessionVariables.RequestProfile); } Framework.Components.Audit.AuditHistoryDataManager.DeleteDataBySystemEntity(DeleteIds, (int)Framework.Components.DataAccess.SystemEntity.WorkTicket, SessionVariables.RequestProfile); Response.Redirect(Page.GetRouteUrl("WorkTicketEntityRoute", new { Action = "Default", SetId = true }), false); } else { var msg = String.Empty; foreach (var id in notDeletableIds) { if (!string.IsNullOrEmpty(msg)) { msg += ", <br/>"; } msg += "WorkTicketId: " + id + " has detail records"; } Response.Write(msg); } } catch (Exception ex) { Response.Write(ex.Message); } }
public static List <WorkTicketDataModel> GetEntityDetails(WorkTicketDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails) { const string sql = @"dbo.WorkTicketSearch "; var parameters = new { AuditId = requestProfile.AuditId , ApplicationId = requestProfile.ApplicationId , ApplicationMode = requestProfile.ApplicationModeId , ReturnAuditInfo = returnAuditInfo , WorkTicketId = dataQuery.WorkTicketId , Name = dataQuery.Name }; List <WorkTicketDataModel> result; using (var dataAccess = new DataAccessBase(DataStoreKey)) { result = dataAccess.Connection.Query <WorkTicketDataModel>(sql, parameters, commandType: CommandType.StoredProcedure).ToList(); } return(result); }
public static string ToSQLParameter(WorkTicketDataModel data, string dataColumnName) { var returnValue = "NULL"; switch (dataColumnName) { case WorkTicketDataModel.DataColumns.WorkTicketId: if (data.WorkTicketId != null) { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, WorkTicketDataModel.DataColumns.WorkTicketId, data.WorkTicketId); } else { returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, WorkTicketDataModel.DataColumns.WorkTicketId); } break; default: returnValue = StandardDataManager.ToSQLParameter(data, dataColumnName); break; } return(returnValue); }
public static void Update(WorkTicketDataModel data, RequestProfile requestProfile) { var sql = Save(data, "Update", requestProfile); DBDML.RunSQL("WorkTicket.Update", sql, DataStoreKey); }
public void SetData(WorkTicketDataModel data) { SystemKeyId = data.WorkTicketId; base.SetData(data); }
public static DataTable Search(WorkTicketDataModel data, RequestProfile requestProfile) { var list = GetEntityDetails(data, requestProfile, 0); return(list.ToDataTable()); }
public static WorkTicketDataModel GetDetails(WorkTicketDataModel data, RequestProfile requestProfile) { var list = GetEntityDetails(data, requestProfile, 1); return(list.FirstOrDefault()); }