public void Load(Business.User item) { SqlConnection Conn = new SqlConnection(Helper.GetSiemeConnectionString()); try { SqlCommand GetData = new SqlCommand(); GetData.Connection = Conn; GetData.CommandType = CommandType.StoredProcedure; GetData.CommandText = "hisp_Notification_User_Load"; GetData.Parameters.Add(SqlHelper.AddParameter("@USR_ID", SqlDbType.UniqueIdentifier, item.UserID)); Conn.Open(); SqlDataReader sqlReader = GetData.ExecuteReader(CommandBehavior.CloseConnection); if (sqlReader.Read()) { FillObject(item, sqlReader); } else { item.Loaded = false; } } finally { if (Conn != null && Conn.State != ConnectionState.Closed) { Conn.Close(); } } }
public static void DecreaseCostOfSmsSend(Guid userGuid, Common.SmsSendType smsSendType, decimal price, string description, Guid smsSentGuid, DataAccessBase dataAccessBase) { Business.Transaction transactionController = new Business.Transaction(dataAccessBase); Business.User userController = new Business.User(dataAccessBase); Common.User user = new Common.User(); lock (lockDecreaseCostOfSmsSend) { transactionController.BeginTransaction(); try { userController.Load(userGuid, user); if (price > user.Credit) { throw new UserCreditNotEnoughException(); } Decrease(userGuid, price, GetTypeCreditChanges(smsSendType), description, smsSentGuid, transactionController.DataAccessProvider); transactionController.CommitTransaction(); } catch (Exception ex) { transactionController.RollbackTransaction(); throw new InnerTransactionException(ex); } } }
public string QueryDeleteList() { string form_name = Request.Forms("form_name"); string typeid = Request.Querys("typeid"); string sidx = Request.Forms("sidx"); string sord = Request.Forms("sord"); int size = Tools.GetPageSize(); int number = Tools.GetPageNumber(); string order = (sidx.IsNullOrEmpty() ? "CreateDate" : sidx) + " " + (sord.IsNullOrEmpty() ? "DESC" : sord); Business.Form form = new Business.Form(); var forms = form.GetPagerList(out int count, size, number, Current.UserId, form_name, "", order, 2); Newtonsoft.Json.Linq.JArray jArray = new Newtonsoft.Json.Linq.JArray(); Business.User user = new Business.User(); foreach (System.Data.DataRow dr in forms.Rows) { Newtonsoft.Json.Linq.JObject jObject = new Newtonsoft.Json.Linq.JObject { { "id", dr["Id"].ToString() }, { "Name", dr["Name"].ToString() }, { "CreateUserName", dr["CreateUserName"].ToString() }, { "CreateTime", dr["CreateDate"].ToString().ToDateTime().ToDateTimeString() }, { "LastModifyTime", dr["EditDate"].ToString().ToDateTime().ToDateTimeString() }, { "Edit", "<a class=\"list\" href=\"javascript:void(0);\" onclick=\"reply('" + dr["Id"].ToString() + "', '" + dr["Name"].ToString() + "');return false;\"><i class=\"fa fa-reply\"></i>还原</a>" } }; jArray.Add(jObject); } return("{\"userdata\":{\"total\":" + count + ",\"pagesize\":" + size + ",\"pagenumber\":" + number + "},\"rows\":" + jArray.ToString() + "}"); }
public string QueryDelete() { string flow_name = Request.Forms("flow_name"); string typeid = Request.Forms("typeid"); string sidx = Request.Forms("sidx"); string sord = Request.Forms("sord"); int size = Tools.GetPageSize(); int number = Tools.GetPageNumber(); string order = (sidx.IsNullOrEmpty() ? "CreateDate" : sidx) + " " + (sord.IsNullOrEmpty() ? "DESC" : sord); Business.Flow flow = new Business.Flow(); var flows = flow.GetPagerList(out int count, size, number, flow.GetManageFlowIds(Current.UserId), flow_name, "", order, 3); Newtonsoft.Json.Linq.JArray jArray = new Newtonsoft.Json.Linq.JArray(); Business.User user = new Business.User(); foreach (System.Data.DataRow dr in flows.Rows) { Newtonsoft.Json.Linq.JObject jObject = new Newtonsoft.Json.Linq.JObject { { "id", dr["Id"].ToString() }, { "Name", dr["Name"].ToString() }, { "CreateDate", dr["CreateDate"].ToString().ToDateTime().ToDateTimeString() }, { "CreateUser", user.GetName(dr["CreateUser"].ToString().ToGuid()) }, { "Status", flow.GetStatusTitle(dr["Status"].ToString().ToInt()) }, { "Note", dr["Note"].ToString() }, { "Opation", "<a class=\"list\" href=\"javascript:void(0);\" onclick=\"reply('" + dr["Id"].ToString() + "', '" + dr["Name"].ToString() + "');return false;\"><i class=\"fa fa-reply\"></i>还原</a>" } }; jArray.Add(jObject); } return("{\"userdata\":{\"total\":" + count + ",\"pagesize\":" + size + ",\"pagenumber\":" + number + "},\"rows\":" + jArray.ToString() + "}"); }
public IActionResult Index() { bool isoneself = "1".Equals(Request.Querys("isoneself")); Guid userId = Current.UserId; var all = new Business.FlowComment().GetAll(); Newtonsoft.Json.Linq.JArray jArray = new Newtonsoft.Json.Linq.JArray(); Business.User user = new Business.User(); foreach (var comment in all) { if (isoneself && comment.UserId != userId) { continue; } Newtonsoft.Json.Linq.JObject jObject = new Newtonsoft.Json.Linq.JObject { { "id", comment.Id }, { "Comments", comment.Comments }, { "UserId", !comment.UserId.IsEmptyGuid() ? user.GetName(comment.UserId) : "全部人员" }, { "AddType", comment.AddType == 0 ? "用户添加" : "管理员添加" }, { "Sort", comment.Sort }, { "Opation", "<a class=\"list\" href=\"javascript:void(0);\" onclick=\"edit('" + comment.Id + "');return false;\"><i class=\"fa fa-edit (alias)\"></i>编辑</a>" } }; jArray.Add(jObject); } ViewData["json"] = jArray.ToString(); ViewData["appId"] = Request.Querys("appid"); ViewData["tabId"] = Request.Querys("tabid"); ViewData["isoneself"] = Request.Querys("isoneself"); return(View()); }
public static void TestDelete() { Test.Business.User UserBusiness = new Business.User(); int result = UserBusiness.Delete(1); Console.WriteLine(result != 0 ? "删除成功" : "删除失败"); }
public static bool InsertUserGeneralPhoneBook(Guid userGuid, string generalPhoneBookGuid, string newGeneralPhoneBook, decimal sumPrice, bool decreaseFromPanelCharge) { Business.User userController = new Business.User(); userController.BeginTransaction(); try { if (!userController.DeleteAllUserGeneralPhoneBook(userGuid)) { throw new Exception("ErrorRecord"); } if (!userController.InsertUserGeneralPhoneBook(userGuid, generalPhoneBookGuid)) { throw new Exception("ErrorRecord"); } if (decreaseFromPanelCharge && sumPrice != 0) { int countNewGeneralPhoneBook = Helper.ImportIntData(newGeneralPhoneBook, "Count"); for (int counterNewGeneralPhoneBook = 0; counterNewGeneralPhoneBook < countNewGeneralPhoneBook; counterNewGeneralPhoneBook++) { Facade.Transaction.Decrease(userGuid, Helper.ImportDecimalData(newGeneralPhoneBook, "Price" + counterNewGeneralPhoneBook), TypeCreditChanges.ActivationGeneralPhoneBook, Language.GetString("DecreaseFromPanelChargeForActivationGeneralPhoneBook") + " \"" + Helper.ImportData(newGeneralPhoneBook, "Name" + counterNewGeneralPhoneBook) + "\"", Guid.Empty, userController.DataAccessProvider); } } userController.CommitTransaction(); } catch (Exception ex) { userController.RollbackTransaction(); throw ex; } return(true); }
//public static Dictionary<Operators, int> GetCountUserNumberOfOperators(Guid parentGuid) //{ // Business.User userController = new Business.User(); // DataTable dtSmsInfo = userController.GetCountUserNumberOfOperators(parentGuid); // Dictionary<Business.Operators, int> operatorCountNumberDictionary = new Dictionary<Business.Operators, int>(); // foreach (DataRow dataRow in dtSmsInfo.Rows) // { // switch (Helper.GetInt(dataRow["Operator"])) // { // case (int)Business.Operators.MCI: // operatorCountNumberDictionary.Add(Business.Operators.MCI, Helper.GetInt(dataRow["Count"])); // break; // case (int)Business.Operators.MTN: // operatorCountNumberDictionary.Add(Business.Operators.MTN, Helper.GetInt(dataRow["Count"])); // break; // case (int)Business.Operators.Rightel: // operatorCountNumberDictionary.Add(Business.Operators.Rightel, Helper.GetInt(dataRow["Count"])); // break; // } // } // return operatorCountNumberDictionary; //} //public static Dictionary<Operators, int> GetCountRoleNumberOfOperators(Guid userGuid, Guid roleGuid) //{ // Business.User userController = new Business.User(); // DataTable dtSmsInfo = userController.GetCountRoleNumberOfOperators(roleGuid, userGuid); // Dictionary<Business.Operators, int> operatorCountNumberDictionary = new Dictionary<Business.Operators, int>(); // foreach (DataRow dataRow in dtSmsInfo.Rows) // { // switch (Helper.GetInt(dataRow["Operator"])) // { // case (int)Business.Operators.MCI: // operatorCountNumberDictionary.Add(Business.Operators.MCI, Helper.GetInt(dataRow["Count"])); // break; // case (int)Business.Operators.MTN: // operatorCountNumberDictionary.Add(Business.Operators.MTN, Helper.GetInt(dataRow["Count"])); // break; // case (int)Business.Operators.Rightel: // operatorCountNumberDictionary.Add(Business.Operators.Rightel, Helper.GetInt(dataRow["Count"])); // break; // } // } // return operatorCountNumberDictionary; //} #endregion public static Common.User LoadUser(Guid userGuid) { Business.User userController = new Business.User(); Common.User commonUser = new Common.User(); userController.Load(userGuid, commonUser); return(commonUser); }
public string Member_GetNote() { string id = Request.Querys("id"); if (id.IsNullOrWhiteSpace()) { return(""); } Business.Organize organize = new Business.Organize(); Business.User user = new Business.User(); Business.OrganizeUser organizeUser = new Business.OrganizeUser(); if (id.StartsWith(Business.Organize.PREFIX_USER))//人员 { var organizeUserModel = organizeUser.GetMainByUserId(id.RemoveUserPrefix().ToGuid()); return(organize.GetParentsName(organizeUserModel.OrganizeId) + " \\ " + organize.GetName(organizeUserModel.OrganizeId)); } else if (id.StartsWith(Business.Organize.PREFIX_RELATION))//兼职人员 { var organizeUserModel = organizeUser.Get(id.RemoveUserRelationPrefix().ToGuid()); return(organize.GetParentsName(organizeUserModel.OrganizeId) + " \\ " + organize.GetName(organizeUserModel.OrganizeId) + "[兼任]"); } else if (id.StartsWith(Business.Organize.PREFIX_WORKGROUP))//工作组 { return(""); } else if (id.IsGuid(out Guid gid)) { return(organize.GetParentsName(gid) + " \\ " + organize.GetName(gid)); } return(""); }
/// <summary> /// 根据Name过滤数据 /// </summary> /// <returns></returns> public ActionResult GetDataByName() { UserSystem.Business.User bllUser = new Business.User(); var name = Request.QueryString["name"]; DataTable dt = bllUser.GetList(string.Format("Name like '{0}%'", name)).Tables[0]; string json = UserSystem.Commom.JsonHelper.ToJson(dt); return Content(json); }
public static void TestSelectAll() { Test.Business.User UserBusiness = new Business.User(); List<Test.Model.User> UserList = UserBusiness.GetAll(); foreach (var item in UserList) { Console.WriteLine(item.LoginName + "\t" + item.Password); } }
//批量删除用户 public ActionResult DelUser() { UserSystem.Business.User bllUser = new Business.User(); bool flag = false; var ids = Request.Form["ids"]; //批量删除(where id in ({0})) flag = bllUser.DeleteList(ids); return Content(flag.ToString()); }
protected void Page_Load(object sender, EventArgs e) { var userId = this.PageEngine.GetWindowArgs<string>(); if (!string.IsNullOrWhiteSpace(userId)) { this.Model = Business.User.GetUserById(userId); this.FillForm(this.Model); } }
protected void Page_Load(object sender, EventArgs e) { var userId = this.PageEngine.GetWindowArgs <string>(); if (!string.IsNullOrWhiteSpace(userId)) { this.Model = Business.User.GetUserById(userId); this.FillForm(this.Model); } }
public static void TestSelectAll() { Test.Business.User UserBusiness = new Business.User(); List <Test.Model.User> UserList = UserBusiness.GetAll(); foreach (var item in UserList) { Console.WriteLine(item.LoginName + "\t" + item.Password); } }
/// <summary> /// Adds the user's details to the database /// </summary> /// <param name="user">User object being added to the database</param> public static void AddUser(Business.User user) { try { Control.ExecuteNonQuery("AddUser", user.GetParametersForStoredProcedure(false)); } catch (System.Exception e) { throw new Exception.AddDbObjectException("Could not add user to the database", e); } }
/// <summary> /// Updates the user's data in the database /// </summary> /// <param name="user">User object being updated in the database</param> public static void UpdateUser(Business.User user) { try { Control.ExecuteNonQuery("UpdateUser", user.GetParametersForStoredProcedure(true)); } catch (System.Exception e) { throw new Exception.UpdateDbObjectException("Could not update user in the database", e); } }
/// <summary> /// Loads all albums that belong to a specified customer /// </summary> /// <param name="customer">Customer the albums belong to</param> /// <returns>All albums that belong to a specified customer</returns> public static Business.CustomerAlbum[] GetCustomerAlbumsByCustomer(Business.User customer) { Business.CustomerAlbum[] customerAlbums = GetCustomerAlbumsByCustomerId(customer.UserId); foreach (Business.CustomerAlbum customerAlbum in customerAlbums) { customerAlbum.customer = customer; } return(customerAlbums); }
public void QueryEntity() { var factory = new Data.RepositoryFactory(); Business.User userBiz = new Business.User(factory); int result = ((List<Entities.User>)userBiz.Query(u => u.Id > 0)).Count; int resultAll = ((List<Entities.User>)userBiz.GetAll()).Count; Assert.AreEqual(result, resultAll); }
public static bool AdvanceUpdate(Common.User user) { try { Business.User userController = new Business.User(); return(userController.AdvanceUpdate(user)); } catch (Exception ex) { throw ex; } }
public IActionResult UserSort() { string orgId = Request.Querys("orgparentid"); Business.Organize organize = new Business.Organize(); Business.User user = new Business.User(); var users = organize.GetAllUsers(orgId.ToGuid()); ViewData["queryString"] = Request.UrlQuery(); ViewData["refreshId"] = orgId; return(View(users)); }
public static void TestUpdate() { Test.Business.User UserBusiness = new Business.User(); int result = UserBusiness.Update(new Test.Model.User() { Id = 2, LoginName = "Hots", Password = "******", CreateTime = DateTime.Now }); Console.WriteLine(result != 0 ? "更新成功" : "更新失败"); }
public void Delete(string id) { Business.User user = Business.User.GetUserById(id); if (user != null) { user.Delete(); this.Bind(null); } else { this.PageEngine.ShowMessageBox(string.Format("没有找到 Id 为 ‘{0}’ 的用户", id)); } }
public void SaveEntity() { var factory = new Data.RepositoryFactory(); Business.User userBiz = new Business.User(factory); var userNew = FakeEntities.Generator.CreateUser(); var creditCardTypeNew = FakeEntities.Generator.CreateCreditCardType(); var creditCardNew = FakeEntities.Generator.CreateCreditCard(creditCardTypeNew, userNew); var userSaved = userBiz.Save(userNew); Assert.IsNotNull(userSaved); }
public string InitUserPassword() { string userId = Request.Querys("userid"); if (!userId.IsGuid(out Guid guid)) { return("用户ID错误!"); } bool success = new Business.User().InitUserPassword(guid); Business.Log.Add("初始化了人员密码-" + userId, success ? "初始化成功!" : "初始化失败!", Business.Log.Type.系统管理); return(success ? "初始化成功!" : "初始化失败!"); }
public static void TestAdd() { Test.Business.User UserBusiness = new Business.User(); int result = UserBusiness.Add(new Test.Model.User() { LoginName = "Hotss", Password = "******", Age = 23, CreateTime = DateTime.Now, UserSex = 1 }); Console.WriteLine(result != 0 ? "新增成功" : "新增失败"); }
public HttpResponseMessage PutUserProfile([FromBody] ProfileForUpdateDto newProfile) { var queryGenerator = new Business.User(); Result res = queryGenerator.PutUserProfile(newProfile); if (res.Value == true) { return(Request.CreateResponse(HttpStatusCode.OK, res.Content)); } else { return(Request.CreateResponse(HttpStatusCode.PreconditionFailed, res.Content)); } }
public static string GetUserNameAndFamily(Guid userGuid) { Business.User userController = new Business.User(); DataTable userInfo = userController.GetUserInfo(userGuid); if (userInfo.Rows.Count > 0) { return(string.Format("{0} {1}", Helper.GetString(userInfo.Rows[0]["FirstName"]), Helper.GetString(userInfo.Rows[0]["LastName"]))); } else { return(string.Empty); } }
public IActionResult ShowUserMenu() { string userName = string.Empty; string userId = Request.Querys("userid"); if (userId.IsGuid(out Guid guid)) { userName = new Business.User().GetName(guid); } ViewData["prevUrl"] = Request.Querys("prevUrl"); ViewData["userName"] = userName; ViewData["userId"] = userId; return(View()); }
public void SetUser(Data.User user) { try { ManipulatedUser = new Business.User() { ID = user.ID, FirstName = user.FirstName, LastName = user.LastName, Address = null, Email = user.Email, NFCUID = user.NFCUID, Password = user.Password, PhoneNumber = user.PhoneNumber, Role = (Business.Roles)user.Role }; } catch (Exception ex) { ErrorHandler.ThrowError(0, ex.Message); } }
/// <summary> /// Creates a new Business.User object from the data in the DataTableReader /// </summary> /// <param name="dtr">DataTableReader containing the User's data</param> /// <returns>Business.User object</returns> private static Business.User GetUserFromDataTableReader(DataTableReader dtr) { Business.User user = new Business.User(); user.UserId = (Guid)dtr["UserId"]; user.FirstName = (String)dtr["FirstName"]; user.Surname = (String)dtr["Surname"]; user.EmailAddress = (String)dtr["EmailAddress"]; user.Password = (String)dtr["Password"]; user.Admin = (Boolean)dtr["Admin"]; user.DateAdded = (DateTime)dtr["DateAdded"]; user.CustomerAlbums = Data.CustomerAlbum.GetCustomerAlbumsByCustomer(user); user.IsInDatabase = true; return(user); }
public static bool CheckPermissionBySDK(this Business.User user, SDK.Operation sdkOperation) { if (user == null || sdkOperation == null) { return(false); } sdkOperation.AppKey = AppSettings.Name; Business.Operation operation = Business.Operation.GetOperation(sdkOperation.AppKey, sdkOperation.TargetCode, sdkOperation.Code); if (operation == null) { return(false); } else { return(user.CheckPermission(operation)); } }
protected void btnEdit_Click(object sender, EventArgs e) { if (lstRoles.SelectedIndex >= 0 && lstCat.SelectedIndex >= 0 && lstPer.SelectedIndex >= 0) { ResetCategory(); string strPer = ""; foreach (ListItem item in lstPer.Items) { strPer += item.Value + ","; } /// nếu có chuyên mục : channel,role;category:permission string id = 1 + "," + lstRoles.SelectedValue + ";" + lstCat.SelectedValue + ":" + strPer.Substring(0, strPer.Length - 1); ViewState["id"] = id; Business.User user = new Business.User(); int Role_ID = Int32.Parse(user.GetRoleID(id)); using (MainDB db = new MainDB()) { lbxRole.SelectedIndex = 0; LoadPermission(db, Role_ID); } ResetPermission(); //set category selected if (user.GetCategoryID(id) != "") { SetListSelected(user.GetCategoryID(id), clbCategory); SetListSelected("," + id.Split(':')[1] + ",", clbPermission); lbxRole.SelectedValue = Role_ID.ToString(); } else { lbxRole.SelectedValue = RoleConst.QuanTriKenh.ToString(); clbPermission.Enabled = false; clbCategory.Enabled = false; } btnAssignPermission.Visible = false; btnUpdate.Visible = true; btnCancel.Visible = true; lblMessage.Visible = false; } else { lblMessageXoa.Text = "Bạn phải chọn vài trò , chuyên mục , quyền muốn sửa"; return; } }
public void Remove(string id) { var orgId = this.OrgTree.TreeView.SelectedValue ?? ""; Organization org = Organization.GetOrganizationById(orgId); if (org == null) { this.PageEngine.ShowMessageBox(string.Format("没有找到 Id 为 ‘{0}’ 的组织", orgId)); return; } Business.User user = Business.User.GetUserById(id); if (user == null) { this.PageEngine.ShowMessageBox(string.Format("没有找到 Id 为 ‘{0}’ 的用户", id)); } org.RemoveUser(user); this.Bind(null); }
public void Loaded() { Users = _usersRepository.GetUsers(); if (IsNewUser) { ManipulatedUser = new Business.User(); ManipulatedUser.FirstName = null; ManipulatedUser.LastName = null; ManipulatedUser.Email = null; ManipulatedUser.Password = GenerateRandomPassword(8); // generate a random password } else { SelectedRole = (Data.Roles)ManipulatedUser.Role; } }
public void DeleteEntity() { var factory = new Data.RepositoryFactory(); Business.User userBiz = new Business.User(factory); var userFound = userBiz.Get(1); if (userFound == null) userFound = userBiz.Save(FakeEntities.Generator.CreateUser()); int id = userFound.Id; userBiz.Delete(userFound); var userDeleted = userBiz.Get(id); Assert.IsNull(userDeleted); }
protected void btnUpdate_Click(object sender, EventArgs e) { //Validate if (!Validated()) { return; } //Delete old record Business.User user = new Business.User(); user.DeleteByUserChannelRole(lblUserName.Text, ViewState["id"].ToString()); //Insert new record btnAssignPermission_Click1(null, null); //show hide button btnUpdate.Visible = false; btnCancel.Visible = false; btnAssignPermission.Visible = true; lblMessage.Text = "Update thành công"; lblMessage.Visible = true; }
/// <summary> /// 根据Name过滤数据 /// </summary> /// <returns></returns> public ActionResult Update() { UserSystem.Business.User bllUser = new Business.User(); var name = Request.Form["name"]; var pwd = Request.Form["pwd"]; var id = Request.Form["id"]; UserSystem.Model.User u = new Model.User(); u.Name = name; u.Password = pwd; u.ID = Convert.ToInt32(id); bool flag = bllUser.Update(u); return Content(flag.ToString()); }
public string Signup(User usersignupdata) { try { Business.User serviceuser = new Business.User(); string companyid = serviceuser.RegisterCompany(usersignupdata.title, usersignupdata.email, usersignupdata.password, "", ""); if (companyid != "") { //Registering User is successfull . return companyid; } else { //Registering User Failed return ""; } } catch { //Registering User Failed return ""; } }
public Business.ApplicationService.AccessObject Login(User logindata) { Business.User businessuser = new Business.User(); Business.ApplicationService.AccessObject accessobj = businessuser.LoginCompany(logindata.userEmail, logindata.password); return accessobj; }
public static void TestSelectSingle() { Test.Business.User UserBusiness = new Business.User(); Test.Model.User User = UserBusiness.Get(3); Console.WriteLine("用户名:" + User.LoginName + "\t" + "创建时间:" + User.CreateTime.ToString()); }