protected void Delete_Click(object sender, EventArgs e)
    {
        ArrayList list = new ArrayList();

        foreach (RepeaterItem i in Repeater.Items)
        {
            CheckBox cb = (CheckBox)i.FindControl("ItemSelect");
            if (cb.Checked)
            {
                EEmpFinalPayment o = new EEmpFinalPayment();
                WebFormUtils.GetKeys(sdb, o, cb);
                list.Add(o);
            }
        }
        if (list.Count > 0)
        {
            WebUtils.StartFunction(Session, FUNCTION_CODE, CurID);
            foreach (BaseObject o in list)
            {
                if (sdb.select(dbConn, o))
                {
                    sdb.delete(dbConn, o);
                }
            }
            WebUtils.EndFunction(dbConn);
        }
        loadData(info, sdb, Repeater);
    }
    protected void Delete_Click(object sender, EventArgs e)
    {
        EEmpFinalPayment c = new EEmpFinalPayment();

        c.EmpFinalPayID = CurID;
        db.select(dbConn, c);
        WebUtils.StartFunction(Session, FUNCTION_CODE, c.EmpID);
        db.delete(dbConn, c);
        WebUtils.EndFunction(dbConn);
        HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "EmpTab_Termination_View.aspx?EmpID=" + EmpID.Value);
    }
    protected bool loadObject()
    {
        obj = new EEmpFinalPayment();
        bool isNew = WebFormWorkers.loadKeys(db, obj, DecryptedRequest);

        DBFilter filter = new DBFilter();

        filter.add(new Match("EmpID", CurEmpID));
        filter.add(WebUtils.AddRankFilter(Session, "EmpID", true));
        if (EEmpPersonalInfo.db.count(dbConn, filter) == 0)
        {
            if (CurEmpID <= 0)
            {
                return(false);
            }
            else
            {
                HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/AccessDeny.aspx");
            }
        }

        if (!db.select(dbConn, obj))
        {
            if (CurID <= 0)
            {
                return(false);
            }
            else
            {
                HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/AccessDeny.aspx");
            }
        }

        if (obj.EmpID != CurEmpID)
        {
            if (CurID <= 0)
            {
                return(false);
            }
            else
            {
                HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/AccessDeny.aspx");
            }
        }

        Hashtable values = new Hashtable();

        db.populate(obj, values);
        binding.toControl(values);


        return(true);
    }
        public void ImportToDatabase(int UploadEmpID)
        {
            DBFilter sessionFilter = new DBFilter();

            sessionFilter.add(new Match("SessionID", m_SessionID));
            if (UploadEmpID > 0)
            {
                sessionFilter.add(new Match("UploadEmpID", UploadEmpID));
            }
            ArrayList uploadEmpFinalPayList = tempDB.select(dbConn, sessionFilter);

            foreach (EUploadEmpFinalPayment obj in uploadEmpFinalPayList)
            {
                EEmpFinalPayment EmpFinalPay = new EEmpFinalPayment();

                if (obj.ImportActionStatus != ImportDBObject.ImportActionEnum.INSERT)
                {
                    EmpFinalPay.EmpFinalPayID = obj.EmpFinalPayID;
                    uploadDB.select(dbConn, EmpFinalPay);
                }

                obj.ExportToObject(EmpFinalPay);

                if (obj.ImportActionStatus == ImportDBObject.ImportActionEnum.INSERT)
                {
                    EmpFinalPay.EmpID = ParseTemp.GetEmpIDFromUploadEmpID(dbConn, obj.UploadEmpID);
                    if (obj.UploadEmpAccID > 0)
                    {
                        EmpFinalPay.EmpAccID = ParseTemp.GetEmpBankAccIDFromUploadEmpBankAccID(dbConn, obj.UploadEmpAccID);
                    }
                    uploadDB.insert(dbConn, EmpFinalPay);
                    //DBFilter emplastPosFilter = new DBFilter();
                }
                else if (obj.ImportActionStatus == ImportDBObject.ImportActionEnum.UPDATE)
                {
                    uploadDB.update(dbConn, EmpFinalPay);
                }
                tempDB.delete(dbConn, obj);
            }
        }
    protected void Repeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        DataRowView row = (DataRowView)e.Item.DataItem;
        CheckBox    cb  = (CheckBox)e.Item.FindControl("ItemSelect");

        WebFormUtils.LoadKeys(sdb, row, cb);

        EEmpFinalPayment obj = new EEmpFinalPayment();

        sdb.toObject(((DataRowView)e.Item.DataItem).Row, obj);
        Hashtable values = new Hashtable();

        sdb.populate(obj, values);

        Binding eBinding = new Binding(dbConn, sdb);

        eBinding.add(new BlankZeroLabelVLBinder(sdb, (Label)e.Item.FindControl("CostCenterID"), ECostCenter.VLCostCenter).setTextDisplayForZero(HROne.Common.WebUtility.GetLocalizedString(ECostCenter.DEFAULT_COST_CENTER_TEXT)));

        eBinding.init(Request, Session);

        eBinding.toControl(values);

        if (obj.PayRecID != null)
        {
            cb.Visible = false;
        }
        else
        {
            cb.Visible = IsAllowEdit;
        }

        ((HtmlTableCell)e.Item.FindControl("CostCenterDetailCell")).Visible = WebUtils.productLicense(Session).IsCostCenter;
        ((HtmlTableCell)e.Item.FindControl("RemarkCell")).ColSpan           = ((HtmlTableRow)e.Item.FindControl("detailRow")).Cells.Count - 1 - (WebUtils.productLicense(Session).IsCostCenter ? 0 : 1);

        HROne.Common.WebUtility.WebControlsLocalization(this.Session, e.Item.Controls);
    }
    protected void Save_Click(object sender, EventArgs e)
    {
        EEmpFinalPayment c = new EEmpFinalPayment();

        Hashtable values = new Hashtable();

        binding.toValues(values);

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

        errors.clear();


        db.validate(errors, values);

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


        db.parse(values, c);

        if (c.EmpFinalPayMethod.Equals("A"))
        {
            if (c.EmpAccID == 0)
            {
                EEmpBankAccount bankAccount = EEmpBankAccount.GetDefaultBankAccount(dbConn, c.EmpID);
                if (bankAccount != null)
                {
                    //c.EmpAccID = bankAccount.EmpBankAccountID;
                }
                else
                {
                    errors.addError("EmpAccID", HROne.Translation.PageErrorMessage.ERROR_ACCOUNT_REQUIRED);
                }
            }
        }

        //DBFilter filter = new DBFilter();
        //filter.add(new Match("EmpID", c.EmpID));
        //filter.add(new Match("EmpFinalPayID", "<>", c.EmpFinalPayID));
        //filter.add(new Match("PayCodeID", c.PayCodeID));
        //if (db.count(dbConn, filter) > 0)
        //{
        //    errors.addError(HROne.Translation.PageErrorMessage.ERROR_ONE_PAYMENT_PER_PCODE);
        //    return;
        //}

        if (errors.isEmpty())
        {
            WebUtils.StartFunction(Session, FUNCTION_CODE, c.EmpID);
            c.CurrencyID = "HKD";
            if (CurID < 0)
            {
                //            Utils.MarkCreate(Session, c);

                db.insert(dbConn, c);
                CurID = c.EmpFinalPayID;
                //            url = Utils.BuildURL(-1, CurID);
            }
            else
            {
                //            Utils.Mark(Session, c);
                db.update(dbConn, c);
            }
            WebUtils.EndFunction(dbConn);


            HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Emp_FinalPayment_View.aspx?EmpID=" + c.EmpID + "&EmpFinalPayID=" + CurID);
        }
    }
Exemple #7
0
    protected bool loadObject()
    {
        obj = new EEmpFinalPayment();
        bool isNew = WebFormWorkers.loadKeys(db, obj, DecryptedRequest);

        DBFilter filter = new DBFilter();

        filter.add(new Match("EmpID", CurEmpID));
        filter.add(WebUtils.AddRankFilter(Session, "EmpID", true));
        if (EEmpPersonalInfo.db.count(dbConn, filter) == 0)
        {
            if (CurEmpID <= 0)
            {
                return(false);
            }
            else
            {
                HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/AccessDeny.aspx");
            }
        }

        if (!db.select(dbConn, obj))
        {
            if (CurID <= 0)
            {
                return(false);
            }
            else
            {
                HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/AccessDeny.aspx");
            }
        }

        if (obj.EmpID != CurEmpID)
        {
            if (CurID <= 0)
            {
                return(false);
            }
            else
            {
                HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/AccessDeny.aspx");
            }
        }

        Hashtable values = new Hashtable();

        db.populate(obj, values);
        binding.toControl(values);

        if (obj.EmpFinalPayMethod.Equals("A"))
        {
            BankAccountRow.Visible     = true;
            lblDefaultBankAccount.Text = string.Empty;
            if (obj.EmpAccID == 0)
            {
                EEmpBankAccount bankAccount = EEmpBankAccount.GetDefaultBankAccount(dbConn, CurEmpID);
                if (bankAccount != null)
                {
                    lblDefaultBankAccount.Text = bankAccount.EmpBankCode + "-" + bankAccount.EmpBranchCode + "-" + bankAccount.EmpAccountNo;
                }
            }
        }
        else
        {
            BankAccountRow.Visible = false;
        }

        return(true);
    }