예제 #1
0
        public bool InsertUpdate(Invoice invoice, OfficeManagementDbContext OfficeManagementDbContext)
        {
            bool isStatus = false;

            try
            {
                if (invoice.Id > 0)
                {
                    Invoice invoicetemp = OfficeManagementDbContext.InvoiceDbSet.Where(x => x.Id == invoice.Id).FirstOrDefault();
                    if (invoicetemp != null)
                    {
                        invoicetemp.Fromcompanyid = invoice.Fromcompanyid;
                        invoicetemp.Tocompanyid   = invoice.Tocompanyid;
                        invoicetemp.IsActive      = invoice.IsActive;
                        invoicetemp.IsDeleted     = invoice.IsDeleted;
                        invoicetemp.Tax           = invoice.Tax;
                        invoicetemp.Total         = invoice.Total;
                        invoicetemp.ModifiedBy    = invoice.ModifiedBy;
                        invoicetemp.ModifiedDate  = invoice.ModifiedDate;
                        OfficeManagementDbContext.InvoiceDbSet.Update(invoicetemp);
                        OfficeManagementDbContext.SaveChanges();
                    }
                }
                else
                {
                    OfficeManagementDbContext.InvoiceDbSet.Add(invoice);
                    OfficeManagementDbContext.SaveChanges();
                }
                isStatus = true;
            }
            catch (Exception ex)
            {
            }
            return(isStatus);
        }
예제 #2
0
        public bool InsertUpdate(InvoiceItem invoiceItem, OfficeManagementDbContext OfficeManagementDbContext)
        {
            bool isStatus = false;

            try
            {
                if (invoiceItem.Id > 0)
                {
                    InvoiceItem invoiceItemtemp = OfficeManagementDbContext.InvoiceItemDbSet.Where(x => x.Id == invoiceItem.Id).FirstOrDefault();
                    if (invoiceItemtemp != null)
                    {
                        invoiceItemtemp.InvoiceId   = invoiceItem.InvoiceId;
                        invoiceItemtemp.Quantity    = invoiceItem.Quantity;
                        invoiceItemtemp.Rate        = invoiceItem.Rate;
                        invoiceItemtemp.Total       = invoiceItem.Total;
                        invoiceItemtemp.Description = invoiceItem.Description;
                        OfficeManagementDbContext.InvoiceItemDbSet.Update(invoiceItemtemp);
                        OfficeManagementDbContext.SaveChanges();
                    }
                }
                else
                {
                    OfficeManagementDbContext.InvoiceItemDbSet.Add(invoiceItem);
                    OfficeManagementDbContext.SaveChanges();
                }
                isStatus = true;
            }
            catch (Exception ex)
            {
            }
            return(isStatus);
        }
예제 #3
0
        public bool InsertUpdate(Company company, OfficeManagementDbContext OfficeManagementDbContext)
        {
            bool isStatus = false;

            try
            {
                if (company.Id > 0)
                {
                    Company companytemp = OfficeManagementDbContext.CompanyDbSet.Where(x => x.Id == company.Id).FirstOrDefault();
                    if (companytemp != null)
                    {
                        companytemp.CompanyName   = company.CompanyName;
                        companytemp.Contactnumber = company.Contactnumber;
                        companytemp.IsActive      = company.IsActive;
                        companytemp.IsDeleted     = company.IsDeleted;
                        companytemp.State         = company.State;
                        companytemp.City          = company.City;
                        companytemp.ModifiedBy    = company.ModifiedBy;
                        companytemp.ModifiedDate  = company.ModifiedDate;
                        OfficeManagementDbContext.CompanyDbSet.Update(companytemp);
                        OfficeManagementDbContext.SaveChanges();
                    }
                }
                else
                {
                    OfficeManagementDbContext.CompanyDbSet.Add(company);
                    OfficeManagementDbContext.SaveChanges();
                }
                isStatus = true;
            }
            catch (Exception ex)
            {
            }
            return(isStatus);
        }
예제 #4
0
        public bool InsertUpdate(Cashflow cashflow, OfficeManagementDbContext OfficeManagementDbContext)
        {
            bool isStatus = false;

            try
            {
                if (cashflow.Id > 0)
                {
                    Cashflow cashflowtemp = OfficeManagementDbContext.CashflowDbSet.Where(x => x.Id == cashflow.Id).FirstOrDefault();
                    if (cashflowtemp != null)
                    {
                        cashflowtemp.Direction      = cashflow.Direction;
                        cashflowtemp.Description    = cashflow.Description;
                        cashflowtemp.Amount         = cashflow.Amount;
                        cashflowtemp.IsActive       = cashflow.IsActive;
                        cashflowtemp.IsDeleted      = cashflow.IsDeleted;
                        cashflowtemp.Loggeddatetime = cashflow.Loggeddatetime;
                        cashflowtemp.ModifiedBy     = cashflow.ModifiedBy;
                        cashflowtemp.ModifiedDate   = cashflow.ModifiedDate;
                        OfficeManagementDbContext.CashflowDbSet.Update(cashflowtemp);
                        OfficeManagementDbContext.SaveChanges();
                    }
                }
                else
                {
                    OfficeManagementDbContext.CashflowDbSet.Add(cashflow);
                    OfficeManagementDbContext.SaveChanges();
                }
                isStatus = true;
            }
            catch (Exception ex)
            {
            }
            return(isStatus);
        }
예제 #5
0
        public bool InsertUpdate(Role role, OfficeManagementDbContext OfficeManagementDbContext)
        {
            bool isStatus = false;

            try
            {
                if (role.Id > 0)
                {
                    Role roletemp = OfficeManagementDbContext.RoleDbSet.Where(x => x.Id == role.Id).FirstOrDefault();
                    if (roletemp != null)
                    {
                        roletemp.Id        = role.Id;
                        roletemp.RoleName  = role.RoleName;
                        roletemp.IsDeleted = role.IsDeleted;

                        roletemp.ModifiedBy   = role.ModifiedBy;
                        roletemp.ModifiedDate = role.ModifiedDate;
                        OfficeManagementDbContext.RoleDbSet.Update(role);
                        OfficeManagementDbContext.SaveChanges();
                    }
                }
                else
                {
                    OfficeManagementDbContext.RoleDbSet.Add(role);
                    OfficeManagementDbContext.SaveChanges();
                }
                isStatus = true;
            }
            catch (Exception ex)
            {
            }
            return(isStatus);
        }
예제 #6
0
        public Invoice GetById(int Id, OfficeManagementDbContext OfficeManagementDbContext)
        {
            Invoice invoice = new Invoice();

            try
            {
                invoice = OfficeManagementDbContext.InvoiceDbSet.Where(x => x.Id == Id).FirstOrDefault();
            }
            catch (Exception ex)
            {
            }
            return(invoice);
        }
예제 #7
0
        public IEnumerable <Invoice> GetAll(OfficeManagementDbContext OfficeManagementDbContext)
        {
            List <Invoice> listInvoice = new List <Invoice>();

            try
            {
                listInvoice = OfficeManagementDbContext.InvoiceDbSet.ToList <Invoice>();
            }
            catch (Exception ex)
            {
            }
            return(listInvoice);
        }
예제 #8
0
        public User GetById(int Id, OfficeManagementDbContext OfficeManagementDbContext)
        {
            User usertable = new User();

            try
            {
                usertable = OfficeManagementDbContext.UserDbSet.Where(x => x.Id == Id).FirstOrDefault();
            }
            catch (Exception ex)
            {
            }
            return(usertable);
        }
예제 #9
0
        public Role GetById(int Id, OfficeManagementDbContext OfficeManagementDbContext)
        {
            Role role = new Role();

            try
            {
                role = OfficeManagementDbContext.RoleDbSet.Where(x => x.Id == Id).FirstOrDefault();
            }
            catch (Exception ex)
            {
            }
            return(role);
        }
예제 #10
0
        public Company GetById(int Id, OfficeManagementDbContext OfficeManagementDbContext)
        {
            Company company = new Company();

            try
            {
                company = OfficeManagementDbContext.CompanyDbSet.Where(x => x.Id == Id).FirstOrDefault();
            }
            catch (Exception ex)
            {
            }
            return(company);
        }
예제 #11
0
        public IEnumerable <Company> GetAll(OfficeManagementDbContext OfficeManagementDbContext)
        {
            List <Company> listCompany = new List <Company>();

            try
            {
                listCompany = OfficeManagementDbContext.CompanyDbSet.ToList <Company>();
            }
            catch (Exception ex)
            {
            }
            return(listCompany);
        }
예제 #12
0
        public Cashflow GetById(int Id, OfficeManagementDbContext OfficeManagementDbContext)
        {
            Cashflow cashflow = new Cashflow();

            try
            {
                cashflow = OfficeManagementDbContext.CashflowDbSet.Where(x => x.Id == Id).FirstOrDefault();
            }
            catch (Exception ex)
            {
            }
            return(cashflow);
        }
예제 #13
0
        public IEnumerable <Cashflow> GetAll(OfficeManagementDbContext OfficeManagementDbContext)
        {
            List <Cashflow> listCashflow = new List <Cashflow>();

            try
            {
                listCashflow = OfficeManagementDbContext.CashflowDbSet.ToList <Cashflow>().ToList <Cashflow>();
            }
            catch (Exception ex)
            {
            }
            return(listCashflow);
        }
예제 #14
0
        public IEnumerable <User> GetAll(OfficeManagementDbContext OfficeManagementDbContext)
        {
            List <User> listUserTable = new List <User>();

            try
            {
                listUserTable = OfficeManagementDbContext.UserDbSet.ToList <User>();
            }
            catch (Exception ex)
            {
            }
            return(listUserTable);
        }
예제 #15
0
        public bool InsertUpdate(User userTable, OfficeManagementDbContext OfficeManagementDbContext)
        {
            bool istatus = false;

            try
            {
                if (userTable.Id > 0)
                {
                    User usertemptemp = OfficeManagementDbContext.UserDbSet.Where(x => x.Id == userTable.Id).FirstOrDefault();

                    if (usertemptemp != null)
                    {
                        usertemptemp.Firstname     = userTable.Firstname;
                        usertemptemp.Lastname      = userTable.Lastname;
                        usertemptemp.Emailid       = userTable.Emailid;
                        usertemptemp.Contactnumber = userTable.Contactnumber;
                        usertemptemp.IsActive      = userTable.IsActive;
                        usertemptemp.IsDeleted     = userTable.IsDeleted;
                        usertemptemp.Password      = userTable.Password;
                        usertemptemp.ModifiedBy    = userTable.ModifiedBy;
                        usertemptemp.ModifiedDate  = userTable.ModifiedDate;
                        OfficeManagementDbContext.UserDbSet.Update(usertemptemp);
                        OfficeManagementDbContext.SaveChanges();
                        // istatus = true;
                    }
                }
                else
                {
                    //Usertable usertemptemp = null;

                    //usertemptemp.Firstname = userTable.Firstname;
                    //usertemptemp.Lastname = userTable.Lastname;
                    //usertemptemp.Emailid = userTable.Emailid;
                    //usertemptemp.Contactnumber = userTable.Contactnumber;
                    //usertemptemp.IsActive = userTable.IsActive;
                    //usertemptemp.IsDeleted = userTable.IsDeleted;
                    //usertemptemp.Password = userTable.Password;
                    //usertemptemp.ModifiedBy = 1;
                    //usertemptemp.ModifiedDate = userTable.ModifiedDate;
                    OfficeManagementDbContext.UserDbSet.Add(userTable);
                    OfficeManagementDbContext.SaveChanges();
                }
                istatus = true;
            }
            catch
            {
            }
            return(istatus);
        }
예제 #16
0
        public bool Delete(int Id, OfficeManagementDbContext OfficeManagementDbContext)
        {
            bool isStatus = false;

            try
            {
                Invoice invoice = OfficeManagementDbContext.InvoiceDbSet.Where(x => x.Id == Id).FirstOrDefault();
                invoice.IsDeleted    = true;
                invoice.ModifiedBy   = 1;
                invoice.ModifiedDate = DateTime.Now;
                OfficeManagementDbContext.InvoiceDbSet.Update(invoice);
                OfficeManagementDbContext.SaveChanges();
                isStatus = true;
            }
            catch (Exception ex)
            {
            }
            return(isStatus);
        }
예제 #17
0
        public bool Delete(int Id, OfficeManagementDbContext OfficeManagementDbContext)
        {
            bool isStatus = false;

            try
            {
                //InvoiceItem invoiceItem = OfficeManagementDbContext.InvoiceItem.Where(x => x.Id == Id).ToList<InvoiceItem>();
                //invoiceItem.IsDeleted = true;
                //invoiceItem.ModifiedBy = 1;
                //invoiceItem.ModifiedDate = DateTime.Now;
                //OfficeManagementDbContext.Cashflow.Update(cashflow);
                //OfficeManagementDbContext.SaveChanges();
                isStatus = true;
            }
            catch (Exception ex)
            {
            }
            return(isStatus);
        }
예제 #18
0
        public bool Delete(int Id, OfficeManagementDbContext OfficeManagementDbContext)
        {
            bool istatus = false;

            try
            {
                var usertemptemp = OfficeManagementDbContext.UserDbSet.Where(x => x.Id == Id).FirstOrDefault();

                if (usertemptemp != null)
                {
                    usertemptemp.IsDeleted    = true;
                    usertemptemp.ModifiedBy   = 1;
                    usertemptemp.ModifiedDate = DateTime.Now;
                    OfficeManagementDbContext.UserDbSet.Update(usertemptemp);
                    OfficeManagementDbContext.SaveChanges();
                    istatus = true;
                }
            }
            catch
            {
            }
            return(istatus);
        }