Ejemplo n.º 1
0
        private void ButtonSelectExcelAndImport_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog();

            fileDialog.Filter      = "All files (*.*)|*.xlsx";
            fileDialog.FilterIndex = 1;
            fileDialog.Title       = "选择要导入的EXCEL文件";
            if (fileDialog.ShowDialog() == true)
            {
                FundBll fundBll = new FundBll();
                Result  result  = fundBll.ImportFunds(fileDialog.FileName);
                if (result.IsSuccess)
                {
                    MessageBox.Show(string.Format("数据导入成功!\n" + (result as Result <Dictionary <string, string> >).Tag.ToMsg()));
                }
                else
                {
                    MessageBox.Show(result.ErrorMsg);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Login
        /// </summary>
        /// <param name="username"></param>
        /// <param name="pswd"></param>
        private void DoLogin(string username, string pswd, bool persist)
        {
            string errMsg   = string.Empty;
            string strWhere = " EmailAddress='" + username + "'";
            List <eChartProject.Model.eChart.fund> user = FundBll.GetModelList(strWhere);


            if (user != null && user.Count > 0)
            {
                ClientUserInfo clientUserInfo = new ClientUserInfo();
                clientUserInfo.Email  = user[0].EmailAddress;
                clientUserInfo.FundID = user[0].ID;

                strWhere = " FundID=" + clientUserInfo.FundID + " and isclientadded=0  and FundBankAccountNo = '" + pswd + "'";
                List <eChartProject.Model.eChart.fundbankaccount> fundbank = FundBankAccountBll.GetModelList(strWhere);

                if (fundbank != null && fundbank.Count > 0)
                {
                    SessionInfo.ClientUserInfo = clientUserInfo;

                    FormsAuthentication.SetAuthCookie(clientUserInfo.FundID.ToString(), persist);
                    Response.Write("success");
                    Response.End();
                }
                else
                {
                    errMsg = "The email or the password is invalid.";
                    Response.Write(errMsg);
                    Response.End();
                }
            }
            else
            {
                errMsg = "The email or the password is invalid.";
                Response.Write(errMsg);
                Response.End();
            }
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //display the Supporter's info
            eChartProject.BLL.eChart.accounts_users bll = new eChartProject.BLL.eChart.accounts_users();
            string strWhere = " 1=1 order by UserID desc";
            List <eChartProject.Model.eChart.accounts_users> user = bll.GetModelList(strWhere);

            if (user != null && user.Count > 0)
            {
                UserInfo userInfo = new UserInfo();
                userInfo.Email      = user[0].Email;
                userInfo.Password   = user[0].Password;
                userInfo.UserId     = user[0].UserID;
                userInfo.Age        = (int)user[0].Age;
                userInfo.City       = user[0].City;
                userInfo.Country    = user[0].Country;
                userInfo.UserName   = user[0].Username;
                userInfo.UserStatus = (int)user[0].UserStatus;

                SessionInfo.UserInfo = userInfo;

                this.txtName.Value    = userInfo.UserName;
                this.txtGender.Value  = userInfo.Gender == "true"?"F":"M";
                this.txtCountry.Value = userInfo.Country;
                this.txtCity.Value    = userInfo.City;
                this.txtAge.Value     = userInfo.Age.ToString() + " yrs";
                TextName.InnerText    = userInfo.UserName;
            }
            //GET CLIENT USER'S COOKIE INFORMATION
            string     cookieName = FormsAuthentication.FormsCookieName;
            HttpCookie authCookie = Context.Request.Cookies[cookieName];

            if (authCookie != null)
            {
                FormsAuthenticationTicket authTicket = null;

                authTicket = FormsAuthentication.Decrypt(authCookie.Value);

                FormsIdentity identity = new FormsIdentity(authTicket);

                string fundID = identity.Name;
                int    outresult;
                if (int.TryParse(fundID, out outresult))
                {
                    strWhere = " ID=" + fundID;
                    List <eChartProject.Model.eChart.fund> user2 = FundBll.GetModelList(strWhere);


                    if (user != null && user.Count > 0)
                    {
                        ClientUserInfo clientUserInfo = new ClientUserInfo();
                        clientUserInfo.Email  = user2[0].EmailAddress;
                        clientUserInfo.FundID = user2[0].ID;

                        strWhere = " FundID=" + clientUserInfo.FundID + " and isclientadded=0  ";
                        List <eChartProject.Model.eChart.fundbankaccount> fundbank = FundBankAccountBll.GetModelList(strWhere);

                        if (fundbank != null && fundbank.Count > 0)
                        {
                            clientUserInfo.Pswd        = fundbank[0].FundBankAccountNo;
                            SessionInfo.ClientUserInfo = clientUserInfo;

                            txtEmail.Value = clientUserInfo.Email;
                            txtPassword.Attributes.Add("value ", clientUserInfo.Pswd);
                            btnLogin.Style["display"]   = "none";
                            ddRemember.Style["display"] = "none";

                            lbtnLogout.Style["display"]        = "inline";
                            ValidationSummary.Style["display"] = "none";
                            PrivateValidation.Style["display"] = "inline";
                        }
                        else
                        {
                            lbtnLogout.Style["display"] = "none";
                        }
                    }
                    else
                    {
                        lbtnLogout.Style["display"] = "none";
                    }
                }
                else
                {
                    lbtnLogout.Style["display"] = "none";
                }
            }
            else
            {
                lbtnLogout.Style["display"] = "none";
            }

            InitializeLearnMORE();
        }