Ejemplo n.º 1
0
    protected void GrdOrganisation_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        Label        lblId     = (Label)GrdOrganisation.Rows[e.RowIndex].FindControl("lblId");
        DropDownList ddlParent = (DropDownList)GrdOrganisation.Rows[e.RowIndex].FindControl("ddlParent");
        DropDownList ddlUseParentOffernigPrices = (DropDownList)GrdOrganisation.Rows[e.RowIndex].FindControl("ddlUseParentOffernigPrices");
        TextBox      txtName         = (TextBox)GrdOrganisation.Rows[e.RowIndex].FindControl("txtName");
        DropDownList ddlType         = (DropDownList)GrdOrganisation.Rows[e.RowIndex].FindControl("ddlType");
        DropDownList ddlCustType     = (DropDownList)GrdOrganisation.Rows[e.RowIndex].FindControl("ddlCustType");
        TextBox      txtABN          = (TextBox)GrdOrganisation.Rows[e.RowIndex].FindControl("txtABN");
        TextBox      txtACN          = (TextBox)GrdOrganisation.Rows[e.RowIndex].FindControl("txtACN");
        TextBox      txtBPayAccount  = (TextBox)GrdOrganisation.Rows[e.RowIndex].FindControl("txtBPayAccount");
        DropDownList ddlServiceCycle = (DropDownList)GrdOrganisation.Rows[e.RowIndex].FindControl("ddlServiceCycle");
        DropDownList ddlIsDebtor     = (DropDownList)GrdOrganisation.Rows[e.RowIndex].FindControl("ddlIsDebtor");
        DropDownList ddlIsCreditor   = (DropDownList)GrdOrganisation.Rows[e.RowIndex].FindControl("ddlIsCreditor");
        DropDownList ddlFreeServices = (DropDownList)GrdOrganisation.Rows[e.RowIndex].FindControl("ddlFreeServices");
        TextBox      txtStartDate    = (TextBox)GrdOrganisation.Rows[e.RowIndex].FindControl("txtStartDate");
        TextBox      txtEndDate      = (TextBox)GrdOrganisation.Rows[e.RowIndex].FindControl("txtEndDate");


        Organisation org = OrganisationDB.GetByID(Convert.ToInt32(lblId.Text));

        UrlParamType urlParamType = GetUrlParamType();
        int          orgTypeID    = Convert.ToInt32(ddlType.SelectedValue);

        if (urlParamType == UrlParamType.Clinic)
        {
            orgTypeID = 218;
        }

        DateTime startDate = GetDate(txtStartDate.Text.Trim());
        DateTime endDate   = GetDate(txtEndDate.Text.Trim());

        if (urlParamType == UrlParamType.External)
        {
            if (urlParamType == UrlParamType.External && IsValidFormOrgTypeIDs() && GetFormOrgTypeIDs() == "191")
            {
                OrganisationDB.UpdateExtOrg(Convert.ToInt32(lblId.Text), Convert.ToInt32(GetFormOrgTypeIDs()), txtName.Text, txtACN.Text, txtABN.Text, DateTime.Now,
                                            org.IsDebtor, org.IsCreditor, org.BpayAccount, org.Comment);
            }
            else
            {
                OrganisationDB.Update(Convert.ToInt32(lblId.Text), Convert.ToInt32(ddlParent.SelectedValue), org.UseParentOffernigPrices, Convert.ToInt32(ddlType.SelectedValue), Convert.ToInt32(ddlCustType.SelectedValue), txtName.Text,

                                      org.Acn, org.Abn, org.IsDebtor, org.IsCreditor, org.BpayAccount, org.WeeksPerServiceCycle, org.StartDate, org.EndDate, org.Comment, org.FreeServices,
                                      //txtACN.Text, txtABN.Text,
                                      //Convert.ToBoolean(ddlIsDebtor.SelectedValue), Convert.ToBoolean(ddlIsCreditor.SelectedValue), txtBPayAccount.Text, Convert.ToInt32(ddlServiceCycle.SelectedValue),
                                      //org.StartDate, org.EndDate, org.Comment, Convert.ToInt32(ddlFreeServices.SelectedValue),

                                      org.ExclSun, org.ExclMon, org.ExclTue, org.ExclWed, org.ExclThu, org.ExclFri, org.ExclSat,
                                      org.SunStartTime, org.SunEndTime,
                                      org.MonStartTime, org.MonEndTime,
                                      org.TueStartTime, org.TueEndTime,
                                      org.WedStartTime, org.WedEndTime,
                                      org.ThuStartTime, org.ThuEndTime,
                                      org.FriStartTime, org.FriEndTime,
                                      org.SatStartTime, org.SatEndTime,
                                      org.SunLunchStartTime, org.SunLunchEndTime,
                                      org.MonLunchStartTime, org.MonLunchEndTime,
                                      org.TueLunchStartTime, org.TueLunchEndTime,
                                      org.WedLunchStartTime, org.WedLunchEndTime,
                                      org.ThuLunchStartTime, org.ThuLunchEndTime,
                                      org.FriLunchStartTime, org.FriLunchEndTime,
                                      org.SatLunchStartTime, org.SatLunchEndTime,
                                      org.LastBatchRun);
            }
        }
        else
        {
            OrganisationDB.Update(Convert.ToInt32(lblId.Text), Convert.ToInt32(ddlParent.SelectedValue), Convert.ToBoolean(ddlUseParentOffernigPrices.SelectedValue), Convert.ToInt32(ddlType.SelectedValue), Convert.ToInt32(ddlCustType.SelectedValue), txtName.Text, txtACN.Text, txtABN.Text,
                                  org.IsDebtor, org.IsCreditor, txtBPayAccount.Text, Convert.ToInt32(ddlServiceCycle.SelectedValue),
                                  startDate, endDate, org.Comment, Convert.ToInt32(ddlFreeServices.SelectedValue),
                                  org.ExclSun, org.ExclMon, org.ExclTue, org.ExclWed, org.ExclThu, org.ExclFri, org.ExclSat,
                                  org.SunStartTime, org.SunEndTime,
                                  org.MonStartTime, org.MonEndTime,
                                  org.TueStartTime, org.TueEndTime,
                                  org.WedStartTime, org.WedEndTime,
                                  org.ThuStartTime, org.ThuEndTime,
                                  org.FriStartTime, org.FriEndTime,
                                  org.SatStartTime, org.SatEndTime,
                                  org.SunLunchStartTime, org.SunLunchEndTime,
                                  org.MonLunchStartTime, org.MonLunchEndTime,
                                  org.TueLunchStartTime, org.TueLunchEndTime,
                                  org.WedLunchStartTime, org.WedLunchEndTime,
                                  org.ThuLunchStartTime, org.ThuLunchEndTime,
                                  org.FriLunchStartTime, org.FriLunchEndTime,
                                  org.SatLunchStartTime, org.SatLunchEndTime, org.LastBatchRun);
        }


        GrdOrganisation.EditIndex = -1;
        FillGrid();
    }