protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         if (!string.IsNullOrEmpty(ONLINEUSER.ID.ToString()))
         {
             ENTMEMUSER user = DALUser.GetUser(ONLINEUSER.ID);
             if (user != null)
             {
                 txtName.Text      = user.NAME;
                 txtSurname.Text   = user.SURNAME;
                 txtEposta.Text    = user.MAIL;
                 txtTelephone.Text = user.PHONE.ToString();
             }
             else
             {
                 Response.Redirect("/Default.aspx");
             }
         }
         else
         {
             Response.Redirect("/Default.aspx");
         }
     }
 }
Exemplo n.º 2
0
        public List <NotificationConnection> GetNotificationConnections(string userid)
        {
            IUser userDAL = new DALUser();

            api.getdelays.POCO.User       u     = userDAL.GetUser(Convert.ToInt32(userid));
            List <NotificationConnection> listS = new List <NotificationConnection>();
            IGetAll  newaccessapi = SNCBAPI.GetAll.Instance();
            DateTime now          = DateTime.UtcNow;

            now = now.AddHours(2);
            if (u != null)
            {
                foreach (api.getdelays.POCO.FollowedConnection s in u.followedConnections)
                {
                    DataApiConnection stat = newaccessapi.GetConnection(s.departure, s.arrival, s.DateTime);
                    foreach (SNCBAPI.Connection c in stat.connection)
                    {
                        DateTime hourTrain = new DateTime();
                        hourTrain = hourTrain.AddHours(2);
                        hourTrain = hourTrain.AddSeconds(c.departure.time);
                        int year = DateTime.Now.Year - hourTrain.Year;
                        hourTrain = hourTrain.AddYears(year);
                        if (s.DateTime.TimeOfDay == hourTrain.TimeOfDay)
                        {
                            hourTrain = hourTrain.AddMinutes(c.departure.delay);
                            if (hourTrain.TimeOfDay > now.TimeOfDay)
                            {
                                hourTrain = hourTrain.AddMinutes(-c.departure.delay);
                                if (c.departure.delay >= 15 && c.departure.delay < 30)
                                {
                                    listS.Add(new NotificationConnection {
                                        Arrival = s.arrival, Departure = s.departure, DelaysArrival = Convert.ToInt32(c.arrival.delay), DelaysDeparture = Convert.ToInt32(c.departure.delay), Time = hourTrain, Priority = "warning"
                                    });
                                }
                                else if (c.departure.delay < 15 && c.departure.delay >= 0)
                                {
                                    listS.Add(new NotificationConnection {
                                        Arrival = s.arrival, Departure = s.departure, DelaysArrival = Convert.ToInt32(c.arrival.delay), DelaysDeparture = Convert.ToInt32(c.departure.delay), Time = hourTrain, Priority = "normal"
                                    });
                                }
                                else if (c.departure.delay >= 30)
                                {
                                    listS.Add(new NotificationConnection {
                                        Arrival = s.arrival, Departure = s.departure, DelaysArrival = Convert.ToInt32(c.arrival.delay), DelaysDeparture = Convert.ToInt32(c.departure.delay), Priority = "danger"
                                    });
                                }
                            }
                        }
                    }
                }
                return(listS);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 3
0
        public api.getdelays.POCO.User GetUser(string email)
        {
            IUser user = new DALUser();

            api.getdelays.POCO.User testUserInformation = user.GetUser(email);
            if (testUserInformation == null)
            {
                return(null);
            }
            else
            {
                return(testUserInformation);
            }
        }
Exemplo n.º 4
0
 protected void btnLogin_Click(object sender, EventArgs e)
 {
     if (ValidateRecord())
     {
         ENTMEMUSER user = DALUser.GetUser(txtMail.Text, MD5(txtPassword.Text));
         if (user != null)
         {
             if (user.STATUS)
             {
                 ONLINEUSER.ID         = user.ID;
                 ONLINEUSER.NAME       = user.NAME;
                 ONLINEUSER.SURNAME    = user.SURNAME;
                 ONLINEUSER.FULLNAME   = user.NAME + " " + user.SURNAME;
                 ONLINEUSER.MAIL       = user.MAIL;
                 ONLINEUSER.TYPEUSERID = user.TYPEUSERID;
                 ONLINEUSER.FIRMID     = user.FIRMID;
                 ONLINEUSER.ISADMIN    = user.ISADMIN;
                 ONLINEUSER.STATUS     = user.STATUS;
                 if (chkRememberMe.Checked)
                 {
                     HttpCookie cookie = new HttpCookie(COOKIENAME);
                     cookie.Values.Add("MAIL", ONLINEUSER.MAIL);
                     cookie.Values.Add("PASSWORD", MD5(txtPassword.Text));
                     cookie.Expires = DateTime.Now.AddDays(1);
                     Response.Cookies.Add(cookie);
                 }
                 else
                 {
                     if (Request.Cookies[COOKIENAME] != null)
                     {
                         HttpCookie cookie = Request.Cookies[COOKIENAME];
                         cookie.Values.Clear();
                         cookie.Expires = DateTime.MinValue;
                         Response.Cookies.Add(cookie);
                     }
                 }
                 Response.Redirect("/Default.aspx");
             }
             else
             {
                 AddMessage(lblError, "Hesabınız pasiftir!", false);
             }
         }
         else
         {
             AddMessage(lblError, "Kullanıcı adı yada Şifre yanlış!", false);
         }
     }
 }
Exemplo n.º 5
0
        public bool DeleteUser(string userid)
        {
            IUser userDAL = new DALUser();

            api.getdelays.POCO.User user = userDAL.GetUser(Convert.ToInt32(userid));
            if (user == null)
            {
                return(false);
            }
            else
            {
                userDAL.DeleteUser(user);
                return(true);
            }
        }
Exemplo n.º 6
0
        public api.getdelays.POCO.User MakeAccount(string email, string name, string surname, string password, string phoneNumber)
        {
            IUser userDAL = new DALUser();

            if (userDAL.GetUser(email) == null)
            {
                api.getdelays.POCO.User user = new api.getdelays.POCO.User {
                    name = name, surname = surname, email = email, password = password, phoneNumber = Convert.ToInt32(phoneNumber)
                };
                userDAL.AddUser(user);
                return(user);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 7
0
        public api.getdelays.POCO.User DeleteFollowConnection(string userid, string idConnection)
        {
            IFollowedConnection followedConnection = new DALFollowedConnection();
            IUser userDAL = new DALUser();

            api.getdelays.POCO.User u = userDAL.GetUser(Convert.ToInt32(userid));
            if (u != null)
            {
                api.getdelays.POCO.FollowedConnection f = followedConnection.GetFollowedConnection(Convert.ToInt32(idConnection));
                followedConnection.DeleteFollowedConnection(f);
                u.followedConnections = followedConnection.GetFollowedConnections(u);
                return(u);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 8
0
        public api.getdelays.POCO.User UpdateUser(string name, string surname, string phoneNumber, string userid)
        {
            IUser userDAL = new DALUser();

            api.getdelays.POCO.User user = userDAL.GetUser(Convert.ToInt32(userid));
            if (user == null)
            {
                return(null);
            }
            else
            {
                api.getdelays.POCO.User newUser = new api.getdelays.POCO.User {
                    Id = Convert.ToInt32(userid), name = name, surname = surname, email = user.email, phoneNumber = Convert.ToInt32(phoneNumber), followedConnections = user.followedConnections, followedStations = user.followedStations
                };
                userDAL.UpdateUser(user, newUser);
                return(newUser);
            }
        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (ValidateRecord())
            {
                ENTMEMUSER user = DALUser.GetUser(ONLINEUSER.ID);
                if (user != null)
                {
                    user.NAME     = txtName.Text;
                    user.SURNAME  = txtSurname.Text;
                    user.MAIL     = txtEposta.Text;
                    user.PHONE    = txtTelephone.Text;
                    user.PASSWORD = MD5(txtPassword.Text);

                    DALUser.UpdateProfile(user);
                    Response.Redirect("/Login.aspx");
                }
            }
        }
Exemplo n.º 10
0
        public api.getdelays.POCO.User FollowConnection(string arrival, string departure, string time, string userid, string repeat)
        {
            IFollowedConnection followedConnection = new DALFollowedConnection();
            IUser userDAL = new DALUser();

            api.getdelays.POCO.User u = userDAL.GetUser(Convert.ToInt32(userid));
            if (u != null)
            {
                followedConnection.AddFollowedConnection(new api.getdelays.POCO.FollowedConnection {
                    departure = departure, arrival = arrival, DateTime = Convert.ToDateTime(time), repeat = Convert.ToBoolean(repeat), user = u
                });
                u.followedConnections = followedConnection.GetFollowedConnections(u);
                return(u);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 11
0
        public api.getdelays.POCO.User FollowStation(string station, string userid)
        {
            IFollowedStation followedStation = new DALFollowedStation();
            IUser            userDAL         = new DALUser();

            api.getdelays.POCO.User u = userDAL.GetUser(Convert.ToInt32(userid));
            if (u != null)
            {
                followedStation.AddFollowedStation(new api.getdelays.POCO.FollowedStation {
                    stationName = station, user = u
                });
                u.followedStations = followedStation.GetFollowedStations();
                return(u);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Request.Cookies[COOKIENAME] != null)
                {
                    HttpCookie cookie = Request.Cookies[COOKIENAME];
                    if (cookie != null)
                    {
                        string     mail     = cookie["MAIL"].ToString();
                        string     password = cookie["PASSWORD"].ToString();
                        ENTMEMUSER user     = DALUser.GetUser(mail, password);
                        if (user != null)
                        {
                            if (user.STATUS)
                            {
                                ONLINEUSER.ID         = user.ID;
                                ONLINEUSER.NAME       = user.NAME;
                                ONLINEUSER.SURNAME    = user.SURNAME;
                                ONLINEUSER.FULLNAME   = user.NAME + " " + user.SURNAME;
                                ONLINEUSER.MAIL       = user.MAIL;
                                ONLINEUSER.TYPEUSERID = user.TYPEUSERID;
                                ONLINEUSER.FIRMID     = user.FIRMID;
                                ONLINEUSER.ISADMIN    = user.ISADMIN;
                                ONLINEUSER.STATUS     = user.STATUS;

                                Response.Redirect("/Default.aspx");
                            }
                            else
                            {
                                AddMessage(lblError, "Hesabınız pasiftir!", false);
                            }
                        }
                        else
                        {
                            AddMessage(lblError, "Kullanıcı adı yada Şifre yanlış!", false);
                        }
                    }
                }
            }
        }
Exemplo n.º 13
0
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     if (ValidateRecord())
     {
         ENTMEMUSER user = DALUser.GetUser(Guid.Parse(Request.QueryString["ID"]));
         if (user != null)
         {
             user.NAME       = txtName.Text;
             user.SURNAME    = txtSurname.Text;
             user.CREATEDATE = Convert.ToDateTime(txtRecorddate.Text);
             user.MAIL       = txtEposta.Text;
             user.FIRMID     = Guid.Parse(drpFirm.SelectedValue);
             user.PHONE      = txtTelephone.Text;
             user.STATUS     = drpStatus.SelectedValue == "1";
             user.TYPEUSERID = Convert.ToByte(drpUserType.SelectedValue);
             user.LANGUAGEID = Convert.ToByte(drpLanguage.SelectedValue);
             DALUser.Update(user);
             Response.Redirect("/Mng/MNGUserDetail.aspx?ID=" + USERID);
         }
     }
 }
Exemplo n.º 14
0
    private void GetUser(int userid)
    {
        try
        {
            objclsUser.OpName = "SELECT1";
            objclsUser.UserId = userid;
            DataSet ds = objDALUser.GetUser(objclsUser);

            if (ds.Tables[0].Rows.Count > 0)
            {
                hf_UserId.Value                = ds.Tables[0].Rows[0]["UserId"].ToString();
                txtUsername.Text               = ds.Tables[0].Rows[0]["Username"].ToString();
                ddlRoleId.SelectedIndex        = ddlRoleId.Items.IndexOf(ddlRoleId.Items.FindByText(ds.Tables[0].Rows[0]["UserRole"].ToString()));
                dropEmployeeName.SelectedIndex = dropEmployeeName.Items.IndexOf(dropEmployeeName.Items.FindByValue(ds.Tables[0].Rows[0]["EmployeeName"].ToString()));
                ddlStatus.SelectedIndex        = ddlStatus.Items.IndexOf(ddlStatus.Items.FindByText(ds.Tables[0].Rows[0]["Status"].ToString()));
                txtPassword.Text               = ds.Tables[0].Rows[0]["Password"].ToString();
                Panel1.Visible = false;
            }
        }
        catch (Exception ex)
        {
            lblError.Text = CommanClass.ShowMessage("danger", "Danger", ex.Message);
        }
    }
Exemplo n.º 15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         CalDate.Visible = false;
         DrpFirmFill();
         DrpTypeUser();
         DrpLanguage();
         if (!string.IsNullOrEmpty(Request.QueryString["ID"]))
         {
             FIRMID = DALUser.GetFirmID(Guid.Parse(Request.QueryString["ID"]));
             ENTMEMUSER user = DALUser.GetUser(Guid.Parse(Request.QueryString["ID"]));
             if (user != null)
             {
                 USERID                    = user.ID;
                 txtName.Text              = user.NAME;
                 txtSurname.Text           = user.SURNAME;
                 txtEposta.Text            = user.MAIL;
                 txtRecorddate.Text        = user.CREATEDATE.ToString();
                 txtTelephone.Text         = user.PHONE.ToString();
                 drpStatus.SelectedValue   = user.STATUS ? "1" : "2";
                 drpUserType.SelectedValue = user.TYPEUSERID.ToString();
                 drpFirm.SelectedValue     = user.FIRMID.ToString();
                 drpLanguage.SelectedValue = user.LANGUAGEID.ToString();
             }
             else
             {
                 Response.Redirect("/Mng/MNGUserDetail.aspx?ID=" + USERID);
             }
         }
         else
         {
             Response.Redirect("/Mng/MNGFirms.aspx");
         }
     }
 }
Exemplo n.º 16
0
        public List <NotificationStation> GetNotificationStations(string userid)
        {
            IUser userDAL = new DALUser();

            api.getdelays.POCO.User    u     = userDAL.GetUser(Convert.ToInt32(userid));
            List <NotificationStation> listS = new List <NotificationStation>();
            IGetAll  newaccessapi            = SNCBAPI.GetAll.Instance();
            DateTime now = DateTime.UtcNow;

            now = now.AddHours(2);
            if (u != null)
            {
                foreach (api.getdelays.POCO.FollowedStation s in u.followedStations)
                {
                    int delays = 0;
                    DataApiPerStations stat = newaccessapi.GetDelaysForStation(s.stationName);
                    foreach (SNCBAPI.ArrDep arrdep in stat.arrivals.arrival)
                    {
                        DateTime hourTrain = new DateTime();
                        hourTrain = hourTrain.AddHours(2);
                        hourTrain = hourTrain.AddSeconds(arrdep.time);
                        hourTrain = hourTrain.AddMinutes(arrdep.delay);
                        if (now.TimeOfDay < hourTrain.TimeOfDay)
                        {
                            delays += arrdep.delay;
                        }
                    }
                    foreach (SNCBAPI.ArrDep arrdep in stat.departures.departure)
                    {
                        DateTime hourTrain = new DateTime();
                        hourTrain = hourTrain.AddHours(2);
                        hourTrain = hourTrain.AddSeconds(arrdep.time);
                        hourTrain = hourTrain.AddMinutes(arrdep.delay);
                        if (now.TimeOfDay < hourTrain.TimeOfDay)
                        {
                            delays += arrdep.delay;
                        }
                    }
                    if (delays >= 15 && delays < 30)
                    {
                        listS.Add(new NotificationStation {
                            StationName = s.stationName, Delays = delays, Priority = "warning"
                        });
                    }
                    else if (delays < 15 && delays > 0)
                    {
                        listS.Add(new NotificationStation {
                            StationName = s.stationName, Delays = delays, Priority = "normal"
                        });
                    }
                    else if (delays >= 30)
                    {
                        listS.Add(new NotificationStation {
                            StationName = s.stationName, Delays = delays, Priority = "danger"
                        });
                    }
                }
                return(listS);
            }
            else
            {
                return(listS);
            }
        }