Exemple #1
0
        public static void SaveVcardAvatar(string username, int UserIndex, IQ vCard)
        {
            string  data = "";
            Element p    = vCard.SelectSingleElement("vCard");

            if (p.HasTag("PHOTO"))
            {
                p = p.SelectSingleElement("PHOTO");
                if (p.HasTag("BINVAL"))
                {
                    p    = p.SelectSingleElement("BINVAL");
                    data = p.Value;
                }
            }

            if (!string.IsNullOrEmpty(data))
            {
                bool   res;
                string fname = ImageTools.SaveAvatar(data, out res);
                if (res)
                {
                    BLL.Users api = new BLL.Users();
                    api.ChangeUserPicture(username, fname);
                    IQ iq = new IQ();
                    if (vCard.HasAttribute("id"))
                    {
                        iq.Id = vCard.Id;
                    }
                    iq.To    = new agsXMPP.Jid(username + "@" + Config.AppSetting.domain);
                    iq.Type  = IqType.result;
                    iq.Vcard = CreateUserVcard(username);
                    ThreadTools.Users.Online[UserIndex].Send(iq);
                }
            }
        }
Exemple #2
0
        public byte[] Init(Stream inputStream, string httpMethod, string user_id)
        {
            byte[] bytes = new byte[inputStream.Length];
            inputStream.Read(bytes, 0, bytes.Length);

            inputStream.Seek(0, SeekOrigin.Begin);

            object obj = SerializationHelper.Deserialize(NetMessageDef.ResponseGetRole, bytes);

            protos.Login.RequestCreateRole requestCreateRole = obj as protos.Login.RequestCreateRole;

            protos.ReturnMessage.ResDefaultInfo resInfo = new protos.ReturnMessage.ResDefaultInfo();

            if (string.IsNullOrEmpty(requestCreateRole.user_name))
            {
                resInfo.results = 0;
                resInfo.details = "昵称不能为空";
            }

            Model.Users mUser = new BLL.Users().GetModel(user_id);

            if (mUser != null)
            {
                mUser.UserName  = requestCreateRole.user_name;
                resInfo.results = 2;
                resInfo.details = "创建角色成功";
            }
            else
            {
                resInfo.results = 0;
                resInfo.details = "账号不存在";
            }

            return(SerializationHelper.Serialize(new MuffinMsg(NetMessageDef.ResponseReturnDefaultInfo, resInfo)));
        }
Exemple #3
0
        public static void Write(string SID, string txt)
        {
            int index;

            if (Codes.ThreadTools.Users.Online.IsSessionExists(SID, out index))
            {
                Guid?UserId = null;
                if (!string.IsNullOrEmpty(Codes.ThreadTools.Users.Online[index].Username))
                {
                    BLL.Users   api  = new BLL.Users();
                    DAL.TbUsers user = api.Find(Codes.ThreadTools.Users.Online[index].Username);
                    if (user != null)
                    {
                        UserId = user.UserId;
                    }
                }

                Api.Insert(Codes.ThreadTools.Users.Online[index].IPAddress,
                           SID, UserId, txt);
            }
            else
            {
                Api.Insert(null, null, null, txt);
            }
        }
Exemple #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["UsersId"] != null)
                {
                    BLL.Users             users             = new BLL.Users();
                    Model.Users           user              = users.GetModel((int)Session["UsersId"]);
                    BLL.Roles             roles             = new BLL.Roles();
                    Model.Roles           role              = roles.GetModel(user.Fk_Roles_Id.Value);
                    BLL.PermisssionsNodes permisssionsNodes = new BLL.PermisssionsNodes();

                    List <Model.PermisssionsNodes> permisssionsNodesList = permisssionsNodes.GetModelList("Fk_Permissions_Id='" + role.Fk_Permissions_Id + "'");
                    List <Model.Nodes>             nodes = new List <Model.Nodes>();
                    foreach (Model.PermisssionsNodes pn in permisssionsNodesList)
                    {
                        BLL.Nodes   nodesBLL = new BLL.Nodes();
                        Model.Nodes node     = nodesBLL.GetModel(pn.Fk_Nodes_Id.Value);
                        if (node != null)
                        {
                            if (node.ParentId == 0 && node.IsVisible == true)
                            {
                                nodes.Add(node);
                            }
                        }
                    }
                    Repeater1.DataSource = nodes.OrderBy(p => p.Orders).ToList();
                    Repeater1.DataBind();
                }
            }
        }
Exemple #5
0
        protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                Repeater Repeater2 = e.Item.FindControl("Repeater2") as Repeater;
                Label    lblId     = e.Item.FindControl("lblId") as Label;
                //BLL.Nodes nodes = new BLL.Nodes();
                //List<Model.Nodes> list = nodes.GetModelList("ParentId='" + lblId.Text + "' and IsVisible='True'").OrderBy(p => p.Orders).ToList();

                BLL.Users             users             = new BLL.Users();
                Model.Users           user              = users.GetModel((int)Session["UsersId"]);
                BLL.Roles             roles             = new BLL.Roles();
                Model.Roles           role              = roles.GetModel(user.Fk_Roles_Id.Value);
                BLL.PermisssionsNodes permisssionsNodes = new BLL.PermisssionsNodes();

                List <Model.PermisssionsNodes> permisssionsNodesList = permisssionsNodes.GetModelList("Fk_Permissions_Id='" + role.Fk_Permissions_Id + "'");
                List <Model.Nodes>             nodes = new List <Model.Nodes>();
                foreach (Model.PermisssionsNodes pn in permisssionsNodesList)
                {
                    BLL.Nodes   nodesBLL = new BLL.Nodes();
                    Model.Nodes node     = nodesBLL.GetModel(pn.Fk_Nodes_Id.Value);
                    if (node != null)
                    {
                        if (node.ParentId == int.Parse(lblId.Text) && node.IsVisible == true)
                        {
                            nodes.Add(node);
                        }
                    }
                }

                Repeater2.DataSource = nodes.OrderBy(p => p.Orders).ToList();
                Repeater2.DataBind();
            }
        }
Exemple #6
0
        public void SelectAllUserTwo()
        {
            JavaScriptSerializer json = new JavaScriptSerializer();
            List <Model.Users>   list = new BLL.Users().GetModelListAll("");

            Context.Response.Write(json.Serialize(list));
        }
Exemple #7
0
        public void SelectAllUser()
        {
            JavaScriptSerializer json = new JavaScriptSerializer();
            List <Model.Users>   list = new BLL.Users().GetModelListAll("  a.RoleID=(select RoleID from Role where RoleName='客户经理')");

            Context.Response.Write(json.Serialize(list));
        }
Exemple #8
0
        private void CheckUserInfo()
        {
            string userName = Request.Form["txtUserName"];
            string pwd      = Request.Form["txtPwd"];

            BLL.Users   bll  = new BLL.Users();
            Model.Users user = null;
            bool        b    = bll.UserLogin(userName, pwd, out msg, out user);

            if (b)
            {
                Session["userInfo"] = user;
                #region 判断用户是否选择“记住我”
                if (Request.Form["checkMe"] != null)
                {
                    HttpCookie cookie1 = new HttpCookie("cp1", user.LoginId);
                    HttpCookie cookie2 = new HttpCookie("cp2", MD5Pwd(user.LoginPwd));
                    cookie1.Expires = DateTime.Now.AddDays(3);
                    cookie2.Expires = DateTime.Now.AddDays(3);
                    Response.Cookies.Add(cookie1);
                    Response.Cookies.Add(cookie2);
                }
                #endregion
                GoPage(msg);
            }
        }
        private void ShowInfo(int Id)
        {
            Maticsoft.BLL.News   bll   = new Maticsoft.BLL.News();
            Maticsoft.Model.News model = bll.GetModel(Id);

            this.lblName.Text = model.Name;
            BLL.NewsType   BLLNewsType   = new BLL.NewsType();
            Model.NewsType ModelNewsType = BLLNewsType.GetModel((int)model.Fk_NewsType_Id);

            this.lblContents.Text = model.Contents;
            BLL.Users   BLLUsers   = new BLL.Users();
            Model.Users ModelUsers = BLLUsers.GetModel((int)model.Fk_Users_Id);
            this.lblFk_Users_Id.Text = ModelUsers.Name;
            this.lblAddTime.Text     = model.AddTime.ToString();
            if (Session["LoginUser"] == null)
            {
                lblUser.Text = "匿名";
            }
            else
            {
                BLL.Users   bllleaveuser   = new BLL.Users();
                Model.Users modelleaveuser = bllleaveuser.GetModel((int)Session["LoginUser"]);
                lblUser.Text = modelleaveuser.TrueName;
            }
        }
Exemple #10
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string name     = txtName.Text.Trim();
            string password = txtPassword.Text.Trim();

            BLL.Users users = new BLL.Users();
            DataSet   ds    = users.GetList("Name='" + name + "' and Password='******'");

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["IsActivity"].ToString() == "True")
                {
                    Session["LoginUser"] = ds.Tables[0].Rows[0]["Id"];
                    Response.Redirect("~/Default.aspx");
                }
                else
                {
                    Maticsoft.Common.MessageBox.Show(this, "未激活用户!");
                }
            }
            else
            {
                Maticsoft.Common.MessageBox.Show(this, "用户名或密码错误!");
            }
        }
Exemple #11
0
        public void SelectUser(string name, int type)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();
            StringBuilder str   = new StringBuilder();
            string        size  = Context.Request.QueryString["limit"]; //数量
            string        index = Context.Request.QueryString["page"];  //页码

            if (!string.IsNullOrEmpty(name))
            {
                str.AppendFormat(" and UserLName like '%{0}%'", name);
            }
            if (type > 0)
            {
                str.AppendFormat(" and a.RoleID ={0}", type);
            }
            List <Maticsoft.Model.Users> list = new List <Model.Users>();
            int count = new BLL.Users().GetRecordCount("1>0" + str.ToString());

            list = new BLL.Users().GetModelList(str.ToString(), "1>0" + str.ToString(), Convert.ToInt32(size), Convert.ToInt32(index));
            dic.Add("code", "0");
            dic.Add("msg", "");
            dic.Add("count", count);
            dic.Add("data", list);
            JavaScriptSerializer json = new JavaScriptSerializer();
            string j = json.Serialize(dic);

            Context.Response.Write(j);
        }
Exemple #12
0
        public void GetUserOne(int uid)
        {
            JavaScriptSerializer json = new JavaScriptSerializer();

            Maticsoft.Model.Users list = new BLL.Users().GetModel(uid);
            Context.Response.Write(json.Serialize(list));
        }
Exemple #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                if (CheckValidateCode())
                {
                    Model.Users user = new Model.Users();
                    user.UserStateId    = new Model.UserStates();
                    user.LoginId        = Request.Form["txtUserName"];
                    user.Name           = Request.Form["txtRealName"];
                    user.LoginPwd       = Request.Form["txtPwd"];
                    user.Mail           = Request.Form["txtEmail"];
                    user.Address        = Request.Form["txtAddress"];
                    user.Phone          = Request.Form["txtPhone"];
                    user.UserStateId.Id = 1;
                    BLL.Users bll = new BLL.Users();
                    string    msg = string.Empty;
                    int       id  = bll.Add(user, out msg);
                    if (id > 0)
                    {
                        //发送激活链接
                        //跳转

                        Response.Redirect("/ShowMsg.aspx?msg=" + Server.UrlEncode(msg)
                                          + "&txt=" + Server.UrlEncode("首页")
                                          + "&url=/Default.aspx");
                    }
                }
            }
        }
Exemple #14
0
        public static void ProcessRosterIQGet(string username, IQ iq)
        {
            iq.Type  = IqType.result;
            iq.Query = new Roster();

            BLL.Users           api   = new BLL.Users();
            List <DAL.VwFriend> FList = api.ListFriend(username);

            for (int i = 0; i < FList.Count; i++)
            {
                RosterItem ri = new RosterItem();
                ri.Name         = FList[i].VcardFirstName + " " + FList[i].VcardLastName;
                ri.Subscription = (FList[i].FriendStatus == 1) ? SubscriptionType.from : SubscriptionType.both;
                ri.Jid          = new agsXMPP.Jid(FList[i].FriendUserName + "@" + Config.AppSetting.domain);
                if (!string.IsNullOrEmpty(FList[i].GroupName))
                {
                    ri.AddGroup(FList[i].GroupName);
                }
                iq.Query.AddChild(ri);
            }

            int index;

            if (ThreadTools.Users.Online.IsAuthenticated(username, out index))
            {
                ThreadTools.Users.Online[index].Send(iq);
                ThreadTools.Users.Online[index].Send(Rosters.FriendStatus(username));
                ThreadTools.Users.Online[index].Send(Messages.OfflineMessage(username));
                ThreadTools.Users.Online[index].Send(Rosters.PendingStatus(iq.From.User));
            }
        }
Exemple #15
0
        public static void ProccessAuthSet(string username, string SID, int UserSessionIndex, IQ iq)
        {
            Auth auth = iq.Query as Auth;

            iq.SwitchDirection();
            string cuser = auth.Username;
            string cpass = auth.Digest;

            if (!string.IsNullOrEmpty(cuser) && !string.IsNullOrEmpty(cpass))
            {
                if (!ThreadTools.Users.Online[UserSessionIndex].Authenticated)
                {
                    int UserIndex;
                    if (!ThreadTools.Users.Online.IsAuthenticated(cuser, out UserIndex))
                    {
                        BLL.Users api = new BLL.Users();
                        if (api.LoginMessenger(cuser, SID, cpass))
                        {
                            iq.Type = IqType.result;
                            ThreadTools.Users.Online[UserSessionIndex].Authenticated = true;
                            ThreadTools.Users.Online[UserSessionIndex].Username      = cuser;
                            iq.Query = null;
                            ThreadTools.Users.Online[UserSessionIndex].Send(iq);

                            api.ChangeUserStatus(cuser, true);

                            Presence p = Rosters.GetPresence(cuser);
                            p.To = new agsXMPP.Jid(cuser + "@" + Config.AppSetting.domain);

                            ThreadTools.Users.Online[UserSessionIndex].Send(p);

                            Rosters.SendStatus(cuser);
                        }
                        else
                        {
                            iq.Type  = IqType.error;
                            iq.Query = null;
                            iq.AddChild(new agsXMPP.protocol.client.Error(ErrorType.auth, ErrorCondition.NotAuthorized));
                            ThreadTools.Users.Online[UserSessionIndex].Send(iq);
                        }
                    }
                    else
                    {
                        iq.Type  = IqType.error;
                        iq.Query = null;
                        iq.AddChild(new agsXMPP.protocol.client.Error(ErrorType.auth, ErrorCondition.Conflict));
                        ThreadTools.Users.Online[UserSessionIndex].Send(iq);
                    }
                }
            }
            else
            {
                iq.Type  = IqType.error;
                iq.Query = null;
                iq.AddChild(new agsXMPP.protocol.client.Error(ErrorType.auth, ErrorCondition.NotAcceptable));
                ThreadTools.Users.Online[UserSessionIndex].Send(iq);
            }
        }
Exemple #16
0
 public HomeController(BLL.ActiveAuctions bllActiveAuctions, BLL.Events bllEvents, BLL.Items bllItems, BLL.BidHistories bllBidHistories, BLL.Users bllUsers, BLL.Withdraws bllWithdraws)
 {
     _bllActiveAuctions = bllActiveAuctions;
     _bllEvents         = bllEvents;
     _bllItems          = bllItems;
     _bllBidHistories   = bllBidHistories;
     _bllUsers          = bllUsers;
     _bllWithdraws      = bllWithdraws;
 }
Exemple #17
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         BLL.Users bll = new BLL.Users();
         DataTable dt  = bll.GetAllList().Tables[0];
         GridView1.DataSource = dt;
         GridView1.DataBind();
     }
 }
Exemple #18
0
        public static void Avatar(string username, IQ iq)
        {
            DAL.TbUsers cuser;
            BLL.Users   api = new BLL.Users();
            switch (iq.Type)
            {
            case IqType.get:
                if (iq.To != null)
                {
                    cuser = api.Find(iq.To.User);
                }
                else
                {
                    cuser = api.Find(username);
                }

                if (cuser != null)
                {
                    if (!string.IsNullOrEmpty(cuser.TbVcard.VcardPhoto))
                    {
                        iq.SwitchDirection();
                        iq.Type            = IqType.result;
                        iq.Query.Namespace = "jabber:iq:avatar";
                        iq.Query.ChildNodes.Clear();
                        Element dataEl = new Element("data");
                        dataEl.Value = ImageTools.ToBase64(cuser.TbVcard.VcardPhoto);

                        iq.Query.AddChild(dataEl);
                        int index;
                        if (ThreadTools.Users.Online.IsAuthenticated(username, out index))
                        {
                            ThreadTools.Users.Online[index].Send(iq);
                        }
                    }
                }
                break;

            case IqType.set:
            case IqType.result:
                if (iq.Query.HasTag("data"))
                {
                    Element el = iq.Query.SelectSingleElement("data");
                    cuser = api.Find(username);
                    string pname;
                    bool   isSaved;
                    pname = ImageTools.SaveAvatar(el.Value, out isSaved);
                    if (isSaved)
                    {
                        api.ChangeUserPicture(username, pname);
                        Rosters.SendStatus(username);
                    }
                }
                break;
            }
        }
Exemple #19
0
 public int LoginUser(string name, string pwd)
 {
     try
     {
         int i = new BLL.Users().GetUserLogin(name, pwd);
         return(i);
     }
     catch (Exception) {
         return(0);
     }
 }
Exemple #20
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Session["UsersId"] != null)
         {
             int       UsersId = (int)Session["UsersId"];
             BLL.Users users   = new BLL.Users();
             lblUsersId.Text = users.GetModel(UsersId).TrueName;
         }
     }
 }
Exemple #21
0
        public int Login()
        {
            string username = HttpContextHelper.InputText(Request.Form["username"], 100);
            string password = HttpContextHelper.InputText(Request.Form["password"], 100);

            BLL.Users bll = new BLL.Users();
            if (bll.Login(username, password))
            {
                return 1;
            }
            return 0;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            BLL.Users api = new BLL.Users();
            lblusercount.Text = api.ListCount(new DynamicSearch.ConditionList()).ToString();

            DynamicSearch.ConditionList li = new DynamicSearch.ConditionList();
            li.Add("UserIsOnline", DynamicSearch.SearchCondition.Equal, true, "bool", false);
            lblonlinecount.Text = api.ListVwCount(li).ToString();

            lblconnectioncount.Text = Codes.ThreadTools.Users.Online.Count.ToString();

            imgserverStatus.ImageUrl = "~/Scripts/Style/images/" + ((Codes.ThreadTools.Main.ThreadIsAlive) ? "active.gif" : "inactive.png");
        }
Exemple #23
0
 private void ShowInfo(int Id)
 {
     Maticsoft.BLL.Reply   bll   = new Maticsoft.BLL.Reply();
     Maticsoft.Model.Reply model = bll.GetModel(Id);
     this.lblId.Text = model.Id.ToString();
     BLL.Leaveword   BLLLeaveword   = new BLL.Leaveword();
     Model.Leaveword ModelLeaveword = BLLLeaveword.GetModel((int)model.Fk_Leaveword_Id);
     this.lblFk_Leaveword_Id.Text = ModelLeaveword.Id.ToString();
     this.lblContents.Text        = model.Contents;
     BLL.Users   BLLUsers   = new BLL.Users();
     Model.Users ModelUsers = BLLUsers.GetModel((int)model.Fk_Users_Id);
     this.lblFk_Users_Id.Text = ModelUsers.Name;
     this.lblAddTimes.Text    = model.AddTimes.ToString();
 }
Exemple #24
0
        public void DeleteUser(int id)
        {
            JavaScriptSerializer json = new JavaScriptSerializer();
            bool c = new BLL.Users().Delete(id);

            if (c)
            {
                Context.Response.Write(1);
            }
            else
            {
                Context.Response.Write(0);
            }
        }
Exemple #25
0
        /// <summary>
        /// Bind DDL Data Source
        /// </summary>
        private void BindDDLSource()
        {
            BLL.Users bllUser  = new BLL.Users();
            string    strWhere = "AND RoleName='Loan Officer'";

            if (CurrUser.bIsCompanyUser)
            {
                strWhere += " AND (UserId IN (SELECT UserId FROM GroupUsers WHERE GroupID IN(select GroupID from Groups where  CompanyID in (SELECT CompanyID FROM Groups where GroupID in (select GroupID from GroupUsers WHERE UserID = " + CurrUser.iUserID.ToString() + ")))))";
            }
            else if (CurrUser.bIsRegionUser)
            {
                strWhere += " AND (UserId IN (SELECT UserId FROM GroupUsers WHERE GroupID IN(select GroupID from Groups where  RegionID in (SELECT RegionID FROM Groups where GroupID in (select GroupID from GroupUsers WHERE UserID = " + CurrUser.iUserID.ToString() + ")))))";
            }
            else if (CurrUser.bIsDivisionUser)
            {
                strWhere += " AND (UserId IN (SELECT UserId FROM GroupUsers WHERE GroupID IN(select GroupID from Groups where  DivisionID in (SELECT DivisionID FROM Groups where GroupID in (select GroupID from GroupUsers WHERE UserID = " + CurrUser.iUserID.ToString() + ")))))";
            }
            else if (CurrUser.bIsBranchUser)
            {
                strWhere += " AND (UserId IN (SELECT UserId FROM GroupUsers WHERE GroupID IN(select GroupID from Groups where  BranchID in (SELECT BranchID FROM Groups where GroupID in (select GroupID from GroupUsers WHERE UserID = " + CurrUser.iUserID.ToString() + ")))))";
            }

            DataTable dtLoadOfficer = bllUser.GetUserList(strWhere);

            if (!dtLoadOfficer.Columns.Contains("LoanOfficer"))
            {
                dtLoadOfficer.Columns.Add("LoanOfficer");
            }
            foreach (DataRow dr in dtLoadOfficer.Rows)
            {
                dr["LoanOfficer"] = dr["Name"].ToString();
            }
            DataRow drNew = dtLoadOfficer.NewRow();

            drNew["UserID"]      = 0;
            drNew["LoanOfficer"] = "All";
            dtLoadOfficer.Rows.Add(drNew);

            DataView dv = dtLoadOfficer.DefaultView;

            dv.Sort = "UserID ";
            DataTable dtLoadOfficerORder = dv.ToTable();

            ddlLoanOfficer.DataSource     = dtLoadOfficerORder;
            ddlLoanOfficer.DataTextField  = "LoanOfficer";
            ddlLoanOfficer.DataValueField = "UserID";
            ddlLoanOfficer.SelectedValue  = "0";
            ddlLoanOfficer.DataBind();
        }
Exemple #26
0
 private void ShowInfo(int Id)
 {
     Maticsoft.BLL.News   bll   = new Maticsoft.BLL.News();
     Maticsoft.Model.News model = bll.GetModel(Id);
     this.lblId.Text   = model.Id.ToString();
     this.lblName.Text = model.Name;
     BLL.NewsType   BLLNewsType   = new BLL.NewsType();
     Model.NewsType ModelNewsType = BLLNewsType.GetModel((int)model.Fk_NewsType_Id);
     this.lblFk_NewsType_Id.Text = ModelNewsType.Name;
     this.lblContents.Text       = model.Contents;
     BLL.Users   BLLUsers   = new BLL.Users();
     Model.Users ModelUsers = BLLUsers.GetModel((int)model.Fk_Users_Id);
     this.lblFk_Users_Id.Text = ModelUsers.Name;
     this.lblAddTime.Text     = model.AddTime.ToString();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["LoginUser"] == null)
     {
         tr1.Visible = true;
         tr2.Visible = false;
     }
     else
     {
         tr1.Visible = false;
         tr2.Visible = true;
         BLL.Users bll = new BLL.Users();
         lblUsersName.Text = bll.GetModel((int)Session["LoginUser"]).TrueName;
     }
 }
Exemple #28
0
        protected void Page_Init(object sender, EventArgs e)
        {
            if (Request.Cookies["cp1"] == null)
            {
                Response.Redirect("/account/Login.aspx?returnurl=");
                return;
            }
            String name = Request.Cookies["cp1"].Value;

            //String pwd = Request.Cookies["cp2"].Value;
            Model.Users model = new BLL.Users().GetModel(name);
            if (model == null || !Common.WebHelper.CheckCookie(model))
            {
                Response.Redirect("/account/Login.aspx?returnurl=");
            }
        }
        private void BindPage(int fileId)
        {
            BLL.Loans bllLoans = new BLL.Loans();

            Model.Loans  modelLoan  = new Model.Loans();
            BLL.Contacts bllContact = new BLL.Contacts();
            BLL.Users    bllUser    = new BLL.Users();

            modelLoan = bllLoans.GetModel(fileId);
            if (modelLoan != null && modelLoan.RateLockExpiration != null)
            {
                lblRateLockExp.Text = modelLoan.RateLockExpiration.Value.ToShortDateString();
                hfdExpDate.Value    = modelLoan.RateLockExpiration.Value.ToOADate().ToString();
            }

            lblCurrentState.Text = bllLoans.GetLoanStage(fileId);

            lblBorrower.Text = bllContact.GetBorrower(fileId);

            if (modelLoan != null)
            {
                lblEstCloseDate.Text = modelLoan.EstCloseDate != null?modelLoan.EstCloseDate.Value.ToShortDateString() : string.Empty;
            }

            lblCoborrower.Text = bllContact.GetCoBorrower(fileId);

            lblLoanOfficer.Text = bllUser.GetLoanOfficer(fileId);

            if (modelLoan != null)
            {
                lblPropertyAddress.Text = modelLoan.PropertyAddr + " " + modelLoan.PropertyCity + " " + modelLoan.PropertyState + " " + modelLoan.PropertyZip;
            }

            if (modelLoan != null && modelLoan.LoanAmount.HasValue)
            {
                lblLoanAmount.Text = "$" + string.Format("{0:N0}", modelLoan.LoanAmount.Value);
            }

            if (modelLoan != null && modelLoan.Rate.HasValue)
            {
                lblInterestRate.Text = modelLoan.Rate.Value.ToString("#.####") + "%";
            }

            lblLender.Text = bllLoans.GetLender(fileId);

            hfdFileId.Value = fileId.ToString();
        }
Exemple #30
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            //context.Response.Write("Hello World");
            String mail = context.Request["mail"];

            BLL.Users UserService = new BLL.Users();
            if (UserService.GetModelByMail(mail) != null)
            {
                UserService.SendMail(mail);
                context.Response.Write("OK");
            }
            else
            {
                context.Response.Write("No");
            }
        }
 protected void rptList_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         Label  lblleaveusername = e.Item.FindControl("lblleaveusername") as Label;
         string userid           = lblleaveusername.Text;
         if (userid == "-1")
         {
             lblleaveusername.Text = "匿名";
         }
         else
         {
             BLL.Users bll = new BLL.Users();
             lblleaveusername.Text = bll.GetModel(int.Parse(lblleaveusername.Text)).TrueName;
         }
     }
 }
Exemple #32
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["uinfo"]==null)
            {
                if (Request.Cookies["uinfo"] == null)
                {
                    //AjaxMsgHelper.AjaxMsg("状态", "您还没登陆", null, "Login.html");
                    PageHelper.WriteJsMsg("您还没登陆", "Login.html");
                    Response.End();
                }
                else
                {
                    string strId = Request.Cookies["uinfo"].Value;
                    Session["uinfo"] = new BLL.Users().GetModel(int.Parse(strId));

                }
            }
            SonLoad();
        }
        public void login()
        {
            //验证验证码,登陆页面可以不需要验证码
            //if (context.Request.Params["UCode"].ToString() != context.Session["ValidateCode"].ToString())
            //{
            //    AjaxMsgHelper.AjaxMsg("err", "输入验证码不正确");
            //    context.Response.End();
            //}
            //如果是使用facebook登陆的话,把用户token保存在session内
            if(context.Request.Params["access_token"]!=null)
            {
                context.Session["access_token"] = context.Request.Params["access_token"];
                //context.Server.Transfer("ActivityNumberSelectable.aspx");
                //context.Response.Redirect("http://www.baidu.com");
                context.Response.Write("home_template.html");
                //context.Response.End();
                //context.Response.Write("who am I");

            }
            else
            {
                //使用实体封装数据
                MODEL.Users u = new MODEL.Users()
                {
                    ULoginName = context.Request.Params["ULoginName"].ToString(),
                    UPwd = context.Request.Params["UPwd"].ToString()
                };

                //1.查找登录名
                u = new BLL.Users().FindUser(u);

                if (u == null)
                {//1.1查无此登录名,返回json
                    //Console.Write("查无此用户");在这里是没有用的
                    System.Diagnostics.Debug.Write("查无此用户");
                    AjaxMsgHelper.AjaxMsg("no_user_found", "User name not found!");

                }
                else
                { //1.2有这个登录名,验证密码,密码正确的话跳转MsgList.aspx
                    //Console.Clear();
                    //Console.WriteLine("找得到了用户"+u.UName);
                    if (DataHelper.MD5(context.Request.Form["UPwd"]) == u.UPwd)
                        System.Diagnostics.Debug.Write("找得到了用户" + u.ULoginName);
                    context.Session["User_Info"] = u;

                    if (DataHelper.MD5(context.Request.Form["UPwd"]) == u.UPwd)
                    {
                        AjaxMsgHelper.AjaxMsg("find_suceess", "找到了这个用户:" + u.ULoginName, null, "home_template.html");
                        if (context.Request.Form["chkAlways"] == "on")//使用cookie保存用户登陆信息一小时
                        {
                            HttpCookie cookie = new HttpCookie("User_Info", u.UId.ToString());//注意只保存id,这样安全
                            cookie.Expires = DateTime.Now.AddMinutes(60);
                            cookie.Path = "";
                            context.Response.Cookies.Add(cookie);

                        }
                    }
                    else
                    {
                        AjaxMsgHelper.AjaxMsg("no_user_found", "Password incorrect");
                    }

                }
            }
        }
        void regUser()
        {
            //1.验证数据
            if (context.Request.Params["verification_code"].ToString() != context.Session["ValidateCode"].ToString())
            {
                AjaxMsgHelper.AjaxMsg("err", "输入验证码不正确");
                context.Response.End();
            }

            //2.使用实体,封装数据
            MODEL.Users userModel = new MODEL.Users()
            {
                UName = context.Request.Params["user_name"],
                ULoginName = context.Request.Params["login_name_n"],
                UPwd = DataHelper.MD5(context.Request.Params["password_first"]),
                UAddtime = DateTime.Now,
                UIsDel = false
            };
            //3.调用业务层对象,封装数据
            BLL.Users users = new BLL.Users();

            //把新注册的用户的ID存入session中
            try
            {
                int CurrentNewUserID = users.Add(userModel);
                MODEL.Users new_user = new BLL.Users().GetModel(CurrentNewUserID);
                context.Session["User_Info"] = new_user;
                //context.Response.Redirect("/View/MsgList.aspx");这么做是没有意义的,浏览器不会跳转,因为这只不过是个异步对象
                AjaxMsgHelper.AjaxMsg("302", "注册成功", null, "home_template.html");
                context.Response.End();
            }
            catch (Exception e)
            {
                throw;
            }
        }
Exemple #35
0
        public void ProcessRequest(HttpContext context)
        {
            this.context = context;
            if (Session["uinfo"] == null)
            {
                if (Request.Cookies["uinfo"] == null)
                {
                    //AjaxMsgHelper.AjaxMsg("状态", "您还没登陆", null, "Login.html");
                    PageHelper.WriteJsMsg("您还没登陆", "Login.html");
                    Response.End();
                }
                else
                {
                    string strId = Request.Cookies["uinfo"].Value;
                    Session["uinfo"] = new BLL.Users().GetModel(int.Parse(strId));

                }
            }
            SonLoad();
        }