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 uploadEmpBeneficiariesList = tempDB.select(dbConn, sessionFilter); foreach (EUploadEmpBeneficiaries obj in uploadEmpBeneficiariesList) { EEmpBeneficiaries EmpBeneficiaries = new EEmpBeneficiaries(); if (obj.ImportActionStatus != ImportDBObject.ImportActionEnum.INSERT) { EmpBeneficiaries.EmpBeneficiariesID = obj.EmpBeneficiariesID; uploadDB.select(dbConn, EmpBeneficiaries); } obj.ExportToObject(EmpBeneficiaries); if (obj.ImportActionStatus == ImportDBObject.ImportActionEnum.INSERT) { EmpBeneficiaries.EmpID = ParseTemp.GetEmpIDFromUploadEmpID(dbConn, obj.UploadEmpID); uploadDB.insert(dbConn, EmpBeneficiaries); } else if (obj.ImportActionStatus == ImportDBObject.ImportActionEnum.UPDATE) { uploadDB.update(dbConn, EmpBeneficiaries); } tempDB.delete(dbConn, obj); } }
protected void Delete_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(sdb, Page.Master); errors.clear(); ArrayList list = new ArrayList(); foreach (RepeaterItem i in Repeater.Items) { CheckBox cb = (CheckBox)i.FindControl("ItemSelect"); if (cb.Checked) { EEmpBeneficiaries o = new EEmpBeneficiaries(); 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 Repeater_ItemDataBound(object sender, RepeaterItemEventArgs e) { DataRowView row = (DataRowView)e.Item.DataItem; EEmpBeneficiaries obj = new EEmpBeneficiaries(); EEmpBeneficiaries.db.toObject(row.Row, obj); }
protected bool loadObject() { obj = new EEmpBeneficiaries(); 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 Delete_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); EEmpBeneficiaries obj = new EEmpBeneficiaries(); obj.EmpBeneficiariesID = CurID; if (EEmpBeneficiaries.db.select(dbConn, obj)) { WebUtils.StartFunction(Session, FUNCTION_CODE, obj.EmpID); db.delete(dbConn, obj); WebUtils.EndFunction(dbConn); } HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "EmpTab_Beneficiaries_View.aspx?EmpID=" + EmpID.Value); }
protected void Save_Click(object sender, EventArgs e) { EEmpBeneficiaries c = new EEmpBeneficiaries(); 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); WebUtils.StartFunction(Session, FUNCTION_CODE, c.EmpID); if (CurID < 0) { db.insert(dbConn, c); CurID = c.EmpBeneficiariesID; } else { db.update(dbConn, c); } WebUtils.EndFunction(dbConn); HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Emp_Beneficiaries_View.aspx?EmpBeneficiariesID=" + CurID + "&EmpID=" + c.EmpID); }