Пример #1
0
 public ActionResult AllotAdmit(int id)
 {
     UsersBLL usreBll = new UsersBLL();
     string loginName = Request.Form["U_LoginName"];
     int S_ID = Convert.ToInt32(Request.Form["S_ID"]);
     ShopsBLL shopBll = new ShopsBLL();
     Shops s = shopBll.SelectWhere(m => m.S_ID == S_ID).FirstOrDefault();
     Users u = new Users();
     try
     {
         using (TransactionScope ts = new TransactionScope())
         {
             u.U_LoginName = loginName;
             u.U_Password = "******";
             u.S_ID = S_ID;
             u.U_Role = 2;
             s.S_IsHasSetAdmin = true;
             shopBll.SaveChanges();
             usreBll.Add(u);
             usreBll.SaveChanges();
             ts.Complete();
         }
         return Json(new { result = "ok" });
     }
     catch
     {
         return Json(new { result = "error" });
     }
 }
Пример #2
0
 /// <summary>
 /// 修改
 /// </summary>
 public ActionResult Edit(int id)
 {
     Users user = new UsersBLL().Find(id);
     var role = new CategoryItemsBLL().SelectWhere(m => m.C_Category == "U_Role" && m.CI_ID != 1);
     ViewBag.U_Role = new SelectList(role, "CI_ID", "CI_Name", user.U_Role);
     ViewBag.CanDelete = user.U_CanDelete == true ? "checked='checked'" : "";
     return View(user);
 }
Пример #3
0
        public ActionResult Index(string loginname, string password)
        {
            var res = new UsersBLL().SelectWhere(u => u.U_Password == password && u.U_LoginName == loginname && u.U_Role != 3 && u.U_Role != 4);

            if (res.Any())
            {
                Session["user"] = res.FirstOrDefault();
                return Content("ok");
            }
            return Content("erro");
        }
Пример #4
0
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        UsersBLL user = new UsersBLL();

        if (user.AddUser(AccountNameTextBox.Text, DisplayNameTextBox.Text, EmailTextBox.Text, Convert.ToInt32(DefaultViewDropDownList.SelectedValue), null, ActiveCheckBox.Checked, Convert.ToInt32(ManagerIDDropDownList.SelectedValue), Convert.ToInt32(SectionIDDropDownList.SelectedValue)))
        {
            InfoBarLabel.Text = "User Added!!";
            UsersGridView.DataBind();
        }
        else
            InfoBarLabel.Text = "Error: User not added.";
    }
Пример #5
0
        /// <summary>
        /// 服务接收客户端消息
        /// </summary>
        /// <param name="sokMsgObj">客户端Scoket</param>
        void ReciveMsg(object sokMsgObj)
        {
            Socket sokMsg = null;

            try
            {
                //sokMsg接收消息的socket
                sokMsg = sokMsgObj as Socket;
                //创建接收消息的缓冲区   默认5M

                //循环接收
                while (isReceing)
                {
                    byte[] arrMsg = new byte[5 * 1024 * 1024];
                    //接收到的真实消息存入缓冲区     并保存消息的真实长度(因为5M缓冲区不会全部用掉)
                    int realLength = sokMsg.Receive(arrMsg);
                    //将缓冲区的真实数据转成字符串
                    string strMsg = Encoding.UTF8.GetString(arrMsg, 1, realLength - 1);
                    //dgSendMsg(strMsg);
                    string[] msgTxt = strMsg.Split('|');
                    //  msgTxt.Length == 2说明用户第一次连入,我们必须记录他的IP并与用户对应起来,如果局域网聊天
                    //IP在同一网段两个客户端还可以互相找到, 如果广域网下只有通过服务器转接才能找到
                    if (msgTxt.Length == 2)
                    {
                        //如果用户名已登录则强制下线
                        if (UserSocket.Values.Contains(msgTxt[0]))
                        {
                            sokMsg.Close();
                            return;
                        }
                        //显示列表
                        System.Threading.Thread.Sleep(500);
                        UsersBLL userbll = new UsersBLL();
                        //更新登录ip
                        userbll.UpDateIp(Convert.ToInt64(msgTxt[0]), sokMsg.RemoteEndPoint.ToString());
                        //这里错误IP不应该在本地存储
                        UserSocket.Add(sokMsg.RemoteEndPoint.ToString(), msgTxt[0]);
                        //显示列表
                        listClient.Items.Add(sokMsg.RemoteEndPoint + "---" + msgTxt[0] + @"---上线~\(≧▽≦)/~啦啦啦");
                        continue;
                    }
                    SendMsgToClient(arrMsg, realLength);
                }
            }
            catch
            {
                //连接出错说明客户端连接断开
                RemoveClient(sokMsg.RemoteEndPoint.ToString());
            }
        }
Пример #6
0
        public void AddUser(HttpContext context)
        {
            string PwdKey = LinkFun.getPwdKey();
            int    UserID = 0;

            if (!string.IsNullOrEmpty(context.Request.QueryString["UserID"].ToString()))
            {
                UserID = Convert.ToInt32(context.Request.QueryString["UserID"].ToString());
            }


            string   objOrder = GetParam("UsersModel", context);
            Users    users    = JsonConvert.DeserializeObject <Users>(objOrder);
            UsersBLL usersbll = new UsersBLL();


            int result = 0;

            //编辑
            if (UserID > 0)
            {
                if (users.LoginName != "" && users.Password != "")
                {
                    result = usersbll.Update(users) ? 1 : 0;
                    if (result > 0)
                    {
                        #region 通知风控系统

                        #endregion
                    }
                }
            }
            else
            {
                string pwd = DESEncrypt.Encrypt(PwdKey, users.Password);//加密密码
                users.Password = pwd;
                //添加
                if (users.LoginName != "" && users.Password != "")
                {
                    result = usersbll.Add(users);
                    if (result > 0)
                    {
                        #region 通知风控系统

                        #endregion
                    }
                }
            }
            context.Response.Write(result);
        }
Пример #7
0
        protected void UserRolesRPT_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "DeleteRole")
            {
                //get current array of roles
                UsersBLL getcurrentroles = new UsersBLL();
                string[] arr             = getcurrentroles.getrolesArray(userID);


                //remove the selected role in the array
                arr = arr.Where(val => val != e.CommandArgument.ToString()).ToArray();



                //if arr length is left with 1, set roles to empty;
                string roles;
                if (arr.Length < 1)
                {
                    // label1.Text = "empty";
                    roles = "";
                }
                else//convert the array back to a string with seperator
                {
                    //label1.Text = "";
                    roles = String.Join(",", arr);
                }

                //store the new combine string into database
                //add to DB
                string   ex;
                UsersDAL updaterole = new UsersDAL();
                int      result     = updaterole.updateroleDAL(userID, roles, out ex);

                if (result > 0)//success
                {
                    //reload all the table
                    //label1.Text = roles;
                    bindrolesDDL();
                    filterrolesDDL();
                    bindRPTUserRole();
                }
                else //failed
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "ShowPopup2();", true);
                    lbVmodalheaderfail.Text  = "Delete Role Failed";
                    lbVmodalfailcontent.Text = "Delete Role Failed, please try again " + ex.ToString();
                }
            }
        }
Пример #8
0
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            if (Validate() == false)
            {
                return;
            }

            if (UsersBLL.GetDuplicateUserName(txtUserName.Text, this._user.Id) != null)
            {
                MessageBox.Show("Username is already used");
            }
            else
            {
                User user = new User();
                user.Id        = Guid.NewGuid();
                user.UserName  = txtUserName.Text;
                user.LastName  = txtLastName.Text;
                user.FirstName = txtFirstName.Text;

                Role role = new Role();
                if (cboRole.SelectedValue.ToString() == Role.Admin.ToString())
                {
                    role = Role.Admin;
                }
                else if (cboRole.SelectedValue.ToString() == Role.Cashier.ToString())
                {
                    role = Role.Cashier;
                }
                else if (cboRole.SelectedValue.ToString() == Role.Chef.ToString())
                {
                    role = Role.Chef;
                }
                else if (cboRole.SelectedValue.ToString() == Role.InventoryController.ToString())
                {
                    role = Role.InventoryController;
                }
                else if (cboRole.SelectedValue.ToString() == Role.Waiter.ToString())
                {
                    role = Role.Waiter;
                }

                user.Role = role;
                user.Id   = this._user.Id;
                UsersBLL.Update(user);
                MessageBox.Show("User successfully updated.");
                this._sender.showList();
                this.Close();
            }
        }
    protected void DisplayTaskByDate(DateTime start, DateTime end)
    {
        Decimal TotalTime = 0;

        if (DirectReportsDropDown.SelectedValue == "AllUsers")
        {
            int      userID = (int)Session["userID"];
            UsersBLL users  = new UsersBLL();
            TimeKeeper.UsersDataTable usersDT = users.GetUsersByDirectReportsOf(userID);

            TasksBLL tasks = new TasksBLL();
            TimeKeeper.TasksDataTable directReportTasks = tasks.GetTasksByUserIDByDateRange(0, start, end);

            foreach (DataRow user in usersDT.Rows)
            {
                int directReportUserID         = Convert.ToInt32(user["userID"]);
                TimeKeeper.TasksDataTable task = tasks.GetTasksByUserIDByDateRange(directReportUserID, start, end);
                directReportTasks.Merge(task);

                TotalTime += tasks.TotalTimeByUserIDByDateRange(directReportUserID, start, end);
            }

            ByUserGridView.DataSource = directReportTasks;
            ByUserGridView.DataBind();

            Output.Text = "Your employees have worked ";
        }
        else
        {
            TasksBLL tasks = new TasksBLL();
            TimeKeeper.TasksDataTable directReportTasks = tasks.GetTasksByUserIDByDateRange(Convert.ToInt32(DirectReportsDropDown.SelectedValue), start, end);

            TotalTime = tasks.TotalTimeByUserIDByDateRange(Convert.ToInt32(DirectReportsDropDown.SelectedValue), start, end);

            ByUserGridView.DataSource = directReportTasks;
            ByUserGridView.DataBind();

            Output.Text = "The employee has worked ";
        }

        if (start == end)
        {
            Output.Text += TotalTime + " hrs on " + start.ToShortDateString();
        }
        else
        {
            Output.Text += TotalTime + " hrs between " + start.ToShortDateString() + " and " + end.ToShortDateString();
        }
    }
Пример #10
0
        public ActionResult GetUsersList()
        {
            try
            {
                var queryParams = new NameValueCollection();
                if (!ParamHelper.CheckParaQ(ref queryParams))
                {
                    return(Json(new ResponseEntity <int>(RegularFunction.RegularSqlRegexText), JsonRequestBehavior.AllowGet));
                }

                var query = new UsersQuery(queryParams);

                var sqlCondition = new StringBuilder();
                sqlCondition.Append("ISNULL(IsDelete,0)!=1");

                if (!string.IsNullOrEmpty(query.Name))
                {
                    sqlCondition.Append($" and (Name like '%{query.Name}%'  or UserName like '%{query.Name}%')");
                }

                PageRequest preq = new PageRequest
                {
                    TableName      = " [Users] ",
                    Where          = sqlCondition.ToString(),
                    Order          = " Id DESC ",
                    IsSelect       = true,
                    IsReturnRecord = true,
                    PageSize       = query.PageSize,
                    PageIndex      = query.PageIndex,
                    FieldStr       = "*"
                };

                var result = new UsersBLL().GetDataByPage(preq);

                var response = new ResponseEntity <object>(true, string.Empty,
                                                           new DataGridResultEntity <Users>
                {
                    TotalRecords   = preq.Out_AllRecordCount,
                    DisplayRecords = preq.Out_PageCount,
                    ResultData     = result
                });

                return(Json(response, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new ResponseEntity <object>(-999, string.Empty, ""), JsonRequestBehavior.AllowGet));
            }
        }
Пример #11
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (Validate() == false)
            {
                return;
            }

            if (UsersBLL.GetUserByUserName(txtUsername.Text) != null)
            {
                MessageBox.Show("Username is already used");
            }
            else
            {
                HAYNARESTAURANT.Domain.Models.Users users = new HAYNARESTAURANT.Domain.Models.Users();
                users.Id        = Guid.NewGuid();
                users.UserName  = txtUsername.Text;
                users.LastName  = txtLastname.Text;
                users.FirstName = txtFirstname.Text;

                Role role = new Role();
                if (cboRole.SelectedValue.ToString() == Role.Admin.ToString())
                {
                    role = Role.Admin;
                }
                else if (cboRole.SelectedValue.ToString() == Role.Cashier.ToString())
                {
                    role = Role.Cashier;
                }
                else if (cboRole.SelectedValue.ToString() == Role.Chef.ToString())
                {
                    role = Role.Chef;
                }
                else if (cboRole.SelectedValue.ToString() == Role.InventoryController.ToString())
                {
                    role = Role.InventoryController;
                }
                else if (cboRole.SelectedValue.ToString() == Role.Waiter.ToString())
                {
                    role = Role.Waiter;
                }

                users.Role = role;
                users.Id   = this._users.Id;
                UsersBLL.Create(users);
                MessageBox.Show("User successfully created.");
                this._sender.showList();
                this.Close();
            }
        }
Пример #12
0
 /// <summary>
 /// 删除
 /// </summary>
 public ActionResult Delete(int id)
 {
     try
     {
         UsersBLL bll = new UsersBLL();
         Users u = bll.Find(id);
         u.U_Role = 4;
         bll.SaveChanges();
         return Json(new { result = "ok" }, JsonRequestBehavior.AllowGet);
     }
     catch
     {
         return Json(new { result = "error" }, JsonRequestBehavior.AllowGet);
     }
 }
        public string DeleteUser(Users UserInfo)
        {
            //Run data validation
            string ReturnErr = UsersBLL.getInstance().ValidateKey(JsonConvert.DeserializeObject <UsersBLLModel>(JsonConvert.SerializeObject(UserInfo)));

            if (ReturnErr != "")
            {
                return(ReturnErr);
            }

            //Execute Delete Request
            string ReturnVal = UsersBLL.getInstance().Delete(JsonConvert.DeserializeObject <UsersBLLModel>(JsonConvert.SerializeObject(UserInfo)));

            return(ReturnVal);
        }
Пример #14
0
        /// <summary>
        /// 提取当前订单积分
        /// </summary>
        /// <param name="orderNo"></param>
        /// <param name="?"></param>
        private void fetchPoint(string orderNo)
        {
            OrdersBLL orderbll  = new OrdersBLL();
            OrderInfo orderItem = orderbll.GetItem(Convert.ToString(orderNo));

            orderbll.UpdateItem(4, orderItem.Id);

            UsersBLL ubll = new UsersBLL();

            ubll.UpdatePoint(orderItem.OrderPoint, orderItem.UserId);



            PageInit();
        }
Пример #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        UsersBLL user = new UsersBLL();

        userName = user.GetUser().UserName;

        //pnlClient.Visible = true;
        if (!IsPostBack)
        {
            txtCaseNumber.Text = GetUniqueId.GetRandomString();
            CountryBind();
            BindRepater();
            BindPrescriptionData();
        }
    }
Пример #16
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        Users users = new Users();

        if (UsersBLL.GetUsersLogin(this.txtUserName.Value.Trim(), this.txtPwd.Value.Trim(), out users))
        {
            Session["Users"] = users;
            Response.Redirect("Index.aspx");
        }
        else
        {
            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('用户名或者密码错误!');</script>");
            return;
        }
    }
Пример #17
0
        protected string CheckMobile(string mobile)
        {
            string strResult = string.Empty;
            int    userid    = new UsersBLL().CheckUserByMobile(mobile);

            if (userid > 0)
            {
                strResult = "1";
            }
            else
            {
                strResult = "0";
            }
            return(strResult);
        }
Пример #18
0
        private void uses_Form_Load(object sender, EventArgs e)
        {
            List <usersType> type = new IdCard_BLL().p_usesType_select();

            foreach (var item in type)
            {
                comboBox1.Items.Add(item.Type);
            }
            List <SectionRoom> se = new UsersBLL().Section();

            foreach (var item in se)
            {
                comboBox2.Items.Add(item.Sname);
            }
        }
Пример #19
0
        public ActionResult GetUsersById(int Id)
        {
            var result = new UsersBLL().GetDataById(Id);

            if (result != null)
            {
                var response = new ResponseEntity <Users>(true, ConstantDefine.TipQuerySuccess, result);
                return(Json(response, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var response = new ResponseEntity <Users>(ConstantDefine.TipQueryFail);
                return(Json(response, JsonRequestBehavior.AllowGet));
            }
        }
Пример #20
0
 private void btn_delete_Click(object sender, EventArgs e)
 {
     if (current != null ? current.Id > 0 : false)
     {
         if (DialogResult.Yes == Messages.Confirmation(Mots.Supprimer))
         {
             if (UsersBLL.Delete(current))
             {
                 DeleteRow(current);
                 Reset();
                 Messages.Succes();
             }
         }
     }
 }
Пример #21
0
        protected string CheckEmail(string email)
        {
            string strResult = string.Empty;
            int    userid    = new UsersBLL().CheckUserByEmail(email);

            if (userid > 0)
            {
                strResult = "1";
            }
            else
            {
                strResult = "0";
            }
            return(strResult);
        }
Пример #22
0
        private string CheckUserName(string username)
        {
            string strResult = string.Empty;
            int    userid    = new UsersBLL().CheckUserIDByUserName(username);

            if (userid > 0)
            {
                strResult = "1";
            }
            else
            {
                strResult = "0";
            }
            return(strResult);
        }
Пример #23
0
        private void btnReg_Click(object sender, EventArgs e)
        {
            foreach (Control item in groupBox1.Controls)
            {
                if (item is Label)
                {
                    continue;
                }
                else
                {
                    if (item.Text == "")
                    {
                        PromptingForm p = new PromptingForm("请填写完整信息");
                        p.ShowDialog();
                        return;
                    }
                }
            }
            Register r = new Register();

            r.Rid           = txtRid.Text;
            r.KId           = int.Parse(txtKid.Text);
            r.IdType        = cboIdType.Text;
            r.SectionRoom   = cboSectionRoom.Text + "";
            r.Doctor        = cboDoctor.Text;
            r.GuaDanFei     = int.Parse(txtGuaHaoFei.Text);
            r.OtherFei      = int.Parse(txtOtherFei.Text);
            r.ReristerTime  = dtpReristerTime.Text;
            r.SeeDoctorTime = dtpSeeDoctorTime.Text;
            string        s    = new UsersBLL().RegisterRew(r);
            PromptingForm prom = new PromptingForm(s);

            prom.ShowDialog();
            if (cheguadan.Checked && s == "挂号成功")
            {
                printPreviewDialog1.Document = printDocument1;
                printPreviewDialog1.Document.DefaultPageSettings.PaperSize = new PaperSize()
                {
                    Height = 600, Width = 500
                };
                printPreviewDialog1.ShowIcon = false;
                printPreviewDialog1.Width    = 400;
                printPreviewDialog1.Height   = 400;
                printPreviewDialog1.Top      = 15;
                printPreviewDialog1.Left     = 10;
                printPreviewDialog1.ShowDialog();
            }
        }
Пример #24
0
        private void BtnAdd_Click(object sender, RoutedEventArgs e)
        {
            if (Validate() == false)
            {
                return;
            }

            if (UsersBLL.Get = User.ByUserName(txtUserName.Text) != null)
            {
                MessageBox.Show("Username is already used");
            }
            else
            {
                User user = new User();
                user.Id        = Guid.NewGuid();
                user.UserName  = txtUserName.Text;
                user.LastName  = txtLastName.Text;
                user.FirstName = txtFirstName.Text;

                Role role = new Role();
                if (cboRole.SelectedValue.ToString() == Role.Admin.ToString())
                {
                    role = Role.Admin;
                }
                else if (cboRole.SelectedValue.ToString() == Role.Cashier.ToString())
                {
                    role = Role.Cashier;
                }
                else if (cboRole.SelectedValue.ToString() == Role.Chef.ToString())
                {
                    role = Role.Chef;
                }
                else if (cboRole.SelectedValue.ToString() == Role.InventoryController.ToString())
                {
                    role = Role.InventoryController;
                }
                else if (cboRole.SelectedValue.ToString() == Role.Waiter.ToString())
                {
                    role = Role.Waiter;
                }

                user.Role     = role;
                user.Password = this.RandomString(6);
                UsersBLL.Create(user);
                MessageBox.Show("User successfully created.");
                this.Close();
            }
        }
Пример #25
0
 protected void Delete_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < DataList1.Items.Count; i++)
     {
         if (((CheckBox)DataList1.Items[i].FindControl("selected")).Checked == true)
         {
             object s = ((System.Web.UI.WebControls.HyperLink)DataList1.Items[i].FindControl("Hyperlink3")).Text;
             usersbll = new UsersBLL();
             if (usersbll.Delete(s))
             {
                 Response.Write("<script>alert('删除成功');history.back();</script>");
             }
         }
     }
     this.Response.Redirect(this.Request.Url.ToString());
 }
Пример #26
0
 private void SetCompany()
 {
     try
     {
         DataSet1.T_OCRX_CORow row = UsersBLL.SelectCompany(CompanyCode);
         lblCompany.Text = row.COMPANYNAME;
     }
     catch (Exception ex)
     {
         //MessageBox.Show(ex.Message);
     }
     finally
     {
         //this.Cursor = Cursors.Default;
     }
 }
Пример #27
0
        public IHttpActionResult PutUsers(int id, Users user)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != user.id_user)
            {
                return(BadRequest());
            }

            UsersBLL.Update(user);

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #28
0
 protected void btnLogin_Click(object sender, EventArgs e)
 {
     if (UsersBLL.ValidateUser(txtUserName.Text, txtPass.Text))
     {
         FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, chkSaveMe.Checked);
         if (Request.QueryString.ToString().Contains("ReturnUrl"))
         {
             Response.Redirect(Request.QueryString["ReturnUrl"]);
         }
         Response.Redirect("/Default.aspx?message");
     }
     else
     {
         Response.Redirect("_Login.aspx?Shit=Error");
     }
 }
Пример #29
0
        public async Task <IActionResult> RegisterUser(User admin)
        {
            admin.Password = Encryption.Encrypt(admin.Password, "asdfewrewqrss323");
            UsersBLL userbll = new UsersBLL();

            var userInfo = userbll.RegisterUser(admin);

            if (userInfo == null)
            {
                return(BadRequest(new { message = "Email Already Exist.." }));
            }
            else
            {
                return(Ok(new { message = "User added successfully." }));
            }
        }
        //初始化加载
        private void Init_Load()
        {
            List <UsersType> type = new IdCard_BLL().p_usesType_select();

            foreach (var item in type)
            {
                comboBox1.Items.Add(item.Type);
            }
            comboBox1.Items.Add("医师");
            List <SectionRoom> se = new UsersBLL().Section();

            foreach (var item in se)
            {
                comboBox2.Items.Add(item.Sname);
            }
        }
Пример #31
0
        //登录验证接口
        public string login(string username, string password)
        {
            string _password = Utils.MD5Encrypt32(password);

            UsersBLL bll  = new UsersBLL();
            UserInfo item = bll.UserLogin(username, _password);

            if (item != null)
            {
                return(_password);
            }
            else
            {
                return(null);
            }
        }
Пример #32
0
        public void DeleteUser(HttpContext context)
        {
            string result = string.Empty;

            try
            {
                var usersIds = DNTRequest.GetString("UsersID");
                if (string.IsNullOrEmpty(usersIds))
                {
                    result = DNTRequest.GetResultJson(false, "请先选择一条数据", null);
                    return;
                }
                else
                {
                    MachineBLL opMachineBLL = new MachineBLL();
                    Machine    modelMachine = new Machine();
                    modelMachine = opMachineBLL.GetModelByUserId(Convert.ToInt32(usersIds));
                    if (modelMachine != null)
                    {
                        result = DNTRequest.GetResultJson(false, "用户已绑定设备,不允许删除", null);
                    }
                    else
                    {
                        UsersBLL bll = new UsersBLL();
                        bool     res = bll.Delete(Convert.ToInt32(usersIds));
                        if (res)
                        {
                            result = DNTRequest.GetResultJson(true, "删除用户成功", null);

                            #region 通知风控系统

                            #endregion
                        }
                        else
                        {
                            result = DNTRequest.GetResultJson(false, "删除用户失败,请稍后再试", null);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, "删除用户异常,请稍后再试", null);
                ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
            }
            context.Response.Write(result);
        }
Пример #33
0
        public void LoadUser()
        {
            try
            {
                employeeBLL = new EmployeeBLL();
                employeeML  = employeeBLL.GetEmploymentByIdUser(BussinesLayer.GlobalBLL.userML.Id);

                if (employeeML != null)
                {
                    KeyTextBox.Text      = employeeML.Id.ToString();
                    NameTextBox.Text     = employeeML.Name;
                    LastNameTextBox.Text = employeeML.LastName;
                }

                if (GlobalBLL.userML != null)
                {
                    UsersBLL usersBLL = new UsersBLL();
                    UsersML  usersML  = usersBLL.GetEntityById(GlobalBLL.userML.Id);

                    UserNameTextBox.Text = usersML.UserName;
                    PasswordTextBox.Text = usersML.Password;

                    if (!string.IsNullOrEmpty(GlobalBLL.userML.Image))
                    {
                        PathFileProfileTextBox.Text = string.Format("{0}\\{1}", System.IO.Path.GetFullPath(GlobalBLL.DirectoryFiles), GlobalBLL.userML.Image);

                        if (System.IO.File.Exists(PathFileProfileTextBox.Text))
                        {
                            ProfilePictureBox.BackgroundImage = new Bitmap(PathFileProfileTextBox.Text);
                        }
                        else
                        {
                            throw new Exception("No se encontró la imagen");
                        }
                    }
                }
                //else
                //{
                //    Alerts.cFAT100010 alr = new Alerts.cFAT100010("ERROR", "No se encontró la información del usuarios", MessageBoxIcon.Error);
                //    alr.ShowDialog();
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("LoadUser: {0}", ex.Message));
            }
        }
Пример #34
0
        public ActionResult UserLogin(UserLogin login)
        {
            if (ModelState.IsValid)
            {
                UsersBLL usersBLL     = new UsersBLL();
                Users    usersDetails = usersBLL.UsersList().Where(s => s.Email == login.Email && s.Password == login.Password).FirstOrDefault();
                Session["UserName"]   = usersDetails.Firstname + " " + usersDetails.Lastname;
                Session["UserRole"]   = usersDetails.RuleId;
                Session["UserActive"] = usersDetails.IsActive;
                if (usersDetails != null)
                {
                    return(Redirect("Users/Users/UserRegistration"));
                }
            }

            return(View("UserLogin"));
        }
        public ActionResult IndexOfMyStuff()
        {
            try
            {
                using (ContextBLL ctx = new ContextBLL())
                {
                    UsersBLL U = ctx.FindUserByEmail(User.Identity.Name);//need to replace User.Identity.Name with search bar logic
                }

                return(View("Details"));//change to Details later
            }
            catch (Exception Ex)
            {
                ViewBag.Exception = Ex;
                return(View("Error"));
            }
        }
Пример #36
0
 public ActionResult Create(Users u)
 {
     try
     {
         UsersBLL bll = new UsersBLL();
         Users user = Session["user"] as Users;
         u.S_ID = user.S_ID;
         u.U_Password = u.U_Password ?? "1";
         u.U_CanDelete = Request["U_CanDelete"] == "on" ? true : false;
         bll.Add(u);
         bll.SaveChanges();
         return Json(new { result = "ok" });
     }
     catch
     {
         return Json(new { result = "error" });
     }
 }
Пример #37
0
    protected void AllTasksLB_Click(object sender, EventArgs e)
    {
        Decimal TotalTime = 0;
        int userID = (int)Session["userID"];

        if (DirectReportsDropDown.SelectedValue == "AllUsers")
        {
            UsersBLL users = new UsersBLL();
            TimeKeeper.UsersDataTable usersDT = users.GetUsersByDirectReportsOf(userID);

            TasksBLL tasks = new TasksBLL();
            TimeKeeper.TasksDataTable directReportTasks = tasks.GetTasksByUserID(0);

            foreach (DataRow user in usersDT.Rows)
            {
                int directReportUserID = Convert.ToInt32(user["userID"]);

                TimeKeeper.TasksDataTable task = tasks.GetTasksByUserID(directReportUserID);
                directReportTasks.Merge(task);

                TotalTime += tasks.TotalTimeByUserIDByDateRange(directReportUserID, DateTime.Today.AddDays(-1000), DateTime.Today);
            }

            ByUserGridView.DataSource = directReportTasks;
            ByUserGridView.DataBind();

            Output.Text = "Your employees have worked " + TotalTime + " hrs since using TimeKeeper.";
        }
        else
        {
            TasksBLL tasks = new TasksBLL();
            TimeKeeper.TasksDataTable directReportTasks = tasks.GetTasksByUserID(Convert.ToInt32(DirectReportsDropDown.SelectedValue));

            TotalTime = tasks.TotalTimeByUserIDByDateRange(Convert.ToInt32(DirectReportsDropDown.SelectedValue), DateTime.Today.AddDays(-1000), DateTime.Today);

            ByUserGridView.DataSource = directReportTasks;
            ByUserGridView.DataBind();

            Output.Text = "The employee has worked " + TotalTime + " hrs since using TimeKeeper.";
        }
    }
Пример #38
0
    protected void ReportCalendar_DayRender(object sender, DayRenderEventArgs e)
    {
        TasksBLL tasks = new TasksBLL();
        TimeKeeper.TasksDataTable directReportTasks = tasks.GetTasksByUserID(0);

        if (DirectReportsDropDown.SelectedValue == "AllUsers")
        {
            int userID = (int)Session["userID"];
            UsersBLL users = new UsersBLL();
            TimeKeeper.UsersDataTable usersDT = users.GetUsersByDirectReportsOf(userID);

            foreach (DataRow user in usersDT.Rows)
            {
                int directReportUserID = Convert.ToInt32(user["userID"]);
                TimeKeeper.TasksDataTable task = tasks.GetTasksByUserIDByDateRange(directReportUserID, e.Day.Date, e.Day.Date);
                directReportTasks.Merge(task);
            }
        }
        else
        {
            directReportTasks = tasks.GetTasksByUserIDByDateRange(Convert.ToInt32(DirectReportsDropDown.SelectedValue), e.Day.Date, e.Day.Date);
        }

        // If the month is CurrentMonth
        if (!e.Day.IsOtherMonth)
        {
            foreach (DataRow dr in directReportTasks)
            {

                if ((dr["Date"].ToString() != DBNull.Value.ToString()))
                {
                    DateTime dtEvent = (DateTime)dr["Date"];

                    if (dtEvent.Equals(e.Day.Date))
                    {
                        System.Web.UI.WebControls.Image image;
                        image = new System.Web.UI.WebControls.Image();
                        image.ImageUrl = "images/green_diamond.gif";
                        e.Cell.Controls.Add(image);
                    }
                }
                //just want the first row...THIS IS VERY UGLY!
                return;
            }
        }
        //If the month is not CurrentMonth then hide the Dates
        else
        {
            e.Cell.Text = "";
        }
    }
Пример #39
0
    protected void DisplayTaskByDate(DateTime start, DateTime end)
    {
        Decimal TotalTime = 0;

        if (DirectReportsDropDown.SelectedValue == "AllUsers")
        {
            int userID = (int)Session["userID"];
            UsersBLL users = new UsersBLL();
            TimeKeeper.UsersDataTable usersDT = users.GetUsersByDirectReportsOf(userID);

            TasksBLL tasks = new TasksBLL();
            TimeKeeper.TasksDataTable directReportTasks = tasks.GetTasksByUserIDByDateRange(0, start, end);

            foreach (DataRow user in usersDT.Rows)
            {
                int directReportUserID = Convert.ToInt32(user["userID"]);
                TimeKeeper.TasksDataTable task = tasks.GetTasksByUserIDByDateRange(directReportUserID, start, end);
                directReportTasks.Merge(task);

                TotalTime += tasks.TotalTimeByUserIDByDateRange(directReportUserID, start, end);
            }

            ByUserGridView.DataSource = directReportTasks;
            ByUserGridView.DataBind();

            Output.Text = "Your employees have worked ";
        }
        else
        {
            TasksBLL tasks = new TasksBLL();
            TimeKeeper.TasksDataTable directReportTasks = tasks.GetTasksByUserIDByDateRange(Convert.ToInt32(DirectReportsDropDown.SelectedValue), start, end);

            TotalTime = tasks.TotalTimeByUserIDByDateRange(Convert.ToInt32(DirectReportsDropDown.SelectedValue), start, end);

            ByUserGridView.DataSource = directReportTasks;
            ByUserGridView.DataBind();

            Output.Text = "The employee has worked ";
        }

        if (start == end)
            Output.Text += TotalTime + " hrs on " + start.ToShortDateString();
        else
            Output.Text += TotalTime + " hrs between " + start.ToShortDateString() + " and " + end.ToShortDateString();
    }
Пример #40
0
        public ActionResult Delete(int id)
        {
            try
            {
                ShopsBLL spBll = new ShopsBLL(); UsersBLL uBll = new UsersBLL();

                Shops shop = spBll.Find(id);
                Users user = uBll.SelectWhere(m => m.S_ID == shop.S_ID && m.U_Role == 2).FirstOrDefault();
                using (TransactionScope ts = new TransactionScope())
                {
                    // 软删除当前店铺的管理员
                    if (user != null)
                    {
                        user.U_Role = 4;
                        uBll.SaveChanges();
                    }
                    shop.S_Category = 4;
                    spBll.SaveChanges();
                    ts.Complete();
                }
                return Json(new { result = "ok" });
            }
            catch
            {
                return Json(new { result = "error" });
            }
        }
Пример #41
0
        /// <summary>
        /// 查询
        /// </summary>
        public ActionResult UserInfo()
        {
            int pageIndex = 0, pageSize = 0;
            if (!string.IsNullOrEmpty(Request.Form["rows"]))
            {
                pageSize = Convert.ToInt32(Request.Form["rows"]);
            }
            if (!string.IsNullOrEmpty(Request.Form["page"]))
            {
                pageIndex = Convert.ToInt32(Request.Form["page"]);
            }

            string loginName = Request.Form["U_LoginName"];
            string realName = Request.Form["U_RealName"];
            string phone = Request.Form["U_Telephone"];

            Users u = Session["user"] as Users;
            int totalRow; var pagelist = new UsersBLL().GetUsers(pageIndex, pageSize, (int)u.S_ID, loginName, realName, phone, out totalRow);
            return Json(new { total = totalRow, rows = pagelist }, JsonRequestBehavior.AllowGet);
        }
Пример #42
0
 public ActionResult Edit(Users u)
 {
     try
     {
         UsersBLL bll = new UsersBLL();
         u.U_Password = u.U_Password ?? "1";
         u.U_CanDelete = Request["U_CanDelete"] == "on" ? true : false;
         bll.Edit(u, "U_Password", "U_RealName", "U_Sex", "U_Telephone", "U_Role", "U_CanDelete");
         bll.SaveChanges();
         return Json(new { result = "ok" });
     }
     catch
     {
         return Json(new { result = "error" });
     }
 }