Esempio n. 1
0
 public bool HardDeleteSupport(int SupportId, string userId = null)
 {
     using (var _context = new AdminPortalEntities())
     {
         if (userId != null)
         {
             var support = _context.SupportMasters.SingleOrDefault(s => s.SupportId == SupportId && s.UserId == userId);
             if (support != null)
             {
                 _context.SupportMasters.Remove(support);
                 _context.SaveChanges();
                 return(true);
             }
             return(false);
         }
         else
         {
             var support = _context.SupportMasters.SingleOrDefault(s => s.SupportId == SupportId);
             if (support != null)
             {
                 _context.SupportMasters.Remove(support);
                 _context.SaveChanges();
                 return(true);
             }
             return(false);
         }
     }
 }
Esempio n. 2
0
 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);
     }
 }
Esempio n. 3
0
 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);
     }
 }
Esempio n. 4
0
 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);
     }
 }
Esempio n. 5
0
        //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);
            }
        }
Esempio n. 6
0
 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);
     }
 }
Esempio n. 7
0
        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;
            }
        }
Esempio n. 8
0
        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);
            }
        }
Esempio n. 9
0
 public void RemoveExpenseSummary(int id)
 {
     using (var _context = new AdminPortalEntities())
     {
         var expenseSummary = _context.ExpenseSummaries.Where(x => x.ExpenseId == id).FirstOrDefault();
         _context.ExpenseSummaries.Remove(expenseSummary);
         _context.SaveChanges();
     }
 }
Esempio n. 10
0
 public void UpdateExpenseSummary(ExpenseSummary es)
 {
     using (var _context = new AdminPortalEntities())
     {
         _context.ExpenseSummaries.Attach(es);
         _context.Entry(es).State = EntityState.Modified;
         _context.SaveChanges();
     }
 }
Esempio n. 11
0
        //private readonly AdminPortalEntities _context;
        //public ProductService(AdminPortalEntities context) { _context = context; }



        public bool CreateNewProduct(Product product)
        {
            using (var _context = new AdminPortalEntities())
            {
                _context.Products.Add(product);
                _context.SaveChanges();
                return(true);
            }
        }
Esempio n. 12
0
 public bool CreateNewUserInfo(UserInfo user)
 {
     using (var _context = new AdminPortalEntities())
     {
         _context.UserInfoes.Add(user);
         _context.SaveChanges();
         return(true);
     }
 }
Esempio n. 13
0
 public bool CreateNewUser(AspNetUser user)
 {
     using (var _context = new AdminPortalEntities())
     {
         _context.AspNetUsers.Add(user);
         _context.SaveChanges();
         return(true);
     }
 }
Esempio n. 14
0
 public bool CreateExpenseSummary(ExpenseSummary summary)
 {
     using (var _context = new AdminPortalEntities())
     {
         _context.ExpenseSummaries.Add(summary);
         _context.SaveChanges();
         return(true);
     }
 }
Esempio n. 15
0
 public bool UpdateClientDocument(List <RecruitmentClientDocument> recruitmentClientDocument)
 {
     using (var _context = new AdminPortalEntities())
     {
         _context.RecruitmentClientDocuments.AddRange(recruitmentClientDocument);
         _context.SaveChanges();
         return(true);
     }
 }
Esempio n. 16
0
 public bool CreateTimeSheetSummary(List <TimeSheetSummary> summaries)
 {
     using (var _context = new AdminPortalEntities())
     {
         _context.TimeSheetSummaries.AddRange(summaries);
         _context.SaveChanges();
         return(true);
     }
 }
Esempio n. 17
0
 public bool UpdateTimeSheet(TimeSheetsMaster timeSheetsMaster)
 {
     using (var _context = new AdminPortalEntities())
     {
         _context.TimeSheetsMasters.Attach(timeSheetsMaster);
         _context.Entry(timeSheetsMaster).State = EntityState.Modified;
         _context.SaveChanges();
         return(true);
     }
 }
Esempio n. 18
0
 public bool UpdateRecruitment(Recruitment recruitment)
 {
     using (var _context = new AdminPortalEntities())
     {
         _context.Recruitments.Attach(recruitment);
         _context.Entry(recruitment).State = EntityState.Modified;
         _context.SaveChanges();
         return(true);
     }
 }
Esempio n. 19
0
 public bool SetRecruitmentDocument(RecruitmentDocument recruitmentdoc)
 {
     using (var _context = new AdminPortalEntities())
     {
         _context.RecruitmentDocuments.Add(recruitmentdoc);
         _context.SaveChanges();
         //int Rid = recruitment.RecruitmentId;
         return(true);
     }
 }
Esempio n. 20
0
 public bool UpdateLOA(LOA loa)
 {
     using (var _context = new AdminPortalEntities())
     {
         _context.LOAs.Attach(loa);
         _context.Entry(loa).State = EntityState.Modified;
         _context.SaveChanges();
         return(true);
     }
 }
Esempio n. 21
0
 public int SetRecruitment(Recruitment recruitment)
 {
     using (var _context = new AdminPortalEntities())
     {
         _context.Recruitments.Add(recruitment);
         _context.SaveChanges();
         int Rid = recruitment.RecruitmentId;
         return(Rid);
     }
 }
Esempio n. 22
0
 public bool UpdateSupport(SupportMaster support)
 {
     using (var _context = new AdminPortalEntities())
     {
         _context.SupportMasters.Attach(support);
         _context.Entry(support).State = EntityState.Modified;
         _context.SaveChanges();
         return(true);
     }
 }
Esempio n. 23
0
 public bool UpdateProduct(Product product)
 {
     using (var _context = new AdminPortalEntities())
     {
         _context.Products.Attach(product);
         _context.Entry(product).State = EntityState.Modified;
         _context.SaveChanges();
         return(true);
     }
 }
Esempio n. 24
0
        public bool SoftDeleteUserInfo(UserInfo userInfo)
        {
            using (var _context = new AdminPortalEntities())
            {
                _context.UserInfoes.Attach(userInfo);
                _context.Entry(userInfo).State = EntityState.Modified;
                _context.SaveChanges();

                return(true);
            }
        }
Esempio n. 25
0
        public bool HardDeleteExpense(int id)
        {
            using (var _context = new AdminPortalEntities())
            {
                var summaries = _context.ExpenseSummaries.Where(s => s.ExpenseId == id);
                if (summaries != null)
                {
                    _context.ExpenseSummaries.RemoveRange(summaries);
                    _context.SaveChanges();
                }
                var expense = _context.ExpenseMasters.SingleOrDefault(s => s.ExpenseId == id);
                if (expense != null)
                {
                    _context.ExpenseMasters.Remove(expense);
                    _context.SaveChanges();
                }

                return(true);
            }
        }
Esempio n. 26
0
        public bool SoftDeleteRecruitment(Recruitment employeerecord)
        {
            using (var _context = new AdminPortalEntities())
            {
                _context.Recruitments.Attach(employeerecord);
                _context.Entry(employeerecord).State = EntityState.Modified;
                _context.SaveChanges();

                return(true);
            }
        }
Esempio n. 27
0
 public bool HardDeleteLOA(int id)
 {
     using (var _context = new AdminPortalEntities())
     {
         var loa = _context.LOAs.SingleOrDefault(s => s.LoaId == id);
         if (loa != null)
         {
             _context.LOAs.Remove(loa);
             _context.SaveChanges();
         }
         return(true);
     }
 }
Esempio n. 28
0
 public bool HardDeleteProduct(int productId)
 {
     using (var _context = new AdminPortalEntities())
     {
         var product = _context.Products.SingleOrDefault(s => s.ProductId == productId);
         if (product != null)
         {
             _context.Products.Remove(product);
             _context.SaveChanges();
         }
         return(true);
     }
 }
Esempio n. 29
0
 public bool DeleteSupportDocumentFile(int id)
 {
     using (var _context = new AdminPortalEntities())
     {
         var supportAttachment = _context.SupportAttachments.SingleOrDefault(s => s.Id == id);
         if (supportAttachment != null)
         {
             _context.SupportAttachments.Remove(supportAttachment);
             _context.SaveChanges();
         }
         return(true);
     }
 }
Esempio n. 30
0
 public bool HardDeleteSummaries(int timeSheetId)
 {
     using (var _context = new AdminPortalEntities())
     {
         var summaries = _context.TimeSheetSummaries.Where(s => s.TimeSheetID == timeSheetId);
         if (summaries != null)
         {
             _context.TimeSheetSummaries.RemoveRange(summaries);
             _context.SaveChanges();
         }
         return(true);
     }
 }