protected void btnBankDel_Click(object sender, EventArgs e) { string employeeid = Convert.ToString(Session["EID"]); string OCODE = ((SessionUser)Session["SessionUser"]).OCode; List <HRM_BankInfo> bankInfo = bankDALObj.GetBankInfo(employeeid, OCODE); if (bankInfo.Count > 0) { // For Save BankInfo_Delete_Log HRM_BankInfo_Delete_Log bankDelObj = new HRM_BankInfo_Delete_Log(); string employee = Convert.ToString(Session["EID"]); bankDelObj.EID = employee; bankDelObj.EDIT_DATE = DateTime.Now; bankDelObj.EDIT_USER = ((SessionUser)Session["SessionUser"]).UserId; bankDelObj.OCODE = OCODE; int result = bankDALObj.DeletedEmployeeBankInfoLog(bankDelObj); if (result == 1) { // For Delete Bankinfo bankDALObj.DeleteEmployeeBankInfo(employee); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "text", "func('Data Deleted Successfully!')", true); } ClearBankLbl(); } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "text", "func('No Data Found!')", true); } }
internal int DeletedEmployeeBankInfoLog(HRM_BankInfo_Delete_Log bankDelObj) { using (var context = new ERPSSLHBEntities()) { context.HRM_BankInfo_Delete_Log.AddObject(bankDelObj); context.SaveChanges(); return(1); } }