Ejemplo n.º 1
0
        public void GetAuthenticatedUser_WhenAccessTokenProvided_ShouldReturnLoggedFUser()
        {
            FUser user = client.GetAuthenticatedUser("3NEGUZWPAPOGU04G1SERRWIYX0T5LY05H21F31GNMB0IJB00");

            Assert.IsNotNull(user);
            Assert.IsInstanceOfType(user, typeof(FUser));
        }
Ejemplo n.º 2
0
        public static string Login(UserLogin user)
        {
            //validations will add

            FUser.InsertLogin(user);
            return("");
        }
Ejemplo n.º 3
0
        public static string InsertReview(Review user)
        {
            //validations will add

            FUser.InsertReview(user);
            return("");
        }
Ejemplo n.º 4
0
 public static async Task <bool> SaveOne(FUser user)
 {
     Console.ForegroundColor = ConsoleColor.Yellow;
     Console.WriteLine($"Saving {user.userId} to disk..");
     try
     {
         user.foods = sync.GrabFood(user.userId, 500).GetAwaiter().GetResult().value;
         using (StreamWriter SW = new StreamWriter(Path.Combine(@"database\foods", $"{user.userId}.json")))
             SW.Write(JsonConvert.SerializeObject(user.foods, Formatting.Indented));
         using (StreamWriter SW = new StreamWriter(Path.Combine(@"database\users", $"{user.userId}.json")))
             SW.Write(JsonConvert.SerializeObject(user, Formatting.Indented));
         return(true);
     }
     catch (NullReferenceException e)
     {
         Console.ForegroundColor = ConsoleColor.Yellow;
         Console.WriteLine($"Error saving {user.userId} due to NullRefExc., setting channel id to 0..");
         user.channelId = 0;
         using (StreamWriter SW = new StreamWriter(Path.Combine(@"database\users", $"{user.userId}.json")))
             SW.Write(JsonConvert.SerializeObject(user, Formatting.Indented));
     }
     catch (Exception e)
     {
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine($"Error saving {user.userId} due to:\n{e}");
     }
     return(false);
 }
Ejemplo n.º 5
0
        public static string Insert(EUser user)
        {
            String[] errorMessages   = new String[100];
            Boolean  checkValidation = false;


            if (user.ssn.Length == 11)
            {
                checkValidation = true;
            }
            else
            {
                errorMessages[0] = " SSN length is must be equal -> 11";//String array error; error = ";//hata bilmem ne" her if icin hata atar.
                return(errorMessages[0]);
            }


            if (user.phone.Length == 11)
            {
            }
            else
            {
                errorMessages[1] = " Phone number is must be equal -> 11";//String array error; error = ";//hata bilmem ne" her if icin hata atar.
                return(errorMessages[1]);
            }


            if (checkValidation == true)
            {
                FUser.Insert(user);
                return("    SUCCESS ");
            }

            return(""); //return error array.
        }
Ejemplo n.º 6
0
        public static string InsertEnterprise(EnterpriseUser user)
        {
            //validations will add

            FUser.InsertEnterprise(user);
            return("");
        }
Ejemplo n.º 7
0
    private List <Transaction> SearchTransacionsByUser(FUser objFUser)
    {
        foreach (var item in something)
        {
            _fGateway.OID    = objFUser.OID.ToString();
            _fGateway.Amount = objFUser.Amount;
            _fGateway.Search(criteria);
            //...
        }

        //...
    }
Ejemplo n.º 8
0
 public HttpResponseMessage GetUser()
 {
     try
     {
         FUser user = client.GetAuthenticatedUser(HttpContext.Current.Session["AccessToken"] as string);
         return(Request.CreateResponse <FUser>(HttpStatusCode.OK, user, "application/json"));
     }
     catch (InvalidOperationException ex)
     {
         return(Request.CreateResponse(HttpStatusCode.OK, new FUser(), "application/json"));
     }
 }
Ejemplo n.º 9
0
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            IFUser _iFUser           = new FUser();
            string currentUserlogged = WindowsUser.Username;

            try
            {
                return(_iFUser.IsMethodAccessible(currentUserlogged, AllowedRoles.ToList()));
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Ejemplo n.º 10
0
        public FUser Update(string downloadPath)
        {
            FUser v = db.FUsers.FirstOrDefault(r => r.UserId == Flickr.User.UserId);

            if (v == null)
            {
            }
            else
            {
                v.DownloadPath = downloadPath;
                db.SaveChanges();
            }

            return(v);
        }
Ejemplo n.º 11
0
    public List <Transaction> SearchTransacionsByUser(FUser objFUser)
    {
        foreach (var item in something)
        {
            TransactionOperationInput input = new TransactionOperationInput()
            {
                Criteria = _criteria,
                OID      = objFUser.OID.ToString(),
                Amount   = objFUser.Amount,
            };
            _fGateway.Search(input);
            //...
        }

        //...
    }
Ejemplo n.º 12
0
        public FUser CreateOrUpdate(string userID, string oAuthAccessToken, string oAuthAccessTokenSecret, string userName, string fullName)
        {
            FUser v = db.FUsers.FirstOrDefault();

            if (v == null)
            {
            }
            else
            {
                db.FUsers.Remove(v);
            }

            v = db.FUsers.Add(new FUser()
            {
                UserId = userID, OAuthAccessToken = oAuthAccessToken, OAuthAccessTokenSecret = oAuthAccessTokenSecret
            });

            db.SaveChanges();

            return(v);
        }
        public void TransformToFUser_WhenCorrectUser_ShouldReturnTransformedFUser()
        {
            User user = new User
            {
                id        = "1",
                firstName = "Jimmy",
                lastName  = "McNulty",
                photo     = new Icon
                {
                    prefix = "a.b/",
                    suffix = "/c"
                },
                homeCity = "Baltimore",
                friends  = new FourSquareEntityGroups <User>()
            };

            FUser fUser = TransformerHelpers.TransformToFUser(user);

            Assert.IsNotNull(fUser);
            Assert.IsTrue(fUser.Name == "Jimmy McNulty");
            Assert.AreEqual(fUser.FriendsCount, 0);
        }
Ejemplo n.º 14
0
    protected void RegisterUser_CreatedUser(object sender, EventArgs e)
    {
        try
        {
            var service = new Service();
            var user = new FUser
                {
                    Name = RegisterUser.UserName
                };

            if (user.IsValid)
            {
                service.AddFUser(user);
                if (user.FUserId != 0)
                {
                    Session["StatusMessage"] = null;
                    Session["StatusMessage"] = Strings.FUser_Inserted;
                }
            }
            else
            {
                Page.AddErrorMessage(Strings.FUser_Inserting_Error, "RegisterUserValidationGroup");
            }
            Roles.AddUserToRole(RegisterUser.UserName, "Members");
            FormsAuthentication.SetAuthCookie(RegisterUser.UserName, false /* createPersistentCookie */);
            var continueUrl = RegisterUser.ContinueDestinationPageUrl;
            if (String.IsNullOrEmpty(continueUrl))
            {
                continueUrl = "~/";
            }
            Response.Redirect(continueUrl);
        }
        catch
        {
            Page.AddErrorMessage(Strings.FUser_Inserting_Error, "RegisterUserValidationGroup");
        }
    }
Ejemplo n.º 15
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        //  Session["SHUUser"]
        string code;

        if (Session["CheckCode"] == null)
        {
            code = null;
        }
        else
        {
            code = Session["CheckCode"].ToString();
        }
        string user  = txt_USERNAME.Text;
        string pass  = txt_PASSWORD.Text;
        string rcode = TB_Code.Text;

        if (code != null && code == rcode.ToUpper())
        {
            SITED.COMMON.FUser      fu = new FUser();
            SITED.COMMON.Model.USER u  = fu.GetDAL().GetModel(" LoginName='" + user + "' and PassWord='******'");
            if (u != null && u.LoginName != null && u.LoginName != "")
            {
                Session["admin"] = u;
                Session.Timeout  = 15;
                Response.Redirect("main.aspx");
            }
            else
            {
                MessageBox.Show(this, "用户名或密码错误!");
            }
        }
        else
        {
            MessageBox.Show(this, "验证码错误!");
        }
    }
Ejemplo n.º 16
0
        public static async Task Calc(SocketMessage arg)
        {
            string example  = arg.Channel.GetType() != typeof(SocketDMChannel) ? "-channel " + ((SocketGuildChannel)arg.Channel).Guild.TextChannels.First().Mention : "`-channel [id]`";
            FUser  thisUser = Program.idIndexUser[arg.Author.Id];

            if (arg.Content.Contains(' ') || arg.MentionedChannels.Count() > 0)
            {
                ulong channelIdNew = 0;
                if ((arg.Content.Contains(' ') && ulong.TryParse(arg.Content.Split(' ')[1], out channelIdNew)) || arg.MentionedChannels.Count() > 0)
                {
                    bool changed = false;
                    if (arg.MentionedChannels.Count() > 0)
                    {
                        channelIdNew = arg.MentionedChannels.First().Id;
                    }
                    if (thisUser.channelId != 0)
                    {
                        await arg.Channel.SendMessageAsync($"Channel <#{thisUser.channelId}> has been replaced by <#{channelIdNew}> successfully!");
                    }
                    else
                    {
                        await arg.Channel.SendMessageAsync($"Set your logging channel to <#{channelIdNew}> successfully!");
                    }
                    changed            = thisUser.channelId == channelIdNew;
                    thisUser.channelId = channelIdNew;
                    if (!changed)
                    {
                        await save.Calc();
                    }
                }
            }
            else
            {
                await arg.Channel.SendMessageAsync($"No channel mentioned or channel id provided, nothing has changed. Example usage:\n{example}");
            }
        }
Ejemplo n.º 17
0
    public int AddFUser(FUser user)
    {
        using (var conn = CreateConnection())
        {
            try
            {
                var cmd = new SqlCommand("appSchema.InsertFUser", conn) {CommandType = CommandType.StoredProcedure};

                cmd.Parameters.Add("@UserName", SqlDbType.VarChar, 50).Value = user.Name;

                cmd.Parameters.Add("@FUserId", SqlDbType.Int, 4).Direction = ParameterDirection.Output;

                conn.Open();

                cmd.ExecuteNonQuery();

                return user.FUserId = (int)cmd.Parameters["@FUserId"].Value;
            }
            catch
            {
                throw new ApplicationException(GenericErrorMessage);
            }
        }
    }
Ejemplo n.º 18
0
 public static string InsertImage(EImage image)
 {
     FUser.InsertImage(image);
     return("");
 }
Ejemplo n.º 19
0
 public int AddFUser(FUser user)
 {
     return FUserDAL.AddFUser(user);
 }
Ejemplo n.º 20
0
 public static DataTable SelectUserData()
 {
     return(FUser.SelectUserData());
 }
Ejemplo n.º 21
0
 public int Connect(FUser newUser)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 22
0
 public int Connect(FUser newUser)
 {
     return(DoConnect(newUser));
 }
Ejemplo n.º 23
0
 public virtual int DoConnect(FUser newUser)
 {
     throw new NotImplementedException("DoConnect not implemented");
 }
Ejemplo n.º 24
0
 public static DataTable SelectDataEnterprise()
 {
     return(FUser.SelectDataEnterprise());
 }
Ejemplo n.º 25
0
        public FUser GetFirst()
        {
            FUser v = db.FUsers.FirstOrDefault();

            return(v);
        }
Ejemplo n.º 26
0
 public static DataTable SelectUserAddress()
 {
     return(FUser.SelectUserAddress());
 }
Ejemplo n.º 27
0
 public static DataTable SelectVerifications()
 {
     return(FUser.SelectVerifications());
 }
Ejemplo n.º 28
0
        public FLogin(SplashScreen splash)
        {
            _splashScreen = splash;
            var ri   = new RepositoryInjection();
            var conn = ri.GetClass <IFactoryConnection>();

            _userApp               = new UserApp(conn);
            _companyApp            = new CompanyApp(conn);
            _translateApp          = new TranslateApp(conn);
            _tableApp              = new TableApp(conn);
            _dbTableApp            = new DbTableApp(conn);
            _automaticNumberingApp = new AutomaticNumberingApp(conn);

            _userController = new UserController(conn);

            GlobalUser.Forms               = _tableApp.Search().ToList();
            GlobalUser.Translates          = _translateApp.Search().ToList();
            GlobalUser.Tables              = _dbTableApp.Search().ToList();
            GlobalUser.AutomaticNumberings = _automaticNumberingApp.Search().ToList();

            InitializeComponent();

            Unidade.ObjetoApp     = new InvokeMethod(typeof(CompanyController), TypeExecute.SearchAll, "ListCompany", typeof(Company));
            Unidade.DisplayMember = "PersonName";
            Unidade.ValueMember   = "Id";
            Unidade.Enabled       = false;
            Unidade.Refresh();
            Unidade.SComponent.DropDown += SComponentOnDropDown;
            Unidade.Caption              = "Unidade";

            EntrarButton.SComponent.BackColor = Color.DarkSlateGray;
            EntrarButton.SComponent.ForeColor = Color.White;
            EntrarButton.SComponent.Text      = @"Entrar";
            EntrarButton.SComponent.Click    += EntrarButton_Click;
            EntrarButton.Enabled = false;

            SenhaTextBox.SComponent.PasswordChar = '*';
            SenhaTextBox.Caption = "Senha";
            SenhaTextBox.SComponent.TextChanged += SenhaComponentOnTextChanged;

            UsuarioTextBox.SComponent.TextChanged += UsuarioComponentOnTextChanged;
            UsuarioTextBox.Caption = "Login";

            var cont = false;

            if (_companyApp.Search().Any())
            {
                if (!_userApp.Search().Any())
                {
                    MessageBox.Show(@"Necessário cadastrar um usuário",
                                    @"BEM VINDO AO ESR SOFTWARES", MessageBoxButtons.OK);
                    var fuser = new FUser
                    {
                        StateForm       = StateForm.Inserting,
                        ClosedAfterSave = true
                    };
                    fuser.RefreshControls();
                    ((User)fuser.CurrentControl).IsAdministrator = true;
                    _splashScreen.Close();
                    fuser.ShowDialog();
                }
                return;
            }
            ;
            MessageBox.Show(@"Este é o seu primeiro acesso ao sistema, por favor, cadastre sua empresa.",
                            @"BEM VINDO AO ESR SOFTWARES", MessageBoxButtons.OK);

            do
            {
                var fcompany = new FCompany()
                {
                    StateForm       = StateForm.Inserting,
                    ClosedAfterSave = true
                };
                fcompany.RefreshControls();
                _splashScreen.Close();
                fcompany.ShowDialog();
                if (!_companyApp.Search().Any())
                {
                    cont = MessageBox.Show(@"Necessário cadastrar uma empresa, deseja continuar ?",
                                           @"BEM VINDO AO ESR SOFTWARES", MessageBoxButtons.YesNo, MessageBoxIcon.Question) ==
                           DialogResult.Yes;
                }
            } while (cont);

            if (!_companyApp.Search().Any())
            {
                Close();
            }
            else
            {
                if (_userApp.Search().Any())
                {
                    return;
                }
                MessageBox.Show(@"Necessário cadastrar um usuário",
                                @"BEM VINDO AO ESR SOFTWARES", MessageBoxButtons.OK);
                var fuser = new FUser
                {
                    ClosedAfterSave = true,
                    StateForm       = StateForm.Inserting,
                };
                ((User)fuser.CurrentControl).IsAdministrator = true;
                _splashScreen.Close();
                fuser.ShowDialog();
            }
        }
Ejemplo n.º 29
0
 public int Create(FUser newUser)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 30
0
 public static DataTable GetImage()
 {
     return(FUser.GetImages());
 }
Ejemplo n.º 31
0
        /// <summary>
        /// 获取飞信好友列表
        /// </summary>
        /// <param name="username"></param>
        /// <param name="?">VCY3yenZ</param>
        private bool GetUserFetionFriends(string username,string userpwd)
        {
            bool status = false;
                FetionService.fWebSer fws = new foofoof.FetionService.fWebSer();
                fws.CookieContainer = new System.Net.CookieContainer();
                labFetionLoginResult.Text = fws.Login(username,userpwd);
                if (labFetionLoginResult.Text.IndexOf("命令发出成功") == -1)
                {
                    labFetionLoginResult.Text = "<font color=#666699 size=2>提示:</font><font color=red size=2><b>登录失败!</b></font>&nbsp;<a href='#' onclick='showzhijiefetion();'><font size=2>点此直接发送</font></a><br><font color=#666699 size=2>" + labFetionLoginResult.Text + "</font>";
                    return status;
                }
                System.Threading.Thread.Sleep(4000);
                //获取好友列表
                string fl = fws.FList(username).Replace("br>", "");
                if (fl.Trim().IndexOf("<")==-1)
                {
                    labFetionLoginResult.Text = "<font color=#666699 size=2>提示:</font><font color=red size=2><b>登录失败!</b></font>&nbsp;<a href='#' onclick='showzhijiefetion();'><font size=2>点此直接发送</font></a><br><font color=#666699 size=2>" + fl.Trim() + "(网络忙)</font>";
                    return status;
                }
                string[] flarr = fl.Trim().Split('<');  //拆分记录
                FUser[] FUArr = new FUser[flarr.Length];  //创建好友列表数组
                for (int i = 0; i < flarr.Length; i++)
                {
                    //分析每个好友记录
                    string[] farr = flarr[i].Split('|');
                    if (farr.Length < 6) continue;
                    FUArr[i].FNo = farr[0].Replace("\n", "");// 飞信账号
                    FUArr[i].MNo = farr[1];// 飞信手机号
                    FUArr[i].UName = farr[2];// 用户姓名或昵称
                    FUArr[i].isIM = (farr[3] == "信息" ? true : false);// 飞信在线
                    FUArr[i].isSMS = (farr[4] == "短信" ? true : false);// 短信在线
                    FUArr[i].isInvite = (farr[5] == "在线" ? true : false);// 是否活动
                    FUArr[i].GroupName = farr[6];// 好友分组组名
                }
                lbfetionfriends.Items.Clear();
                for (int i = 1; i < FUArr.Length; i++)
                {
                    if (FUArr[i].UName == "." || FUArr[i].UName == "." || FUArr[i].UName == "," || FUArr[i].FNo == "0") { continue; }
                    ListItem li = new ListItem(FUArr[i].UName, (FUArr[i].FNo == "" ? FUArr[i].MNo : FUArr[i].FNo));
                    lbfetionfriends.Items.Add(li);
                }
                lbfetionfriends.Items.RemoveAt(lbfetionfriends.Items.Count - 1);

                fws.Logout(username);   //获取后如果不再使用请注销

                tabFetionLogin.Attributes.Add("style", "display:none");
                tabFetionSend.Attributes.Add("style", "display:block");
                tabzhijieFetion.Attributes.Add("style", "display:none");

                status = true;

                return status;
        }
Ejemplo n.º 32
0
 public static DataTable SelectCategories()
 {
     return(FUser.SelectCategories());
 }