Ejemplo n.º 1
0
        public ActionResult Save(Department1 department)
        {
            if (!ModelState.IsValid)
            {
                return(View("DepartmentForm"));
            }

            MessageViewModel model = new MessageViewModel();

            if (department.Id == 0)
            {
                db.Department1.Add(department);
                model.Message = department.Name + " added. Press to return ";
            }
            else
            {
                var deparmentToUpdate = db.Department1.Find(department.Id);
                if (deparmentToUpdate == null)
                {
                    return(HttpNotFound());
                }
                deparmentToUpdate.Name = department.Name;
                model.Message          = department.Name + " updated. Press to return ";
            }
            db.SaveChanges();
            model.Status   = true;
            model.LinkText = "Department List";
            model.Url      = "/Department";
            return(View("_Message", model));
        }
Ejemplo n.º 2
0
    public static void Main()
    {
        String depart_Name;

        Console.WriteLine("Enter the department name");
        depart_Name = Console.ReadLine();
        depart_Name = depart_Name.ToLower();
        if (depart_Name.Equals("d1"))
        {
            Department1 d1 = new Department1();
            dpartment1_get_data(d1);
        }
        else if (depart_Name.Equals("d2"))
        {
            Department2 d2 = new Department2();
            dpartment2_get_data(d2);
        }
        else if (depart_Name.Equals("d3"))
        {
            Department3 d3 = new Department3();
            dpartment3_get_data(d3);
        }
        else
        {
            System.Diagnostics.Debug.WriteLine("Department not found");
        }
    }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("Department1Id,Department1Name")] Department1 department1)
        {
            /*Check Session */
            var page            = "68";
            var typeofuser      = "";
            var PermisionAction = "";

            // CheckSession
            if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username")))
            {
                Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error);
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                typeofuser      = HttpContext.Session.GetString("TypeOfUserId");
                PermisionAction = HttpContext.Session.GetString("PermisionAction");
                if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false)
                {
                    Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error);
                    return(RedirectToAction("Index", "Home"));
                }
            }
            /*Check Session */

            if (ModelState.IsValid)
            {
                _context.Add(department1);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(RedirectToAction("Index", "Home"));
        }
Ejemplo n.º 4
0
    public static void Main()
    {
        CheckSchedule ch1;
        String        depart_Name;

        Console.WriteLine("Enter the department name as department1 , department2, or department3");
        depart_Name = Console.ReadLine().ToLower();
        switch (depart_Name)
        {
        case "department1":
            ch1 = new Department1();
            getClassUse(ch1);
            break;

        case "department2":
            ch1 = new Department2();
            getClassUse(ch1);
            break;

        case "department3":
            ch1 = new Department3();
            getClassUse(ch1);
            break;

        default:
            Console.WriteLine("Not having the class named");
            break;
        }
    }
Ejemplo n.º 5
0
 public static void dpartment1_get_data(Department1 objc)
 {
     System.Diagnostics.Debug.WriteLine("Enter the room type as general or icu: " + room_Type);
     room_Type = Console.ReadLine().ToLower();
     if (room_Type.Equals("general"))
     {
         System.Diagnostics.Debug.WriteLine("Enter the duration in only hours " + duration);
         duration   = Convert.ToInt32(Console.ReadLine());
         objc.total = (objc.total + 30) * duration;
         System.Diagnostics.Debug.WriteLine("Enter the proced name as p1 or p2 can select only one: " + proced_Name);
         proced_Name = Console.ReadLine().ToLower();
         if (proced_Name.Equals("p1"))
         {
             objc.total = objc.total + objc.procedure1();
             objc.calculate(objc.total);
         }
         else if (proced_Name.Equals("p2"))
         {
             objc.total = objc.total + objc.procedure2();
             objc.calculate(objc.total);
         }
         else
         {
             System.Diagnostics.Debug.WriteLine("No Procdure");
         }
     }
     else if (room_Type.Equals("icu"))
     {
         System.Diagnostics.Debug.WriteLine("Enter the duration in only hours");
         duration   = Convert.ToInt32(Console.ReadLine());
         objc.total = (objc.total + 50) * duration;
         System.Diagnostics.Debug.WriteLine("Enter the proced name as p1 or p2 can select only one");
         proced_Name = Console.ReadLine().ToLower();
         if (proced_Name.Equals("p1"))
         {
             objc.total = objc.total + objc.procedure1();
             objc.calculate(objc.total);
         }
         else if (proced_Name.Equals("p2"))
         {
             objc.total = objc.total + objc.procedure2();
             objc.calculate(objc.total);
         }
         else
         {
             System.Diagnostics.Debug.WriteLine("No Procdure");
         }
     }
     else
     {
         System.Diagnostics.Debug.WriteLine("Not a room Type");
     }
 }
Ejemplo n.º 6
0
        public async Task <IActionResult> Edit([Bind("Department1Id,Department1Name")] Department1 department1)
        {
            /*Check Session */
            var page            = "69";
            var typeofuser      = "";
            var PermisionAction = "";

            // CheckSession
            if (string.IsNullOrEmpty(HttpContext.Session.GetString("Username")))
            {
                Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error);
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                typeofuser      = HttpContext.Session.GetString("TypeOfUserId");
                PermisionAction = HttpContext.Session.GetString("PermisionAction");
                if (PermisionHelper.CheckPermision(typeofuser, PermisionAction, page) == false)
                {
                    Alert("คุณไม่มีสิทธิ์ใช้งานหน้าดังกล่าว", NotificationType.error);
                    return(RedirectToAction("Index", "Home"));
                }
            }
            /*Check Session */


            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(department1);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Department1Exists(department1.Department1Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(department1));
        }
Ejemplo n.º 7
0
    public static void getData(String dept_name)
    {
        Hospital h1;

        if (dept_name.Equals("d1"))
        {
            h1 = new Department1();
            System.Diagnostics.Debug.WriteLine("Enter the room type as general or icu: " + room_Type);
            room_Type = Console.ReadLine().ToLower();
            if (room_Type.Equals("general"))
            {
                System.Diagnostics.Debug.WriteLine("Enter the duration in only hours: " + duration);
                duration = Convert.ToInt32(Console.ReadLine());
                total    = (total + 30) * duration;
                System.Diagnostics.Debug.WriteLine("Enter the proced name as p1 or p2 can select only one: " + proced_Name);
                proced_Name = Console.ReadLine().ToLower();
                if (proced_Name.Equals("p1"))
                {
                    total = total + h1.proced1();
                    h1.Calculate(total);
                }
                else if (proced_Name.Equals("p2"))
                {
                    total = total + h1.proced2();
                    h1.Calculate(total);
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine("No Procdure");
                }
            }
            else if (room_Type.Equals("icu"))
            {
                System.Diagnostics.Debug.WriteLine("Enter the duration in only hours: " + duration);
                duration = Convert.ToInt32(Console.ReadLine());
                total    = (total + 50) * duration;
                System.Diagnostics.Debug.WriteLine("Enter the proced name as p1 or p2 can select only one: " + proced_Name);
                proced_Name = Console.ReadLine().ToLower();
                if (proced_Name.Equals("p1"))
                {
                    total = total + h1.proced1();
                    h1.Calculate(total);
                }
                else if (proced_Name.Equals("p2"))
                {
                    total = total + h1.proced2();
                    h1.Calculate(total);
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine("No Procdure");
                }
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("Not a room Type");
            }
        }
        else if (dept_name.Equals("d2"))
        {
            h1 = new Department2();
            System.Diagnostics.Debug.WriteLine("Enter the room type as general or icu: " + room_Type);
            room_Type = Console.ReadLine().ToLower();
            if (room_Type.Equals("general"))
            {
                System.Diagnostics.Debug.WriteLine("Enter the duration in only hours: " + duration);
                duration = Convert.ToInt32(Console.ReadLine());
                total    = (total + 30) * duration;
                System.Diagnostics.Debug.WriteLine("Enter the proced name as p1 or p2 can select only one: " + proced_Name);
                proced_Name = Console.ReadLine().ToLower();
                if (proced_Name.Equals("p1"))
                {
                    total = total + h1.proced1();
                    h1.Calculate(total);
                }
                else if (proced_Name.Equals("p2"))
                {
                    total = total + h1.proced2();
                    h1.Calculate(total);
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine("No Procdure");
                }
            }
            else if (room_Type.Equals("icu"))
            {
                System.Diagnostics.Debug.WriteLine("Enter the duration in only hours: " + duration);
                duration = Convert.ToInt32(Console.ReadLine());
                total    = (total + 50) * duration;
                System.Diagnostics.Debug.WriteLine("Enter the proced name as p1 or p2 can select only one: " + proced_Name);
                proced_Name = Console.ReadLine().ToLower();
                if (proced_Name.Equals("p1"))
                {
                    total = total + h1.proced1();
                    h1.Calculate(total);
                }
                else if (proced_Name.Equals("p2"))
                {
                    total = total + h1.proced2();
                    h1.Calculate(total);
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine("No Procdure");
                }
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("Not a room Type");
            }
        }
        else if (dept_name.Equals("d3"))
        {
            h1 = new Department3();
            System.Diagnostics.Debug.WriteLine("Enter the room type as general or icu: " + room_Type);
            room_Type = Console.ReadLine().ToLower();
            if (room_Type.Equals("general"))
            {
                System.Diagnostics.Debug.WriteLine("Enter the duration in only hours :" + room_Type);
                duration = Convert.ToInt32(Console.ReadLine());
                total    = (total + 30) * duration;
                System.Diagnostics.Debug.WriteLine("Enter the proced name as p1 or p2 can select only one: " + proced_Name);
                proced_Name = Console.ReadLine().ToLower();
                if (proced_Name.Equals("p1"))
                {
                    total = total + h1.proced1();
                    h1.Calculate(total);
                }
                else if (proced_Name.Equals("p2"))
                {
                    total = total + h1.proced2();
                    h1.Calculate(total);
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine("No Procdure");
                }
            }
            else if (room_Type.Equals("icu"))
            {
                System.Diagnostics.Debug.WriteLine("Enter the duration in only hours: " + duration);
                duration = Convert.ToInt32(Console.ReadLine());
                total    = (total + 50) * duration;
                System.Diagnostics.Debug.WriteLine("Enter the proced name as p1 or p2 can select only one: " + proced_Name);
                proced_Name = Console.ReadLine().ToLower();
                if (proced_Name.Equals("p1"))
                {
                    total = total + h1.proced1();
                    h1.Calculate(total);
                }
                else if (proced_Name.Equals("p2"))
                {
                    total = total + h1.proced2();
                    h1.Calculate(total);
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine("No Procdure");
                }
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("Not a room Type");
            }
        }
        else
        {
            System.Diagnostics.Debug.WriteLine("Department noit found");
        }
    }