Exemplo n.º 1
0
    private void ValidateData(ETaxEmpPlaceOfResidence obj, PageErrors errors)
    {
        DBFilter overlapCheckingFilter = new DBFilter();

        overlapCheckingFilter.add(new Match("TaxEmpID", obj.TaxEmpID));
        if (obj.TaxEmpPlaceID > 0)
        {
            overlapCheckingFilter.add(new Match("TaxEmpPlaceID", "<>", obj.TaxEmpPlaceID));
        }
        overlapCheckingFilter.add(new Match("TaxEmpPlacePeriodTo", ">=", obj.TaxEmpPlacePeriodFr));
        overlapCheckingFilter.add(new Match("TaxEmpPlacePeriodFr", "<=", obj.TaxEmpPlacePeriodTo));

        if (ETaxEmpPlaceOfResidence.db.count(dbConn, overlapCheckingFilter) > 0)
        {
            errors.addError(HROne.Translation.PageErrorMessage.ERROR_INCORRECT_DATE_RANGE);
        }
        else
        {
            if (obj.TaxEmpPlacePeriodFr > obj.TaxEmpPlacePeriodTo)
            {
                errors.addError(HROne.Translation.PageErrorMessage.ERROR_INCORRECT_DATE_RANGE);
                return;
            }
            ETaxEmp taxEmp = new ETaxEmp();
            taxEmp.TaxEmpID = obj.TaxEmpID;
            if (ETaxEmp.db.select(dbConn, taxEmp))
            {
                if (taxEmp.TaxEmpStartDate > obj.TaxEmpPlacePeriodFr || taxEmp.TaxEmpEndDate < obj.TaxEmpPlacePeriodTo)
                {
                    errors.addError(HROne.Translation.PageErrorMessage.ERROR_INCORRECT_DATE_RANGE);
                }
            }
        }
    }
Exemplo n.º 2
0
    protected void Delete_Click(object sender, EventArgs e)
    {
        ArrayList list = new ArrayList();

        foreach (DataListItem item in Repeater.Items)
        {
            CheckBox        c = (CheckBox)item.FindControl("DeleteItem");
            HtmlInputHidden h = (HtmlInputHidden)item.FindControl("TaxEmpPlaceID");
            if (c.Checked)
            {
                ETaxEmpPlaceOfResidence obj = new ETaxEmpPlaceOfResidence();
                obj.TaxEmpPlaceID = Int32.Parse(h.Value);
                list.Add(obj);
            }
        }

        ETaxEmp taxEmp = new ETaxEmp();

        taxEmp.TaxEmpID = int.Parse(TaxEmpID.Value);
        if (ETaxEmp.db.select(dbConn, taxEmp))
        {
            WebUtils.StartFunction(Session, FUNCTION_CODE, taxEmp.EmpID);
            foreach (ETaxEmpPlaceOfResidence obj in list)
            {
                if (db.select(dbConn, obj))
                {
                    db.delete(dbConn, obj);
                }
            }
            WebUtils.EndFunction(dbConn);
        }
        view = loadData(info, db, Repeater);
    }
Exemplo n.º 3
0
    protected void Add_Click(object sender, EventArgs e)
    {
        Repeater.EditItemIndex = -1;
        ETaxEmpPlaceOfResidence c = new ETaxEmpPlaceOfResidence();

        Hashtable values = new Hashtable();

        newBinding.toValues(values);

        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();


        db.validate(errors, values);

        if (!errors.isEmpty())
        {
            return;
        }


        db.parse(values, c);

        ValidateData(c, errors);

        if (!errors.isEmpty())
        {
            return;
        }

        ETaxEmp taxEmp = new ETaxEmp();

        taxEmp.TaxEmpID = c.TaxEmpID;
        if (ETaxEmp.db.select(dbConn, taxEmp))
        {
            WebUtils.StartFunction(Session, FUNCTION_CODE, taxEmp.EmpID);
            db.insert(dbConn, c);
            WebUtils.EndFunction(dbConn);
        }
        TaxEmpPlaceAddress.Text          = string.Empty;
        TaxEmpPlaceEERent.Text           = string.Empty;
        TaxEmpPlaceEERentRefunded.Text   = string.Empty;
        TaxEmpPlaceERRent.Text           = string.Empty;
        TaxEmpPlaceERRentByEE.Text       = string.Empty;
        TaxEmpPlaceNature.Text           = string.Empty;
        TaxEmpPlacePeriodFr.TextBox.Text = string.Empty;
        TaxEmpPlacePeriodTo.TextBox.Text = string.Empty;

        loadObject();
        view = loadData(info, db, Repeater);
    }
Exemplo n.º 4
0
    protected void Repeater_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        ETaxEmpPlaceOfResidence obj = new ETaxEmpPlaceOfResidence();

        db.toObject(((DataRowView)e.Item.DataItem).Row, obj);

        if (e.Item.ItemIndex == Repeater.EditItemIndex)
        {
            ebinding = new Binding(dbConn, db);

            ebinding.add((HtmlInputHidden)e.Item.FindControl("TaxEmpPlaceID"));
            ebinding.add((TextBox)e.Item.FindControl("TaxEmpPlaceAddress"));
            ebinding.add((TextBox)e.Item.FindControl("TaxEmpPlaceNature"));
            ebinding.add(new TextBoxBinder(db, ((WebDatePicker)e.Item.FindControl("TaxEmpPlacePeriodFr")).TextBox, "TaxEmpPlacePeriodFr"));
            ebinding.add(new TextBoxBinder(db, ((WebDatePicker)e.Item.FindControl("TaxEmpPlacePeriodTo")).TextBox, "TaxEmpPlacePeriodTo"));
            ebinding.add((TextBox)e.Item.FindControl("TaxEmpPlaceERRent"));
            ebinding.add((TextBox)e.Item.FindControl("TaxEmpPlaceEERent"));
            ebinding.add((TextBox)e.Item.FindControl("TaxEmpPlaceEERentRefunded"));
            ebinding.add((TextBox)e.Item.FindControl("TaxEmpPlaceERRentByEE"));



            ebinding.init(Request, Session);

            Hashtable values = new Hashtable();
            db.populate(obj, values);

            ebinding.toControl(values);
        }
        else
        {
            DataRowView row = (DataRowView)e.Item.DataItem;
            CheckBox    cb  = (CheckBox)e.Item.FindControl("DeleteItem");
            WebFormUtils.LoadKeys(db, row, cb);
            cb.Visible = IsAllowEdit;
            ((Button)e.Item.FindControl("Edit")).Visible = IsAllowEdit;
            HtmlInputHidden h = (HtmlInputHidden)e.Item.FindControl("TaxEmpPlaceID");
            h.Value = ((DataRowView)e.Item.DataItem)["TaxEmpPlaceID"].ToString();
        }
        HROne.Common.WebUtility.WebControlsLocalization(Session, e.Item.Controls);
    }
Exemplo n.º 5
0
    protected void Repeater_ItemCommand(object source, DataListCommandEventArgs e)
    {
        Button b = (Button)e.CommandSource;



        if (b.ID.Equals("Edit"))
        {
            Repeater.EditItemIndex = e.Item.ItemIndex;
            view = loadData(info, db, Repeater);
            WebUtils.SetEnabledControlSection(TaxEmpPoRAddPanel, false);
        }
        else if (b.ID.Equals("Cancel"))
        {
            Repeater.EditItemIndex = -1;
            view = loadData(info, db, Repeater);
            WebUtils.SetEnabledControlSection(TaxEmpPoRAddPanel, true);
        }
        else if (b.ID.Equals("Save"))
        {
            ebinding = new Binding(dbConn, db);

            ebinding.add(TaxEmpID);
            ebinding.add((HtmlInputHidden)e.Item.FindControl("TaxEmpPlaceID"));
            ebinding.add((TextBox)e.Item.FindControl("TaxEmpPlaceAddress"));
            ebinding.add((TextBox)e.Item.FindControl("TaxEmpPlaceNature"));
            ebinding.add(new TextBoxBinder(db, ((WebDatePicker)e.Item.FindControl("TaxEmpPlacePeriodFr")).TextBox, "TaxEmpPlacePeriodFr"));
            ebinding.add(new TextBoxBinder(db, ((WebDatePicker)e.Item.FindControl("TaxEmpPlacePeriodTo")).TextBox, "TaxEmpPlacePeriodTo"));
            ebinding.add((TextBox)e.Item.FindControl("TaxEmpPlaceERRent"));
            ebinding.add((TextBox)e.Item.FindControl("TaxEmpPlaceEERent"));
            ebinding.add((TextBox)e.Item.FindControl("TaxEmpPlaceEERentRefunded"));
            ebinding.add((TextBox)e.Item.FindControl("TaxEmpPlaceERRentByEE"));

            ebinding.init(Request, Session);


            ETaxEmpPlaceOfResidence obj = new ETaxEmpPlaceOfResidence();
            Hashtable values            = new Hashtable();

            PageErrors errors = PageErrors.getErrors(db, Page.Master);
            errors.clear();


            ebinding.toValues(values);
            db.validate(errors, values);

            if (!errors.isEmpty())
            {
                return;
            }

            db.parse(values, obj);

            ValidateData(obj, errors);

            if (!errors.isEmpty())
            {
                return;
            }

            ETaxEmp taxEmp = new ETaxEmp();
            taxEmp.TaxEmpID = obj.TaxEmpID;
            if (ETaxEmp.db.select(dbConn, taxEmp))
            {
                WebUtils.StartFunction(Session, FUNCTION_CODE, taxEmp.EmpID);
                db.update(dbConn, obj);
                WebUtils.EndFunction(dbConn);
            }
            Repeater.EditItemIndex = -1;
            view = loadData(info, db, Repeater);
            WebUtils.SetEnabledControlSection(TaxEmpPoRAddPanel, true);
        }
    }