Exemple #1
0
        public string Add_Users(List <User> model)
        {
            List <User> user = model;

            string username   = "";
            string password   = "";
            string rolenum    = "";
            string realname   = "";
            string email      = "";
            string phone      = "";
            string department = "";

            foreach (var item in user)
            {
                username   = item.UserName;
                password   = item.Password;
                rolenum    = item.RoleNum;
                realname   = item.RealName;
                email      = item.Email;
                phone      = item.Phone;
                department = item.DepartNum;
            }
            String sql    = " insert into Users(UserName,PassWord,RoleNum,RealName,Email,Phone,DepartNum) values( '" + username + "','" + password + "','" + rolenum + "','" + realname + "','" + email + "','" + email + "','" + department + "')";
            int    result = Dbs.ExecuteNonQuery(sql);

            if (result == 1)
            {
                return("Success");
            }
            else
            {
                return("no");
            }
        }
Exemple #2
0
        public String Delete_Role(int id)
        {
            String sql    = "proc_Delete_Role '" + id + "'";
            int    result = Dbs.ExecuteNonQuery(sql);

            if (result == 1)
            {
                ViewBag.saveStatus = 1;
                // return 1;
                String tip = "success";
                //return RedirectToAction("Basci_faq");
                return(tip);
            }
            else
            {
                ViewBag.saveStatus = 0;
                String tip = "Fail";
                return(tip);
                //return Content("<script>alert('no');history.go(-1);</script>");
            }
        }
Exemple #3
0
        public ActionResult Edit_Role(List <String> Role_manage)
        {
            string ID = Role_manage[0];
            //string UserName = Role_manage[1];
            string Password  = Role_manage[1];
            string Role      = Role_manage[2];
            string RealName  = Role_manage[3];
            string Phone     = Role_manage[4];
            string DepartNum = Role_manage[5];


            //string newUserName = Leach(UserName);
            string newPassword  = Leach(Password);
            string newRole      = Leach(Role);
            string newRealName  = Leach(RealName);
            string newPhone     = Leach(Phone);
            string newDepartNum = Leach(DepartNum);

            String sql    = "exec proc_Update_Role_Manage '" + ID + "','" + newPassword + "','" + newRole + "','" + newRealName + "','" + newPhone + "','" + newDepartNum + "'";
            int    result = Dbs.ExecuteNonQuery(sql);

            if (result == 1)
            {
                ViewBag.saveStatus = 1;
                // return 1;
                String tip = "Success";
                return(JavaScript(tip));
            }
            else
            {
                ViewBag.saveStatus = 0;
                String tip = "Fail";
                return(JavaScript(tip));
                //return Content("<script>alert('no');history.go(-1);</script>");
            }
        }