protected void GrdSite_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("Insert")) { TextBox txtName = (TextBox)GrdSite.FooterRow.FindControl("txtNewName"); DropDownList ddlClinic = (DropDownList)GrdSite.FooterRow.FindControl("ddlNewClinic"); TextBox txtABN = (TextBox)GrdSite.FooterRow.FindControl("txtNewABN"); TextBox txtACN = (TextBox)GrdSite.FooterRow.FindControl("txtNewACN"); TextBox txtTFN = (TextBox)GrdSite.FooterRow.FindControl("txtNewTFN"); TextBox txtASIC = (TextBox)GrdSite.FooterRow.FindControl("txtNewASIC"); CheckBox chkIsProvider = (CheckBox)GrdSite.FooterRow.FindControl("chkNewIsProvider"); TextBox txtBPay = (TextBox)GrdSite.FooterRow.FindControl("txtNewBPay"); TextBox txtBSB = (TextBox)GrdSite.FooterRow.FindControl("txtNewBSB"); TextBox txtBankAccount = (TextBox)GrdSite.FooterRow.FindControl("txtNewBankAccount"); TextBox txtBankDirectDebitUserID = (TextBox)GrdSite.FooterRow.FindControl("txtNewBankDirectDebitUserID"); TextBox txtBankUsername = (TextBox)GrdSite.FooterRow.FindControl("txtNewBankUsername"); TextBox txtOustandingBalanceWarning = (TextBox)GrdSite.FooterRow.FindControl("txtNewOustandingBalanceWarning"); CheckBox chkIsPrintEPC = (CheckBox)GrdSite.FooterRow.FindControl("chkNewIsPrintEPC"); DropDownList ddlNumBookingMonthsToGet = (DropDownList)GrdSite.FooterRow.FindControl("ddlNewNumBookingMonthsToGet"); TextBox txtFiscalYrEnd = (TextBox)GrdSite.FooterRow.FindControl("txtNewFiscalYrEnd"); string[] fyeParts = txtFiscalYrEnd.Text.Trim().Split(new char[] { '-' }); DateTime fye = new DateTime(2000, Convert.ToInt32(fyeParts[1]), Convert.ToInt32(fyeParts[0]), 23, 59, 59); SiteDB.Insert(Utilities.FormatName(txtName.Text), Convert.ToInt32(ddlClinic.SelectedValue), txtABN.Text, txtACN.Text, txtTFN.Text, txtASIC.Text, chkIsProvider.Checked, txtBPay.Text, txtBSB.Text, txtBankAccount.Text, txtBankDirectDebitUserID.Text, txtBankUsername.Text, Convert.ToDecimal(txtOustandingBalanceWarning.Text), chkIsPrintEPC.Checked, false, false, false, false, false, false, false, new TimeSpan(9, 0, 0), new TimeSpan(12, 0, 0), new TimeSpan(13, 0, 0), new TimeSpan(18, 0, 0), fye, Convert.ToInt32(ddlNumBookingMonthsToGet.SelectedValue)); FillGrid(); } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (GetUrlParamType() == UrlParamType.View) { Response.Redirect(UrlParamModifier.AddEdit(Request.RawUrl, "type", "edit")); } if (GetUrlParamType() == UrlParamType.Edit) { SiteDB.Update(Convert.ToInt32(lblId.Text), Utilities.FormatName(txtName.Text), Convert.ToInt32(ddlClinic.SelectedValue), txtABN.Text, txtACN.Text, txtTFN.Text, txtASIC.Text, chkIsProvider.Checked, txtBPay.Text, txtBSB.Text, txtBankAccount.Text, txtBankDirectDebitUserID.Text, txtBankUsername.Text, Convert.ToDecimal(txtOustandingBalanceWarning.Text), chkIsPrintEPC.Checked, !chkIncSunday.Checked, !chkIncMonday.Checked, !chkIncTuesday.Checked, !chkIncWednesday.Checked, !chkIncThursday.Checked, !chkIncFriday.Checked, !chkIncSaturday.Checked, GetDayStartTime(), GetLunchStartTime(), GetLunchEndTime(), GetDayEndTime(), GetFYEFromForm(), Convert.ToInt32(ddlNumBookingMonthsToGet.SelectedValue)); Response.Redirect(UrlParamModifier.AddEdit(Request.RawUrl, "type", "view")); } else if (GetUrlParamType() == UrlParamType.Add) { int id = SiteDB.Insert(Utilities.FormatName(txtName.Text), Convert.ToInt32(ddlClinic.SelectedValue), txtABN.Text, txtACN.Text, txtTFN.Text, txtASIC.Text, chkIsProvider.Checked, txtBPay.Text, txtBSB.Text, txtBankAccount.Text, txtBankDirectDebitUserID.Text, txtBankUsername.Text, Convert.ToDecimal(txtOustandingBalanceWarning.Text), chkIsPrintEPC.Checked, !chkIncSunday.Checked, !chkIncMonday.Checked, !chkIncTuesday.Checked, !chkIncWednesday.Checked, !chkIncThursday.Checked, !chkIncFriday.Checked, !chkIncSaturday.Checked, GetDayStartTime(), GetLunchStartTime(), GetLunchEndTime(), GetDayEndTime(), GetFYEFromForm(), Convert.ToInt32(ddlNumBookingMonthsToGet.SelectedValue)); string url = Request.RawUrl; url = UrlParamModifier.AddEdit(url, "type", "view"); url = UrlParamModifier.AddEdit(url, "id", id.ToString()); Response.Redirect(url); } else { HideTableAndSetErrorMessage("", "Invalid URL Parameters"); } }