protected void btnOK_Click(object sender, EventArgs e)
    {
        int ParcelId = Convert.ToInt16(Request.QueryString["ParcelId"].ToString());
        ParcelsManager pManager = new ParcelsManager(this);
        Parcel originalParcel = pManager.GetParcel(ParcelId, Company.CompanyId);
        Parcel parcel = pManager.GetParcel(ParcelId, Company.CompanyId);
        parcel.EffectedAmount = Convert.ToDecimal(txtEffectedAmount.Text);
        parcel.EffectedDate = Convert.ToDateTime(txtEffectedDate.Text);

        try
        {
            pManager.Update(originalParcel, parcel);
        }
        catch (Exception ex)
        {
            throw ex;
        }

        if (chkRecurrent.Checked)
        {
            parcel.IsRecurrent = true;
            if (RadioButton1.Checked)
                parcel.RecurrentPeriod = 7;
            else if (RadioButton2.Checked)
                parcel.RecurrentPeriod = 15;
            else if (RadioButton3.Checked)
                parcel.RecurrentPeriod = 30;
            else
                parcel.RecurrentPeriod = 365;

            pManager.Insert(parcel, new FinancierCondition());
        }

        Page.ClientScript.RegisterStartupScript(this.GetType(), "modal", "top.$.modal.Hide();", true);
    }
示例#2
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        int            ParcelId       = Convert.ToInt16(Request.QueryString["ParcelId"].ToString());
        ParcelsManager pManager       = new ParcelsManager(this);
        Parcel         originalParcel = pManager.GetParcel(ParcelId, Company.CompanyId);
        Parcel         parcel         = pManager.GetParcel(ParcelId, Company.CompanyId);

        parcel.EffectedAmount = Convert.ToDecimal(txtEffectedAmount.Text);
        parcel.EffectedDate   = Convert.ToDateTime(txtEffectedDate.Text);

        try
        {
            pManager.Update(originalParcel, parcel);
        }
        catch (Exception ex)
        {
            throw ex;
        }

        if (chkRecurrent.Checked)
        {
            parcel.IsRecurrent = true;
            if (RadioButton1.Checked)
            {
                parcel.RecurrentPeriod = 7;
            }
            else if (RadioButton2.Checked)
            {
                parcel.RecurrentPeriod = 15;
            }
            else if (RadioButton3.Checked)
            {
                parcel.RecurrentPeriod = 30;
            }
            else
            {
                parcel.RecurrentPeriod = 365;
            }

            pManager.Insert(parcel, new FinancierCondition());
        }

        Page.ClientScript.RegisterStartupScript(this.GetType(), "modal", "top.$.modal.Hide();", true);
    }
示例#3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int            ParcelId = Convert.ToInt16(Request.QueryString["ParcelId"].ToString());
            ParcelsManager pManager = new ParcelsManager(this);
            Parcel         parcel   = pManager.GetParcel(ParcelId, Company.CompanyId);
            txtEffectedAmount.Text = parcel.Amount.ToString();
            txtEffectedDate.Text   = DateTime.Today.ToShortDateString().Replace("00:00:00", "");
            if (Request.QueryString["Mode"] != null)
            {
                pnlAccount.Visible = true;
                cboAccount.DataBind();

                if (parcel.RecurrentPeriod == 7)
                {
                    RadioButton1.Checked = true;
                }
                else if (parcel.RecurrentPeriod == 15)
                {
                    RadioButton2.Checked = true;
                }
                else if (parcel.RecurrentPeriod == 30)
                {
                    RadioButton3.Checked = true;
                }
                else if (parcel.RecurrentPeriod == 365)
                {
                    RadioButton4.Checked = true;
                }

                if (Convert.ToBoolean(parcel.IsRecurrent))
                {
                    chkRecurrent.Checked = true;
                    lblRecurrent.Visible = chkRecurrent.Checked;
                    RadioButton1.Visible = chkRecurrent.Checked;
                    RadioButton2.Visible = chkRecurrent.Checked;
                    RadioButton3.Visible = chkRecurrent.Checked;
                    RadioButton4.Visible = chkRecurrent.Checked;
                }
            }
        }
    }
示例#4
0
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        var      parcelsManager = new ParcelsManager(this);
        Parcel   parcel;
        CheckBox registered;

        foreach (GridViewRow row in grdAccountRegister.Rows)
        {
            var parcelId = (Int32)grdAccountRegister.DataKeys[row.RowIndex]["ParcelId"];
            registered = (row.Cells[0].Controls[1] as CheckBox);

            if (registered != null)
            {
                if (registered.Checked)
                {
                    parcel = parcelsManager.GetParcel(parcelId, Company.CompanyId);
                    if (parcel == null)
                    {
                        return;
                    }

                    var ucDtDateMov = (row.Cells[4].Controls[3] as Date);

                    parcel.EffectedAmount = parcel.Amount;

                    parcel.OperationDate = parcel.DueDate;
                    parcel.OperationDate = ucDtDateMov.DateTime;

                    parcel.AccountId = Convert.ToInt32(cboAccount.SelectedValue);
                    parcelsManager.Update(parcel, parcel);
                }
            }
        }
        grdAccountRegister.DataBind();
        CalculateBalance();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int ParcelId = Convert.ToInt16(Request.QueryString["ParcelId"].ToString());
            ParcelsManager pManager = new ParcelsManager(this);
            Parcel parcel = pManager.GetParcel(ParcelId, Company.CompanyId);
            txtEffectedAmount.Text = parcel.Amount.ToString();
            txtEffectedDate.Text = DateTime.Today.ToShortDateString().Replace("00:00:00", "");
            if (Request.QueryString["Mode"] != null)
            {
                pnlAccount.Visible = true;
                cboAccount.DataBind();

                if (parcel.RecurrentPeriod == 7)
                    RadioButton1.Checked = true;
                else if (parcel.RecurrentPeriod == 15)
                    RadioButton2.Checked = true;
                else if (parcel.RecurrentPeriod == 30)
                    RadioButton3.Checked = true;
                else if (parcel.RecurrentPeriod == 365)
                    RadioButton4.Checked = true;

                if (Convert.ToBoolean(parcel.IsRecurrent))
                {
                    chkRecurrent.Checked = true;
                    lblRecurrent.Visible = chkRecurrent.Checked;
                    RadioButton1.Visible = chkRecurrent.Checked;
                    RadioButton2.Visible = chkRecurrent.Checked;
                    RadioButton3.Visible = chkRecurrent.Checked;
                    RadioButton4.Visible = chkRecurrent.Checked;
                }

            }
        }
    }
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        var parcelsManager = new ParcelsManager(this);
        Parcel parcel;
        CheckBox registered;

        foreach (GridViewRow row in grdAccountRegister.Rows)
        {
            var parcelId = (Int32)grdAccountRegister.DataKeys[row.RowIndex]["ParcelId"];
            registered = (row.Cells[0].Controls[1] as CheckBox);

            if (registered != null)
                if (registered.Checked)
                {
                    parcel = parcelsManager.GetParcel(parcelId, Company.CompanyId);
                    if (parcel == null)
                        return;

                    var ucDtDateMov = (row.Cells[4].Controls[3] as Date);

                    parcel.EffectedAmount = parcel.Amount;

                    parcel.OperationDate = parcel.DueDate;
                    parcel.OperationDate = ucDtDateMov.DateTime;

                    parcel.AccountId = Convert.ToInt32(cboAccount.SelectedValue);
                    parcelsManager.Update(parcel, parcel);
                }
        }
        grdAccountRegister.DataBind();
        CalculateBalance();
    }