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