Exemple #1
0
        protected void register_btn_Click(object sender, EventArgs e)
        {
            AdminClass a = new AdminClass();
            //Create Patient class and assign values to it.
            doctor d = createDoctorObject();
            bool   alreadyRegistered = a.registered(d);

            if (alreadyRegistered)
            {
                ErrorL.Text = "Already Registered";
            }
            else
            {
                //Register Patient
                bool registerSucceeded = a.addDoctor(d);

                if (registerSucceeded == true)
                {
                    Response.Redirect("AdminViewDoctor.aspx");
                }
                else
                {
                    ErrorL.Text = "Whoops";
                }
            }
        }
Exemple #2
0
        public IActionResult Rating(AdminClass admin)
        {
            if (admin.Password == password)
            {
                switch (admin.actionToPerform)
                {
                case "Generate":
                {
                    GenerateWeeklyRating();
                    return(RedirectToAction("RatingWithVKpage"));
                }

                case "Update":
                {
                    UpdateWeeklyRating();
                    break;
                }

                case "Delete":
                {
                    DeleteWeeklyRating();
                    break;
                }

                default:
                    return(RedirectToAction("Index", "Home"));
                }

                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                return(View());
            }
        }
        public List <AdminClass> GetAllAdmins(int id)
        {
            int ShowRecords = 20;
            int skip        = id * ShowRecords;
            var DesiMasala  = "";

            var AllRecords = obj.Admins.Count();
            int max        = (skip + ShowRecords);

            if (max > AllRecords)
            {
                max = AllRecords;
            }
            DesiMasala = (skip + 1).ToString() + "-" + max.ToString() + "/" + AllRecords.ToString();

            List <AdminClass> li = new List <AdminClass>();

            var AllAdmins = obj.Admins.Skip(skip).Take(ShowRecords).Where(x => x.Status != 0).ToList();
            var count     = AllAdmins.Count();

            foreach (var details in AllAdmins)
            {
                AdminClass temp = new AdminClass();
                temp.Id       = details.Id;
                temp.UserName = details.UserName;

                temp.Count           = count;
                temp.NumberOfShowing = DesiMasala;
                li.Add(temp);
            }
            return(li);
        }
        public ActionResult Edit_Approver(string StaffNumber)
        {
            try
            {
                StaffADProfile staffADProfile = new StaffADProfile();
                CurrentUser    currentuser    = new CurrentUser();
                staffADProfile.user_logon_name = User.Identity.Name;

                ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

                staffADProfile     = activeDirectoryQuery.GetStaffProfile();
                currentuser.UserNo = staffADProfile.employee_number;

                bool checkApproverUser = new AppClass().ValidateCheckApproverUser(currentuser.UserNo);
                ViewData["checkApproverUser"] = checkApproverUser;

                ApproverInfo approvers = new ApproverInfo();
                approvers            = new AdminClass().GetApproverDetails(StaffNumber).First();
                ViewBag.ErrorMessage = TempData["ErrorMessage"] as string;
                return(View(approvers));
            }catch (Exception ex)
            {
                TempData["ErrorMessage"] = ex.Message;
                return(RedirectToAction("Edit_Approver"));
            }
        }
        internal void UpdateInformation(AdminClass admin, IRestro restro, Customer customer)
        {
            SetCustomersName();
            var choice = ChooseWhatToDo(restro, customer);

            ProceedAsPerTheChoice(customer, admin, restro, choice);
        }
Exemple #6
0
 public void PlaceOrder(AdminClass admin, NewCustomer.Customer customer)
 {
     this.admin          = admin;
     customer.RestroName = "Pizza Hut";
     BookTable(customer);
     OrderItems(customer);
     Bill(customer);
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            AdminClass    ac = new AdminClass();
            List <doctor> ld = ac.viewDoctors();

            GridView1.DataSource = ld;
            GridView1.DataBind();
        }
        public ActionResult UpdateApprover(ApproverInfo approver)
        {
            try
            {
                StaffADProfile staffADProfile = new StaffADProfile();
                CurrentUser    currentuser    = new CurrentUser();
                staffADProfile.user_logon_name = User.Identity.Name;

                ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

                staffADProfile     = activeDirectoryQuery.GetStaffProfile();
                currentuser.UserNo = staffADProfile.employee_number;

                bool checkApproverUser = new AppClass().ValidateCheckApproverUser(currentuser.UserNo);
                ViewData["checkApproverUser"] = checkApproverUser;

                bool checkAdmin = new AppClass().ValidateAdminUser(currentuser.UserNo);
                //ViewData["checkAdmin"] = checkAdmin;

                if (!checkAdmin)
                {
                    TempData["ErrorMessage"]  = "You are not authorized to Perform these operation";
                    TempData["TravelRequest"] = approver;
                    return(RedirectToAction("Manage_Approval_List"));
                }
                else
                {
                    var      Update = new AdminClass().UpdateApprover(approver);
                    string[] result = Update.ToString().Split('|');

                    if (result[0] != "0")
                    {
                        if (result[0] == "2627")
                        {
                            TempData["ErrorMessage"] = "User Already Existed on Approver list";
                            // TempData["TravelRequest"] = approver;
                            return(RedirectToAction("EditApprover"));
                        }
                        else
                        {
                            TempData["ErrorMessage"] = result[1];
                            //TempData["TravelRequest"] = approver;
                            return(RedirectToAction("EditApprover"));
                        }
                    }
                    else
                    {
                        TempData["ErrorMessage"] = "You have successfully Updated ApproverName";
                        //  TempData["Approvernames"] = string.Join("\\n", approverNames);
                        return(RedirectToAction("ApproverList"));
                    }
                }
            }
            catch (Exception ex)
            {
                return(Content(ex.Message));
            }
        }
        public void PlaceOrder(AdminClass admin, NewCustomer.Customer customer)
        {
            this.admin          = admin;
            customer.RestroName = "McD";
            BookTable(customer);
            OrderItems(customer);
            Bill(customer);
            var sendBillViaMail = new SendBillViaMail();
            var mailService     = new MailService();

            sendBillViaMail.SentMail += mailService.OnSentMail;
            sendBillViaMail.PayBill(customer);
        }
Exemple #10
0
        /// <summary>
        /// 根据类别编号查询类别
        /// </summary>
        /// <param name="classId"></param>
        /// <returns></returns>
        public static AdminClass SelectAdminClassByClassId(int classId)
        {
            AdminClass    c   = null;
            string        sql = "select * from AdminClass where Id ='" + classId + "'";
            SqlDataReader dr  = DBHelper.ExecuteReader(sql, CommandType.Text);

            if (dr.Read())
            {
                c      = new AdminClass();
                c.Id   = classId;
                c.Name = dr["Name"].ToString();
            }
            dr.Close();
            return(c);
        }
Exemple #11
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            AdminClass.GetEmail    = txtemail.Text.Trim();
            AdminClass.GetPassword = txtpass.Text.Trim();
            DataTable dt = new DataTable();

            dt = AdminClass.AdminLogin();;
            if (dt.Rows.Count > 0)
            {
                Response.Redirect("Branch.aspx");
            }
            else
            {
                lblmsg.Text = "Invalid User Name or Password";
            }
        }
Exemple #12
0
 public Boolean VerifyPassword(String UserName, String Password, String Role)
 {
     if (Role == "Customer")
     {
         CustomerClass cust = new CustomerClass();
         cust = cust.VerifyUser(UserName);
         if (cust != null)
         {
             return(cust.decryptHashPassword(Password));
         }
         else
         {
             return(false);
         }
     }
     else if (Role == "Business")
     {
         BusinessUser business = new BusinessUser();
         business = business.SelectOneByEmail(UserName);
         if (business != null)
         {
             return(business.decryptHashPassword(Password));
         }
         else
         {
             return(false);
         }
     }
     else if (Role == "Admin")
     {
         AdminClass admin = new AdminClass();
         admin = admin.SelectOneAdmin(UserName);
         if (admin != null)
         {
             return(admin.decryptHashPassword(Password));
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
        public ActionResult Delete(int Id)//
        {
            ShowAdminList showAdminList = new ShowAdminList();
            AdminClass    adminClass    = new AdminClass();

            showAdminList.GetTempAdminList().Single(List => List.Id == Id);
            ViewBag.msg = adminClass.Username;
            using (SqlConnection con = new SqlConnection(Helper.connectionString))
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("spRejectAdmin", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Adminid", Id);
                cmd.ExecuteNonQuery();
            }
            return(View());
        }
        public List <AdminClass> GetAllAdminsByName(string id)
        {
            List <AdminClass> li = new List <AdminClass>();

            var AllAdmins = obj.Admins.Where(x => x.Status != 0 && x.UserName.Equals(id)).ToList();
            var count     = AllAdmins.Count();

            foreach (var details in AllAdmins)
            {
                AdminClass temp = new AdminClass();
                temp.Id       = details.Id;
                temp.UserName = details.UserName;
                temp.Count    = count;
                li.Add(temp);
            }
            return(li);
        }
        public ActionResult ApproverList()
        {
            try
            {
                StaffADProfile staffADProfile = new StaffADProfile();
                CurrentUser    currentuser    = new CurrentUser();
                staffADProfile.user_logon_name = User.Identity.Name;

                ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

                staffADProfile        = activeDirectoryQuery.GetStaffProfile();
                currentuser.UserNo    = staffADProfile.employee_number;
                currentuser.UserName  = staffADProfile.in_StaffName;
                currentuser.logonName = staffADProfile.user_logon_name;
                currentuser.Email     = staffADProfile.email;
                List <ApproverInfo> approverList = new List <ApproverInfo>();
                // bool checkApprover = new AppClass().ValidateCurrentUser(currentuser);

                bool checkApproverUser = new AppClass().ValidateCheckApproverUser(currentuser.UserNo);
                ViewData["checkApproverUser"] = checkApproverUser;

                if (checkApproverUser != false)
                {
                    approverList   = new AdminClass().GetApproverList();
                    ViewBag.coInit = (String.IsNullOrEmpty(TempData["ErrorMessage"] as string)) ?
                                     "" : "<script type='text/javascript'>alert('" + TempData["ErrorMessage"] + "');</script>";
                    return(View(approverList));
                }
                else
                {
                    ViewBag.coInit = (String.IsNullOrEmpty(TempData["ErrorMessage"] as string)) ?
                                     "" : "<script type='text/javascript'>alert('" + TempData["ErrorMessage"] + "');</script>";
                    return(View(approverList));
                }
            }
            catch (Exception ex)
            {
                ViewBag.coInit = (String.IsNullOrEmpty(TempData["ErrorMessage"] as string)) ?
                                 "" : "<script type='text/javascript'>alert('" + TempData["ErrorMessage"] + "');</script>";
                return(View(ex.Message));
            }


            return(View());
        }
        public int PostAdmin(AdminClass AC)
        {
            int check = 0;

            try
            {
                Admin Admins = new Admin();
                Admins.UserName = AC.UserName;
                Admins.Password = AC.Password;
                Admins.Status   = AC.Role;
                Admins.AddDate  = DateTime.Now.ToShortDateString();
                obj.Admins.InsertOnSubmit(Admins);
                obj.SubmitChanges();
                check = Admins.Id;
            }
            catch (Exception e) { check = 0; }
            return(check);
        }
        public int UpdateAdmin(AdminClass AC)
        {
            int check = 0;

            try
            {
                Admin Admins = obj.Admins.First(x => x.Id.Equals(AC.Id));
                Admins.UserName = AC.UserName;
                if (AC.Password != "No")
                {
                    Admins.Password = AC.Password;
                }
                Admins.Status = AC.Role;
                obj.SubmitChanges();
                check = Admins.Id;
            }
            catch (Exception e) { check = 0; }
            return(check);
        }
        private void ProceedAsPerTheChoice(Customer customer, AdminClass admin, IRestro restro, int choice)
        {
            int ans;

            switch (choice)
            {
            case 1:
                restro.ShowTables();
                break;

            case 2:
                restro.ShowItems();
                break;

            case 3:
                restro.PlaceOrder(admin, customer);
                break;

            case 4:
                Environment.Exit(0);
                break;

            default:
                Console.WriteLine("Invalid Option");
                break;
            }
askAgain:
            Console.WriteLine("Do you want to continue:\n1. Yes\n2. No");
            ans = Convert.ToInt16(Console.ReadLine());
            if (ans == 1)
            {
                Program.Start(admin);
            }
            else if (ans == 2)
            {
                Environment.Exit(0);
            }
            else
            {
                Console.WriteLine("Invalid Option");
                goto askAgain;
            }
        }
Exemple #19
0
        private static void ChooseYourRole(IRestro restro, AdminClass admin)
        {
            Console.WriteLine("\nChoose Your Role\n");
            Console.WriteLine("1. Admin\n2. Customer\n3.Exit");
            Console.WriteLine("---------------------------------------------");
            var choice = Convert.ToInt16(Console.ReadLine());

            Console.WriteLine("---------------------------------------------");
            switch (choice)
            {
            case 1:
                admin.ShowFunctionalityOfAdmin(admin);
                break;

            case 2:
                Customer customer = new Customer();
                customer.UpdateInformation(admin, restro, customer);
                break;
            }
        }
Exemple #20
0
        public static void Start(AdminClass admin)
        {
            IRestro restro = null;

            Console.WriteLine("Select a Restaurant");
            Console.WriteLine("1. McD \n2.Pizza Hut");
            var choice = Convert.ToInt16(Console.ReadLine());

            switch (choice)
            {
            case 1:
                restro = new RestroMcD();
                ChooseYourRole(restro, admin);
                break;

            case 2:
                restro = new RestroPizzaHut();
                ChooseYourRole(restro, admin);
                break;
            }
        }
Exemple #21
0
        public ActionResult AdminLogin(AdminClass admin)
        {
            using (ApplicationDbContext db = new ApplicationDbContext())
            {
                var adminVarmi = db.AdminClasses.Where(x => x.Tc == admin.Tc && x.Sifre == admin.Sifre).FirstOrDefault();

                if (adminVarmi == null)

                {
                    //hasta.LoginErorMsg = "Tc'nizi veya şifrenizi kontrol ediniz.";
                    ViewBag.Mesaj = "Tc'nizi veya şifrenizi kontrol ediniz.";
                    return(View());
                }
                else
                {
                    FormsAuthentication.SetAuthCookie(adminVarmi.Ad, false);

                    return(RedirectToAction("Index", "Home"));
                }
            }
        }
        public ActionResult NewAdmin(AdminClass uc)
        {
            string        myconstr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
            SqlConnection con      = new SqlConnection(myconstr);

            con.Open();
            SqlCommand cmd = new SqlCommand("spNewAdmin", con);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@fname", uc.Fname);
            cmd.Parameters.AddWithValue("@lname", uc.Lname);
            cmd.Parameters.AddWithValue("@age", uc.Age);
            cmd.Parameters.AddWithValue("@gender", uc.Gender);
            cmd.Parameters.AddWithValue("@contact", uc.Contact);
            cmd.Parameters.AddWithValue("@Adminusername", uc.Username);
            cmd.Parameters.AddWithValue("@Adminpassword", uc.Password);
            cmd.ExecuteNonQuery();
            con.Close();
            //ViewData["Message"] = "User Record" + uc.Username + "Is saved successfully";
            return(View("RegisterStatus"));
        }
        public ActionResult ApprovedRequest()
        {
            try
            {
                StaffADProfile staffADProfile = new StaffADProfile();
                CurrentUser    currentuser    = new CurrentUser();
                staffADProfile.user_logon_name = User.Identity.Name;

                ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

                staffADProfile        = activeDirectoryQuery.GetStaffProfile();
                currentuser.UserNo    = staffADProfile.employee_number;
                currentuser.UserName  = staffADProfile.in_StaffName;
                currentuser.logonName = staffADProfile.user_logon_name;
                currentuser.Email     = staffADProfile.email;
                List <TravelRequest> requestList = new List <TravelRequest>();
                //  bool checkApprover = new AppClass().ValidateCurrentUser(currentuser);


                bool checkApproverUser = new AppClass().ValidateCheckApproverUser(currentuser.UserNo);
                ViewData["checkApproverUser"] = checkApproverUser;


                if (checkApproverUser != false)
                {
                    requestList = new AdminClass().GetApprovedRequest();

                    return(View(requestList));
                }
                else
                {
                    return(View(requestList));
                }
            }
            catch (Exception ex)
            {
                return(View(ex.Message));
            }
        }
 public ActionResult adminPage(AdminClass a)//adminlogin a
 {
     //Admin loginAdmin = new Admin();
     // if (Session["admin090JYMAdmin"] == null)
     // {
     // try
     // {
     //      loginAdmin = obj.Admins.First(x => x.UserName.Equals(a.UserName) && x.Password.Equals(a.Password));
     //  }
     //  catch (Exception e) { /*TempData["ErrorMessage"] = "ErrorMessage"; */}
     //  if (loginAdmin.UserName!= null && loginAdmin.Password != null)
     //  {
     //       //Session["admin090JYMAdmin"] = "RandomValue";
     //        return View();
     //    }
     //    else
     //       return RedirectToAction("loginPage", "Admin");
     // }
     // else
     //{
     return(View());
     //}
 }
Exemple #25
0
        public List <AdminClass> SelectAllAdmin()
        {
            AdminClass admin = new AdminClass();

            return(admin.SelectAllAdmin());
        }
Exemple #26
0
 public ActionResult AdminEdit(AdminClass model)
 {
     return(View("AdminIndex"));
 }
 public RemoveAdmin()
 {
     InitializeComponent();
     listofadmins = AdminClass.GetAllAdmins();
     FillTheComboBox();
 }
Exemple #28
0
        //Admin
        public Int16 InsertAdmin(String adminName, String userName, String password, String role)
        {
            AdminClass admin = new AdminClass(adminName, userName, password, role);

            return(admin.InsertIntoDatabase());
        }
Exemple #29
0
        public AdminClass SelectOneAdmin(String userName)
        {
            AdminClass admin = new AdminClass();

            return(admin.SelectOneAdmin(userName));
        }
Exemple #30
0
 public bool InsertItem(string username, int weizi, int itemid)
 {
     try
     {
         string server   = "d1";
         string name     = username;
         int    num      = weizi;
         long   num2     = 0L;
         int    num3     = itemid;
         int    num4     = 0;
         int    num5     = 0;
         int    num6     = 0;
         int    num7     = 0;
         int    num8     = 0;
         int    num9     = 0;
         int    num10    = 0;
         int    num11    = 0;
         int    num12    = 1;
         bool   flag     = false;
         string sm       = "550088081";
         string selectDb = "0";
         string str5     = "TBL_XWWL_Char";
         string str6     = "FLD_ITEM,FLD_ID,FLD_JOB,FLD_ZX";
         string str7     = "FLD_ITEM";
         string str8     = "FLD_NAME";
         if (selectDb == "0")
         {
             str5 = "TBL_XWWL_Char";
             str6 = "FLD_ITEM,FLD_ID,FLD_JOB,FLD_ZX";
             str7 = "FLD_ITEM";
             str8 = "FLD_NAME";
         }
         else if (selectDb == "1")
         {
             str5 = "TBL_XWWL_Char";
             str6 = "FLD_WEARITEM,FLD_ID,FLD_JOB,FLD_ZX";
             str7 = "FLD_WEARITEM";
             str8 = "FLD_NAME";
         }
         else if (selectDb == "2")
         {
             str5 = "TBL_XWWL_Warehouse";
             str6 = "FLD_ITEM,FLD_ID";
             str7 = "FLD_ITEM";
             str8 = "FLD_NAME";
         }
         else if (selectDb == "3")
         {
             str5 = "TBL_XWWL_PublicWarehouse";
             str6 = "FLD_ITEM,FLD_ID";
             str7 = "FLD_ITEM";
             str8 = "FLD_ID";
         }
         DataTable table = DBA.GetDBToDataTable(string.Format("select {3} from {2} WHERE {1} ='{0}'", new object[] { name, str8, str5, str6 }), "rxjhgame", server);
         if (table == null)
         {
             return(false);
         }
         if (table.Rows.Count == 0)
         {
             table.Dispose();
             throw new ArgumentException("提示:错误没有这个人物!");
         }
         物品类 物品类 = new 物品类(new byte[37]);
         if (num2 != 0)
         {
             sm = "更新物品 " + sm;
         }
         else
         {
             num2 = long.Parse(DBA.GetDBValue_3("EXEC XWWL_GetItemSerial 1", "rxjhgame", server).ToString());
         }
         物品类.物品全局ID     = BitConverter.GetBytes(num2);
         物品类.物品ID       = BitConverter.GetBytes(num3);
         物品类.物品数量       = BitConverter.GetBytes(num12);
         物品类.FLD_MAGIC0 = num4;
         物品类.FLD_MAGIC1 = num5;
         物品类.FLD_MAGIC2 = num6;
         物品类.FLD_MAGIC3 = num7;
         物品类.FLD_MAGIC4 = num8;
         //物品类.FLD_FJ_初级附魂 = num9;
         //物品类.FLD_FJ_中级附魂 = num10;
         //物品类.FLD_FJ_进化 = num11;
         物品类.物品绑定 = flag;
         byte[] dst = (byte[])table.Rows[0][str7];
         AdminClass.SetItmeLog(BitConverter.ToInt64(物品类.物品全局ID, 0), 物品类.物品名称, name, string.Concat(new object[] { num4, "_", num5, "_", num6, "_", num7, "_", num8, " 初", num9, " 中", num10, " 进", num11 }), server, sm);
         Buffer.BlockCopy(物品类.物品_byte, 0, dst, num * 37, 37);
         AdminClass.UpItemsDate(server, name, dst, selectDb);
         ItmeSClass itmeSC = new ItmeSClass {
             FLD_ID   = table.Rows[0]["FLD_ID"].ToString(),
             FLD_Name = name
         };
         if ((selectDb != "2") && (selectDb != "3"))
         {
             itmeSC.FLD_JOB = table.Rows[0]["FLD_JOB"].ToString();
             itmeSC.FLD_ZX  = table.Rows[0]["FLD_ZX"].ToString();
         }
         DataTable table2 = DBA.GetDBToDataTable(string.Format("select FLD_ID,FLD_ONLINE,FLD_SEX from [TBL_ACCOUNT] where FLD_ID='{0}'", itmeSC.FLD_ID)
                                                 , "rxjhaccount", server);
         itmeSC.FLD_ONLINE = table2.Rows[0]["FLD_ONLINE"].ToString();
         itmeSC.FLD_SEX    = table2.Rows[0]["FLD_SEX"].ToString();
         table2.Dispose();
         AdminClass.GetItemslist(itmeSC, dst, 0x24);
         table.Dispose();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }