コード例 #1
0
    protected void GrdSite_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        Label        lblId                       = (Label)GrdSite.Rows[e.RowIndex].FindControl("lblId");
        TextBox      txtName                     = (TextBox)GrdSite.Rows[e.RowIndex].FindControl("txtName");
        DropDownList ddlClinic                   = (DropDownList)GrdSite.Rows[e.RowIndex].FindControl("ddlClinic");
        TextBox      txtABN                      = (TextBox)GrdSite.Rows[e.RowIndex].FindControl("txtABN");
        TextBox      txtACN                      = (TextBox)GrdSite.Rows[e.RowIndex].FindControl("txtACN");
        TextBox      txtTFN                      = (TextBox)GrdSite.Rows[e.RowIndex].FindControl("txtTFN");
        TextBox      txtASIC                     = (TextBox)GrdSite.Rows[e.RowIndex].FindControl("txtASIC");
        CheckBox     chkIsProvider               = (CheckBox)GrdSite.Rows[e.RowIndex].FindControl("chkIsProvider");
        TextBox      txtBPay                     = (TextBox)GrdSite.Rows[e.RowIndex].FindControl("txtBPay");
        TextBox      txtBSB                      = (TextBox)GrdSite.Rows[e.RowIndex].FindControl("txtBSB");
        TextBox      txtBankAccount              = (TextBox)GrdSite.Rows[e.RowIndex].FindControl("txtBankAccount");
        TextBox      txtBankDirectDebitUserID    = (TextBox)GrdSite.Rows[e.RowIndex].FindControl("txtBankDirectDebitUserID");
        TextBox      txtBankUsername             = (TextBox)GrdSite.Rows[e.RowIndex].FindControl("txtBankUsername");
        TextBox      txtOustandingBalanceWarning = (TextBox)GrdSite.Rows[e.RowIndex].FindControl("txtOustandingBalanceWarning");
        CheckBox     chkIsPrintEPC               = (CheckBox)GrdSite.Rows[e.RowIndex].FindControl("chkIsPrintEPC");
        DropDownList ddlNumBookingMonthsToGet    = (DropDownList)GrdSite.Rows[e.RowIndex].FindControl("ddlNumBookingMonthsToGet");
        TextBox      txtFiscalYrEnd              = (TextBox)GrdSite.Rows[e.RowIndex].FindControl("txtFiscalYrEnd");


        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.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, 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));

        GrdSite.EditIndex = -1;
        FillGrid();
    }
コード例 #2
0
    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");
        }
    }