Beispiel #1
0
        public string InsertNote(Notes Info)
        {
            string Result = string.Empty;

            try
            {
                using (SqlConnection con = new SqlConnection(conn))
                {
                    SqlCommand com = new SqlCommand("[dbo].[Insert_Note]", con);
                    com.CommandType = CommandType.StoredProcedure;
                    com.Parameters.AddWithValue("@UID", Info.UserID_Fk);
                    com.Parameters.AddWithValue("@Note", Info.Note);

                    com.Parameters.Add("@ID", SqlDbType.BigInt).Direction = ParameterDirection.Output;
                    con.Open();
                    if (com.ExecuteNonQuery() > 0)
                    {
                        string id = com.Parameters["@ID"].Value.ToString();
                        Result = "Success!" + id;
                    }
                    else
                    {
                        Result = "Failed! ";
                    }
                    con.Close();
                }
            }
            catch (Exception ex)
            {
                WriteLogFile.WriteErrorLog("Error.txt", ex.Message);
            }
            return(Result);
        }
Beispiel #2
0
        public List <EventComment> GetEventComments(long id)
        {
            List <EventComment> Result = new List <EventComment>();

            try
            {
                using (SqlConnection con = new SqlConnection(conn))
                {
                    SqlCommand com = new SqlCommand("SP_GetAllEventCommentByEventID", con);
                    com.Parameters.AddWithValue("@EventID", id);
                    com.CommandType = CommandType.StoredProcedure;
                    con.Open();
                    SqlDataReader reader = com.ExecuteReader();
                    while (reader.Read())
                    {
                        EventComment temp = new EventComment();
                        temp.CommentID   = Convert.ToInt16(reader["ID"]);
                        temp.Text        = Convert.ToString(reader["Text"]);
                        temp.CreatedDate = Convert.ToDateTime(reader["InsertedDate"]);
                        temp.StudentName = Convert.ToString(reader["Student_Name"]);
                        temp.TeacherName = Convert.ToString(reader["TeacherName"]);
                        temp.IsStudent   = Convert.ToBoolean(reader["IsStudent"]);
                        Result.Add(temp);
                    }
                    con.Close();
                }
            }
            catch (Exception ex)
            {
                WriteLogFile.WriteErrorLog("Error.txt", ex.Message);
            }
            return(Result);
        }
Beispiel #3
0
        public List <ExamDetails_Newsfeed> ExamForNewsfeed()
        {
            List <ExamDetails_Newsfeed> Result = new List <ExamDetails_Newsfeed>();

            try
            {
                using (SqlConnection con = new SqlConnection(conn))
                {
                    string     query = @"select ID,Exam,ExamDate from admin.ExamDetails where ExamDate>=getdate() and Status=1 order by ExamDate asc";
                    SqlCommand cmd   = new SqlCommand(query, con);

                    con.Open();
                    SqlDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        ExamDetails_Newsfeed temp = new ExamDetails_Newsfeed();
                        temp.ID       = Convert.ToInt32(reader["ID"]);
                        temp.Exam     = Convert.ToString(reader["Exam"]);
                        temp.tempdate = Convert.ToString(reader["ExamDate"]);

                        Result.Add(temp);
                    }
                    con.Close();
                }
            }
            catch (Exception ex)
            {
                WriteLogFile.WriteErrorLog("Error.txt", ex.Message);
            }
            return(Result);
        }
Beispiel #4
0
        public CollegeDay GetCollegeEventDetailsByID(long id)
        {
            CollegeDay Result = new CollegeDay();

            try
            {
                using (SqlConnection con = new SqlConnection(conn))
                {
                    SqlCommand com = new SqlCommand("SP_GetCollegeEventDetails", con);
                    com.Parameters.AddWithValue("@id", id);
                    com.CommandType = CommandType.StoredProcedure;

                    con.Open();
                    SqlDataReader reader = com.ExecuteReader();
                    while (reader.Read())
                    {
                        Result.ID          = Convert.ToInt16(reader["NxtCollege_ID"]);
                        Result.video       = Convert.ToString(reader["NxtCollege_Video"]);
                        Result.CollegeName = Convert.ToString(reader["NxtCollege_Name"]);
                        Result.EventDate   = Convert.ToDateTime(reader["NxtCollege_AddedDate"]);
                        break;
                    }
                    con.Close();
                }
            }
            catch (Exception ex)
            {
                WriteLogFile.WriteErrorLog("Error.txt", ex.Message);
            }
            return(Result);
        }
Beispiel #5
0
        public Event GetEventDetailsByID(long id)
        {
            Event Result = new Event();

            try
            {
                using (SqlConnection con = new SqlConnection(conn))
                {
                    SqlCommand com = new SqlCommand("SP_GetEventDetails", con);
                    com.Parameters.AddWithValue("@id", id);
                    com.CommandType = CommandType.StoredProcedure;
                    con.Open();
                    SqlDataReader reader = com.ExecuteReader();
                    while (reader.Read())
                    {
                        Result.ID        = Convert.ToInt16(reader["ID"]);
                        Result.Title     = Convert.ToString(reader["Title"]);
                        Result.EventDate = Convert.ToDateTime(reader["EventDate"]);
                        Result.IsActive  = Convert.ToBoolean(reader["IsActive"]);
                        Result.EventData = Convert.ToString(reader["EventData"]);
                        break;
                    }
                    con.Close();
                }
            }
            catch (Exception ex)
            {
                WriteLogFile.WriteErrorLog("Error.txt", ex.Message);
            }
            return(Result);
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            // Depends on Condition, we can Perform the different Actions for sending Email, SMS, and Writing Log File

            string actionRequired = ""; // Assign Value to string according to Requirement.

            Watcher watcher = null;

            switch (actionRequired)
            {
            case "LogFile":
                WriteLogFile writeLog = new WriteLogFile();
                watcher = new Watcher(writeLog);
                watcher.Notify("Write in log File");
                break;

            case "SendEmail":
                SendEmail email = new SendEmail();
                watcher = new Watcher(email);
                watcher.Notify("Send Email");
                break;

            case "SendSms":
                SendSMS sms = new SendSMS();
                watcher = new Watcher(sms);
                watcher.Notify("Send SMS");
                break;

            default:
                Console.WriteLine("No Watcher Selected");
                break;
            }

            Console.ReadKey();
        }
Beispiel #7
0
        public List <Event> GetEventPastData()
        {
            List <Event> Result = new List <Event>();

            try
            {
                using (SqlConnection con = new SqlConnection(conn))
                {
                    SqlCommand com = new SqlCommand("SP_GetAllEventPast", con);
                    com.CommandType = CommandType.StoredProcedure;
                    con.Open();
                    SqlDataReader reader = com.ExecuteReader();
                    while (reader.Read())
                    {
                        Event temp = new Event();
                        temp.ID         = Convert.ToInt16(reader["ID"]);
                        temp.Title      = Convert.ToString(reader["Title"]);
                        temp.Event_Date = Convert.ToString(reader["EventDate"]);
                        temp.IsActive   = Convert.ToBoolean(reader["IsActive"]);
                        temp.EventData  = Convert.ToString(reader["EventData"]);
                        Result.Add(temp);
                    }
                    con.Close();
                }
            }
            catch (Exception ex)
            {
                WriteLogFile.WriteErrorLog("Error.txt", ex.Message);
            }
            return(Result);
        }
        public AssignRolesToUserOutput AssignRolesToUser(AssignRolesToUserInput input)
        {
            try
            {
                RestHTTP    http = new RestHTTP();
                RestRequest req  = new RestRequest("api/accounts/assignRolesToUser", RestSharp.Method.POST);
                req.AddHeader("Content-Type", "application/json");
                req.AddHeader("Authorization", "Bearer " + input.AccessToken);
                req.AddJsonBody(input);


                var response = http.HttpPost <object>(req);

                AssignRolesToUserOutput output = new AssignRolesToUserOutput();
                output.Id = JsonConvert.DeserializeObject <string>(response.ToString());

                return(output);
            }
            catch (Exception ex)
            {
                WriteLogFile.Append("AssignRolesToUser : ");
                WriteLogFile.Append(ex.Message);
                WriteLogFile.Append(ex.StackTrace);
            }
            return(null);
        }
        public UpdateUserInfoOutput UpdateUserInfo(UpdateUserInfoInput input)
        {
            try
            {
                RestHTTP    http = new RestHTTP();
                RestRequest req  = null;
                if (!string.IsNullOrEmpty(input.Id))
                {
                    req = new RestRequest("api/accounts/update", RestSharp.Method.POST);
                }

                req.AddHeader("Authorization", "Bearer " + input.AccessToken);
                req.RequestFormat = DataFormat.Json;
                req.AddJsonBody(input);

                var response = http.HttpPost <UpdateUserInfoOutput>(req);

                return(response);
            }
            catch (Exception ex)
            {
                WriteLogFile.Append("UpdateUserInfo : ");
                WriteLogFile.Append(ex.Message);
                WriteLogFile.Append(ex.StackTrace);
                return(default(UpdateUserInfoOutput));
            }
        }
Beispiel #10
0
        public GetAllUsersOutput GetAllUsers(GetAllUsersInput input)
        {
            try
            {
                RestHTTP    http = new RestHTTP();
                RestRequest req  = null;
                req = new RestRequest("api/accounts/users", RestSharp.Method.POST);

                req.AddHeader("Authorization", "Bearer " + input.AccessToken);
                req.RequestFormat = DataFormat.Json;
                RestSharp.RestClient client = new RestSharp.RestClient(WebConfigurationManager.AppSettings["AuthServerAPI"]);
                var response = client.Execute <GetAllUsersOutput>(req);

                GetAllUsersOutput output = new GetAllUsersOutput();
                output.Users = JsonConvert.DeserializeObject <List <GetUserInfoModel> >(response.Content, new ClaimConverter());

                return(output);
            }
            catch (Exception ex)
            {
                WriteLogFile.Append("GetAllUsers : ");
                WriteLogFile.Append(ex.Message);
                WriteLogFile.Append(ex.StackTrace);
                return(default(GetAllUsersOutput));
            }
        }
Beispiel #11
0
        public List <CollegeDay> GetAllNextCollegeUpcoming()
        {
            List <CollegeDay> Result = new List <CollegeDay>();

            try
            {
                using (SqlConnection con = new SqlConnection(conn))
                {
                    SqlCommand com = new SqlCommand("SP_GetAllNextCollegeUpcoming", con);
                    com.CommandType = CommandType.StoredProcedure;
                    con.Open();
                    SqlDataReader reader = com.ExecuteReader();
                    while (reader.Read())
                    {
                        CollegeDay temp = new CollegeDay();
                        temp.ID          = Convert.ToInt16(reader["NxtCollege_ID"]);
                        temp.CollegeName = Convert.ToString(reader["NxtCollege_Name"]);
                        temp.Event_Date  = Convert.ToString(reader["NxtCollege_AddedDate"]);
                        temp.IsUpcoming  = Convert.ToBoolean(reader["IsUpcoming"]);
                        Result.Add(temp);
                    }
                    con.Close();
                }
            }
            catch (Exception ex)
            {
                WriteLogFile.WriteErrorLog("Error.txt", ex.Message);
            }
            return(Result);
        }
Beispiel #12
0
        public List <TeacherNote> GetTeacherNotes(long TeacherID_FK)
        {
            List <TeacherNote> Result = new List <TeacherNote>();

            try
            {
                using (SqlConnection con = new SqlConnection(conn))
                {
                    SqlCommand com = new SqlCommand("[teacher].[SP_GetTeacherNotes]", con);
                    com.CommandType = CommandType.StoredProcedure;
                    com.Parameters.AddWithValue("@TeacherID", TeacherID_FK);
                    con.Open();
                    SqlDataReader reader = com.ExecuteReader();
                    while (reader.Read())
                    {
                        TeacherNote temp = new TeacherNote();
                        temp.ID          = Convert.ToInt32(reader["ID"]);
                        temp.Note        = Convert.ToString(reader["Note"]);
                        temp.CreatedDate = Convert.ToDateTime(reader["CreatedDate"]);
                        Result.Add(temp);
                    }
                    con.Close();
                }
            }
            catch (Exception ex)
            {
                WriteLogFile.WriteErrorLog("Error.txt", ex.Message);
            }
            return(Result);
        }
        //Public Methods
        public GetAllRolesOutput GetAllRoles(GetAllRolesInput input)
        {
            try
            {
                RestHTTP    http = new RestHTTP();
                RestRequest req  = new RestRequest("api/roles", RestSharp.Method.POST);
                req.AddHeader("Content-Type", "application/json");
                req.AddHeader("Authorization", "Bearer " + input.AccessToken);
                req.AddJsonBody(input);

                RestSharp.RestClient client = new RestSharp.RestClient(WebConfigurationManager.AppSettings["AuthServerAPI"]);
                var response            = client.Execute <List <RoleModel> >(req);
                List <RoleModel> result = JsonConvert.DeserializeObject <List <RoleModel> >(response.Content);

                GetAllRolesOutput output = new GetAllRolesOutput();
                output.Roles = result;

                return(output);
            }
            catch (Exception ex)
            {
                WriteLogFile.Append("GetAllRoles : ");
                WriteLogFile.Append(ex.Message);
                WriteLogFile.Append(ex.StackTrace);
            }
            return(null);
        }
Beispiel #14
0
        public List <TimeTable> GetAllTimeTableList(long ID)
        {
            List <TimeTable> Result = new List <TimeTable>();

            try
            {
                using (SqlConnection con = new SqlConnection(conn))
                {
                    SqlCommand com = new SqlCommand("[teacher].[SP_GetTimeTable]", con);
                    com.CommandType = CommandType.StoredProcedure;
                    com.Parameters.AddWithValue("@ID", ID);
                    con.Open();
                    SqlDataReader reader = com.ExecuteReader();
                    while (reader.Read())
                    {
                        TimeTable temp = new TimeTable();
                        temp.ID        = Convert.ToInt32(reader["ID"]);
                        temp.TeacherID = Convert.ToInt32(reader["TeacherID"]);
                        temp.WeekID    = Convert.ToInt32(reader["WeekID"]);
                        temp.TimeID    = Convert.ToInt32(reader["TimeID"]);
                        temp.Day       = Convert.ToString(reader["Day"]);
                        temp.SubID     = Convert.ToInt32(reader["SubID"]);
                        temp.Period    = Convert.ToString(reader["Period"]);
                        temp.Sub       = Convert.ToString(reader["Sub"]);
                        Result.Add(temp);
                    }
                    con.Close();
                }
            }
            catch (Exception ex)
            {
                WriteLogFile.WriteErrorLog("Error.txt", ex.Message);
            }
            return(Result);
        }
Beispiel #15
0
        public string InsertTeacherNote(TeacherNote Info)
        {
            string Result = string.Empty;

            try
            {
                using (SqlConnection con = new SqlConnection(conn))
                {
                    SqlCommand com = new SqlCommand("[teacher].[SP_InsertTeacherNote]", con);
                    com.CommandType = CommandType.StoredProcedure;
                    com.Parameters.AddWithValue("@TeacherID_FK", Info.TeacherID_FK);
                    com.Parameters.AddWithValue("@Note", Info.Note);
                    con.Open();
                    int LastRow = Convert.ToInt32(com.ExecuteScalar());
                    if (LastRow > 0)
                    {
                        Result = "Success!" + LastRow;;
                    }
                    else
                    {
                        Result = "Failed! ";
                    }
                    con.Close();
                }
            }
            catch (Exception ex)
            {
                WriteLogFile.WriteErrorLog("Error.txt", ex.Message);
            }
            return(Result);
        }
Beispiel #16
0
        public EditProfileTeacher EditProfile(long TID)
        {
            EditProfileTeacher result = new EditProfileTeacher();

            try
            {
                using (SqlConnection con = new SqlConnection(conn))
                {
                    string     Query = @"select IsNull(ID,'') AS TeacherID, IsNull(Name,'') As Name,IsNull(Email,'') AS Email,IsNull(Password,'') As Password,IsNull(Joining_Date,'') AS Joining_Date,IsNull(MObile_No,'') AS Mobile_NO,IsNUll(Profile_Image,'') AS Profile_Image from teacher.TeachersDetails where ID=@TeacherID";
                    SqlCommand com   = new SqlCommand(Query, con);
                    com.Parameters.AddWithValue("@TeacherID", TID);
                    // com.CommandType = CommandType.StoredProcedure;
                    con.Open();
                    SqlDataReader reader = com.ExecuteReader();
                    while (reader.Read())
                    {
                        result.Teacher_Name = Convert.ToString(reader["Name"]);
                        result.Email        = Convert.ToString(reader["Email"]);
                        result.Password     = Convert.ToString(reader["Password"]);
                        result.JoiningDate  = Convert.ToDateTime(reader["Joining_Date"]);

                        result.MobileNo     = Convert.ToString(reader["Mobile_NO"]);
                        result.ProfileImage = Convert.ToString(reader["Profile_Image"]);
                        result.ID           = Convert.ToInt32(reader["TeacherID"]);
                    }
                    con.Close();
                }
            }
            catch (Exception ex)
            {
                WriteLogFile.WriteErrorLog("Error.txt", ex.Message);
            }
            return(result);
        }
Beispiel #17
0
        public List <AssignmentDueDate> GetAssignmentDetails(long TeacherID_FK)
        {
            List <AssignmentDueDate> Result = new List <AssignmentDueDate>();

            try
            {
                using (SqlConnection con = new SqlConnection(conn))
                {
                    SqlCommand com = new SqlCommand("[teacher].[SP_GetAssignmentDetails]", con);
                    com.CommandType = CommandType.StoredProcedure;
                    com.Parameters.AddWithValue("@TeacherID_FK", TeacherID_FK);
                    con.Open();
                    SqlDataReader reader = com.ExecuteReader();
                    while (reader.Read())
                    {
                        AssignmentDueDate temp = new AssignmentDueDate();
                        //temp.ID = Convert.ToInt32(reader["ID"]);
                        temp.Subject  = Convert.ToString(reader["Subject"]);
                        temp.Chapter  = Convert.ToString(reader["Chapter"]);
                        temp.Standard = Convert.ToInt32(reader["Standard"]);
                        temp.SetDate  = Convert.ToDateTime(reader["SetDate"]);
                        temp.DueDate  = Convert.ToDateTime(reader["DueDate"]);
                        Result.Add(temp);
                    }
                    con.Close();
                }
            }
            catch (Exception ex)
            {
                WriteLogFile.WriteErrorLog("Error.txt", ex.Message);
            }
            return(Result);
        }
Beispiel #18
0
        private void UploadS3()
        {
            try
            {
                LoginS3(S3UP);
                string uploadURL = "https://i.randstad.pt/PortalS3/UploadWizard.aspx?CloudClientId=4";
                //IWebElement i = S3.FindElement(By.Id("RandstadTheme_wt101_block_wtActions_wtbtnUpload"));
                //i.Click();
                S3UP.Navigate().GoToUrl(uploadURL);

                foreach (Settings.UploadFile item in setts.UploadFiles.Where(x => x.Refresh.ToLower() == "true"))
                {
                    try
                    {
                        string tempFile = item.Documento;
                        if (tempFile.Contains("{Now}"))
                        {
                            tempFile = tempFile.Replace("{Now}", DateTime.Now.AddDays(-1).ToString("dd-MM-yyyy"));
                        }
                        ExcelLink tempEx = new ExcelLink(tempFile); tempEx.RefreshAll();
                    }
                    catch (Exception ex)
                    {
                        continue;
                    }
                }
                foreach (Settings.UploadFile item in setts.UploadFiles.Where(x => x.Active == "true" || x.Active == "True"))
                {
                    try
                    {
                        string tempFile = item.Documento;
                        if (tempFile.Contains("{Now}"))
                        {
                            tempFile = tempFile.Replace("{Now}", DateTime.Now.AddDays(-1).ToString("dd-MM-yyyy"));
                        }
                        // if (item.Refresh.ToLower() == "true") { ExcelLink tempEx = new ExcelLink(tempFile); tempEx.RefreshAll();  }
                        S3UP.FindElement(By.CssSelector("#WebPatterns_wt3_block_wtMainContent_wt2_wtfiles input[type=file]")).SendKeys(tempFile);
                    }
                    catch (Exception ex)
                    {
                        continue;
                    }
                }
                //WebPatterns_wt3_block_wtMainContent_wt2_wtTempUploadedFileTable
                System.Collections.ObjectModel.ReadOnlyCollection <IWebElement> t;
                do
                {
                    t = S3UP.FindElements(By.CssSelector(".qq-upload-list li"));
                } while (t.Count > 0);
                S3UP.FindElement(By.CssSelector(".qq-upload-button .button.Button")).Click();
            }
            catch (Exception ex)
            {
                WriteLogFile.WriteLog("LogS3.txt", String.Format("[{0}]:{1}->Function:Upload", DateTime.Now, ex.Message));
            }
            uploadDate = DateTime.Now.ToShortDateString();
        }
Beispiel #19
0
        public void DownloadS3()
        {
            try
            {
                setts = ser.Deserialize <Settings>((string)File.ReadAllText(@"Settings.xml"));
                if (nextRefreshS3 > DateTime.Parse(FimS3.Text))
                {
                    nextRefreshS3 = DateTime.Parse(InicioS3.Text);
                }
                else
                {
                    nextRefreshS3 = DateTime.Now.AddMinutes(Int32.Parse(intervaloS3.Text));
                }
                foreach (Settings.Clientes url in setts.ClientesList.Where(x => x.Active == "true"))
                {
                    try { S3.FindElement(By.Id("RandstadTheme_wt101_block_wtHeader_wt99_wt4_wtLogoutLink")).Click(); } catch {
                        //string uploadURL = "https://i.randstad.pt/PortalS3/UploadWizard.aspx?CloudClientId=4";
                        //S3.Navigate().GoToUrl(uploadURL);

                        //foreach (Settings.UploadFile item in setts.UploadFiles)
                        //{
                        //    string tempFile = item.Documento;
                        //    if (tempFile.Contains("{Now}")) tempFile = tempFile.Replace("{Now}", DateTime.Now.AddDays(-1).ToString("dd-MM-yyyy"));
                        //    S3.FindElement(By.CssSelector("#WebPatterns_wt3_block_wtMainContent_wt2_wtfiles input[type=file]")).SendKeys(tempFile);
                        // }
                    }
                    try { Thread.Sleep(1000); S3.Navigate().GoToUrl(DownSetts.Read("S3")); LoginS3(S3); } catch (Exception ex) { WriteLogFile.WriteLog("Log.txt", String.Format("[{0}]:{1}->Function:DownloadS3", DateTime.Now, ex.Message)); }
                    Thread.Sleep(1000);
                    S3.FindElement(By.Id("RandstadTheme_wt101_block_wtMainContent_WebPatterns_wt42_block_wtColumn1_wtStartDate")).Clear(); S3.FindElement(By.Id("RandstadTheme_wt101_block_wtMainContent_WebPatterns_wt42_block_wtColumn1_wtEndDate")).Clear();
                    S3.FindElement(By.Id("RandstadTheme_wt101_block_wtMainContent_WebPatterns_wt42_block_wtColumn1_wtStartDate")).SendKeys(DateTime.Now.Date.ToString("yyyy-MM-dd")); S3.FindElement(By.Id("RandstadTheme_wt101_block_wtMainContent_WebPatterns_wt42_block_wtColumn1_wtEndDate")).SendKeys(DateTime.Now.Date.ToString("yyyy-MM-dd"));
                    S3.FindElement(By.Id("RandstadTheme_wt101_block_wtMainContent_wt68")).Click(); //botao Filtrar

                    Thread.Sleep(1000);
                    System.Collections.ObjectModel.ReadOnlyCollection <IWebElement> options = S3.FindElements(By.CssSelector(".select2-results-dept-0.select2-result.select2-result-selectable"));
                    IWebElement item2 = options.Where(x => x.Text == url.Cliente).FirstOrDefault();
                    item2.Click();
                    Thread.Sleep(1000);
                    System.Collections.ObjectModel.ReadOnlyCollection <IWebElement> linhas = S3.FindElements(By.CssSelector("table.TableRecords.OSFillParent.OSAutoMarginTop tbody tr "));
                    foreach (IWebElement d in linhas)
                    {
                        IWebElement file = d.FindElement(By.CssSelector("td:nth-of-type(2)"));
                        if (File.Exists(pathDownloadS3.Text + "\\" + file.Text))
                        {
                            continue;
                        }
                        d.FindElement(By.CssSelector("td div:not(.OSAutoMarginTop) a")).Click();
                        Thread.Sleep(1000);
                    }
                    Thread.Sleep(1000);
                }
            }catch (Exception ex) { WriteLogFile.WriteLog("LogS3.txt", String.Format("[{0}]:{1}->Function:DownloadS3", DateTime.Now, ex.Message)); }
            ctrlS3 = true;
            S3.Navigate().GoToUrl(DownSetts.Read("S3"));
            delaytimeS3 = DateTime.Now.AddSeconds(30);
            // lastRunS3LB.Text = DateTime.Now.ToString();
        }
Beispiel #20
0
 //Takes near around 35 seconds to call onDisconnect
 public override Task OnDisconnected(bool stopCalled)
 {
     if (!stopCalled)
     {
         var userToBeRemove = _listUserConnetion.Find(o => o.ConnectionID == Context.ConnectionId);
         _listUserConnetion.Remove(userToBeRemove);
         WriteLogFile.WriteLog(string.Format("SignalR disconneted for Username: {0}, ConntectionId: {1}, User count: {2}", userToBeRemove.UserName, userToBeRemove.ConnectionID, _listUserConnetion.Count));
     }
     return(base.OnDisconnected(false));
 }
Beispiel #21
0
        public override Task OnReconnected()
        {
            var checkUserIsExists = _listUserConnetion.Find(o => o.ConnectionID == Context.ConnectionId);

            if (checkUserIsExists != null)
            {
                WriteLogFile.WriteLog(string.Format("Trying to reconnect SignalR for Username: {0}, ConntectionId: {1}, User count: {2}", checkUserIsExists.UserName, checkUserIsExists.ConnectionID, _listUserConnetion.Count));
                SendData(checkUserIsExists.ConnectionID);
            }
            return(base.OnReconnected());
        }
Beispiel #22
0
        public void DownloadCGI()
        {
            string baseUrl = DownSetts.Read("CGI");
            string mainURL = baseUrl + "download/";

            try { CGI.Navigate().GoToUrl(baseUrl); LoginCGI(); Thread.Sleep(1000); } catch (Exception ex) {
                WriteLogFile.WriteLog("Log.txt", String.Format("[{0}]:{1}->Function:DownloadCGI", DateTime.Now, ex.Message));
            }
            setts = ser.Deserialize <Settings>((string)File.ReadAllText(@"Settings.xml"));
            if (nextRefreshCGI > DateTime.Parse(FimCGI.Text))
            {
                nextRefreshCGI = DateTime.Parse(InicioCGI.Text);
            }
            else
            {
                nextRefreshCGI = DateTime.Now.AddMinutes(Int32.Parse(intervaloCGI.Text));
            }
            try
            {
                foreach (Settings.Links url in setts.DownloadLinks.Where(x => x.Active == "True" || x.Active == "true"))
                {
                    CGI.Navigate().GoToUrl(mainURL + url.Link); Thread.Sleep(4000);
                    IWebElement fileName = CGI.FindElement(By.CssSelector(".ui.small.animated.divided.selection.middle.aligned.list .item .header"));
                    string      path     = pathDownloadCGITxt.Text + "\\" + fileName.Text;
                    if (File.Exists(path))
                    {
                        continue;
                    }
                    IWebElement i = CGI.FindElement(By.CssSelector(".ui.green.mini.button"));
                    i.Click(); Thread.Sleep(4000);
                    if (File.Exists(path))
                    {
                        CGIalertas.Add(new Alertas()
                        {
                            Alerta = TipoAlerta.Sucesso, Ficheiro = fileName.Text, TimeError = DateTime.Now
                        });
                    }
                    else
                    {
                        CGIalertas.Add(new Alertas()
                        {
                            Alerta = TipoAlerta.Erro, Ficheiro = fileName.Text, TimeError = DateTime.Now
                        });
                    }
                }
            }
            catch (Exception ex) { WriteLogFile.WriteLog("Log.txt", String.Format("[{0}]:{1}->Function:DownloadCGI", DateTime.Now, ex.Message)); }
            ctrlCGI = true;
            CGI.Navigate().GoToUrl(baseUrl);
            delaytimeCGI = DateTime.Now.AddSeconds(30);
            //  lastRunCGILB.Text = DateTime.Now.ToString();
            this.lastRunCGILB.BeginInvoke((MethodInvoker) delegate() { this.lastRunCGILB.Text = DateTime.Now.ToString(); });
        }
Beispiel #23
0
        public string UpdateTeacherProfile(EditProfileTeacher Data)
        {
            string Result = string.Empty;

            try
            {
                using (SqlConnection con = new SqlConnection(conn))
                {
                    string Query = string.Empty;
                    if (Data.ProfileImage != null && Data.ProfileImage != "")
                    {
                        Query = @" update  [teacher].TeachersDetails set  Name=@TeacherName ,Email=@Email, Password=@Password, Joining_Date=@JoiningDate, MObile_No=@MobileNo, Profile_Image=@ProfileImage  where ID=@TeacherID ";
                    }
                    else
                    {
                        Query = @" update  [teacher].TeachersDetails set  Name=@TeacherName ,Email=@Email, Password=@Password, Joining_Date=@JoiningDate, MObile_No=@MobileNo  where ID=@TeacherID ";
                    }
                    SqlCommand com = new SqlCommand(Query, con);
                    //com.CommandType = CommandType.StoredProcedure;
                    com.Parameters.AddWithValue("@TeacherID", Data.ID);
                    com.Parameters.AddWithValue("@TeacherName", Data.Teacher_Name);
                    com.Parameters.AddWithValue("@Email", Data.Email);
                    com.Parameters.AddWithValue("@Password", Data.Password);



                    com.Parameters.AddWithValue("@JoiningDate", Data.JoiningDate);
                    com.Parameters.AddWithValue("@MobileNo", Data.MobileNo);

                    if (Data.ProfileImage != null && Data.ProfileImage != "")
                    {
                        com.Parameters.AddWithValue("@ProfileImage", Data.ProfileImage);
                    }


                    con.Open();
                    if (com.ExecuteNonQuery() > 0)
                    {
                        Result = "Success!Updated";
                    }
                    else
                    {
                        Result = "Failed!Process Failed ";
                    }
                    con.Close();
                }
            }
            catch (Exception ex)
            {
                WriteLogFile.WriteErrorLog("Error.txt", ex.Message);
            }
            return(Result);
        }
Beispiel #24
0
 public void LoginCGI()
 {
     try
     {
         System.Collections.ObjectModel.ReadOnlyCollection <IWebElement> links = CGI.FindElements(By.CssSelector(".ui.fluid.left.icon.input input"));
         links[0].SendKeys(userCGI.Text);
         links[1].SendKeys(passCGI.Text);
         links[0].Submit();
         DownSetts.Write("User", userCGI.Text, "CGI");
         DownSetts.Write("Pass", passCGI.Text, "CGI");
     }
     catch (Exception ex) { WriteLogFile.WriteLog("Log.txt", String.Format("[{0}]:{1}->Function:LoginCGI", DateTime.Now, ex.Message)); }
 }
        public GetAllMedicalProfilesByUserIdOutput GetAllMedicalProfilesByUserId(GetAllMedicalProfilesByUserIdInput input)
        {
            GetAllMedicalProfilesByUserIdOutput outputToReturn = new GetAllMedicalProfilesByUserIdOutput();

            try
            {
                var medicalProfiles = _medicalProfileRepository.GetMedicalProfileByUserId(input.UserId);

                if (medicalProfiles != null && medicalProfiles.Any())
                {
                    outputToReturn.MedicalProfiles = new List <MedicalProfileModel>();
                    foreach (var entity in medicalProfiles)
                    {
                        MedicalProfileModel model = new MedicalProfileModel();
                        model.Id                    = entity.Id;
                        model.UserId                = entity.UserID;
                        model.FirstName             = entity.FirstName;
                        model.LastName              = entity.LastName;
                        model.GenderSD              = entity.GenderSD;
                        model.MaritalStatusSD       = entity.MaritalStatusSD;
                        model.Age                   = entity.Age;
                        model.BloodType             = entity.BloodTypeSD;
                        model.WeightSD              = entity.WeightSD;
                        model.HeightSD              = entity.HeightSD;
                        model.Occupation            = entity.Occupation;
                        model.HaveInsurance         = entity.HaveInsurance;
                        model.HaveNSSF              = entity.HaveNSSF;
                        model.Smoker                = entity.Smoker;
                        model.HaveChildren          = entity.HaveChildren;
                        model.CaffeineDrinker       = entity.CaffeineDrinker;
                        model.CaffeinePerDay        = entity.CaffeinePerDay;
                        model.TakeMedication        = entity.TakeMedication;
                        model.HavePreviousSurgeries = entity.HavePreviousSurgeries;
                        model.HaveMedicationAllergy = entity.HaveMedicationAllergy;
                        model.HaveOtherAllergy      = entity.HaveOtherAllergy;
                        model.FamilyMedicalHistory  = entity.FamilyMedicalHistory;

                        outputToReturn.MedicalProfiles.Add(model);
                    }
                }

                return(outputToReturn);
            }
            catch (Exception ex)
            {
                WriteLogFile.Append("GetAllMedicalProfilesByUserId : ");
                WriteLogFile.Append(ex.Message);
                WriteLogFile.Append(ex.StackTrace);
                return(null);
            }
        }
Beispiel #26
0
 public void LoginS3(IWebDriver web)
 {
     try
     {
         System.Collections.ObjectModel.ReadOnlyCollection <IWebElement> links = web.FindElements(By.CssSelector("input.OSFillParent.Mandatory"));
         links[0].SendKeys(userS3.Text);
         links[1].SendKeys(passS3.Text);
         // links[0].Submit();
         web.FindElement(By.CssSelector(".Button.Is_Default.OSFillParent")).Click();
         DownSetts.Write("User", userS3.Text, "S3");
         DownSetts.Write("Pass", passS3.Text, "S3");
     }
     catch (Exception ex) { WriteLogFile.WriteLog("LogS3.txt", String.Format("[{0}]:{1}->Function:LoginS3", DateTime.Now, ex.Message)); }
 }
Beispiel #27
0
        public override Task OnConnected()
        {
            var us = new UserConnection();

            us.UserName     = Context.Request.QueryString["UserName"].ToString();
            us.ConnectionID = Context.ConnectionId;
            _listUserConnetion.Add(us);
            if (_listUserConnetion != null)
            {
                WriteLogFile.WriteLog(string.Format("SignalR Connected for Username: {0}, ConntectionId: {1}, User count: {2}", us.UserName, us.ConnectionID, _listUserConnetion.Count));
                SendData(us.ConnectionID);
            }
            return(base.OnConnected());
        }
Beispiel #28
0
        public List <Data_Calender> DataForCalender(long UserID)
        {
            List <Data_Calender> Result = new List <Data_Calender>();

            try
            {
                using (SqlConnection con = new SqlConnection(conn))
                {
                    string     Query = @" select ID as id,CONVERT(VARCHAR(10),EventDate,101) as Date,Title as Text,'Event' as Type from collegeEvents.Events 
                  union
                  select NxtCollege_ID as id,CONVERT(VARCHAR(8),NxtCollege_AddedDate,1) as Date,NxtCollege_name as Text,'College' as Type from collegeEvents.NextCollege 
                  union
                  select ID as id ,CONVERT(VARCHAR(8),ExamDate,1) as Date ,Exam as Text,'Exam' as Type from admin.ExamDetails 
                  union                 
                  select studentinfo.Goal.ID,CONVERT(VARCHAR(8),studentinfo.Goal.StartDate,1),
                  (studentinfo.ExamType.ExamType+'-'+studentinfo.Examsubjects.Subject+'-'+studentinfo.ExamTopics.Topic) as Text,
                  'Goal' as Type from studentinfo.Goal
                    inner join studentinfo.ExamTopics on studentinfo.Goal.ExamTopicID_FK=studentinfo.ExamTopics.ID
                    inner join studentinfo.Examsubjects on studentinfo.ExamTopics.SubjectID=studentinfo.Examsubjects.ID
                    inner join studentinfo.ExamType on studentinfo.Examtopics.ExamID=studentinfo.ExamType.ID
                    where studentinfo.Goal.UserID_FK=@UID";
                    SqlCommand com   = new SqlCommand(Query, con);

                    com.Parameters.AddWithValue("@UID", UserID);

                    con.Open();
                    SqlDataReader reader = com.ExecuteReader();
                    while (reader.Read())
                    {
                        Data_Calender temp = new Data_Calender();

                        temp.id       = Convert.ToInt32(reader["id"]);
                        temp.TempDate = Convert.ToString(reader["Date"]);
                        temp.Text     = Convert.ToString(reader["Text"]);
                        temp.Type     = Convert.ToString(reader["Type"]);


                        Result.Add(temp);
                    }
                    con.Close();
                }
            }
            catch (Exception ex)
            {
                WriteLogFile.WriteErrorLog("Error.txt", ex.Message);
            }
            return(Result);
        }
Beispiel #29
0
        public List <StockExchange> FetchData()
        {
            OleDbConnection      conn        = null;
            List <StockExchange> listStudent = new List <StockExchange>();
            string FilePath         = @"D:\Auth\SignalR\SignalR\Excel\ExcelData.xlsx";
            string ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + FilePath + ";Extended Properties=\"Excel 12.0;ReadOnly=true;HDR=Yes;\"";
            string Command          = "SELECT TOP 4 Id, CompanyName, Price FROM [Sheet1$] ORDER BY Id Desc";

            try
            {
                using (conn = new OleDbConnection(ConnectionString))
                {
                    using (OleDbCommand cmd = new OleDbCommand(Command, conn))
                    {
                        conn.Open();
                        using (OleDbDataAdapter da = new OleDbDataAdapter(cmd))
                        {
                            DataSet id = new DataSet();
                            da.Fill(id);

                            DataTable idtable = id.Tables[0];

                            listStudent = (from s in idtable.AsEnumerable()
                                           select new StockExchange
                            {
                                Id = Convert.ToInt32(s["Id"].ToString()),
                                Name = s["CompanyName"].ToString(),
                                Price = Convert.ToDouble(s["Price"])
                            }).ToList();

                            return(listStudent);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                WriteLogFile.WriteLog(ex.Message);
            }
            finally
            {
                if (conn != null || conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            return(listStudent);
        }
Beispiel #30
0
 private void TimersCheck(IWebDriver Web, string url, string caminho, ref bool CTRL, string Inicio, string Fim, ref DateTime nextDown, DateTime delay, ref bool CTRLDel, ref Thread script, ref Thread del, string Portal)
 {
     try
     {
         //inicio
         MethodInfo mi = this.GetType().GetMethod("Download" + Portal);
         if (CTRL && DateTime.Now.ToShortTimeString() == DateTime.Parse(Inicio).ToShortTimeString())
         {
             CTRL   = false;
             script = new Thread(new ThreadStart(delegate() { mi.Invoke(this, null); }));
             script.Start();
         }//fim
         else if (CTRL && DateTime.Now.ToShortTimeString() == DateTime.Parse(Fim).ToShortTimeString())
         {
             script.Abort();
             nextDown = DateTime.Now.AddHours(-2);
             delay    = DateTime.Now.AddMinutes(1);
         }
         else
         { //intervalos
             if (CTRL && DateTime.Now.ToShortTimeString() == nextDown.ToShortTimeString())
             {
                 CTRL   = false;
                 script = new Thread(new ThreadStart(delegate() { mi.Invoke(this, null); }));
                 script.Start();
             }
             else if (CTRLDel && DateTime.Now.ToShortTimeString() == DateTime.Parse(delCGI.Text).ToShortTimeString())
             {
                 CTRLDel = false;
                 del     = new Thread(new ThreadStart(delegate { apagarFicheiros(caminho, Portal); }));
                 del.Start();
             }
             else
             {
                 if (script != null)
                 {
                     if (script.IsAlive)
                     {
                         CGIAlertasSource.ResetBindings(false);
                     }
                 }
                 CGIAlertasSource.Sort = "TimeError DESC";
             }
         }
     }catch (Exception ex) { WriteLogFile.WriteLog("Log.txt", String.Format("[{0}]:{1}->Function:TimerCheck():{2}", DateTime.Now, ex.Message, Portal)); }
 }