public override int?Save(string action) { var data = new EntityDateRangeStateTypeDataModel(); data.EntityDateRangeStateTypeId = SystemKeyId; data.Name = Name; data.Description = Description; data.SortOrder = SortOrder; if (action == "Insert") { var dtEntityDateRangeStateType = EntityDateRangeStateTypeDataManager.DoesExist(data, SessionVariables.RequestProfile); if (dtEntityDateRangeStateType.Rows.Count == 0) { EntityDateRangeStateTypeDataManager.Create(data, SessionVariables.RequestProfile); } else { throw new Exception("Record with given ID already exists."); } } else { EntityDateRangeStateTypeDataManager.Update(data, SessionVariables.RequestProfile); } // not correct ... when doing insert, we didn't get/change the value of EntityDateRangeStateTypeID ? return(data.EntityDateRangeStateTypeId); }
protected override DataTable UpdateData() { var UpdatedData = new DataTable(); var data = new EntityDateRangeStateTypeDataModel(); UpdatedData = EntityDateRangeStateTypeDataManager.Search(data, SessionVariables.RequestProfile).Clone(); for (var i = 0; i < SelectedData.Rows.Count; i++) { data.EntityDateRangeStateTypeId = Convert.ToInt32(SelectedData.Rows[i][EntityDateRangeStateTypeDataModel.DataColumns.EntityDateRangeStateTypeId].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()); EntityDateRangeStateTypeDataManager.Update(data, SessionVariables.RequestProfile); data = new EntityDateRangeStateTypeDataModel(); data.EntityDateRangeStateTypeId = Convert.ToInt32(SelectedData.Rows[i][EntityDateRangeStateTypeDataModel.DataColumns.EntityDateRangeStateTypeId].ToString()); var dt = EntityDateRangeStateTypeDataManager.Search(data, SessionVariables.RequestProfile); if (dt.Rows.Count == 1) { UpdatedData.ImportRow(dt.Rows[0]); } } return(UpdatedData); }
private void SetupDropdown() { var isTesting = SessionVariables.IsTesting; var data = new EntityDateRangeStateTypeDataModel(); var dateRangeStateTypeData = EntityDateRangeStateTypeDataManager.GetDetails(EntityDateRangeStateTypeDataModel.Empty, SessionVariables.RequestProfile); UIHelper.LoadDropDown(dateRangeStateTypeData, drpEntityDateRangeStateTypeList, StandardDataModel.StandardDataColumns.Name, EntityDateRangeStateTypeDataModel.DataColumns.EntityDateRangeStateTypeId); if (isTesting) { drpEntityDateRangeStateTypeList.AutoPostBack = true; if (drpEntityDateRangeStateTypeList.Items.Count > 0) { if (!string.IsNullOrEmpty(txtEntityDateRangeStateTypeId.Text.Trim())) { drpEntityDateRangeStateTypeList.SelectedValue = txtEntityDateRangeStateTypeId.Text; } else { txtEntityDateRangeStateTypeId.Text = drpEntityDateRangeStateTypeList.SelectedItem.Value; } } txtEntityDateRangeStateTypeId.Visible = true; } else { if (!string.IsNullOrEmpty(txtEntityDateRangeStateTypeId.Text.Trim())) { drpEntityDateRangeStateTypeList.SelectedValue = txtEntityDateRangeStateTypeId.Text; } } }
protected override DataTable GetEntityData(int?entityKey) { var entityDateRangeStateTypedata = new EntityDateRangeStateTypeDataModel(); entityDateRangeStateTypedata.EntityDateRangeStateTypeId = entityKey; var results = EntityDateRangeStateTypeDataManager.Search(entityDateRangeStateTypedata, SessionVariables.RequestProfile); return(results); }
protected override void Update(Dictionary <string, string> values) { var data = new EntityDateRangeStateTypeDataModel(); // copies properties from values dictionary object to data object PropertyMapper.CopyProperties(data, values); EntityDateRangeStateTypeDataManager.Update(data, SessionVariables.RequestProfile); base.Update(values); }
public override void LoadDropDownListSources(string fieldName, DropDownList dropDownListControl) { base.LoadDropDownListSources(fieldName, dropDownListControl); if (fieldName.Equals("EntityDateRangeStateTypeId")) { var dateRangeStateTypedata = EntityDateRangeStateTypeDataManager.GetList(SessionVariables.RequestProfile); UIHelper.LoadDropDown(dateRangeStateTypedata, dropDownListControl, StandardDataModel.StandardDataColumns.Name, EntityDateRangeStateTypeDataModel.DataColumns.EntityDateRangeStateTypeId); } }
protected void btnDelete_Click(object sender, EventArgs e) { try { string[] deleteIndexList = DeleteIds.Split(','); foreach (string index in deleteIndexList) { var data = new EntityDateRangeStateTypeDataModel(); data.EntityDateRangeStateTypeId = int.Parse(index); EntityDateRangeStateTypeDataManager.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 entityDateRangeStateTypedata = new EntityDateRangeStateTypeDataModel(); selectedrows = EntityDateRangeStateTypeDataManager.GetDetails(entityDateRangeStateTypedata, SessionVariables.RequestProfile).Clone(); if (!string.IsNullOrEmpty(SuperKey)) { var systemEntityTypeId = (int)PrimaryEntity; var lstEntityKeys = ApplicationCommon.GetSuperKeyDetails(systemEntityTypeId, SuperKey); foreach (var entityKey in lstEntityKeys) { entityDateRangeStateTypedata.EntityDateRangeStateTypeId = entityKey; var result = EntityDateRangeStateTypeDataManager.GetDetails(entityDateRangeStateTypedata, SessionVariables.RequestProfile); selectedrows.ImportRow(result.Rows[0]); } } else { entityDateRangeStateTypedata.EntityDateRangeStateTypeId = SetId; var result = EntityDateRangeStateTypeDataManager.GetDetails(entityDateRangeStateTypedata, SessionVariables.RequestProfile); selectedrows.ImportRow(result.Rows[0]); } return(selectedrows); } catch (Exception ex) { Response.Write(ex.Message); } return(null); }
protected override void ShowData(int entityDateRangeStateTypeId) { base.ShowData(entityDateRangeStateTypeId); oDetailButtonPanel.SetId = SetId; Clear(); var data = new EntityDateRangeStateTypeDataModel(); data.EntityDateRangeStateTypeId = entityDateRangeStateTypeId; var items = EntityDateRangeStateTypeDataManager.GetEntityDetails(data, SessionVariables.RequestProfile); if (items.Count == 1) { var item = items[0]; SetData(item); oHistoryList.Setup(PrimaryEntity, entityDateRangeStateTypeId, "EntityDateRangeStateType"); } }
public void LoadData(int entityDateRangeStateTypeId, bool showId) { // clear UI Clear(); // set up parameters var data = new EntityDateRangeStateTypeDataModel(); data.EntityDateRangeStateTypeId = entityDateRangeStateTypeId; // get data var items = EntityDateRangeStateTypeDataManager.GetEntityDetails(data, SessionVariables.RequestProfile); // should only have single match -- should log exception. if (items.Count != 1) { return; } var item = items[0]; SetData(item); if (!showId) { SystemKeyId = item.EntityDateRangeStateTypeId; //PlaceHolderAuditHistory.Visible = true; // only show Audit History in case of Update page, not for Clone. oHistoryList.Setup(PrimaryEntity, entityDateRangeStateTypeId, PrimaryEntityKey); } else { CoreSystemKey.Text = String.Empty; } }
protected override DataTable GetData() { var dt = EntityDateRangeStateTypeDataManager.Search(oSearchFilter.SearchParameters, SessionVariables.RequestProfile); return(dt); }