{ // 创建业务方法(调用数据访问层对象方法的) public DataTable GetUsersInfoById(UsersModel model) { UsersDAL dal = new UsersDAL(); DataTable dt = dal.GetUsersInfoById(model); return(dt); }
public bool UpdateUser(Users user) { if (user.id != 0) { if (!string.IsNullOrEmpty(user.name) && !string.IsNullOrEmpty(user.surname) && !string.IsNullOrEmpty(user.email) && !string.IsNullOrEmpty(user.password)) { return(UsersDAL.Update(user)); } if (!string.IsNullOrEmpty(user.name)) { return(UsersDAL.Update("name", user.name, user.id)); } if (!string.IsNullOrEmpty(user.surname)) { return(UsersDAL.Update("surname", user.surname, user.id)); } if (!string.IsNullOrEmpty(user.email)) { return(UsersDAL.Update("email", user.email, user.id)); } if (!string.IsNullOrEmpty(user.password)) { return(UsersDAL.Update("password", user.password, user.id)); } } return(false); }
//To get user public UserDTO GetUserAccount(string email, string password) { try { UsersDAL user = _unitOfWork.UserRepository.GetUserAccount(email, password); UserDTO userDTO = new UserDTO { Id = user.Id, FirstName = user.FirstName, Surname = user.Surname, Email = user.Email, Password = user.Password, RoleId = user.RoleId, Role = new RoleDTO { Id = user.Role.Id, Name = user.Role.Name }, Picture = new PictureDTO { Id = user.Picture.Id, Image = user.Picture.Image } }; return(userDTO); } catch { throw; } }
///////////////////////////////////// Users ///////////////////////////////////// //////////////////////////////////////// Users ///////////////////////////////////// private void nomPrenomButton_Click(object sender, RoutedEventArgs e) { myDataObject = new UsersViewModel(); myDataObject.nomUsersProperty = nomUsers.Text; myDataObject.prenomUsersProperty = prenomUsers.Text; myDataObject.adresseMailUsersProperty = AdresseMailUsers.Text; myDataObject.identifiantUsersProperty = Identifiant.Text; myDataObject.motDePasseUsersProperty = MotDePasse.Password; UsersViewModel nouveau = new UsersViewModel(UsersDAL.getMaxIdUsers() + 1, myDataObject.nomUsersProperty, myDataObject.prenomUsersProperty, myDataObject.identifiantUsersProperty, myDataObject.adresseMailUsersProperty, myDataObject.motDePasseUsersProperty, 0); lp.Add(nouveau); UsersORM.insertUsers(nouveau); ((TextBox)nomUsers).Text = string.Empty; ((TextBox)prenomUsers).Text = string.Empty; ((TextBox)AdresseMailUsers).Text = string.Empty; ((TextBox)Identifiant).Text = string.Empty; ((PasswordBox)MotDePasse).Password = string.Empty; compteur = lp.Count(); MessageBox.Show("Utilisateur ajouté avec succes ! "); }
static Provaider() { string typeDAL = ConfigurationManager.AppSettings["DAL"]; string typeBLL = ConfigurationManager.AppSettings["BLL"]; switch (typeDAL) { case "DataBase": { UsersDAL = new UsersDAL(); ImagesDAL = new ImagesDAL(); RelationsDAL = new UsersImagesDAL(); } break; default: { throw new ConfigurationFileException("error in configuration file"); } } switch (typeBLL) { case "DefaultLogic": { UsersBLL = new UsersBLL(UsersDAL, RelationsDAL); ImagesBLL = new ImagesBLL(ImagesDAL, RelationsDAL); RelationsBLL = new UsersImagesBLL(UsersDAL, ImagesDAL, RelationsDAL); } break; default: { throw new ConfigurationFileException("error in configuration file"); } } }
public void LoginUser() { string passwordHash = UsersDAL.ComputeSha256Hash(Password); User = _contextDal.FindAll(x => x.UserName == UserName && x.UserPassword == passwordHash).FirstOrDefault(); if (User == null) { MessageBox.Show("Ismeretlen felhasználónév vagy jelszó!", "Sikertelen belépés", MessageBoxButton.OK, MessageBoxImage.Error); } else if (User.IsPasswordChangeRequired) { SwitchWindows(new PasswordChangeWindow()); } else { var contextTeacher = _contextDal.applicationDbContext.Teacher.Where(x => x.UserID == User.ID && !x.Deleted).FirstOrDefault(); if (contextTeacher == null) { var contextStudent = _contextDal.applicationDbContext.Student.Where(x => x.UserID == User.ID && !x.Deleted).FirstOrDefault(); if (contextStudent == null) { MessageBox.Show("Érvénytelen jogosultság!", "Érvénytelen jogosultság!", MessageBoxButton.OK, MessageBoxImage.Error); } else { SwitchWindows(new ServiceStoreWindow(contextStudent, null)); } } else { SwitchWindows(new TeacherWindow(contextTeacher)); } } }
private void PopulateModal(int UserID) { UsersDAL UsersModal = new UsersDAL(); DataTable dt = UsersModal.GetSpecificUserData(UserID); foreach (DataRow dtRow in dt.Rows) { lbVCreatedBy.Text = HttpUtility.HtmlEncode(dtRow["createdBy"].ToString()); lbVCreatedOn.Text = HttpUtility.HtmlEncode(dtRow["createdOn"].ToString()); lbVDisplayname.Text = HttpUtility.HtmlEncode(dtRow["displayname"].ToString()); lbVusername.Text = HttpUtility.HtmlEncode(dtRow["username"].ToString()); lbVEmail.Text = HttpUtility.HtmlEncode(dtRow["email"].ToString()); lbVroles.Text = HttpUtility.HtmlEncode(dtRow["roles"].ToString()); lbVFirstName.Text = HttpUtility.HtmlEncode(dtRow["firstname"].ToString()); lbVLastName.Text = HttpUtility.HtmlEncode(dtRow["lastname"].ToString()); string gender = dtRow["gender"].ToString(); if (gender == "M") { gender = "Male"; } else if (gender == "F") { gender = "Female"; } lbVGender.Text = HttpUtility.HtmlEncode(gender); lbVJobTitle.Text = HttpUtility.HtmlEncode(dtRow["jobtitle"].ToString()); } }
//GET: /Admin/Task public ActionResult Task(string name) { if (!(User.Identity.IsAuthenticated && User.Identity.Name == "admin")) { return(RedirectToAction("Index", "Home")); } ViewBag.Operation = name; if (name == "Edit") { List <Tasks> tasks = TasksDAL.GetAllTasks(); List <TaskViewModel> tasksViewModel = new List <TaskViewModel>(); foreach (var task in tasks) { tasksViewModel.Add( new TaskViewModel(task) ); } return(View(tasksViewModel)); } else { List <Users> users = UsersDAL.GetAllUsers(); List <UserViewModel> usersViewModel = new List <UserViewModel>(); foreach (var user in users) { usersViewModel.Add( new UserViewModel(user) ); } return(View(usersViewModel)); } }
/// <summary> /// 添加聊天记录 /// </summary> /// <param name="UID"></param> /// <param name="SendUID"></param> /// <param name="MsgText"></param> /// <returns></returns> public int AddRecords(string UID, string SendUID, string MsgText) { if (string.IsNullOrEmpty(UID)) { return(-2);//接收人UID不能为空 } if (string.IsNullOrEmpty(SendUID)) { return(-3);//发送人UID不能为空 } if (string.IsNullOrEmpty(MsgText)) { return(-4);//消息文本不能为空 } UsersDAL uDAL = new UsersDAL(); if (uDAL.Query(UID) == null) { return(-5);//接收人UID不存在 } if (uDAL.Query(SendUID) == null) { return(-6);//发送人UID不存在 } ChatRecords entity = new ChatRecords(); return(dal.AddRecords(entity)); }
private void SaveData() { string sUserName = Session["User"].ToString(); oDAL = new UsersDAL(); oClass = new UserModel(); oClass.UserName = UserName.Value; oClass.UserPassword = EncryptDecryptProvider.EncryptString("b14ca5898a4e4133bbce2ea2315a1916", UserPassword.Value); oClass.LastName = LastName.Value; oClass.FirstName = FirstName.Value; oClass.AccountType = AccountType.Value; oClass.Address = txtAddress.InnerText; oClass.Phone = txtContact.Value; oClass.Email = txtEmail.Value; string id = UserID.Value; if (id == "") { oDAL.InsertData(sUserName, oClass); //lblMsg.Text = "New Record has been saved"; } else { oClass.ID = Convert.ToInt16(id); oDAL.UpdateData(sUserName, oClass); // lblMsg.Text = "Record has been updated"; } }
public void LoadDGVUsers() { UsersDAL ud = new UsersDAL(); DGVUsers.DataSource = ud.GetAllUsers(); DGVUserTable.DataSource = ud.GetAllUsers(); }
public int updateuserinfo(string currentusername, string username, string hash, string displayname, string email, int changepass, int displaymemberlist, string firstname, string lastname, Nullable <DateTime> DOB, char gender, string jobtitle, int userID, out string ex) { UsersDAL updateinfo = new UsersDAL(); ex = ""; if (currentusername == username) { int result = updateinfo.UpdateUserInfo(username, hash, displayname, email, changepass, displaymemberlist, firstname, lastname, DOB, gender, jobtitle, userID, out ex); return(result); } else { int UserExistResult = updateinfo.CheckUserNameExistDAL(username); if (UserExistResult > 0) { //user already exist return(-10101010); } else { int result = updateinfo.UpdateUserInfo(username, hash, displayname, email, changepass, displaymemberlist, firstname, lastname, DOB, gender, jobtitle, userID, out ex); return(result); } } }
//To get user public UserDTO GetUserAccount(string email, string password) { try { UsersDAL userDAL = _unitOfWork.UserRepository.GetUserAccount(email, password); UserDTO userDTO = _mapper.Map <UserDTO>(userDAL); //UserDTO userDTO = new UserDTO //{ // Id = user.Id, // FirstName = user.FirstName, // Surname = user.Surname, // Email = user.Email, // Password = user.Password, // RoleId = user.RoleId, // Role = new RoleDTO // { // Id = user.Role.Id, // Name = user.Role.Name // }, // Picture = new PictureDTO // { // Id = user.Picture.Id, // Image = user.Picture.Image // } //}; return(userDTO); } catch { throw; } }
static void Main(string[] args) { UsersDAL usersDAL = new UsersDAL(); usersDAL.ReadAll(); Guid userUid = new Guid("590932d2-0f9a-9709-332a-15d71940a32b"); usersDAL.ReadByUid(userUid); Guid userUid1 = new Guid("590932d2-0f9a-9709-332a-15d71940a32b"); usersDAL.DeleteByUid(userUid1); Guid userUid2 = new Guid("590932d2-0f9a-9709-332a-15d71940a32b"); int userPhoneNumber = 0749110163; usersDAL.UpdatePhoneNumberByUid(userUid2, userPhoneNumber); Guid userUid3 = new Guid("590932d2-0f9a-9709-332a-15d71940a32b"); string firstName = "Alexandra"; string lastName = "Roamn"; int phoneNumber = 0749110163; string emailAddress = "*****@*****.**"; DateTime birthday = new DateTime(1998, 04, 30); usersDAL.InsertUser(userUid3, firstName, lastName, emailAddress, phoneNumber, birthday); }
public ActionResult ModerateUsers() { var viewModel = new AdminModerateUsersViewModel(); viewModel.Users = UsersDAL.GetUsers(moderateResultId: (int)ModerateResults.NotChecked); // viewModel.SbisInfoUsers = new List<User>(); // foreach (var user in viewModel.Users) // { // var sbisInfoUser = P.GetSbisInformationFromInn(user.INN); //if (sbisInfoUser != null) //{ // sbisInfoUser.Id = user.Id; // viewModel.SbisInfoUsers.Add(sbisInfoUser); //} // } ViewBag.Heading = "Модерация пользователей"; #region Хлебные крошки var breadCrumbs = new List <BreadCrumbLink>(); breadCrumbs.Add(new BreadCrumbLink() { Text = "Админка", Url = C.SiteUrl + "Admin", Title = "Перейти на главную админки" }); breadCrumbs.Add(new BreadCrumbLink() { Text = ViewBag.Heading, EndPoint = true }); ViewBag.BreadCrumbs = breadCrumbs; #endregion return(View(viewModel)); }
public ActionResult savejurisdiction(int userid, bool isenable, int tid) { UsersDAL dal = new UsersDAL(); JurisdictionDAL jdal = new JurisdictionDAL(); try { UsersModel users = dal.QuerySingle(" id=" + userid); if (users == null) return Content(false.ToResult("用户错误").ToJsonString()); JurisdictionModel model = jdal.QuerySingle(" id=" + tid); if (model == null) return Content(false.ToResult("权限项错误").ToJsonString()); List<string> liststrs = users.Jurisdiction.Split(',').ToList(); if (liststrs.Any(c => c == tid.ToString())) liststrs.Remove(tid.ToString()); if (isenable) { liststrs.Add(tid.ToString()); } liststrs.Remove(""); users.Jurisdiction = string.Join(",", liststrs.ToArray()); dal.UpdateSQL(users); return Content(true.ToResult().ToJsonString()); } catch (Exception ex) { Log.Default.Error(ex); return Content(false.ToResult("网络错误,请稍后重试").ToJsonString()); } }
private void toolStripDeleteRecord_Click(object sender, EventArgs e) { if (dataGridStudents.CurrentRow.IsNewRow) { MessageBox.Show("Cannot delete empty record!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //delete student with such student id if (dataGridStudents.SelectedRows.Count > 1) { MessageBox.Show("You should select only one row!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { int selectedRow = dataGridStudents.CurrentCell.RowIndex; int studentID = int.Parse( dataGridStudents.Rows[selectedRow].Cells[0].Value.ToString()); if ( MessageBox.Show( string.Format("Do you really want to delete student {0} {1}?", dataGridStudents["_Last_name", selectedRow].Value.ToString(), dataGridStudents["_First_name", selectedRow].Value.ToString()), "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { UsersDAL.DeleteUser(studentID); dataGridStudents.Rows.Remove(dataGridStudents.Rows[selectedRow]); } else { return; } } }
public ActionResult UserProfile(UserProfile user) { if (!Utilities.IsLoggedUser()) { return(RedirectToAction("Login", "Home")); } LogHelpers.LogHandler.Info("Start."); try { ViewData["ListCities"] = new List <SelectListItem>(); if (user == null) { return(RedirectToAction("UserProfile")); } var result = UsersDAL.Update(user); if (result.Code < 0) { LogHelpers.LogHandler.Error(result.ErrorMessage); ModelState.AddModelError("", result.ErrorMessage); } Session["LoggedUser"] = user; return(View(user)); } catch (Exception ex) { LogHelpers.LogHandler.Error(ex.ToString()); return(RedirectToAction("UserProfile")); } }
public PasswordChangeViewModel(PasswordChangeWindow sourceWindow) { this.SourceWindow = sourceWindow; this.BackToLogin = new RelayCommand(GoBack); this.ChangePassword = new RelayCommand(SavePassword, CanChange); _contextDal = new UsersDAL(); }
/// <summary> /// 用户登录 /// </summary> /// <param name="model"></param> /// <returns></returns> public ApiResult Login(RequestUserLoginModel model) { ApiResult result = new ApiResult(); model.Pwd = Func.MD5Encrypt(model.Pwd, 32, false); string AccessToken = new UsersDAL().Login(model); if (string.IsNullOrEmpty(AccessToken)) { //登录失败 result.SetFailResult("用户名密码不匹配"); } else if (AccessToken.Length == 32) { //登录成功 result.ResultData = new string[] { AccessToken }; result.SetSuccessResult("登录成功"); } else { //accesstoken异常 result.SetResult(DataDic.ResultCode.UnLegalToken, "登录失败,accesstoken异常"); } return(result); }
public ActionResult EditUser() { string username = Request.Form["user"]; if (Request.Form["edit"] != null) { Users user = UsersDAL.GetUserByUsername(username); aspnet_Membership membershipUser = UsersDAL.GetMembershipUserByUsername(username); ViewBag.User = user; ViewBag.Membership = membershipUser; ViewBag.Operation = "Edit"; } else if (Request.Form["delete"] != null) { if (username != null) { UsersDAL.DeleteUser(username); } } else if (Request.Form["save"] != null) { UsersDAL.EditUser(Request.Form["username"], Request.Form["firstname"], Request.Form["lastname"], Request.Form["email"], Request.Form["password"]); } return(View("../Admin/Employee")); }
public async Task Execute(IJobExecutionContext context) { FilesDAL filesDAL = new FilesDAL(); UsersDAL usersDAL = new UsersDAL(); Trace.TraceInformation("Running the New Files Job."); List <Users> subscribers = usersDAL.GetSubscribers(subFiles); foreach (var user in subscribers) { try { var files = filesDAL.GetRecentFiles(context.PreviousFireTimeUtc); string subject = "ATHENA : Recent File Uploads"; string body = $"<p>Attached is a spreadsheet with recent files [{files.Count}] uploaded since the last email.</p>"; if (files.Count > 0) { await SendEmailWithCSV(user.Email, subject, body, "NewFiles.csv", files.ToCsv()); } }catch (Exception e) { Trace.TraceError($"Exception during new files job. {e.Message}"); } } if (subscribers.Count == 0) { Trace.TraceWarning("No new files subscribers"); } }
private void SendValueToBLL(string displayname, string username, string email, string hash, int changepass, string createdBy, string salt) { string ex; UsersBLL newuser = new UsersBLL(); int result = newuser.CheckUserNameExistBLL(displayname, username, email, hash, changepass, createdBy, salt, out ex); if (result == -10101010) { //user already exist tbusername.Focus(); lbusername.Visible = true; } else if (result == -10001111 || result == -11110000) { //failed lblerror.Text += "Error" + " : " + ex.ToString(); } else if (result > 0) { //success //get new userID UsersDAL getID = new UsersDAL(); int userID = getID.getuserID(username); Response.Redirect("ManageUser.aspx?UserID=" + userID); } else { //failed lblerror.Text += "Error" + " : " + ex.ToString(); } }
public ActionResult IndexPhep() { UsersDAL userDAL = new UsersDAL(); var modelUser = userDAL.GetUser(User.Identity.Name); return(View("IndexPhep", ueDAL.UeListAllByUser(2, modelUser.UserID))); }
public int UsersCode(UsersData ItemCode) { UsersDAL UsersDAL = new UsersDAL(); try { switch (ItemCode.DataStatus) { case DataStatus.New: UsersDAL.Add(ItemCode); break; case DataStatus.Modified: UsersDAL.update(ItemCode); break; case DataStatus.Deleted: UsersDAL.Delete(ItemCode); return(0); } return(ItemCode.ID); } catch (Exception ex) { throw ex; } }
public void PatchUser(UsersDAL user) { SqlConnection con = new SqlConnection(_connectionString); SqlCommand cmd = new SqlCommand("sp_PatchUser", con); cmd.CommandType = CommandType.StoredProcedure; try { cmd.Parameters.AddWithValue("@User_Id", user.User_Id); cmd.Parameters.AddWithValue("@UserName", user.UserName); cmd.Parameters.AddWithValue("@Role_Id", user.User_Info.Role_Id); cmd.Parameters.AddWithValue("@Email", user.User_Info.Email); cmd.Parameters.AddWithValue("@LastModifiedBy", user.User_Info.LastModifiedBy); cmd.Parameters.AddWithValue("@LastModifiedDate", user.User_Info.LastModifiedDate); con.Open(); cmd.ExecuteNonQuery(); } catch (Exception error) { using (StreamWriter writer = new StreamWriter(_errorLog)) { writer.WriteLine(DateTime.Now + " Patch User Data Access Exception: " + error + "/r/n"); } } finally { con.Close(); } }
public void FillPanelUsers(INSTITUTION objectInstitution) { List <HelpClassUsers> byInstitutionNew = new UsersDAL().GetUsersPermissionsByInstitutionNew(true, objectInstitution); this.PanelUsers.Controls.Clear(); foreach (HelpClassUsers helpClassUsers in byInstitutionNew) { if (helpClassUsers.Type == 2) { Label label = new Label(); this.PanelUsers.Controls.Add((Control) new LiteralControl("<p>")); label.ID = "LabelU" + (object)helpClassUsers.ID; label.Text = helpClassUsers.NameSurname; label.CssClass = "lblpanelsinfo"; this.PanelUsers.Controls.Add((Control)label); LinkButton linkButton = new LinkButton(); linkButton.ID = "LinkU" + (object)helpClassUsers.ID; linkButton.Text = " Повеќе..."; linkButton.CssClass = "linkpanelsinfo"; linkButton.Click += new EventHandler(this.LinkU_Click); this.PanelUsers.Controls.Add((Control)linkButton); this.PanelUsers.Controls.Add((Control) new LiteralControl("</p>")); } } }
//To Update user public int UpdateUser(UserDTO entity) { try { UsersDAL user = new UsersDAL(); PictureDAL picture = new PictureDAL(); if (entity != null) { user.Id = entity.Id; user.FirstName = entity.FirstName; user.Surname = entity.Surname; user.Email = entity.Email; user.Password = entity.Password; user.RoleId = entity.RoleId == 0 ? 1 : entity.RoleId; if (entity.Picture != null) { picture.Image = entity.Picture.Image; picture.UserId = entity.Id; } } _unitOfWork.UserRepository.Update(user, picture); _unitOfWork.Save(); return(1); } catch { throw; } }
//Get the details of a user public UserDTO GetUserData(int id) { try { UsersDAL userDAL = _unitOfWork.UserRepository.GetByID(id); UserDTO userDTO = _mapper.Map <UserDTO>(userDAL); //UserDTO userDTO = new UserDTO //{ // Id = user.Id, // FirstName = user.FirstName, // Surname = user.Surname, // Email = user.Email, // Password = user.Password, // Role = new RoleDTO // { // Id = user.Role.Id, // Name = user.Role.Name // }, // RoleId = user.RoleId, //}; return(userDTO); } catch { throw; } }
//GET: /Admin/Card public ActionResult Card(string name) { if (!(User.Identity.IsAuthenticated && User.Identity.Name == "admin")) { return(RedirectToAction("Index", "Home")); } ViewBag.Operation = name; if (name == "Edit") { string username = Request.Form["username"]; List <WorkCards> cards = CardsDAL.GetCardsByUser(username); List <CardViewModel> cardsViewModel = new List <CardViewModel>(); foreach (var card in cards) { cardsViewModel.Add( new CardViewModel(card) ); } return(View(cardsViewModel)); } List <Users> users = UsersDAL.GetAllUsers(); List <UserViewModel> usersViewModel = new List <UserViewModel>(); foreach (var user in users) { usersViewModel.Add( new UserViewModel(user) ); } return(View(usersViewModel)); }
protected void btn_promeni_Click(object sender, EventArgs e) { INSTITUTION inst = (INSTITUTION)this.Application["Institution"]; bool flag1 = false; if (this.CheckBoxPTrue.Checked) { flag1 = true; } bool flag2 = false; if (!flag1) { List <HelpClassUsers> usersByInstitution = new UsersDAL().GetUsersByInstitution(inst); List <WEBSERVICE> servicesByIstitution = new WebservicesDAL().GetServicesByIstitution(inst); if (usersByInstitution.Count != 0 || servicesByIstitution.Count != 0) { string str = "Не е дозволено бришење! Зависност од следниве објекти<br />"; if (usersByInstitution.Count != 0) { str += "<br />Корисници:<br />"; foreach (HelpClassUsers helpClassUsers in usersByInstitution) { str = str + " " + helpClassUsers.NameSurname + "<br />"; } } if (servicesByIstitution.Count != 0) { str += "<br />Сервиси:<br />"; foreach (WEBSERVICE webservice in servicesByIstitution) { str = str + " " + webservice.Tittle + "<br />"; } } this.diverror.Visible = true; this.Literal1.Text = str; } else { flag2 = true; } } else { flag2 = true; } if (flag2) { new InstitutionsDAL().Update(this.txtPName.Text, this.txtPDescription.Text, new bool?(flag1), new DateTime?(), inst.ID); string old = inst.Tittle + ";" + inst.Description + ";" + inst.Active.ToString(); string newone = this.txtPName.Text + ";" + this.txtPDescription.Text + ";" + flag1.ToString(); new LOGDAL().Insert(Enumerable.Single <KeyValuePair <int, string> >((IEnumerable <KeyValuePair <int, string> >)InteropDAL.TablesDictionary, (Func <KeyValuePair <int, string>, bool>)(p => p.Value == "INSTITUTIONS")).Key, (USER)this.Session["user"], inst.ID.ToString(), 2, DateTime.Now, old, newone); this.Application["ListInstitutions"] = (object)new InstitutionsDAL().GetAllActiveDeleted(true); this.InstitutionsGridView.DataSource = (object)(List <INSTITUTION>) this.Application["ListInstitutions"]; this.InstitutionsGridView.DataBind(); } this.PanelEditUser.CssClass = "content-box column-right closed-box"; this.PanelNewUser.CssClass = "content-box column-left closed-box"; }
private void singin_btn_Click(object sender, EventArgs e) { UsersDAL user = new UsersDAL(); UserDTO dto = new UserDTO(); dto = user.GetUserByLoginPassword(dto.login, dto.password); if (dto.id_user != 0) { MagorPage m = new MagorPage(); m.Show(); } }
public ActionResult Index() { UsersDAL dal = new UsersDAL(); IList<UsersModel> list = null; try { list = dal.QuerySQL(" 1=1 and username!='admin'"); } catch (Exception ex) { Log.Default.Error(ex); } if (list == null) list = new List<UsersModel>(); ViewBag.list = list; return View(); }
public ActionResult dologin(string username, string password, string remName) { try { username = DataTypeHelper.StringFiltrate(username); password = DataTypeHelper.StringFiltrate(password); UsersDAL dal = new UsersDAL(); UsersModel model = dal.login(username, password); if (model != null && model.ID > 0) { LoginHandle.Login(model, remName); return Content(true.ToResult(model).ToJsonString()); } return Content(false.ToResult("用户名或密码错误").ToJsonString()); } catch (Exception ex) { Log.Default.Error(ex); return Content(false.ToResult("网络错误,请稍后重试").ToJsonString()); } }
public ActionResult detail(int id) { UsersDAL dal = new UsersDAL(); JurisdictionDAL jdal = new JurisdictionDAL(); IList<JurisdictionModel> list = null; UsersModel users = null; try { users = dal.QuerySingle(" id=" + id); list = jdal.QuerySQL(" id!=5", " Sort"); } catch (Exception ex) { Log.Default.Error(ex); } if (users == null) users = new UsersModel(); ViewBag.users = users; if (list == null) list = new List<JurisdictionModel>(); ViewBag.list = list; return View(); }