Beispiel #1
0
        //

        public void DropdownValues()
        {
            var JobSchema = _IJobSchemaRepository.GetJobSchema(new Guid(Session["OrganizationGUID"].ToString())).ToList().Select(r => new SelectListItem
            {
                Value = r.JobFormGUID.ToString(),
                Text  = r.FriendlyName
            });

            ViewBag.JobSchemaName = new SelectList(JobSchema, "Value", "Text");

            var listItems = new List <ListItem> {
                new ListItem {
                    Text = "One Time", Value = "true"
                }, new ListItem {
                    Text = "Any Time", Value = "false"
                }
            };

            ViewBag.Schedule = new SelectList(listItems, "Value", "Text");
        }
Beispiel #2
0
        //
        // GET: /Job/
        public ActionResult Index(string id = "")
        {
            Logger.Debug("Inside Job Controller- Index");
            try
            {
                if (Session["OrganizationGUID"] != null)
                {
                    DropdownValues();
                    var jobSchemaList = new JobSchemaViewModel();
                    jobSchemaList.JobSchemaModel = new List <JobSchemaModel>();
                    var appJobSchema = new List <JobForm>();
                    // if (string.IsNullOrEmpty(id))
                    {
                        appJobSchema = _IJobSchemaRepository.GetJobSchema(new Guid(Session["OrganizationGUID"].ToString())).ToList();
                    }
                    //else
                    //{
                    //    appJobSchema = _IJobSchemaRepository.GetJobSchemabyGroupCode(new Guid(id)).ToList();
                    //}
                    foreach (var jobshcema in appJobSchema.ToList())
                    {
                        JobSchemaModel pJobSchemaModel = new JobSchemaModel();

                        pJobSchemaModel.JobLogicalID     = jobshcema.JobFormGUID.ToString();
                        pJobSchemaModel.OrganizationGUID = jobshcema.OrganizationGUID != null?jobshcema.OrganizationGUID.ToString() : Guid.Empty.ToString();

                        pJobSchemaModel.JobSchemaName = jobshcema.FriendlyName;
                        // GroupCode = "",//jobshcema.GroupCode.ToString(),

                        pJobSchemaModel.LastModifiedDate = Session["TimeZoneID"] != null?Convert.ToDateTime(_IUserRepository.GetLocalDateTime(jobshcema.LastModifiedDate, Session["TimeZoneID"].ToString())) : Convert.ToDateTime(jobshcema.LastModifiedDate);

                        pJobSchemaModel.LastModifiedDateTime = pJobSchemaModel.LastModifiedDate.ToString("MM/dd/yy hh:mm tt");
                        pJobSchemaModel.LastModifiedBy       = jobshcema.LastModifiedBy.ToString();
                        //  EstimatedDuration = jobshcema.EstimatedDuration


                        jobSchemaList.JobSchemaModel.Add(pJobSchemaModel);
                    }
                    StringBuilder sb = new StringBuilder();
                    sb.Append("<div class='actions'>");
                    sb.Append("<div class='btn-group'>");
                    //if (!string.IsNullOrEmpty(id))
                    //{
                    //    sb.Append("<a href='#' id='ulaworkergroup' class='btn green' data-toggle='dropdown'><i class='icon-map-marker'></i>" + _IGroupRepository.GetGroupNameByGroupGUID(new Guid(id)) + " <i class='icon-angle-down'></i></a>");
                    //}
                    //else
                    {
                        sb.Append("<a href='#' id='ulaworkergroup' class='btn green' data-toggle='dropdown'><i class='icon-map-marker'></i>Worker Group <i class='icon-angle-down'></i></a>");
                    }
                    sb.Append("<ul id='ulworkgroup' class='dropdown-menu pull-left'>");
                    sb.Append("<li><a href=" + Url.Action("Index", new { id = "" }) + ">All</a></li>");
                    //List<Group> GroupList = _IGroupRepository.GetGroupByOrganizationGUID(new Guid(Session["OrganizationGUID"].ToString())).ToList();
                    //foreach (Group item in GroupList)
                    //{

                    //    sb.Append("<li><a href=" + Url.Action("Index", new { id = item.GroupGUID.ToString() }) + " data-groupguid=" + item.GroupGUID + ">" + item.Name + "</a></li>");
                    //}
                    sb.Append("</ul>");
                    sb.Append("</div>");
                    sb.Append("</div>");
                    ViewBag.Group = sb.ToString();
                    return(View(jobSchemaList.JobSchemaModel.AsEnumerable()));
                }
                else
                {
                    return(RedirectToAction("SessionTimeOut", "User"));
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message);
                return(RedirectToAction("Login", "User"));
            }
        }