public bool UpdateExpense(ExpenseMaster expense) { using (var _context = new AdminPortalEntities()) { _context.ExpenseMasters.Attach(expense); _context.Entry(expense).State = EntityState.Modified; foreach (ExpenseSummary s in expense.ExpenseSummaries) { _context.ExpenseSummaries.Attach(s); _context.Entry(s).State = EntityState.Modified; } _context.SaveChanges(); return(true); } }
public bool DeleteClientDocumentById(string UserId, int FileId, int ClientId) { using (var _context = new AdminPortalEntities()) { ////RecruitmentClientDocument recruitmentClientDoc = _context.RecruitmentClientDocuments.Where(x => x.Id == FileId).FirstOrDefault(); ////_context.RecruitmentClientDocuments.Remove(recruitmentClientDoc); RecruitmentClient recruitmentClientDoc = _context.RecruitmentClients.Where(x => x.Id == ClientId).FirstOrDefault(); recruitmentClientDoc.ModifiedUserId = UserId; recruitmentClientDoc.ModifiedDate = System.DateTime.Now; switch (FileId) { case 1: recruitmentClientDoc.ClientDocument1 = null; recruitmentClientDoc.DocumentName1 = null; break; case 2: recruitmentClientDoc.ClientDocument2 = null; recruitmentClientDoc.DocumentName2 = null; break; } _context.Entry(recruitmentClientDoc).State = EntityState.Modified; _context.SaveChanges(); return(true); } }
public void UpdateExpenseSummary(ExpenseSummary es) { using (var _context = new AdminPortalEntities()) { _context.ExpenseSummaries.Attach(es); _context.Entry(es).State = EntityState.Modified; _context.SaveChanges(); } }
public bool UpdateProduct(Product product) { using (var _context = new AdminPortalEntities()) { _context.Products.Attach(product); _context.Entry(product).State = EntityState.Modified; _context.SaveChanges(); return(true); } }
public bool UpdateSupport(SupportMaster support) { using (var _context = new AdminPortalEntities()) { _context.SupportMasters.Attach(support); _context.Entry(support).State = EntityState.Modified; _context.SaveChanges(); return(true); } }
public bool UpdateRecruitment(Recruitment recruitment) { using (var _context = new AdminPortalEntities()) { _context.Recruitments.Attach(recruitment); _context.Entry(recruitment).State = EntityState.Modified; _context.SaveChanges(); return(true); } }
public bool UpdateLOA(LOA loa) { using (var _context = new AdminPortalEntities()) { _context.LOAs.Attach(loa); _context.Entry(loa).State = EntityState.Modified; _context.SaveChanges(); return(true); } }
public bool UpdateTimeSheet(TimeSheetsMaster timeSheetsMaster) { using (var _context = new AdminPortalEntities()) { _context.TimeSheetsMasters.Attach(timeSheetsMaster); _context.Entry(timeSheetsMaster).State = EntityState.Modified; _context.SaveChanges(); return(true); } }
public bool SoftDeleteUserInfo(UserInfo userInfo) { using (var _context = new AdminPortalEntities()) { _context.UserInfoes.Attach(userInfo); _context.Entry(userInfo).State = EntityState.Modified; _context.SaveChanges(); return(true); } }
public bool SoftDeleteRecruitment(Recruitment employeerecord) { using (var _context = new AdminPortalEntities()) { _context.Recruitments.Attach(employeerecord); _context.Entry(employeerecord).State = EntityState.Modified; _context.SaveChanges(); return(true); } }
public bool CreateLoa(LOA loa) { using (var _context = new AdminPortalEntities()) { _context.LOAs.Add(loa); _context.SaveChanges(); loa.LoaCode = "LOA" + (1100 + loa.LoaId).ToString(); _context.LOAs.Attach(loa); _context.Entry(loa).State = EntityState.Modified; _context.SaveChanges(); return(true); } }
public bool UpdateTimeSheetSummaries(List <TimeSheetSummary> summaries) { using (var _context = new AdminPortalEntities()) { foreach (TimeSheetSummary s in summaries) { _context.TimeSheetSummaries.Attach(s); _context.Entry(s).State = EntityState.Modified; } _context.SaveChanges(); return(true); } }
public bool CreateTimeSheet(TimeSheetsMaster timeSheet) { using (var _context = new AdminPortalEntities()) { _context.TimeSheetsMasters.Add(timeSheet); _context.SaveChanges(); timeSheet.TimeSheetCode = "TS" + (1100 + timeSheet.TimeSheetID).ToString(); _context.TimeSheetsMasters.Attach(timeSheet); _context.Entry(timeSheet).State = EntityState.Modified; _context.SaveChanges(); return(true); } }
public bool SetExpenseAttachment(ExpenseAttachment expensedoc) { using (var _context = new AdminPortalEntities()) { _context.ExpenseAttachments.Add(expensedoc); _context.SaveChanges(); expensedoc.FileName = "(" + expensedoc.Id + ")" + expensedoc.FileName; _context.ExpenseAttachments.Attach(expensedoc); _context.Entry(expensedoc).State = EntityState.Modified; _context.SaveChanges(); return(true); } }
//public string GenerateSupportCode() //{ // using (var _context = new AdminPortalEntities()) // { // var lastsupportid = _context.SupportMasters.OrderByDescending(o => o.SupportId).FirstOrDefault(); // int lastsupid = 0; // if (lastsupportid != null) // { // lastsupid= lastsupportid.SupportId; // //return lastsupportid.SupportId ; // } // return "100125405-" + (1100 + lastsupid + 1).ToString(); // } //} public bool SetSupportAttachment(SupportAttachment supportdoc) { using (var _context = new AdminPortalEntities()) { _context.SupportAttachments.Add(supportdoc); _context.SaveChanges(); supportdoc.FileName = "(" + supportdoc.Id + ")" + supportdoc.FileName; _context.SupportAttachments.Attach(supportdoc); _context.Entry(supportdoc).State = EntityState.Modified; _context.SaveChanges(); return(true); } }
public void CreateSupport(SupportMaster support) { using (var _context = new AdminPortalEntities()) { _context.SupportMasters.Add(support); _context.SaveChanges(); support.SupportCode = "ST-" + DateTime.Now.ToString("MM") + DateTime.Now.ToString("yyyy") + "-" + (1100 + support.SupportId).ToString(); _context.SupportMasters.Attach(support); _context.Entry(support).State = EntityState.Modified; _context.SaveChanges(); //int Sid = support.SupportId; //return Sid; } }
public bool CreateExpense(ExpenseMaster expense) { using (var _context = new AdminPortalEntities()) { _context.ExpenseMasters.Add(expense); _context.SaveChanges(); expense.ExpenseCode = "Ex" + (1100 + expense.ExpenseId).ToString(); _context.ExpenseMasters.Attach(expense); _context.Entry(expense).State = EntityState.Modified; _context.SaveChanges(); //_context.ExpenseSummaries.AddRange(expense.ExpenseSummaries); //_context.SaveChanges(); return(true); } }
public bool SoftDeleteLOA(int id) { using (var _context = new AdminPortalEntities()) { var loa = _context.LOAs.SingleOrDefault(s => s.LoaId == id); if (loa != null) { loa.IsDeleted = true; loa.IsActive = false; _context.LOAs.Attach(loa); _context.Entry(loa).State = EntityState.Modified; _context.SaveChanges(); } return(true); } }