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("EmpWorkInjuryRecordID");
            if (c.Checked)
            {
                EEmpWorkInjuryRecord obj = new EEmpWorkInjuryRecord();
                obj.EmpWorkInjuryRecordID = Int32.Parse(h.Value);
                list.Add(obj);
            }
        }
        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);
    }
        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 uploadEmpWorkInjuryRecordList = tempDB.select(dbConn, sessionFilter);

            foreach (EUploadEmpWorkInjuryRecord obj in uploadEmpWorkInjuryRecordList)
            {
                EEmpWorkInjuryRecord EmpWorkInjuryRecord = new EEmpWorkInjuryRecord();

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

                obj.ExportToObject(EmpWorkInjuryRecord);

                if (obj.ImportActionStatus == ImportDBObject.ImportActionEnum.INSERT)
                {
                    EmpWorkInjuryRecord.EmpID = ParseTemp.GetEmpIDFromUploadEmpID(dbConn, obj.UploadEmpID);
                    uploadDB.insert(dbConn, EmpWorkInjuryRecord);
                }
                else if (obj.ImportActionStatus == ImportDBObject.ImportActionEnum.UPDATE)
                {
                    uploadDB.update(dbConn, EmpWorkInjuryRecord);
                }
                tempDB.delete(dbConn, obj);
            }
        }
    protected void Delete_Click(object sender, EventArgs e)
    {
        EEmpWorkInjuryRecord c = new EEmpWorkInjuryRecord();

        c.EmpWorkInjuryRecordID = 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_WorkInjury_View.aspx?EmpID=" + EmpID.Value);
    }
    protected bool loadObject()
    {
        EEmpWorkInjuryRecord obj = new EEmpWorkInjuryRecord();
        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);
    }
    protected void Save_Click(object sender, EventArgs e)
    {
        EEmpWorkInjuryRecord c = new EEmpWorkInjuryRecord();

        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 (!AppUtils.checkDuplicate(dbConn, CurEmpID, db, c, errors, "PermitTypeID"))
        //    return;

        WebUtils.StartFunction(Session, FUNCTION_CODE, c.EmpID);
        if (CurID < 0)
        {
//            Utils.MarkCreate(Session, c);

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


        HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Emp_WorkInjury_View.aspx?EmpWorkInjuryRecordID=" + CurID + "&EmpID=" + c.EmpID);
    }
    protected void Repeater_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        EEmpWorkInjuryRecord obj = new EEmpWorkInjuryRecord();

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

        sdb.populate(obj, values);

        if (e.Item.ItemIndex == Repeater.EditItemIndex)
        {
        }
        else
        {
            //e.Item.FindControl("Edit").Visible = true & IsAllowEdit;
            //e.Item.FindControl("DeleteItem").Visible = true & IsAllowEdit;

            HtmlInputHidden h = (HtmlInputHidden)e.Item.FindControl("EmpWorkInjuryRecordID");
            h.Value = ((DataRowView)e.Item.DataItem)["EmpWorkInjuryRecordID"].ToString();
        }
        HROne.Common.WebUtility.WebControlsLocalization(Session, e.Item.Controls);
    }