Пример #1
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("EmpWorkingSummaryID");
            if (c.Checked)
            {
                EEmpWorkingSummary obj = new EEmpWorkingSummary();
                obj.EmpWorkingSummaryID = Int32.Parse(h.Value);
                list.Add(obj);
            }
        }
        WebUtils.StartFunction(Session, FUNCTION_CODE, CurID);
        foreach (EEmpWorkingSummary obj in list)
        {
            if (db.select(dbConn, obj))
            {
                db.delete(dbConn, obj);
            }
        }
        WebUtils.EndFunction(dbConn);
        loadData(info, db, Repeater);
    }
        public override void ImportToDatabase()
        {
            DataTable dataTable = GetImportDataFromTempDatabase(null);

            if (dataTable.Rows.Count > 0)
            {
                foreach (DataRow row in dataTable.Rows)
                {
                    EUploadEmpWorkingSummary obj = new EUploadEmpWorkingSummary();
                    tempDB.toObject(row, obj);

                    EEmpWorkingSummary empWorkingSummary;
                    DBFilter           dbFilter = new DBFilter();
                    dbFilter.add(new Match("EmpID", obj.EmpID));
                    dbFilter.add(new Match("EmpWorkingSummaryAsOfDate", obj.EmpWorkingSummaryAsOfDate));
                    ArrayList empWorkingSummaryList = EEmpWorkingSummary.db.select(dbConn, dbFilter);
                    if (empWorkingSummaryList.Count > 0)
                    {
                        empWorkingSummary = (EEmpWorkingSummary)empWorkingSummaryList[0];
                    }
                    else
                    {
                        empWorkingSummary = new EEmpWorkingSummary();
                    }

                    empWorkingSummary.EmpID = obj.EmpID;
                    empWorkingSummary.EmpWorkingSummaryAsOfDate            = obj.EmpWorkingSummaryAsOfDate;
                    empWorkingSummary.EmpWorkingSummaryRestDayEntitled     = obj.EmpWorkingSummaryRestDayEntitled;
                    empWorkingSummary.EmpWorkingSummaryRestDayTaken        = obj.EmpWorkingSummaryRestDayTaken;
                    empWorkingSummary.EmpWorkingSummaryTotalWorkingDays    = obj.EmpWorkingSummaryTotalWorkingDays;
                    empWorkingSummary.EmpWorkingSummaryTotalWorkingHours   = obj.EmpWorkingSummaryTotalWorkingHours;
                    empWorkingSummary.EmpWorkingSummaryTotalLunchTimeHours = obj.EmpWorkingSummaryTotalLunchTimeHours;

                    if (empWorkingSummary.EmpWorkingSummaryID > 0)
                    {
                        EEmpWorkingSummary.db.update(dbConn, empWorkingSummary);
                    }
                    else
                    {
                        EEmpWorkingSummary.db.insert(dbConn, empWorkingSummary);
                    }

                    tempDB.delete(dbConn, obj);
                }
            }
        }
Пример #3
0
    protected void Add_Click(object sender, EventArgs e)
    {
        Repeater.EditItemIndex = -1;
        EEmpWorkingSummary c = new EEmpWorkingSummary();

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

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

        WebUtils.StartFunction(Session, FUNCTION_CODE, c.EmpID);
        db.insert(dbConn, c);
        WebUtils.EndFunction(dbConn);


        EmpWorkingSummaryAsOfDate.Value           = string.Empty;
        EmpWorkingSummaryRestDayEntitled.Text     = string.Empty;
        EmpWorkingSummaryRestDayTaken.Text        = string.Empty;
        EmpWorkingSummaryTotalWorkingDays.Text    = string.Empty;
        EmpWorkingSummaryTotalWorkingHours.Text   = string.Empty;
        EmpWorkingSummaryTotalLunchTimeHours.Text = string.Empty;


        loadData(info, db, Repeater);
    }
Пример #4
0
    protected void Repeater_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        Binding ebinding;

        EEmpWorkingSummary obj = new EEmpWorkingSummary();

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

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



            ebinding.add(new TextBoxBinder(db, ((WebDatePicker)e.Item.FindControl("EmpWorkingSummaryAsOfDate")).TextBox, "EmpWorkingSummaryAsOfDate"));
            ebinding.add((HtmlInputHidden)e.Item.FindControl("EmpWorkingSummaryID"));
            ebinding.add((TextBox)e.Item.FindControl("EmpWorkingSummaryRestDayEntitled"));
            ebinding.add((TextBox)e.Item.FindControl("EmpWorkingSummaryRestDayTaken"));
            ebinding.add((TextBox)e.Item.FindControl("EmpWorkingSummaryTotalWorkingDays"));
            ebinding.add((TextBox)e.Item.FindControl("EmpWorkingSummaryTotalWorkingHours"));
            ebinding.add((TextBox)e.Item.FindControl("EmpWorkingSummaryTotalLunchTimeHours"));



            ebinding.init(Request, Session);

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

            ebinding.toControl(values);
        }
        else
        {
            ((Button)e.Item.FindControl("Edit")).Visible         = IsAllowEdit;
            ((CheckBox)e.Item.FindControl("DeleteItem")).Visible = IsAllowEdit;
            HtmlInputHidden h = (HtmlInputHidden)e.Item.FindControl("EmpWorkingSummaryID");
            h.Value = ((DataRowView)e.Item.DataItem)["EmpWorkingSummaryID"].ToString();
        }

        HROne.Common.WebUtility.WebControlsLocalization(this, e.Item.Controls);
    }
Пример #5
0
    protected void Repeater_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        EEmpWorkingSummary obj = new EEmpWorkingSummary();

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

        if (e.Item.ItemIndex == Repeater.EditItemIndex)
        {
            //ebinding = new Binding(dbConn, db);
            //ebinding.add((TextBox)e.Item.FindControl("EmpWorkingSummaryAsOfDate"));
            //ebinding.add((TextBox)e.Item.FindControl("CNDAmount"));
            //ebinding.add((TextBox)e.Item.FindControl("EmpWorkingSummaryRestDayEntitled"));

            //DBFilter filter = new DBFilter();
            //filter.add(new Match("EmpID", obj.EmpID));
            //ebinding.add(new DropDownVLBinder(db, (DropDownList)e.Item.FindControl("EmpAccID"), EEmpBankAccount.VLBankAccount, filter));



            //ebinding.init(Request, Session);

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

            //ebinding.toControl(values);
        }
        else
        {
            //((Button)e.Item.FindControl("Edit")).Visible = IsAllowEdit;
            //if (obj.PayRecID != null)
            //{
            //    ((Button)e.Item.FindControl("Edit")).Visible = false;
            //    ((CheckBox)e.Item.FindControl("DeleteItem")).Visible = false;
            //}
            //HtmlInputHidden h = (HtmlInputHidden)e.Item.FindControl("UploadWorkingEmpSummaryID");
            //h.Value = ((DataRowView)e.Item.DataItem)["UploadWorkingEmpSummaryID"].ToString();
        }
    }
Пример #6
0
    protected void Repeater_ItemCommand(object source, DataListCommandEventArgs e)
    {
        Button b = (Button)e.CommandSource;



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


            ebinding = new Binding(dbConn, db);
            ebinding.add(EmpID);
            ebinding.add(new TextBoxBinder(db, ((WebDatePicker)e.Item.FindControl("EmpWorkingSummaryAsOfDate")).TextBox, "EmpWorkingSummaryAsOfDate"));
            ebinding.add((HtmlInputHidden)e.Item.FindControl("EmpWorkingSummaryID"));
            ebinding.add((TextBox)e.Item.FindControl("EmpWorkingSummaryRestDayEntitled"));
            ebinding.add((TextBox)e.Item.FindControl("EmpWorkingSummaryRestDayTaken"));
            ebinding.add((TextBox)e.Item.FindControl("EmpWorkingSummaryTotalWorkingDays"));
            ebinding.add((TextBox)e.Item.FindControl("EmpWorkingSummaryTotalWorkingHours"));
            ebinding.add((TextBox)e.Item.FindControl("EmpWorkingSummaryTotalLunchTimeHours"));

            ebinding.init(Request, Session);


            EEmpWorkingSummary obj    = new EEmpWorkingSummary();
            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);


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

            WebUtils.StartFunction(Session, FUNCTION_CODE, obj.EmpID);
            db.update(dbConn, obj);
            WebUtils.EndFunction(dbConn);

            Repeater.EditItemIndex = -1;
            //WorkingSummaryAddPanel.Visible = IsAllowEdit;
            loadData(info, db, Repeater);
            WebUtils.SetEnabledControlSection(WorkingSummaryAddPanel, true);
        }
    }