Beispiel #1
0
        public static List <ListBoxHelper> GetCrewUsers()
        {
            JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();

            List <JneCommSitesDataLayer.AspNetUsers> itemList = (from p in _dbContext.AspNetUsers
                                                                 from d in p.AspNetRoles
                                                                 where d.Name == "CrewRole"
                                                                 select p).ToList();

            List <ListBoxHelper> listUsers = new List <ListBoxHelper>();

            listUsers.Add(new ListBoxHelper
            {
                Selected   = true,
                isChildren = false,
                Text       = "All Users",
                Value      = "AllUsers",
            });

            foreach (JneCommSitesDataLayer.AspNetUsers item in itemList)
            {
                listUsers.Add(new ListBoxHelper
                {
                    Selected   = false,
                    isChildren = false,
                    Text       = item.T_UsersData.UserFirstName + " " + item.T_UsersData.UserLastName,
                    Value      = item.UserName,
                });
            }
            return(listUsers);
        }
Beispiel #2
0
        public ActionResult EditUser(string userName)
        {
            if (string.IsNullOrEmpty(userName))
            {
                return(RedirectToAction("UsersIndex", "Maintenance"));
            }
            JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();

            var aspNetUserQuery = (from p in _dbContext.AspNetUsers
                                   where p.UserName == userName
                                   select p).FirstOrDefault();

            var rolQUery = (from p in _dbContext.AspNetRoles
                            from d in p.AspNetUsers
                            where d.Id == aspNetUserQuery.Id
                            select p).FirstOrDefault();

            var userInf = (from p in _dbContext.T_UsersData
                           where p.Id == aspNetUserQuery.Id
                           select p).First();

            Models.CreateUserModel model = new Models.CreateUserModel();

            model._UserGroup      = Helper.Helper.GetRoles();
            model.UserGroup       = rolQUery.Name;
            model.UserName        = aspNetUserQuery.UserName;
            model.firstName       = userInf.UserFirstName;
            model.LastName        = userInf.UserLastName;
            model.daysChangePass  = Convert.ToInt16(userInf.NumDaysForPassChange);
            model.Email           = aspNetUserQuery.Email;
            model.lockedOutUser   = aspNetUserQuery.LockoutEnabled;
            model.forcePassChange = Convert.ToBoolean(userInf.ForcePassChange);
            return(View(model));
        }
Beispiel #3
0
 public ActionResult CreateCertification(Models.CertificationModel model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();
             var existCertification = (from p in _dbContext.T_Certifications
                                       where p.vCertificationName == model.certificationName
                                       select p).FirstOrDefault();
             if (existCertification != null)
             {
                 ModelState.AddModelError(string.Empty, "The certification already exist");
                 return(View());
             }
             JneCommSitesDataLayer.T_Certifications newCertification = new JneCommSitesDataLayer.T_Certifications();
             newCertification.vCertificationName        = model.certificationName;
             newCertification.vCertificationDescription = model.certificationpDescription;
             _dbContext.T_Certifications.Add(newCertification);
             _dbContext.SaveChanges();
             return(RedirectToAction("CertificationsList", "Maintenance"));
         }
         catch (Exception error)
         {
             ModelState.AddModelError(string.Empty, error.Message);
             return(View());
         }
     }
     return(View());
 }
        public JsonResult GetPurchaseByUser(string purchaseType)
        {
            JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();
            string userName = HttpContext.User.Identity.Name;

            var queryCurrentActivityLog = (from p in _dbContext.T_ActivityLog
                                           where p.AspNetUsers.UserName == userName &&
                                           (p.dtEndWorkingDay == null)
                                           select p).FirstOrDefault();

            var queryPurchaseID = (from p in _dbContext.T_PurchaseType
                                   where p.vPurchaseTypeName == purchaseType
                                   select p.iPuchaseTypeID).FirstOrDefault();

            List <PurchaseInformation> purchaseInformation = new List <PurchaseInformation>();
            var purchaseQuery = (from p in _dbContext.T_ActivityLog
                                 from d in p.T_Purchase
                                 where p.AspNetUsers.UserName == userName &&
                                 (p.dtEndWorkingDay == null) && d.iPuchaseTypeID == queryPurchaseID
                                 select d);

            foreach (var item in purchaseQuery)
            {
                purchaseInformation.Add(new PurchaseInformation
                {
                    description  = item.Description,
                    purchaseDate = item.dtPurchaseStartDate.ToString(),
                    invoiceName  = item.InvoiceName
                });
            }


            return(Json(purchaseInformation, JsonRequestBehavior.AllowGet));
        }
        public ActionResult CreateActivityLogOptions()
        {
            Models.ActivityLogsOptions model = GetActivityLogsOptionsModel(new Models.ActivityLogsOptions());
            JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();

            string userName = HttpContext.User.Identity.Name;

            var queryUser = (from p in _dbContext.AspNetUsers
                             where p.UserName == userName
                             select p).FirstOrDefault();

            var queryExistLogActivity = (from p in _dbContext.T_ActivityLog
                                         where p.AspNetUsers.UserName == userName &&
                                         p.dtEndWorkingDay == null
                                         select p).FirstOrDefault();

            if (queryExistLogActivity != null)
            {
                if (!string.IsNullOrEmpty(queryExistLogActivity.vSiteName))
                {
                    model.site = queryExistLogActivity.vSiteName;
                }
            }
            return(View(model));
        }
Beispiel #6
0
        public ActionResult EditCrewRol(Models.CrewRolModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();

                    var queryCetification = (from p in _dbContext.T_CrewRoles
                                             where p.vCrewRoleName == model.crewRoleName
                                             select p).FirstOrDefault();

                    queryCetification.vCrewRoleDescription = model.crewRoleDescription;

                    _dbContext.SaveChanges();
                    return(RedirectToAction("CrewRolesList", "Maintenance"));
                }
                catch (Exception error)
                {
                    ModelState.AddModelError(string.Empty, error.Message);
                    return(View());
                }
            }
            return(View());
        }
Beispiel #7
0
        public JsonResult GetCrewUsersBySite(string siteName)
        {
            JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();

            var queryCrewUsersBySite = (from p in _dbContext.AspNetUsers
                                        from d in p.T_Sites
                                        where d.vSiteName == siteName
                                        select p);
            List <CrewUserData> crewUsers = new List <CrewUserData>();

            foreach (var item in queryCrewUsersBySite)
            {
                string roleQuery = (from p in _dbContext.T_CrewRoles
                                    from d in p.AspNetUsers
                                    where d.Id == item.Id
                                    select p.vCrewRoleName).FirstOrDefault();

                crewUsers.Add(new CrewUserData
                {
                    crewName = item.UserName,
                    crewRole = item.T_UsersData.UserFirstName + " " + item.T_UsersData.UserLastName + "-" + roleQuery
                });
            }

            return(Json(crewUsers, JsonRequestBehavior.AllowGet));
        }
Beispiel #8
0
        public JsonResult GetExpensesBySite(string siteName)
        {
            JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();

            decimal totalExpenses = 0;
            List <ExpensesnBySite> expensesBySite = new List <ExpensesnBySite>();

            var queryActivityLogBySite = (from p in _dbContext.T_ActivityLog
                                          where p.vSiteName == siteName
                                          select p);

            foreach (var item in queryActivityLogBySite)
            {
                var queryExpensesByLogActivity = (from p in _dbContext.T_Purchase
                                                  where p.iActivityLogID == item.iActivityLogID
                                                  select p);
                foreach (var itemExpense in queryExpensesByLogActivity)
                {
                    totalExpenses = (totalExpenses + Convert.ToDecimal(itemExpense.dPrice));
                    expensesBySite.Add(new ExpensesnBySite
                    {
                        datePurchase        = itemExpense.dtPurchaseStartDate.ToString(),
                        purchaseDescription = itemExpense.Description,
                        purchaseType        = itemExpense.T_PurchaseType.vPurchaseTypeName,
                        valuePurchase       = itemExpense.dPrice.ToString(),
                        totalExpenses       = totalExpenses
                    });
                }
            }

            return(Json(expensesBySite, JsonRequestBehavior.AllowGet));
        }
Beispiel #9
0
        public ActionResult CreateEmployee()
        {
            JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbConetxt = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();
            Models.EmployeeModel model = new Models.EmployeeModel();
            string actualDate          = "";// DateTime.Now.ToString("yyyy-MM-dd");

            model._UserCrewGroup = Helper.Helper.GetSubRoles("CrewRole");
            model._StatesList    = Helper.Helper.GetUSAStates();

            var queryCertifications = (from p in _dbConetxt.T_Certifications
                                       select p);

            model._ListCertifications = new List <Models.CertificationsByEmployee>();

            foreach (var item in queryCertifications)
            {
                model._ListCertifications.Add(new Models.CertificationsByEmployee
                {
                    certificationName = item.vCertificationName,
                    expirationTime    = actualDate
                });
            }

            return(View(model));
        }
Beispiel #10
0
        public ActionResult EditTechEvolutionCode(Models.TechEvolutionCodesModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();

                    var queryTechEvolutionCode = (from p in _dbContext.T_TechEvolutionCodes
                                                  where p.vTechEvolutionCodeName == model.techEvolutionCodeName
                                                  select p).FirstOrDefault();

                    queryTechEvolutionCode.vTechEvolutionCodeDescription = model.techEvolutionCodeDescription;

                    _dbContext.SaveChanges();
                    return(RedirectToAction("TechEvolutionCodesList", "Maintenance"));
                }
                catch (Exception error)
                {
                    ModelState.AddModelError(string.Empty, error.Message);
                    return(View());
                }
            }
            return(View());
        }
Beispiel #11
0
        public static List <ListBoxHelper> GetOperations(string rolName)
        {
            JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();
            List <JneCommSitesDataLayer.T_Operations>          itemList   = (from p in _dbContext.T_Operations
                                                                             where p.vControllerName != "Mobile"
                                                                             select p).ToList();

            List <ListBoxHelper> listPermission = new List <ListBoxHelper>();

            foreach (JneCommSitesDataLayer.T_Operations item in itemList)
            {
                bool selected       = false;
                var  operationByRol = (from p in _dbContext.T_Operations
                                       from d in p.AspNetRoles
                                       where d.Name == rolName
                                       select p);
                foreach (var itemOperation in operationByRol)
                {
                    if (itemOperation.biOperationsId == item.biOperationsId)
                    {
                        selected = true;
                    }
                }
                listPermission.Add(new ListBoxHelper
                {
                    Selected   = selected,
                    isChildren = false,
                    Text       = item.vDisplayTittle,
                    Value      = item.biOperationsId.ToString(),
                });
            }
            return(listPermission);
        }
Beispiel #12
0
        public ActionResult TaskProgressList()
        {
            JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();
            var queryTaskActivity = from p in _dbContext.T_TaskProgress
                                    select p;

            return(View(queryTaskActivity));
        }
Beispiel #13
0
        public ActionResult TechEvolutionCodesList()
        {
            JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();
            var techEvolutionCodesQuery = (from p in _dbContext.T_TechEvolutionCodes
                                           orderby p.vTechEvolutionCodeName descending
                                           select p);

            return(View(techEvolutionCodesQuery));
        }
Beispiel #14
0
        public ActionResult CrewRolesList()
        {
            JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();
            var certificationsQuery = (from p in _dbContext.T_CrewRoles
                                       orderby p.vCrewRoleName descending
                                       select p);

            return(View(certificationsQuery));
        }
Beispiel #15
0
        public JsonResult GetCertifications()
        {
            JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();

            var queryCertifications = (from p in _dbContext.T_Certifications
                                       select p.vCertificationName);

            return(Json(queryCertifications, JsonRequestBehavior.AllowGet));
        }
Beispiel #16
0
        public ActionResult EditCustomer(Models.CustomerModels model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();

                    var queryCustomer = (from p in _dbContext.T_Customer
                                         where p.vCustomerName == model.custumerName
                                         select p).FirstOrDefault();

                    model._StatesList = Helper.Helper.GetUSAStates();
                    //queryCustomer.custumerName = model.custumerName;
                    queryCustomer.vCustomerAddress = model.customerAddress;
                    queryCustomer.vStateCode       = model.states;
                    queryCustomer.vCustomerCity    = model.customerCity;

                    _dbContext.SaveChanges();

                    JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContextContacts = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();

                    var queryContactsByCustomer = (from p in _dbContextContacts.T_ContactsByCustomer
                                                   where p.vCustomerName == model.custumerName
                                                   select p);

                    foreach (var item in queryContactsByCustomer)
                    {
                        _dbContextContacts.T_ContactsByCustomer.Remove(item);
                    }
                    _dbContextContacts.SaveChanges();

                    foreach (var item in model._ListContacts)
                    {
                        JneCommSitesDataLayer.T_ContactsByCustomer newContactByCustomer = new JneCommSitesDataLayer.T_ContactsByCustomer();

                        newContactByCustomer.vContactName  = item.contactName;
                        newContactByCustomer.vEmailContact = item.contactEmail;
                        newContactByCustomer.vPhoneContact = item.contactPhone;
                        newContactByCustomer.vAreaContact  = item.contactArea;
                        newContactByCustomer.vCustomerName = model.custumerName;

                        _dbContext.T_ContactsByCustomer.Add(newContactByCustomer);

                        _dbContext.SaveChanges();
                    }

                    return(Json(true));
                }
                catch (Exception error)
                {
                    return(Json(error.Message));
                }
            }
            return(Json("There is a error, Please try again."));
        }
Beispiel #17
0
        public static string GetCrewRoleByUser(string userName)
        {
            JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();
            string queryRol = (from p in _dbContext.T_CrewRoles
                               from d in p.AspNetUsers
                               where d.UserName == userName
                               select p.vCrewRoleName).FirstOrDefault();

            return(queryRol);
        }
        public ActionResult Index()
        {
            JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();
            DateTime timeExpirationAlert = DateTime.Now.AddDays(15);
            var      queryCertification  = (from p in _dbContext.T_CertificationsByUserCrew
                                            where timeExpirationAlert > p.dExpirationTime
                                            select p);

            return(View(queryCertification));
        }
Beispiel #19
0
        public ActionResult CreateCustomer(Models.CustomerModels model)
        {
            if (ModelState.IsValid)
            {
                JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();

                var queryCustomer = (from p in _dbContext.T_Customer
                                     where p.vCustomerName == model.custumerName
                                     select p).FirstOrDefault();

                if (queryCustomer != null)
                {
                    ModelState.AddModelError(string.Empty, "The Customer already exist");
                    model._StatesList = Helper.Helper.GetUSAStates();
                    return(Json("The Customer already exist"));
                }

                JneCommSitesDataLayer.T_Customer newCustomer = new JneCommSitesDataLayer.T_Customer();

                newCustomer.vCustomerName    = model.custumerName;
                newCustomer.vCustomerAddress = model.customerAddress;
                newCustomer.vCustomerCity    = model.customerCity;
                newCustomer.vStateCode       = model.states;

                _dbContext.T_Customer.Add(newCustomer);
                _dbContext.SaveChanges();

                foreach (var item in model._ListContacts)
                {
                    JneCommSitesDataLayer.T_ContactsByCustomer newContactByCustomer = new JneCommSitesDataLayer.T_ContactsByCustomer();

                    newContactByCustomer.vContactName  = item.contactName;
                    newContactByCustomer.vEmailContact = item.contactEmail;
                    newContactByCustomer.vPhoneContact = item.contactPhone;
                    newContactByCustomer.vAreaContact  = item.contactArea;
                    newContactByCustomer.vCustomerName = model.custumerName;

                    _dbContext.T_ContactsByCustomer.Add(newContactByCustomer);

                    _dbContext.SaveChanges();
                }

                return(Json(true));
            }
            if (model._ListContacts == null)
            {
                return(Json("You need add a contact for the costumer."));
            }
            return(Json("There is a error, please try again."));
        }
Beispiel #20
0
        public ActionResult CustomersIndex(string customerID)
        {
            if (string.IsNullOrEmpty(customerID))
            {
                customerID = "";
            }

            JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();
            var queryCustomers = (from p in _dbContext.T_Customer
                                  where p.vCustomerName.Contains(customerID)
                                  orderby p.vCustomerName descending
                                  select p);

            return(View(queryCustomers));
        }
Beispiel #21
0
        public ActionResult PaymentPeriod()
        {
            JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();

            var paymentPeriodQuery = (from p in _dbContext.T_PaymentPeriod
                                      select p).FirstOrDefault();

            if (paymentPeriodQuery == null)
            {
                paymentPeriodQuery = new JneCommSitesDataLayer.T_PaymentPeriod();
                paymentPeriodQuery.dStartCutOffDate = DateTime.Now;
            }

            return(View(paymentPeriodQuery));
        }
Beispiel #22
0
        public ActionResult CrewEmployeeIndex(string userID)
        {
            if (string.IsNullOrEmpty(userID))
            {
                userID = "";
            }

            JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();
            var queryUsers = (from p in _dbContext.vwUserData
                              where p.UserName.Contains(userID) &&
                              p.RoleName == "CrewRole"
                              select p);

            return(View(queryUsers));
        }
        public ActionResult Purchase(Models.ActivityLogsPurchase model)
        {
            if (ModelState.IsValid)
            {
                JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();

                string userName = HttpContext.User.Identity.Name;

                var queryCurrentActivityLog = (from p in _dbContext.T_ActivityLog
                                               where p.AspNetUsers.UserName == userName &&
                                               (p.dtEndWorkingDay == null)
                                               select p).FirstOrDefault();

                var queryPurchaseID = (from p in _dbContext.T_PurchaseType
                                       where p.vPurchaseTypeName == model.purchaseType
                                       select p.iPuchaseTypeID).FirstOrDefault();

                JneCommSitesDataLayer.T_Purchase newPurchase = new JneCommSitesDataLayer.T_Purchase();

                string invoiceName = "Nothing";
                newPurchase.iActivityLogID = queryCurrentActivityLog.iActivityLogID;
                newPurchase.Description    = model.description;

                newPurchase.iPuchaseTypeID      = queryPurchaseID;
                newPurchase.dtPurchaseEndDate   = Convert.ToDateTime(DateTime.Now);
                newPurchase.dtPurchaseStartDate = Convert.ToDateTime(model.startPurchaseCheckPoint, culture);
                newPurchase.dPrice    = Convert.ToDecimal(model.price);
                newPurchase.vPosition = model.position;
                _dbContext.T_Purchase.Add(newPurchase);


                if (model.documentToUpload != null)
                {
                    invoiceName = userName + "_" + model.description.Replace(" ", "") + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + "_" + Path.GetExtension(model.documentToUpload.FileName).Replace(" ", "");

                    string path = System.IO.Path.Combine(Server.MapPath("~/Documents/Invoices/"), invoiceName);
                    // file is uploaded
                    model.documentToUpload.SaveAs(path);
                }
                newPurchase.InvoiceName = invoiceName;
                _dbContext.SaveChanges();
                return(View(model));
            }
            else
            {
                return(RedirectToAction("CreateActivityLogOptions"));
            }
        }
Beispiel #24
0
        public ActionResult EditCertification(string certificationName)
        {
            JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();
            Models.CertificationModel newCertificationModel = new CertificationModel();
            var queryCertification = (from p in _dbContext.T_Certifications
                                      where p.vCertificationName == certificationName
                                      select p).FirstOrDefault();

            if (queryCertification == null)
            {
                RedirectToAction("CertificationsList", "Maintenance");
            }
            newCertificationModel.certificationpDescription = queryCertification.vCertificationDescription;
            newCertificationModel.certificationName         = queryCertification.vCertificationName;
            return(View(newCertificationModel));
        }
Beispiel #25
0
        public ActionResult EditTaskProgress(int taskProgressID)
        {
            JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();
            Models.TaskProgress newTaskProgressModel = new TaskProgress();

            var queryTaskProgress = (from p in _dbContext.T_TaskProgress
                                     where p.iTaskProgressID == taskProgressID
                                     select p).FirstOrDefault();

            newTaskProgressModel.taskName        = queryTaskProgress.vTaskProgressName;
            newTaskProgressModel.taskDescription = queryTaskProgress.vTaskDescription;
            newTaskProgressModel.canUploadFile   = queryTaskProgress.bCanLoadFile;
            newTaskProgressModel.isActive        = Convert.ToBoolean(queryTaskProgress.bIsActive);

            return(View(newTaskProgressModel));
        }
Beispiel #26
0
        public ActionResult EditCrewRol(string crewRoleName)
        {
            JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();
            Models.CrewRolModel newCrewRolModel = new CrewRolModel();
            var queryCrewRole = (from p in _dbContext.T_CrewRoles
                                 where p.vCrewRoleName == crewRoleName
                                 select p).FirstOrDefault();

            if (queryCrewRole == null)
            {
                RedirectToAction("CrewRolesList", "Maintenance");
            }
            newCrewRolModel.crewRoleName        = queryCrewRole.vCrewRoleName;
            newCrewRolModel.crewRoleDescription = queryCrewRole.vCrewRoleDescription;
            return(View(newCrewRolModel));
        }
Beispiel #27
0
        public ActionResult EditTechEvolutionCode(string techEvolutionCodeName)
        {
            JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();
            Models.TechEvolutionCodesModel newTechEvolutionCode           = new TechEvolutionCodesModel();
            var querytechEvolutionCode = (from p in _dbContext.T_TechEvolutionCodes
                                          where p.vTechEvolutionCodeName == techEvolutionCodeName
                                          select p).FirstOrDefault();

            if (querytechEvolutionCode == null)
            {
                RedirectToAction("TechEvolutionCodesList", "Maintenance");
            }
            newTechEvolutionCode.techEvolutionCodeName        = querytechEvolutionCode.vTechEvolutionCodeName;
            newTechEvolutionCode.techEvolutionCodeDescription = querytechEvolutionCode.vTechEvolutionCodeDescription;
            return(View(newTechEvolutionCode));
        }
Beispiel #28
0
        public static List <Entry> GetCustomers()
        {
            JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();
            List <JneCommSitesDataLayer.T_Customer>            itemList   = (from p in _dbContext.T_Customer
                                                                             select p).ToList();
            List <Entry> items = new List <Entry>();

            foreach (JneCommSitesDataLayer.T_Customer item in itemList)
            {
                items.Add(new Entry
                {
                    ID          = item.vCustomerName,
                    Description = item.vCustomerName
                });
            }
            return(items);
        }
Beispiel #29
0
        public static List <Entry> GetTechEvolutionCodes()
        {
            JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();
            List <JneCommSitesDataLayer.T_TechEvolutionCodes>  itemList   = (from p in _dbContext.T_TechEvolutionCodes
                                                                             select p).ToList();
            List <Entry> items = new List <Entry>();

            foreach (JneCommSitesDataLayer.T_TechEvolutionCodes item in itemList)
            {
                items.Add(new Entry
                {
                    ID          = item.vTechEvolutionCodeName,
                    Description = item.vTechEvolutionCodeName
                });
            }
            return(items);
        }
Beispiel #30
0
 public ActionResult CreateTaskProgress(Models.TaskProgress model)
 {
     if (ModelState.IsValid)
     {
         JneCommSitesDataLayer.JneCommSitesDataBaseEntities _dbContext = new JneCommSitesDataLayer.JneCommSitesDataBaseEntities();
         JneCommSitesDataLayer.T_TaskProgress newTaskProgress          = new JneCommSitesDataLayer.T_TaskProgress();
         newTaskProgress.vTaskProgressName = model.taskName;
         newTaskProgress.vTaskDescription  = model.taskDescription;
         newTaskProgress.bCanLoadFile      = model.canUploadFile;
         newTaskProgress.bIsActive         = model.isActive;
         _dbContext.T_TaskProgress.Add(newTaskProgress);
         _dbContext.SaveChanges();
         return(RedirectToAction("TaskProgressList"));
     }
     ModelState.AddModelError(string.Empty, "There is an error, Try again.");
     return(View());
 }