Пример #1
0
 // GET: Parent/Edit/5
 public ActionResult Edit(int id)
 {
     Student.Models.Parent _parent = new Student.Models.Parent();
     if (id == null)
     {
         return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
     }
     using (TritonEntities EFDbContext = new TritonEntities())
     {
         var ParentData = from ParentTable in EFDbContext.Parents
                          where ParentTable.ParentID == id
                          select ParentTable;
         if (ParentData.Any())
         {
             Dropdownlist _student = new Dropdownlist();
             ViewBag.studentID = _student.DrowStudentID();
             _parent.StudentID = ParentData.First().StudentID;
             _parent.ParentID  = ParentData.First().ParentID;
             _parent.Pa_name   = ParentData.First().Pa_name;
             _parent.Pa_sex    = ParentData.First().Pa_sex;
             //EFDbContext.SaveChanges();
             return(View(_parent));
         }
         else
         {
             return(HttpNotFound());
         }
     }
     return(View(_parent));
 }
Пример #2
0
        // GET: Parent/Create
        public ActionResult Create()
        {
            Dropdownlist _student = new Dropdownlist();

            ViewBag.studentID = _student.DrowStudentID();
            return(View());
        }
Пример #3
0
 // GET: Benchmark/Edit/5
 public ActionResult Edit(int id)
 {
     Student.Models.Benchmark _Benchmark = new Student.Models.Benchmark();
     if (id == null)
     {
         return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
     }
     using (TritonEntities EFDbContext = new TritonEntities())
     {
         var BenchmarkData = from BenchmarkTable in EFDbContext.Benchmarks
                             where BenchmarkTable.BenchmarkID == id
                             select BenchmarkTable;
         if (BenchmarkData.Any())
         {
             Dropdownlist _student = new Dropdownlist();
             ViewBag.studentID = _student.DrowStudentID();
             Dropdownlist _Course = new Dropdownlist();
             ViewBag.CourseID          = _Course.DrowCourseID();
             _Benchmark.StudentID      = BenchmarkData.First().StudentID;
             _Benchmark.BenchmarkID    = BenchmarkData.First().BenchmarkID;
             _Benchmark.CourseID       = BenchmarkData.First().CourseID;
             _Benchmark.benchmarkRange = BenchmarkData.First().benchmarkRange;
             //EFDbContext.SaveChanges();
             return(View(_Benchmark));
         }
         else
         {
             return(HttpNotFound());
         }
     }
     return(View(_Benchmark));
 }
Пример #4
0
        private List <Dropdownlist> createDropDownList()
        {
            List <Dropdownlist> allDropdownlists = new List <Dropdownlist>();

            // Get dropdownlist selected options (saved in Index POST function)
            string statisticsOption = (TempData["statisticsOption"] == null) ? "" : (string)TempData["statisticsOption"];

            // Create Statistic choice dropdownlist
            Dropdownlist districtList = new Dropdownlist();

            districtList.listLabel   = "Select Statistic:";
            districtList.listName    = "StatisticDropDownList";
            districtList.listOptions = new List <SelectListItem>();
            string[] statisticsOptions = { "Property Type Popularity", "Population in Districts" };
            foreach (string option in statisticsOptions)
            {
                districtList.listOptions.Add(
                    new SelectListItem()
                {
                    Text     = option,
                    Value    = option,
                    Selected = (statisticsOption.Equals(option)) ? true : false
                });
            }
            allDropdownlists.Add(districtList);
            return(allDropdownlists);
        }
Пример #5
0
        public ActionResult UserInfo(bool mail = false)
        {
            if (mail)
            {
                ViewBag.Massage = "Alreday exists";
            }

            ViewBag.Designations = new SelectList(Dropdownlist.GetDesignations(), "Value", "Text");
            return(View());
        }
Пример #6
0
        public ActionResult EditUser(int userId)
        {
            var user = dbContext.tb_UserInfos.FirstOrDefault(x => x.UserInfoId == userId);

            ViewBag.Designations = new SelectList(Dropdownlist.GetDesignations(), "Value", "Text");
            if (user != null)
            {
                return(View(user));
            }
            return(RedirectToAction("UserList"));
        }
Пример #7
0
        public static List <Dropdownlist> LoadDropDownList(List <Dropdownlist> lista, string accion)
        {
            Dropdownlist oParametro = new Dropdownlist
            {
                Id = -1
            };

            if (accion == "Seleccionar")
            {
                oParametro.Value = "--Seleccionar--";
            }
            else
            {
                oParametro.Value = "--Todos--";
            }

            lista.Insert(0, oParametro);
            return(lista);
        }
Пример #8
0
        public ActionResult ViewTaskComment()
        {
            ViewBag.ProjectName = new SelectList(Dropdownlist.GetAllProjects(), "Value", "Text");
            var taskComents = (from tb_ProjectTask in dbContext.tb_ProjectTasks
                               join tb_TaskComment in dbContext.tb_TaskComments on tb_ProjectTask.ProjectTaskId equals tb_TaskComment.TaskId
                               join tb_UserInfo in dbContext.tb_UserInfos on tb_ProjectTask.UserId equals tb_UserInfo.UserInfoId
                               //where tb_ProjectTask.ProjectTaskId == taskId
                               select new ViewComment
            {
                TaskId = tb_ProjectTask.ProjectTaskId,
                Cmnt = tb_TaskComment.Comment,
                UserId = tb_TaskComment.UpdateId,
                AssignBy = tb_UserInfo.Name,
                CommentDateTime = tb_ProjectTask.DueDate
            }).ToList();

            ViewBag.ViewTaskComment = taskComents;
            return(View());
        }
Пример #9
0
        public static List <Dropdownlist> LoadDropDownList(List <Dropdownlist> list, string action)
        {
            Dropdownlist oDropdownlistModel = new Dropdownlist
            {
                Id = "-1"
            };

            if (action == "Seleccionar")
            {
                oDropdownlistModel.Value = "--Seleccionar--";
            }
            else
            {
                oDropdownlistModel.Value = "--Todos--";
            }

            list.Insert(0, oDropdownlistModel);
            return(list);
        }
Пример #10
0
        public List <Dropdownlist> GetDdlYear()
        {
            using (var ctx = new ConXContext())
            {
                List <Dropdownlist> ddl = new List <Dropdownlist>();
                int year = DateTime.Today.Year + 1;
                for (int i = 0; i < 6; i++)
                {
                    Dropdownlist d = new Dropdownlist()
                    {
                        key   = year - i,
                        value = (year - i).ToString()
                    };
                    ddl.Add(d);
                }

                return(ddl);
            }
        }
Пример #11
0
        public ActionResult AssignResourcePerson()
        {
            ViewBag.ProjectName = new SelectList(Dropdownlist.GetAllProjects(), "Value", "Text");
            ViewBag.UserName    = new SelectList(Dropdownlist.GetAllUsers(), "Value", "Text");

            var model = (from tb_AssignPerson in dbContext.tb_AssignPersons
                         join tb_UserInfo in dbContext.tb_UserInfos on tb_AssignPerson.UserId equals tb_UserInfo.UserInfoId
                         join tb_ProjectInfo in dbContext.tb_ProjectInfos on tb_AssignPerson.ProjectId equals tb_ProjectInfo.ProjectInfoId
                         select new AssignPersonList
            {
                ProjectId = tb_AssignPerson.ProjectId,
                ProjectName = tb_ProjectInfo.Name,
                UserId = tb_AssignPerson.UserId,
                PersonName = tb_UserInfo.Name,
                PersonDesignation = tb_UserInfo.Designation,
            }).ToList();

            ViewBag.assignPersonList = model;
            return(View());
        }
Пример #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                EmployeeJob.Value = Session["job"].ToString();
                //Session.Remove("name");

                string         str  = @"data source=FRANK\SQLEXPRESS; initial catalog = LocalDB; user id = sa; password = 123";
                SqlConnection  con  = new SqlConnection(str);
                string         com  = "select EmployeeJob, PricingCode+' '+PricingName as 'PricingAll' from dbo.Works where EmployeeJob='" + this.EmployeeJob.Value + "'";
                SqlDataAdapter adpt = new SqlDataAdapter(com, con);
                DataTable      dt   = new DataTable();
                adpt.Fill(dt);
                Dropdownlist.DataSource = dt;
                Dropdownlist.DataBind();
                Dropdownlist.DataTextField  = "PricingAll";
                Dropdownlist.DataValueField = "PricingAll";
                Dropdownlist.DataBind();
            }
        }
Пример #13
0
        public List <Dropdownlist> GetDdlMonth()
        {
            using (var ctx = new ConXContext())
            {
                List <Dropdownlist> ddl = new List <Dropdownlist>();


                for (int i = 1; i <= 12; i++)
                {
                    Dropdownlist d = new Dropdownlist()
                    {
                        key   = i,
                        value = Util.Util.GetMonthNameThai(i)
                    };
                    ddl.Add(d);
                }

                return(ddl);
            }
        }
Пример #14
0
        public ActionResult AddItem()
        {
            try
            {
                NewItem model = new NewItem();
                model.DateOfEntry = DateTime.Today;

                Dropdownlist item  = new Dropdownlist();
                var          tuple = item.InitModel();

                model.Size     = tuple.Item1;
                model.Color    = tuple.Item2;
                model.Category = tuple.Item3;
                model.Brand    = tuple.Item4;

                return(View(model));
            }

            catch (Exception ex)
            {
                Log.Error(ex.ToString());
                throw;
            }
        }
Пример #15
0
        public AuthenticationData login(string username, string password)
        {
            using (var ctx = new ConXContext())
            {
                User user = ctx.Users
                            .Include("userBranchPrvlgList.branch")
                            .Include("userBranchPrvlgList.userRole")
                            .Include("department")
                            .Where(z => z.username == username)
                            .SingleOrDefault();

                if (user == null)
                {
                    throw new Exception("รหัสผู้ใช้หรือรหัสผ่านไม่ถูกต้อง");
                }
                else
                {
                    if (!user.password.Equals(password))
                    {
                        throw new Exception("รหัสผู้ใช้หรือรหัสผ่านไม่ถูกต้อง");
                    }

                    if (!user.statusId.Equals("A"))
                    {
                        throw new Exception("สถานะผู้ใช้งานนี้ถูกยกเลิก");
                    }
                }

                AuthenticationData data = new AuthenticationData()
                {
                    username            = user.username,
                    name                = user.name,
                    isPC                = user.isPC,
                    isDefaultPassword   = (user.password == DefaultPassword.value),
                    department          = user.department,
                    departmentId        = user.departmentId,
                    statusId            = user.statusId,
                    userBranchPrvlgList = user.userBranchPrvlgList.Where(x => x.branch.status == "A").ToList(),
                    userRoleId          = user.userRoleId,
                    menuGroups          = new List <ModelViews.menuFunctionGroupView>(),
                    userBranchGroupes   = new List <Dropdownlist>(),
                    userBranches        = new List <Dropdownlist>()
                };
                foreach (UserBranchPrvlg branchPrvlg in user.userBranchPrvlgList.Where(x => x.branch.status == "A"))
                {
                    Dropdownlist branch = new Dropdownlist
                    {
                        parentKey = branchPrvlg.branch.branchGroupId,
                        key       = branchPrvlg.branch.branchId,
                        value     = branchPrvlg.branch.branchCode + "-" + branchPrvlg.branch.entityCode + " " + branchPrvlg.branch.branchNameThai,
                    };
                    data.userBranches.Add(branch);

                    Dropdownlist bGroup = data.userBranchGroupes.Find(z => z.key == branch.parentKey);

                    if (bGroup == null)
                    {
                        BranchGroup  bGroupFull  = ctx.BranchGroups.Where(z => z.branchGroupId == branch.parentKey).SingleOrDefault();
                        Dropdownlist branchGroup = new Dropdownlist()
                        {
                            key   = bGroupFull.branchGroupId,
                            value = bGroupFull.branchGroupCode + "-" + bGroupFull.branchGroupName
                        };
                        data.userBranchGroupes.Add(branchGroup);
                    }
                }


                if (!user.isPC)
                {
                    data.menuGroups = getUserRole((long)user.userRoleId);
                }


                return(data);
            }
        }
Пример #16
0
 public ActionResult CreateTask()
 {
     ViewBag.ProjectName = new SelectList(Dropdownlist.GetAllProjects(), "Value", "Text");
     ViewBag.Priority    = new SelectList(Dropdownlist.GetPriority(), "Value", "Text");
     return(View());
 }
Пример #17
0
 public ActionResult AddComment()
 {
     ViewBag.ProjectName = new SelectList(Dropdownlist.GetAllProjects(), "Value", "Text");
     return(View());
 }
        // Function to create all dropdown lists for property listing
        private List <Dropdownlist> createDropDownLists()
        {
            List <Dropdownlist> allDropdownlists = new List <Dropdownlist>();

            // Get dropdownlist selected options (saved in Listing POST function)
            string districtOption     = (TempData["districtOption"] == null) ? "" : (string)TempData["districtOption"];
            string propertyTypeOption = (TempData["propertyTypeOption"] == null) ? "" : (string)TempData["propertyTypeOption"];
            string listingTypeOption  = (TempData["listingTypeOption"] == null) ? "" : (string)TempData["listingTypeOption"];
            string priceOption        = (TempData["priceOption"] == null) ? "" : (string)TempData["priceOption"];

            // Create District Dropdownlist
            Dropdownlist districtList = new Dropdownlist();

            districtList.listLabel   = "District:";
            districtList.listName    = "DistrictDropDownList";
            districtList.listOptions = new List <SelectListItem>();
            districtList.listOptions.Add(new SelectListItem()
            {
                Text = defaultListOption, Value = defaultListOption
            });
            foreach (string district in propertyMapper.GetAllDistrictName())
            {
                districtList.listOptions.Add(
                    new SelectListItem()
                {
                    Text     = district,
                    Value    = district,
                    Selected = (districtOption.Equals(district)) ? true : false
                });
            }
            allDropdownlists.Add(districtList);

            // Create Property Type Dropdownlist
            Dropdownlist propertyTypeList = new Dropdownlist();

            propertyTypeList.listLabel   = "Property Type:";
            propertyTypeList.listName    = "PropertyTypeDropDownList";
            propertyTypeList.listOptions = new List <SelectListItem>();
            propertyTypeList.listOptions.Add(new SelectListItem()
            {
                Text = defaultListOption, Value = defaultListOption
            });
            foreach (string propertyType in propertyMapper.GetAllPropertyTypes())
            {
                propertyTypeList.listOptions.Add(
                    new SelectListItem()
                {
                    Text     = propertyType,
                    Value    = propertyType,
                    Selected = (propertyTypeOption.Equals(propertyType)) ? true : false
                });
            }
            allDropdownlists.Add(propertyTypeList);

            // Create Listing Type DropdownList
            Dropdownlist listingTypeList = new Dropdownlist();

            listingTypeList.listLabel   = "Listing Type:";
            listingTypeList.listName    = "ListTypeDropDownList";
            listingTypeList.listOptions = new List <SelectListItem>();
            listingTypeList.listOptions.Add(new SelectListItem()
            {
                Text = defaultListOption, Value = defaultListOption
            });
            foreach (string listingType in propertyMapper.GetAllListingTypes())
            {
                listingTypeList.listOptions.Add(
                    new SelectListItem()
                {
                    Text     = listingType,
                    Value    = listingType,
                    Selected = (listingTypeOption.Equals(listingType)) ? true : false
                });
            }
            allDropdownlists.Add(listingTypeList);

            // Create Price DropdownList
            Dropdownlist priceList = new Dropdownlist();

            priceList.listLabel   = "Price:";
            priceList.listName    = "PriceDropDownList";
            priceList.listOptions = new List <SelectListItem>();
            int[] priceRange = { 0, 2000, 5000, 100000, 500000, 1000000, 5000000 };
            foreach (int price in priceRange)
            {
                priceList.listOptions.Add(
                    new SelectListItem()
                {
                    Text     = (price == 0) ? defaultListOption : "< " + price,
                    Value    = price.ToString(),
                    Selected = (priceOption.Equals(price.ToString())) ? true : false
                });
            }
            allDropdownlists.Add(priceList);

            return(allDropdownlists);
        }