private void LoadSearchData() { hdnGridRowSelectedPrvious.Value = null; tdGrid.Visible = true; btnSave.Visible = true; //set gridview panel height PnlGrid.Style.Add("height", hdnGridPnlHeight.Value); SetFromToDates(); royCostsBL = new RoyaltorCostsBL(); DataSet gridData = royCostsBL.GetSearchData(txtRoyaltor.Text.Split('-')[0].ToString(), ddlStmtPeriod.SelectedValue, fromDate, toDate, out errorId); royCostsBL = null; if (gridData.Tables.Count != 0 && errorId != 2) { if (gridData.Tables[0].Rows.Count == 0) { gvRoyCosts.DataSource = gridData.Tables[0]; gvRoyCosts.EmptyDataText = "No data found for the selected filter criteria"; gvRoyCosts.DataBind(); } else { gvRoyCosts.DataSource = gridData.Tables[0]; gvRoyCosts.DataBind(); } Session["RoyCostsGridDataInitial"] = gridData.Tables[0]; Session["RoyCostsGridData"] = gridData.Tables[0]; } else if (gridData.Tables.Count == 0 && errorId != 2) { dtEmpty = new DataTable(); gvRoyCosts.DataSource = dtEmpty; gvRoyCosts.EmptyDataText = "No data found for the selected filter criteria"; gvRoyCosts.DataBind(); } else { ExceptionHandler("Error in loading grid data.", string.Empty); } UserAuthorization(); }
private void LoadStmtPeriodData(string royaltorId) { royCostsBL = new RoyaltorCostsBL(); DataSet stmtPeriods = royCostsBL.GetStmtPeriods(royaltorId, out errorId); royCostsBL = null; if (stmtPeriods.Tables.Count != 0 && errorId != 2) { ddlStmtPeriod.DataTextField = "stmt_period"; ddlStmtPeriod.DataValueField = "statement_period_id"; ddlStmtPeriod.DataSource = stmtPeriods.Tables[0]; ddlStmtPeriod.DataBind(); ddlStmtPeriod.Items.Insert(0, new ListItem("-")); } else { ExceptionHandler("Error in loading statement periods.", string.Empty); } }
private void PopulateDropDowns() { royCostsBL = new RoyaltorCostsBL(); DataSet dropdownListData = royCostsBL.GetDropDownData(out errorId); royCostsBL = null; if (dropdownListData.Tables.Count != 0 && errorId != 2) { Session["RoyCostsAccountType"] = dropdownListData.Tables[0];//used in appending row to grid ddlAccTypeAdd.DataTextField = "account_type_desc"; ddlAccTypeAdd.DataValueField = "type_id"; ddlAccTypeAdd.DataSource = dropdownListData.Tables[0]; ddlAccTypeAdd.DataBind(); ddlAccTypeAdd.Items.Insert(0, new ListItem("-")); LoadInitialStmtPeriod(); } else { ExceptionHandler("Error in fetching royaltors", string.Empty); } }
protected void btnSave_Click(object sender, EventArgs e) { try { if (txtRoyaltor.Text == string.Empty || txtRoyaltor.Text == "No results found" || hdnRoyaltorSelected.Value == "N") { msgView.SetMessage("Cost details not saved – Please select a valid royaltor from the list", MessageType.Warning, PositionType.Auto); txtRoyaltor.Text = string.Empty; LoadInitialStmtPeriod(); return; } //validate date fields Page.Validate("valSearch"); if (!Page.IsValid) { msgView.SetMessage("Cost details not saved – invalid or missing data!", MessageType.Warning, PositionType.Auto); return; } string userCode = Convert.ToString(Session["UserCode"]); Array costSaveList = CostDetailsList(); SetFromToDates(); royCostsBL = new RoyaltorCostsBL(); DataSet gridData = royCostsBL.SaveCost(txtRoyaltor.Text.Split('-')[0].ToString(), ddlStmtPeriod.SelectedValue, fromDate, toDate, userCode, costSaveList, out errorId); royCostsBL = null; if (gridData.Tables.Count != 0 && errorId != 2) { if (gridData.Tables[0].Rows.Count == 0) { gvRoyCosts.DataSource = gridData.Tables[0]; gvRoyCosts.EmptyDataText = "No data found for the selected filter criteria."; gvRoyCosts.DataBind(); } else { gvRoyCosts.DataSource = gridData.Tables[0]; gvRoyCosts.DataBind(); } Session["RoyCostsGridDataInitial"] = gridData.Tables[0]; Session["RoyCostsGridData"] = gridData.Tables[0]; } else if (gridData.Tables.Count == 0 && errorId != 2) { dtEmpty = new DataTable(); gvRoyCosts.DataSource = dtEmpty; gvRoyCosts.EmptyDataText = "No data found for the selected filter criteria."; gvRoyCosts.DataBind(); } else { ExceptionHandler("Error in updating cost data.", string.Empty); } ClearAddRowFields(); } catch (Exception ex) { ExceptionHandler("Error in saving cost data.", ex.Message); } }