コード例 #1
0
        public static bool login(string url, string UserName, string Password, out string Name, out string LoginName, out int?SystemRole, out string DepartmentId)
        {
            try
            {
                Password = Encryptor.MD5Hash(Password);
                string apiUrlUser = Utilities.BASE_URL + "/api/Users";

                object input = new
                {
                    Name = UserName.Trim(),
                    Pass = Password.Trim()
                };
                string    inputJson = (new JavaScriptSerializer()).Serialize(input);
                WebClient client    = new WebClient();
                client.Headers["Content-type"] = "application/json";
                client.Encoding = Encoding.UTF8;
                string json                = client.UploadString(apiUrlUser + "/ValidateUserNameAndPassword?userName="******"&password="******"/GetUser?userName="******"&password="******"Error.txt";


                using (StreamWriter writer = new StreamWriter(filePath, true))
                {
                    writer.WriteLine("-----------------------------------------------------------------------------");
                    writer.WriteLine("Date : " + DateTime.Now.ToString());
                    writer.WriteLine();

                    while (ex != null)
                    {
                        writer.WriteLine(ex.GetType().FullName);
                        writer.WriteLine("Message : " + ex.Message);
                        writer.WriteLine("StackTrace : " + ex.StackTrace);

                        ex = ex.InnerException;
                    }
                }
                throw;
            }
        }
コード例 #2
0
        public static List <UserGrid> ShowCommitteeMembersForNew(int userId)
        {
            List <UserGrid> UserGrid = new List <UserGrid>();
            string          apiUrl3  = Utilities.BASE_URL + "/api/CommitteesMembers";

            WebClient client = new WebClient();

            client.Headers["Content-type"] = "application/json";
            client.Encoding = Encoding.UTF8;

            Committee.Models.User user = (new JavaScriptSerializer()).Deserialize <User>(client.DownloadString(apiUrl3 + "/GetMemberForGrid?userId=" + userId));

            UserGrid.Add(new UserGrid()
            {
                رقم_العضو = user.ID, اسم_العضو = user.Name, رقم_الجوال = user.Phone, البريد_الالكترونى = user.UserEmailId, جهة_العمل = user.WorkSide, الدور = "عضو"
            });
            return(UserGrid);
        }