Beispiel #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         DatabaseCalls    dc = new DatabaseCalls();
         clsContactReport cr = new clsContactReport(Request);
         cr.ArrivalTime = sw.arrivalTime;
         if (string.IsNullOrEmpty(sw.departureTime))
         {
             cr.DepartureTime = DateTime.Now.ToShortTimeString();
             sw.departureTime = cr.DepartureTime;
         }
         cr.VisitDate = sw.visitDate;
         if (sw.VisitID > 0)
         {
             cr.VisitId = sw.VisitID;
             dc.UpdateVisit(cr);
         }
         else
         {
             cr.VisitId = dc.InsertVisit(cr);
             sw.VisitID = cr.VisitId;
         }
         var list = new List <clsContactReport> {
             cr
         };
         DetailsView1.DataSource = list;
         DetailsView1.DataBind();
     }
     catch (Exception exc)
     {
         Response.Write(exc.Message);
     }
 }
Beispiel #2
0
        public Manager ManagerByEmail(string Email)
        {
            DatabaseCalls dc = new DatabaseCalls();

            System.Data.DataTable dt = dc.GetManagerByEmail(Email);
            if (dt.Rows.Count >= 1)
            {
                this.ManagerID = Convert.ToInt16(dt.Rows[0]["ManagerID"]);
                this.StoreID   = Convert.ToInt16(dt.Rows[0]["StoreID"]);
                return(this);
            }
            else
            {
                return(null);
            }
        }
Beispiel #3
0
        public User LoadByEmail(string Email)
        {
            DatabaseCalls dc = new DatabaseCalls();

            System.Data.DataTable dt = dc.GetUserByEmail(Email);//check: todo ??
            if (dt.Rows.Count >= 1)
            {
                this.UserID        = Convert.ToInt16(dt.Rows[0]["id"]);
                this.Password      = Password;
                this.FirstName     = dt.Rows[0]["FName"].ToString();
                this.LastName      = dt.Rows[0]["LName"].ToString();
                this.SecurityLevel = Convert.ToInt16(dt.Rows[0]["SecurityLevel"]);
                return(this);
            }
            else
            {
                return(null);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            DatabaseCalls    dc = new DatabaseCalls();
            clsContactReport cr = new clsContactReport(Request);

            cr.ArrivalTime = sw.arrivalTime;
            if (!string.IsNullOrEmpty(sw.departureTime))
            {
                cr.DepartureTime = DateTime.Now.ToShortTimeString();
                sw.departureTime = cr.DepartureTime;
            }
            cr.VisitDate = sw.visitDate;
            cr.VisitId   = dc.InsertVisit(cr);
            var list = new List <clsContactReport> {
                cr
            };

            DetailsView1.DataSource = list;
            DetailsView1.DataBind();
        }
Beispiel #5
0
        private User LoadByUserID(int UserID)
        {
            DatabaseCalls dc = new DatabaseCalls();

            System.Data.DataTable dt = dc.GetUserByID(UserID);
            if (dt.Rows.Count >= 1)
            {
                this.UserID        = UserID;
                this.Password      = Password;
                this.FirstName     = dt.Rows[0]["FName"].ToString();
                this.LastName      = dt.Rows[0]["LName"].ToString();
                this.SecurityLevel = Convert.ToInt16(dt.Rows[0]["SecurityLevel"]);
                this.Email         = dt.Rows[0]["Email"].ToString();
                return(this);
            }
            else
            {
                return(null);
            }
        }
Beispiel #6
0
        public User FindUserByEmailPassword(string Email, string Password)
        {
            DatabaseCalls dc = new DatabaseCalls();

            System.Data.DataTable dt = dc.FindUserByEmailPassword(Email, Password);
            if (dt.Rows.Count >= 1)
            {
                this.Email    = Email;
                UserID        = Convert.ToInt16(dt.Rows[0]["Id"]);
                this.Password = Password;
                FirstName     = dt.Rows[0]["FName"].ToString();
                LastName      = dt.Rows[0]["LName"].ToString();
                SecurityLevel = Convert.ToInt16(dt.Rows[0]["SecurityLevel"]);
                //check for nulls
                if (dsUser.IsItNull(dt.Rows[0]["managerID"].ToString()))
                {
                    ManagerID = 0;
                }
                else
                {
                    ManagerID = Convert.ToInt16(dt.Rows[0]["managerID"]);
                }
                if (dsUser.IsItNull(dt.Rows[0]["storeID"].ToString()))
                {
                    StoreID = 0;
                }
                else
                {
                    StoreID = Convert.ToInt16(dt.Rows[0]["storeID"]);
                }

                //this.Email = dt.Rows[0]["Email"].ToString();
                return(this);
            }
            else
            {
                return(null);
            }
        }