コード例 #1
0
ファイル: DlgUserInfo.cs プロジェクト: zfc317/mscd
        private void btn_Ok_Click(object sender, EventArgs e)
        {
            if(_viewType=="Add")
            {
                if(dxValidationProvider1.Validate())
                {
                    var userBll = new BLL.User();
                    _user=new User
                              {
                                  Department = txt_Department.Text.Trim(),
                                  Name = txt_Name.Text.Trim(),
                                  Password = Common.DEncrypt.DESEncrypt.Encrypt(txt_Password.Text.Trim()),
                                  Phone = txt_Phone.Text.Trim(),
                                  Remark = txt_Remark.Text,
                                  Tel = txt_Remark.Text.Trim(),
                                  Type = commbox_UserRole.SelectedIndex,
                                  Username = txt_Username.Text.Trim()
                              };
                    var userId = userBll.Add(_user);
                    if(userId>0)
                    {
                        _user.Id = userId;
                        XtraMessageBox.Show("添加成功!", "提示");
                        DialogResult = DialogResult.OK;
                    }
                    }
                    else
                    {
                        XtraMessageBox.Show("添加失败!", "提示");
                    }

            }
            else if(_viewType=="Edit")
            {
                if (dxValidationProvider1.Validate())
                {
                    var userBll = new BLL.User();
                    _user.Department = txt_Department.Text.Trim();
                    if(txt_Password.Text.Trim()!="")
                    {
                        _user.Password = Common.DEncrypt.DESEncrypt.Encrypt(txt_Password.Text.Trim());
                    }
                    _user.Phone = txt_Phone.Text.Trim();
                    _user.Remark = txt_Remark.Text;
                    _user.Tel = txt_Remark.Text.Trim();
                    _user.Type = commbox_UserRole.SelectedIndex;
                    _user.Username = txt_Username.Text.Trim();
                    if(userBll.Update(_user))
                    {
                        XtraMessageBox.Show("编辑成功!", "提示");
                        DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        XtraMessageBox.Show("编辑失败!", "提示");
                    }

                }
            }
        }
コード例 #2
0
ファイル: step1Page.aspx.cs プロジェクト: scutsky/iyuewan
 protected void submitbtn_Click(object sender, EventArgs e)
 {
     try
     {
         Spread.Model.User model = new Model.User();
         Spread.BLL.User bll = new BLL.User();
         if (bll.chkExists(this.username.Value))
         {
             string verifycookie = Request.Cookies["VerifyCode"] == null ? "" : Request.Cookies["VerifyCode"].Value.Trim();
             if (verifycode.Value.Replace(" ", "") != verifycookie.Replace(" ", ""))
             {
                 string myScript = @"alertMsg('验证码错误!','error.gif');";
                 Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
                 return;
             }
             else
             {
                 Session["changeName"] = this.username.Value;
                 Response.Redirect("step2Page.aspx");
             }
         }
         else
         {
             string myScript = @"alertMsg('用户名错误!','error.gif');";
             Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
             return;
         }
     }
     catch (Exception ex)
     {
         string myScript = @"alertMsg('登陆失败,'" + ex.ToString() + "','error.gif');";
         Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
     }
 }
コード例 #3
0
 public ActionResult Login(string email, string password)
 {
     BLL.User bll = new BLL.User();
     Models.User model = bll.GetModel(email, password);
     if (model == null)
     {
         return Redirect("/Account/Login?message=邮箱或密码不正确");
     }
     switch (model.RoleID)
     {
         case 0:
             Session.Add("user", model);
             Session.Add("userId", model.UserID);
             Session.Add("userNickName", model.NickName);
             Session.Add("roleId", model.RoleID);
             Session.Add("email", model.Email);
             return Redirect("/Admin/Index");
         case 1:
             return Redirect("/Account/Login?message=还木有编辑功能");
         case 2:
             return Redirect("/Account/Login?message=还木有用户功能");
         default:
             return Redirect("/Account/Login?message=未知");
     }
 }
コード例 #4
0
ファイル: Login.cs プロジェクト: biousco/DataBaseLearn
 private void btnLogin_Click(object sender, EventArgs e)
 {
     string userName = txtUserName.Text.Trim();
     string password = txtPassword.Text.Trim();
     if (userName == "" || password == "")
     {
         MessageBox.Show("用户名或密码不能为空!");
         txtUserName.Focus();
         return;
     }
     else
     {
         BLL.User user = new BLL.User();
         if (user.Login(userName, password))
         {
             UserHelper.userName = txtUserName.Text.Trim();
             UserHelper.password = txtPassword.Text.Trim();
             this.Hide();
             FormMain f = new FormMain();
             f.ShowDialog();
         }
         else
         {
             MessageBox.Show("用户名或密码错误,请重新输入!", "错误");
             txtUserName.Text = "";
             txtPassword.Text = "";
             txtUserName.Focus();
         }
       }
 }
コード例 #5
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     if (txtOldPwd.Text.Trim() != UserHelper.password)
     {
         MessageBox.Show("原始密码错误!");
         txtOldPwd.Focus();
         return;
     }
     if (txtNewPwd .Text.Trim() == "")
     {
         MessageBox.Show("新密码不能为空,请输入!");
         txtNewPwd.Focus();
         return;
     }
     if (txtNewPwdAgain.Text.Trim() != txtNewPwd.Text.Trim())
     {
         MessageBox.Show("两次输入密码不一致,请重新输入!");
         txtNewPwdAgain.Focus();
         return;
     }
     Model.User model = new Model.User();
     model.UserName = UserHelper.userName;
     model.Password = txtNewPwd.Text.Trim();
     BLL.User user = new BLL.User();
     if (user.Update(model))
     {
         UserHelper.password = model.Password;
         MessageBox.Show("密码更新成功!");
     }
     else
     {
         MessageBox.Show("密码更改失败!");
     }
 }
コード例 #6
0
ファイル: UserViewModel.cs プロジェクト: AuthorProxy/QP
        public static UserViewModel Create(BLL.User user, string tabId, int parentId, IUserService service)
        {
            var model = Create <UserViewModel>(user, tabId, parentId);

            model.Service = service;
            model.Init();
            return(model);
        }
コード例 #7
0
        public async Task <IActionResult> Deactivate([FromBody] int[] ids)
        {
            var buser = new BLL.User(unitOfWork);

            await buser.Deactivate(ids);

            return(Json("Success!"));
        }
コード例 #8
0
 private void btn_Ok_Click(object sender, EventArgs e)
 {
     if (_viewType == "Add")
     {
         if (dxValidationProvider1.Validate())
         {
             var userBll = new BLL.User();
             _user = new User
             {
                 Department = txt_Department.Text.Trim(),
                 Name       = txt_Name.Text.Trim(),
                 Password   = Common.DEncrypt.DESEncrypt.Encrypt(txt_Password.Text.Trim()),
                 Phone      = txt_Phone.Text.Trim(),
                 Remark     = txt_Remark.Text,
                 Tel        = txt_Remark.Text.Trim(),
                 Type       = commbox_UserRole.SelectedIndex,
                 Username   = txt_Username.Text.Trim()
             };
             var userId = userBll.Add(_user);
             if (userId > 0)
             {
                 _user.Id = userId;
                 XtraMessageBox.Show("添加成功!", "提示");
                 DialogResult = DialogResult.OK;
             }
         }
         else
         {
             XtraMessageBox.Show("添加失败!", "提示");
         }
     }
     else if (_viewType == "Edit")
     {
         if (dxValidationProvider1.Validate())
         {
             var userBll = new BLL.User();
             _user.Department = txt_Department.Text.Trim();
             if (txt_Password.Text.Trim() != "")
             {
                 _user.Password = Common.DEncrypt.DESEncrypt.Encrypt(txt_Password.Text.Trim());
             }
             _user.Phone    = txt_Phone.Text.Trim();
             _user.Remark   = txt_Remark.Text;
             _user.Tel      = txt_Remark.Text.Trim();
             _user.Type     = commbox_UserRole.SelectedIndex;
             _user.Username = txt_Username.Text.Trim();
             if (userBll.Update(_user))
             {
                 XtraMessageBox.Show("编辑成功!", "提示");
                 DialogResult = DialogResult.OK;
             }
             else
             {
                 XtraMessageBox.Show("编辑失败!", "提示");
             }
         }
     }
 }
コード例 #9
0
        /// <summary>
        /// 获取所有用户列表
        /// </summary>
        /// <returns></returns>
        public static DataSet GetUserList()
        {
            DataSet ds = new DataSet();
            Dictionary <string, string> dict = new Dictionary <string, string>();

            Hi.BLL.User bll = new BLL.User();
            ds = bll.List(dict, 1, 100, "");
            return(ds);
        }
コード例 #10
0
ファイル: UserController.cs プロジェクト: ZjyZjy1314520/book
        public JsonResult getlistByPage(int pageSize, int pageNumber, int role, string sortName, string sortOrder, int Id = -1, string search = "", string loginName = "", string nickName = "")
        {
            BLL.User          bllUser = new BLL.User();
            List <Model.User> lst     = bllUser.GetlistByPage(Id, pageSize, pageNumber, role, search, sortName, sortOrder, loginName, nickName);
            int totalcount            = bllUser.GetCount();
            var result = new { rows = lst, total = totalcount };

            return(Json(result));
        }
コード例 #11
0
        public static void SaveList(List <User> list)
        {
            BLL.User bv = new BLL.User();
            foreach (User v in list)
            {
                // try to load by primary key
                bv.LoadByPrimaryKey(v.ID.Value);

                // if the entry doesn't exist, create it
                if (bv.RowCount == 0)
                {
                    bv.AddNew();
                }
                // populate the contents of v on the to the database list
                if (v.ID.HasValue)
                {
                    bv.ID = v.ID.Value;
                }
                if (v.FullName != "" && v.FullName != null)
                {
                    bv.FullName = v.FullName;
                }
                if (v.Address != "" && v.Address != null)
                {
                    bv.Address = v.Address;
                }
                if (v.Mobile != "" && v.Mobile != null)
                {
                    bv.Mobile = v.Mobile;
                }
                if (v.UserName != "" && v.UserName != null)
                {
                    bv.UserName = v.UserName;
                }
                if (v.Password != "" && v.Password != null)
                {
                    bv.Password = v.Password;
                }
                if (v.UserType.HasValue)
                {
                    bv.UserType = v.UserType.Value;
                }
                if (v.Active.HasValue)
                {
                    bv.Active = v.Active.Value;
                }
                //if( v.IsDeleted.HasValue )
                //     bv.IsDeleted = v.IsDeleted.Value;
                //if( v.UpdateTime.HasValue )
                //     bv.UpdateTime = v.UpdateTime.Value;

                bv.Save();
            }
        }
コード例 #12
0
        protected void btnSubmitPlan_Click(object sender, EventArgs e)
        {
            currentUser = (BLL.User)Session["currentUser"];

            //add to Itinerary table
            newItinerary.userId        = currentUser.Id;
            newItinerary.itineraryName = tbName.Text;
            newItinerary.startDate     = Convert.ToDateTime(tbStartDate.Text);
            newItinerary.endDate       = Convert.ToDateTime(tbEndDate.Text);
            newItinerary.groupSize     = tbNoPeople.Text;

            //Calculate Middle Dates
            DateTime startDate = Convert.ToDateTime(newItinerary.startDate);

            startDate.ToString("dd MMM");
            DateTime      endDate      = Convert.ToDateTime(newItinerary.endDate);
            DateTime      current      = startDate;
            List <string> betweenDates = new List <string>();

            while (current <= endDate)
            {
                var currentDateStr = current.ToString("dd MMM");        //convert 12/1/2020 to 12 Jan
                betweenDates.Add(currentDateStr);
                current = current.AddDays(1);                           //add to current as 12/1/2020
            }

            newItinerary.AddItinerary();
            Response.Write("<script> alert('Plan Created!');</script>");

            //daybydays table
            int datesSize = betweenDates.Count;

            for (int i = 0; i < betweenDates.Count; i++)
            {
                newDayByDay.itineraryId = newItinerary.itineraryId;
                newDayByDay.date        = betweenDates[i];
                newDayByDay.AddDayByDay();
            }

            daybydaysList = betweenDates;

            Session["startDate"] = tbStartDate.Text;
            Session["endDate"]   = tbEndDate.Text;
            createdItineraryId   = newItinerary.itineraryId;

            //check pref
            PrefSelect(newItinerary.itineraryId);
            //days table and planner generate - with pref/no pref
            GeneratePlanner(newItinerary);

            string url = "Timeline.aspx?Id=" + newItinerary.itineraryId;

            Response.Redirect(url);
        }
コード例 #13
0
        private void getExistingPlan()
        {
            Itinerary        retrieveItinerary = new Itinerary();
            List <Itinerary> itineraryList     = new List <Itinerary>();

            currentUser   = (BLL.User)Session["currentUser"];
            itineraryList = retrieveItinerary.RetrieveItinerary(currentUser);

            rpItinerary.DataSource = itineraryList;
            rpItinerary.DataBind();
        }
コード例 #14
0
ファイル: CardEdit.aspx.cs プロジェクト: scutsky/iyuewan
        //绑定数据
        private void ShowInfo()
        {

            Model.User userMod = new Model.User();
            BLL.User userBll = new BLL.User();
            Model.Game gMod = new Model.Game();
            BLL.Game gBll = new BLL.Game();
            //gMod = gBll.GetModel(Convert.ToInt32(modelExtend.gameID));
            this.lbChanelName.Text = modelExtend.ChanelName;
            this.lbgamename.Text = modelExtend.gameName;

        }
コード例 #15
0
        private void getEventCreatedData()
        {
            currentUser = (BLL.User)Session["currentUser"];
            Event        retrieveEventData    = new Event();
            List <Event> createdEventDataList = new List <Event>();

            createdEventDataList = retrieveEventData.GetAllEventCreatedByUser(currentUser.Id);

            System.Diagnostics.Debug.WriteLine("gh say: " + currentUser.Id);
            rpViewEventPageCreated.DataSource = createdEventDataList;
            rpViewEventPageCreated.DataBind();
        }
コード例 #16
0
        private void getAllSignUpDetails(int eventId)
        {
            SignUpEventDetail        retrieveSignUpDetail   = new SignUpEventDetail();
            List <SignUpEventDetail> signUpEventDetailsList = new List <SignUpEventDetail>();

            currentUser            = (BLL.User)Session["currentUser"];
            signUpEventDetailsList = retrieveSignUpDetail.GetSignUpEventDetails(eventId);
            // signUpEventDetailList have no data
            System.Diagnostics.Debug.WriteLine("gh say: " + signUpEventDetailsList.Count());

            foreach (SignUpEventDetail signUpEventDetailsListBB in signUpEventDetailsList)
            {
                string numberOfBookingSlot;
                System.Diagnostics.Debug.WriteLine("gh say: " + signUpEventDetailsListBB.numberOfBookingSlot);
                if (signUpEventDetailsListBB.numberOfBookingSlot != null)
                {
                    numberOfBookingSlot = signUpEventDetailsListBB.numberOfBookingSlot.ToString();
                }
                else
                {
                    numberOfBookingSlot = "";
                }

                if (numberOfBookingSlot == "")
                {
                    numberOfBookingSlot = "No Limit";
                }
                else
                {
                    TotalBookedSlot += Int32.Parse(numberOfBookingSlot);
                }

                System.Diagnostics.Debug.WriteLine("dinesh say: " + TotalBookedSlot);

                if (signUpEventDetailsListBB.userId == currentUser.Id)
                {
                    toEditPage = "True";
                }
                else
                {
                    toEditPage = "False";
                }
            }
            if (singleEventDetails.eventMaxSlot == "No Limit")
            {
                avaliableSlotsText = "No Limit";
            }
            else
            {
                totalAvaliableSlots = Int32.Parse(singleEventDetails.eventMaxSlot) - TotalBookedSlot;
            }
        }
コード例 #17
0
        public static List <int> GetDeletedIDsAfter(long LastVersion)
        {
            BLL.User v = new BLL.User();
            //v.LoadDeletedIDs(LastVersion);
            List <int> list = new List <int>();

            while (!v.EOF)
            {
                list.Add((int)v.GetColumn("ID"));
                v.MoveNext();
            }
            return(list);
        }
コード例 #18
0
 public JsonResult Delete(int id)
 {
     BLL.User bll = new BLL.User();
     try
     {
         bll.Delete(id);
         return Json(200, "删除成功", null);
     }
     catch (Exception e)
     {
         return Json(500, e.Message, null);
     }
 }
コード例 #19
0
        protected void submitButt_Click(object sender, EventArgs e)
        {
            var newProfile = new BLL.User();

            newProfile.Id           = currentUser.Id;
            newProfile.Username     = nameTB.Text;
            newProfile.Bio          = bioTB.Text;
            newProfile.ProfileImage = GeneralHelpers.UploadFile(imageUpload);

            UserDAO.EditUser(newProfile);

            Response.Redirect("/Home/Post.aspx");
        }
コード例 #20
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            Model.User model = new Model.User();
            model.UserID    = "不可更改!";
            model.UserAddr  = UserAddr.Text;
            model.UserAge   = UserAge.Text;
            model.UserGrade = "不可更改!";
            model.UserName  = "******";
            model.UserPwd   = UserPwd.Text;
            model.UserSex   = UserSex.Text;
            model.UserSpec  = UserSpec.Text;

            BLL.User bll = new BLL.User();
        }
コード例 #21
0
 /// <summary>
 /// 用户添加Cookie免登陆信息
 /// </summary>
 /// <returns></returns>
 public bool UserAddCookie(Entities.Users entityUser)
 {
     if (entityUser != null && UserAddSession(entityUser))
     {
         BLL.User bllUser = new BLL.User();
         Common.Helper.CookieHelper.SetCookie(Common.CacheKey.CookieUserName, entityUser.UserName, new TimeSpan(Common.CacheKey.CookieTimeSpan, 0, 0, 0));
         Common.Helper.CookieHelper.SetCookie(Common.CacheKey.CookieUserEncrypt, bllUser.UserCookieEncrypt(entityUser.UserName, entityUser.Password, this.IP), new TimeSpan(7, 0, 0, 0));
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #22
0
        private void button1_Click(object sender, EventArgs e)
        {
            BLL.User user = new BLL.User();
            string   msg  = "";

            if (user.ChangePassword(username.Text, oldp.Text, newp.Text, out msg))
            {
                MessageBox.Show("修改成功");
            }
            else
            {
                MessageBox.Show(msg);
            }
        }
コード例 #23
0
ファイル: HandlerLogin.ashx.cs プロジェクト: benxuu/SYPM
        private string CheckLogin(string uname, string upwd)
        {
            BLL.User  bll = new BLL.User();
            DataTable dt  = bll.GetList("UserName='******' and UserPwd='" + upwd + "'").Tables[0];

            if (dt.Rows.Count > 0)
            {
                return("0");//登录成功
            }
            else
            {
                return("1");
            }
        }
コード例 #24
0
        public static List <User> ToList(BLL.User v)
        {
            List <User> list = new List <User>();

            while (!v.EOF)
            {
                User t = new User();
                if (!v.IsColumnNull("ID"))
                {
                    t.ID = v.ID;
                }
                if (!v.IsColumnNull("FullName"))
                {
                    t.FullName = v.FullName;
                }
                if (!v.IsColumnNull("Address"))
                {
                    t.Address = v.Address;
                }
                if (!v.IsColumnNull("Mobile"))
                {
                    t.Mobile = v.Mobile;
                }
                if (!v.IsColumnNull("UserName"))
                {
                    t.UserName = v.UserName;
                }
                if (!v.IsColumnNull("Password"))
                {
                    t.Password = v.Password;
                }
                if (!v.IsColumnNull("UserType"))
                {
                    t.UserType = v.UserType;
                }
                if (!v.IsColumnNull("Active"))
                {
                    t.Active = v.Active;
                }
                //if(!v.IsColumnNull("IsDeleted"))
                //      t.IsDeleted = v.IsDeleted;
                //if(!v.IsColumnNull("UpdateTime"))
                //      t.UpdateTime = v.UpdateTime;

                list.Add(t);
                v.MoveNext();
            }
            return(list);
        }
コード例 #25
0
        private static BLL.Blog publish(string title, string body, BLL.User author)
        {
            BlogRepository repository = new BlogRepository(Helper.context);

            BLL.Blog blog = new BLL.Blog
            {
                Title  = title,
                Body   = body,
                Author = author
            };

            repository.Save(blog);
            //blog.Publish();
            return(blog);
        }
コード例 #26
0
ファイル: AdminList.aspx.cs プロジェクト: ichoukou/yhq
        protected void qiyongByID(string id)
        {
            bool result = new BLL.User().qiyong(id);

            Response.Clear();
            if (result)
            {
                Response.Write(UtilsCommons.AjaxReturnJson(result.ToString(), "启用成功"));
            }
            if (!result)
            {
                Response.Write(UtilsCommons.AjaxReturnJson(result.ToString(), "启用失败"));
            }

            Response.End();
        }
コード例 #27
0
 public static void DeleteList(List <int> list)
 {
     BLL.User bv = new BLL.User();
     foreach (int v in list)
     {
         // try to load by primary key
         bv.LoadByPrimaryKey(v);
         // if the entry doesn't exist, create it
         if (bv.RowCount > 0)
         {
             bv.MarkAsDeleted();
             bv.Save();
         }
         // populate the contents of v on the to the database list
     }
 }
コード例 #28
0
        public ActionResult AddEditer(Models.User model)
        {
            BLL.User bll = new BLL.User();
            model.RoleID = 1;
            model.RegisterDate = DateTime.Now;
            model.UserStatus = (int?)Models.UserStatus.NORMAL;
            try
            {
                bll.Add(model);
                return Redirect("/Admin/AddEditer");
            }
            catch (Exception e)
            {

            }
        }
コード例 #29
0
ファイル: Edit.aspx.cs プロジェクト: scutsky/iyuewan
        //绑定数据
        private void ShowInfo()
        {

            Model.User userMod = new Model.User();
            BLL.User userBll = new BLL.User();
            Model.Products proMod = new Model.Products();
            BLL.Products proBll = new BLL.Products();
            userMod = userBll.GetModel(Convert.ToInt32(model.UserID));
            proMod = proBll.GetModel(Convert.ToInt32(model.ParentId));
            this.lbChanel.Text = model.Title;
            this.lbProducts.Text = proMod.Title;
            this.lbBak1.Text = model.Bak1;
            this.lbUser.Text = userMod.Name;
            this.ddlStatus.SelectedValue = model.Status.ToString();
            
        }
コード例 #30
0
        internal static void Create()
        {
            //using (SQLContext context = new SQLContext())
            //{
            //    for (int i = 0; i < 30; i++)
            //    {
            //        BLL.Blog b = new BLL.Blog
            //        {
            //            Title = "我是Blog" + i,
            //            Author = context._users.First()
            //        };
            //        context.Blogs.Add(b);
            //    }
            //    context.SaveChanges();

            //    context.Blogs.Remove(context.Blogs.First<BLL.Blog>());
            //    context.SaveChanges();

            //    BLL.Blog blog = context.Blogs.LastOrDefault();
            //    blog.Title = "saber的Blog";
            //    context.SaveChanges();
            //}

            //string path = Environment.CurrentDirectory;

            string folderPath = "..\\..\\..\\Blogs\\contents";

            string[] filenames = Directory.GetFiles(folderPath);

            blogs = new List <BLL.Blog>();

            for (int i = 0; i < filenames.Length; i++)
            {
                string   path   = filenames[i];
                string   body   = File.ReadAllText(path, Encoding.UTF8);
                BLL.User author = null;
                if (i % 4 == 0)
                {
                    author = RegisterFactory.Saber;
                }
                else
                {
                    author = RegisterFactory.Lancer;
                }
                blogs.Add(publish(Path.GetFileName(path), body, author));
            }
        }
コード例 #31
0
 public static List <User> GetUpdatesAfter(long?lastVersion, DateTime?lastUpdateTime)
 {
     BLL.User v = new BLL.User();
     if (lastVersion.HasValue && lastVersion.Value != 0)
     {
         v.LoadUpdatesAfter(Convert.ToInt32(lastVersion.Value));
     }
     else if (lastUpdateTime.HasValue)
     {
         // v.LoadUpdatesAfterByTime(lastUpdateTime.Value);
     }
     else
     {
         v.LoadAll();
     }
     return(ToList(v));
 }
コード例 #32
0
        private void ULogin()
        {
            Objects.User obj = new Objects.User();
            obj.Email    = txtEmail.Text.ToString();
            obj.Password = txtPassword.Password.ToString();
            int vcheck = new BLL.User().ULogin(obj);

            if (vcheck > 0)
            {
                ControlPanel Cp = new ControlPanel();
                Cp.Show();
                Close();
            }
            else
            {
                MessageBox.Show("Please enter valid email or password");
            }
        }
コード例 #33
0
        // get the data from event schedule
        //private void getSelectedEventToParticipate()
        //{
        //    currentUser = (BLL.User)Session["currentUser"];
        //    EventSchedule retrieveEventSchedule = new EventSchedule();
        //    List<EventSchedule> eventScheduleList = new List<EventSchedule>();

        //    eventScheduleList = retrieveEventSchedule.GetAllEventRegisteredByUser(currentUser.Id);
        //    // end time will updateds be updated
        //    foreach (EventSchedule x in eventScheduleList)
        //    {

        //        // if user selected the event scheudle event then view all the event selected
        //        // else say Participate All
        //        // if user registered include in the registeredList then we add start time and end time differencely
        //        // else just get the start and end time of the event -> so we need do validation in the html to do that
        //        if (userRegisteredEventId.Contains(x.eventId.ToString())){


        //            startTimeList.Add(x.startTime);
        //            EndTimeList.Add(x.endTime);
        //            SelectedEventToPaticipiate.Add(x.eventDescription);
        //        }
        //        else
        //        {
        //            selectedEventToParticipate = "Participate All";
        //            // start time and end time
        //        }
        //    }
        //    System.Diagnostics.Debug.WriteLine("gh say: " + currentUser.Id);

        //}

        private void getEventRegisteredData()
        {
            currentUser = (BLL.User)Session["currentUser"];
            SignUpEventDetail        retrieveSignUpEventDetails = new SignUpEventDetail();
            List <SignUpEventDetail> userSignUpEventDetail      = new List <SignUpEventDetail>();
            List <String>            registeredEventId          = new List <String>();

            userSignUpEventDetail = retrieveSignUpEventDetails.getUserSignUpEventDetails(currentUser.Id);

            foreach (SignUpEventDetail x in userSignUpEventDetail)
            {
                registeredEventId.Add(x.eventId.ToString());
            }
            userRegisteredEventId = registeredEventId;

            rpViewEventPageRegistered.DataSource = userSignUpEventDetail;
            rpViewEventPageRegistered.DataBind();
        }
コード例 #34
0
        public async Task <IActionResult> SignIn(EF.User args)
        {
            var buser = new BLL.User(unitOfWork);

            var user = await buser.Get(new EF.User {
                Email = args.Email
            });

            if (user != null)
            {
                // Check if active
                if (user.DateInactive != null)
                {
                    ModelState.AddModelError(string.Empty, "Account is inactive.");
                    return(View(args));
                }

                // Check password
                var salt      = user.PasswordSalt;
                var saltBytes = Convert.FromBase64String(salt);

                if (Core.Crypto.Hash(args.PasswordHash, saltBytes) == user.PasswordHash)
                {
                    // Successful log in
                    user.LastSessionId = Guid.NewGuid().ToString();
                    user.LastLoginDate = DateTime.Now;
                    await buser.Edit(user);

                    await AddClaimsAndSignIn(user);

                    if (user.RoleId == (int)BLL.User.Roles.User)
                    {
                        return(Redirect("~/Main"));
                    }
                    else
                    {
                        return(Redirect("~/Admin"));
                    }
                }
            }

            ModelState.AddModelError(string.Empty, "Access denied.");
            return(View(args));
        }
コード例 #35
0
ファイル: step3Page.aspx.cs プロジェクト: scutsky/iyuewan
 protected void submitbtn_Click(object sender, EventArgs e)
 {
     try
     {
         if (password.Value.Replace(" ", "") != confirmpassword.Value.Replace(" ", ""))
         {
             string myScript = @"alertMsg('密码不相同!','error.gif');";
             Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
             return;
         }
         else
         {
             if (Session["changeName"] != null)
             {
                 Spread.BLL.User bll = new BLL.User();
                 string name = Session["changeName"].ToString();
                 if (bll.UpdatePassword(name, this.password.Value))
                 {
                     string myScript = @"alertRedirectMsg('密码修改成功!','success.gif','Index.aspx');";
                     Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
                 }
                 else
                 {
                     string myScript = @"alertMsg('密码修改错误!','error.gif');";
                     Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
                     return;
                 }
             }
             else
             {
                 string myScript = @"alertMsg('密码修改错误!','error.gif');";
                 Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
                 return;
             }
         }
     }
     catch
     {
         string myScript = @"alertMsg('密码修改错误!','error.gif');";
         Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
         return;
     }
 }
コード例 #36
0
        private void URegistration()
        {
            Objects.User obj = new Objects.User();
            obj.UserID    = new BLL.User().GetMaxID();
            obj.FirstName = textBoxFirstName.Text;
            obj.LastName  = textBoxLastName.Text;
            obj.Email     = textBoxEmail.Text;
            obj.Password  = passwordBox1.Password;
            obj.Address   = textBoxAddress.Text;
            obj.Country   = textBoxCountry.Text;

            int vcheck = new BLL.User().URegistration(obj);

            if (vcheck == 1)
            {
                errormessage.Text = "You have Registered successfully.";
                Reset();
            }
        }
コード例 #37
0
        //TODO: Enable follow user through web api
        //TODO: Delete conversations
        protected void Page_Load(object sender, EventArgs e)
        {
            RedirectValidator.isUser();

            chatRoomId  = Convert.ToInt32(Request.QueryString["chatroom"]);
            currentUser = (BLL.User)Session["currentUser"];
            rptUserChatRooms.DataSource = ChatRoomDAO.GetUserChatRooms(currentUser.Id);
            recieverUser = UserDAO.GetUserById(ChatRoomDAO.GetRecieverId(currentUser.Id, chatRoomId));

            if (chatRoomId.Equals(0) || recieverUser == null)
            {
                Response.Redirect("/Profile/User.aspx?username=" + currentUser.Username);
            }
            else
            {
                rptUserChatRooms.DataBind();
                requestedUserProfilePicture.ImageUrl = recieverUser.ProfileImage;
            }
        }
コード例 #38
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RedirectValidator.isUser();
            currentUser = (BLL.User)Session["currentUser"];

            foreach (BLL.Post post in PostDAO.GetPosts())
            {
                postDataList.InnerHtml += "<option value='" + post.Content + "'>" + post.Content + "</option>";
            }

            foreach (BLL.Circle circle in CircleDAO.GetAllCircles())
            {
                circleDataList.InnerHtml += "<option value='" + circle.Id + "'>" + circle.Id + "</option>";
            }

            foreach (BLL.User user in UserDAO.GetAllUsers())
            {
                userDataList.InnerHtml += "<option value='" + user.Username + "'>" + user.Username + "</option>";
            }
        }
コード例 #39
0
        private static BLL.Post comment(BLL.Blog onblog, string content, BLL.User author)
        {
            BLL.Post post = new BLL.Post
            {
                Blog    = onblog,
                BlogId  = onblog.Id,
                Content = content,
                Author  = author
            };
            //onblog.Publish();
            ////面向数据库:
            //new PostRepository(Helper.context).Save(post);

            //面向对象写法:
            onblog.Posts = onblog.Posts ?? new List <BLL.Post>();
            onblog.Posts.Add(post);
            new BlogRepository(Helper.context).Flush();

            return(post);
        }
コード例 #40
0
        protected void GridViewFollow_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                var      data     = e.Row.DataItem;
                BLL.User userpost = data as BLL.User;

                var circlesname = UserCircleDAO.GetAllUserCircles(userpost.Id);

                DropDownList DropDownList1 = (e.Row.FindControl("DropDownList1") as DropDownList);
                DropDownList1.DataSource     = circlesname;
                DropDownList1.DataTextField  = "CircleId";
                DropDownList1.DataValueField = "CircleId";
                DropDownList1.DataBind();

                Button followButton = (e.Row.FindControl("peopleNearbyFollowBtn") as Button);
                followButton.Attributes["followingid"] = userpost.Id.ToString();
                followButton.Attributes["followerid"]  = currentUser.Id.ToString();
            }
        }
コード例 #41
0
 public JsonResult AddEditer(Models.User model,string email)
 {
     string sex =Request.Form["sex"];
     BLL.User bll = new BLL.User();
     model.Sex = sex == "0" ? false : true;
     model.RoleID = (int?)Models.RoleType.EDITOR;
     model.RegisterDate = DateTime.Now;
     model.UserStatus = (int?)Models.UserStatus.NORMAL;
     try
     {
         if (bll.Exists(email))
         {
             return Json(400, "邮箱已被使用", null);
         }
         bll.Add(model);
         return Json(200, "添加成功", null);
     }
     catch (Exception e)
     {
         return Json(500, e.Message, null);
     }
 }
コード例 #42
0
ファイル: GameEdit.aspx.cs プロジェクト: scutsky/iyuewan
        //绑定数据
        private void ShowInfo()
        {

            Model.User userMod = new Model.User();
            BLL.User userBll = new BLL.User();
            Model.Game gMod = new Model.Game();
            BLL.Game gBll = new BLL.Game();
            //gMod = gBll.GetModel(Convert.ToInt32(model.gameID));
            this.lbChanel.Text = model.ChanelName;
            this.lbGameName.Text = model.gameName;
            this.ddlStatus.SelectedValue = model.Status;
            this.ddlUpdateType.SelectedValue = model.UpdateType;
            this.txtBak1.Text = model.Bak1;
            this.txtVersion.Text = model.version;
            if (model.Bak2 != "")
            {
                this.ddlMenu.SelectedValue = model.Bak2;
                this.ddlChanel.SelectedValue = model.Bak3;
                this.ddlGame.SelectedValue = model.Bak4;
            }
            this.txtScale.Text = model.Bak5;
        }
コード例 #43
0
ファイル: DlgUserManager.cs プロジェクト: zfc317/mscd
        private void btn_Delete_Click(object sender, EventArgs e)
        {
            if(gv_User.FocusedRowHandle<0)
            {
                XtraMessageBox.Show("请选择需要删除的用户!", "提示");
                return;
            }

            if(gv_User.GetFocusedRowCellValue("Username").ToString()=="admin")
            {
                XtraMessageBox.Show("管理员用户不能删除!", "提示");
                return;
            }

            var id =Convert.ToInt32(gv_User.GetFocusedRowCellValue("Id"));
            var userBll =new BLL.User();
            var userModel = _users.First(u => u.Id == id);
            if(userBll.Delete(id))
            {
                _users.Remove(userModel);
                gc_User.RefreshDataSource();
            }
        }
コード例 #44
0
 public JsonResult GetAdminPersonalInfo()
 {
     int id =(int)Session["userId"];
     BLL.User bll = new BLL.User();
     try
     {
         var m=bll.GetModel(id);
         var jsonObj = new{
                           m.UserID,
                           m.RoleID,
                           m.Age,
                           m.Email,
                           m.NickName,
                           RegisterDate = m.RegisterDate.Value.ToLongDateString(),
                           Sex = m.Sex == true ? "男" : "女"
                       };
         return Json(200, "", jsonObj);
     }
     catch (Exception e)
     {
         return Json(500,e.Message, null);
     }
 }
コード例 #45
0
        public JsonResult GetAllDeleteList()
        {
            BLL.User bll=new BLL.User();
            try{
                var list = bll.GetAllDeleteList();

                var jsonObj = from m in list
                              select new
                              {
                                  m.UserID,
                                  m.RoleID,
                                  m.Age,
                                  m.Email,
                                  m.NickName,
                                  RegisterDate = m.RegisterDate.Value.ToLongDateString(),
                                  Sex = m.Sex == true ? "男" : "女"
                              };
                return Json(200, "ok", jsonObj);
            }
            catch (Exception e)
            {
                return Json(500, e.Message, null);
            }
        }
コード例 #46
0
ファイル: LoginAjax.ashx.cs プロジェクト: CharlieWan/wsqp
 bool DoLogin(string name, string password)
 {
     BLL.User bllUser = new BLL.User();
     return bllUser.Login(name, password) ? true : false;
 }
コード例 #47
0
ファイル: Register.aspx.cs プロジェクト: scutsky/iyuewan
        protected void submitbtn2_Click(object sender, EventArgs e)
        {
            try
            {
                Spread.Model.User model = new Model.User();
                Spread.BLL.User bll = new BLL.User();
                if (bll.chkExists(this.gusername.Value))
                {
                    string myScript = @"alertMsg('用户名已存在!','error.gif');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
                    return;
                }
                if (this.gusertype01.Checked)
                {
                    model.UserType = 1;
                }
                else
                {
                    model.UserType = 2;
                }
                model.Name = this.gusername.Value;
                model.Password = Common.DESEncrypt.Encrypt(this.gpassword.Value); 
                model.TrueName = this.gcontactor.Value;
                model.IdentityCard = "";// this.gidcard.Value;
                model.PaypalAccount = this.gpaypalAccount.Value;
                if (this.gsex01.Checked)
                {
                    model.Sex = true;
                }
                else
                {
                    model.Sex = false;
                }
                model.QQ = this.gqq.Value;
                model.RegistrationMark = this.gqq.Value;
                model.Email = "";//this.gemail.Value;
                model.Applicationdesc = this.gremark.Value;
                model.Phone = this.gtelphone.Value;
                model.Tel = "";// this.gtel.Value;
                model.RegDate = DateTime.Now;
                model.LastLogin = DateTime.Now;
                int num = bll.Add(model);
                if (num > 0)
                {
                    Model.Log modLog = new Model.Log();
                    modLog.UserId = num;
                    modLog.UserName = this.gusername.Value;                    
                    InsertLog(modLog);
                    string myScript = @"alertRedirectMsg('注册成功!','success.gif','registerSuccess.aspx');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);

                }
                else
                {
                    string myScript = @"alertMsg('注册失败!','error.gif');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);

                }
            }
            catch
            {
                string myScript = @"alertMsg('注册失败!','error.gif');";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
            }
            
        }
コード例 #48
0
 public static List<int> GetDeletedIDsAfter(long LastVersion)
 {
     BLL.User v = new BLL.User();
     //v.LoadDeletedIDs(LastVersion);
     List<int> list = new List<int>();
     while (!v.EOF)
     {
         list.Add((int)v.GetColumn("ID"));
         v.MoveNext();
     }
     return list;
 }
コード例 #49
0
 public JsonResult PasswordAuthentication(Models.User Form)
 {
     int id =(int)Session["userId"];
     BLL.User bll = new BLL.User();
     try
     {
         Models.User model = bll.GetModel(id);
         if (Form.Password == Form.NickName)
         {
             if (model.Password == Form.Email)
             {
                 model.Password = Form.Password;
                 bll.Update(model);
                 return Json(200, "修改成功", null);
             }
             else
             {
                 return Json(301, "密码错误", null);
             }
         }else {
                 return Json(302, "两次输入的密码不一", null);
             }
     }
     catch (Exception e)
     {
         return Json(500, e.Message, null);
     }
 }
コード例 #50
0
 public JsonResult Stop(int id)
 {
     BLL.User bll = new BLL.User();
     try
     {
         bll.Stop(id);
         return Json(200, "success", null);
     }
     catch (Exception e)
     {
         return Json(500, e.Message, null);
     }
 }
コード例 #51
0
 public JsonResult RevisePersonalInfo(Models.User form)
 {
     int id = (int)Session["userId"];
     BLL.User bll = new BLL.User();
     try
     {
         Models.User model = bll.GetModel(id);
         model.Age = form.Age;
         model.NickName = form.NickName;
         string sex = Request.Form["sex"];
         model.Sex = sex == "0" ? false : true;
         bll.Update(model);
         return Json(200,"修改成功",null);
     }
     catch (Exception e)
     {
         return Json(500, e.Message, null);
     }
 }
コード例 #52
0
 public static List<User> GetUpdatesAfter(long? lastVersion,DateTime? lastUpdateTime)
 {
     BLL.User v = new BLL.User();
     if(lastVersion.HasValue && lastVersion.Value != 0)
     {
         v.LoadUpdatesAfter( Convert.ToInt32(lastVersion.Value) );
     }else if(lastUpdateTime.HasValue)
     {
        // v.LoadUpdatesAfterByTime(lastUpdateTime.Value);
     }else
     {
         v.LoadAll();
     }
     return ToList(v);
 }
コード例 #53
0
ファイル: Index.aspx.cs プロジェクト: scutsky/iyuewan
        protected void submitbtn_Click(object sender, EventArgs e)
        {
            try
            {
                Spread.Model.User model = new Model.User();
                Spread.BLL.User bll = new BLL.User();
                if (bll.chkUserLogin(this.username.Value, this.password.Value))
                {
                    Session["user_name"] = this.username.Value;
                    HttpCookie hckUID = null;       //登录的用户ID
                    HttpCookie hckPWD = null;       //登录的密码(MD5后)

                    try
                    {
                        #region 写入Cook
                        //判断原用户ID是否存在
                        if (Request.Cookies["UserPage_UID"] != null)
                        {
                            //存在时清理原有的值
                            Response.Cookies.Remove("UserPage_UID");
                        }

                        //判断原用户ID是否存在
                        if (Request.Cookies["UserPage_PWD"] != null)
                        {
                            //存在时清理原有的值
                            Response.Cookies.Remove("UserPage_PWD");
                        }

                        //生成Cookie(用户名, 密码)
                        hckUID = new HttpCookie("UserPage_UID", this.username.Value);
                        hckPWD = new HttpCookie("UserPage_PWD", this.password.Value);

                        //保存Cookie(用户名, 密码)
                        this.Response.Cookies.Add(hckUID);
                        this.Response.Cookies.Add(hckPWD);
                        #endregion
                    }
                    catch (Exception ex)
                    {
                        string myScript = @"alertMsg('登陆错误!','error.gif');";
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
                        return;
                    }
                    Response.Redirect("Index.aspx");
                }
                else
                {
                    string myScript = @"alertMsg('用户名或密码错误!','error.gif');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
                    return;
                }
            }
            catch(Exception ex)
            {
                string myScript = @"alertMsg('登陆失败,'" + ex.ToString() + "','error.gif');";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
            }
        }
コード例 #54
0
ファイル: ModuleData.cs プロジェクト: TjcJose/Hi
 /// <summary>
 /// 获取所有用户列表
 /// </summary>
 /// <returns></returns>
 public static DataSet GetUserList()
 {
     DataSet ds = new DataSet();
     Dictionary<string,string> dict = new Dictionary<string,string>() ;
     Hi.BLL.User bll = new BLL.User();
     ds = bll.List(dict, 1, 100,"");
     return ds;
 }
コード例 #55
0
 public static List<User> GetAll()
 {
     BLL.User v = new BLL.User();
     v.LoadAll();
     return ToList(v);
 }
コード例 #56
0
        public static void DeleteList(List<int> list)
        {
            BLL.User bv = new BLL.User();
            foreach (int v in list)
            {
                // try to load by primary key
                bv.LoadByPrimaryKey(v);
                // if the entry doesn't exist, create it
                if (bv.RowCount > 0)
                {
                    bv.MarkAsDeleted();
                    bv.Save();
                }
                // populate the contents of v on the to the database list

            }
        }
コード例 #57
0
ファイル: DlgUserManager.cs プロジェクト: zfc317/mscd
 private void InitUserGrid()
 {
     var userBll = new BLL.User();
     _users = userBll.GetModelList("");
     gc_User.DataSource = _users;
 }
コード例 #58
0
        public static void SaveList(List<User> list)
        {
            BLL.User bv = new BLL.User();
            foreach (User v in list)
            {
                // try to load by primary key
                bv.LoadByPrimaryKey(v.ID.Value);

                // if the entry doesn't exist, create it
                if (bv.RowCount == 0)
                {
                    bv.AddNew();
                }
                // populate the contents of v on the to the database list
              if( v.ID.HasValue )
                   bv.ID = v.ID.Value;
              if( v.FullName != "" && v.FullName != null )
                   bv.FullName = v.FullName;
              if( v.Address != "" && v.Address != null )
                   bv.Address = v.Address;
              if( v.Mobile != "" && v.Mobile != null )
                   bv.Mobile = v.Mobile;
              if( v.UserName != "" && v.UserName != null )
                   bv.UserName = v.UserName;
              if( v.Password != "" && v.Password != null )
                   bv.Password = v.Password;
              if( v.UserType.HasValue )
                   bv.UserType = v.UserType.Value;
              if( v.Active.HasValue )
                   bv.Active = v.Active.Value;
              //if( v.IsDeleted.HasValue )
              //     bv.IsDeleted = v.IsDeleted.Value;
              //if( v.UpdateTime.HasValue )
              //     bv.UpdateTime = v.UpdateTime.Value;

                bv.Save();
            }
        }