Beispiel #1
0
        public object GetTravellerCheckInHistory(Int64 travellerID, string mode)
        {
            object        objResult = null;
            DataTable     dtResult  = null;
            IDbConnection con       = null;

            try
            {
                con      = DALHelper.GetConnection();
                dtResult = _travellerDL.GetTravellerCheckInHistory(travellerID, con, mode);
                if (dtResult.Rows.Count > 0)
                {
                    objResult = dtResult;
                }
                else
                {
                    objResult = "No data found";
                }
            }
            catch (Exception ex)
            {
                ErrorLogDL.InsertErrorLog(ex.Message, "GetTravellerCheckInHistory");
            }


            return(objResult);
        }
Beispiel #2
0
        public string ChangeUserAuthentication(User _user, string newPassword)
        {
            bool           IsSuccess   = true;
            string         message     = "";
            IDbTransaction transaction = null;

            try
            {
                transaction = DALHelper.GetTransaction();

                Int64 resultID = _loginDL.ChangePassword(_user, transaction, newPassword);

                if (resultID > 0)
                {
                    message = "Password changed sucessfully";
                }
                else if (resultID == -1)
                {
                    message = "OldPasword is incorrect.";
                }
            }
            catch (Exception ex)
            {
                IsSuccess = false;
                ErrorLogDL.InsertErrorLog(ex.Message, "RegisterTravellerUser");
                throw;
            }
            finally
            {
                DALHelper.CloseDB(transaction, IsSuccess);
            }

            return(message);
        }
Beispiel #3
0
 protected void ObjectDataSource1_Deleted(object sender, ObjectDataSourceStatusEventArgs e)
 {
     if (e.Exception != null)
     {
         ErrorLogDL.Insert(e.Exception);
     }
 }
Beispiel #4
0
        public object ValidateEmail(string email)
        {
            object        objResult = null;
            Int64         Result    = 0;
            IDbConnection con       = null;

            try
            {
                con    = DALHelper.GetConnection();
                Result = _loginDL.ValidateEmail(email, con);
                if (Result > 0)
                {
                    objResult = Result;
                }
                else
                {
                    objResult = false;
                }
            }
            catch (Exception ex)
            {
                ErrorLogDL.InsertErrorLog(ex.Message, "ValidateEmail");
            }


            return(objResult);
        }
Beispiel #5
0
        public object GetTravellerProfile(Int64 travellerID)
        {
            object        objResult = null;
            DataTable     dtResult  = null;
            IDbConnection con       = null;

            try
            {
                con      = DALHelper.GetConnection();
                dtResult = _travellerDL.GetTravellerProfile(travellerID, con);
                if (dtResult.Rows.Count > 0)
                {
                    objResult = dtResult;
                }
                else
                {
                    objResult = null;
                }
            }
            catch (Exception ex)
            {
                ErrorLogDL.InsertErrorLog(ex.Message, "GetTravellerProfile");
            }


            return(objResult);
        }
Beispiel #6
0
        public string ResetPassword(User _user)
        {
            bool           IsSuccess   = true;
            string         message     = "";
            IDbTransaction transaction = null;

            try
            {
                transaction = DALHelper.GetTransaction();

                Int64 resultID = _loginDL.ResetPassword(_user, transaction);

                if (resultID > 0)
                {
                    message = "Password reset sucessfully";
                }
                else
                {
                    message = "unable to reset password please contact support provider";
                }
            }
            catch (Exception ex)
            {
                IsSuccess = false;
                ErrorLogDL.InsertErrorLog(ex.Message, "ResetPassword");
                throw;
            }
            finally
            {
                DALHelper.CloseDB(transaction, IsSuccess);
            }

            return(message);
        }
Beispiel #7
0
        public object GetAllTravellerCheckInDetails(Int64 hostelId, string mode)
        {
            object        objResult = null;
            DataTable     dtResult  = null;
            IDbConnection con       = null;

            try
            {
                con      = DALHelper.GetConnection();
                dtResult = _hostelDL.GetAllTravellerCheckInDetails(hostelId, con, mode);
                if (dtResult.Rows.Count > 0)
                {
                    objResult = dtResult;
                }
                else
                {
                    objResult = "No ChecK In found";
                }
            }
            catch (Exception ex)
            {
                ErrorLogDL.InsertErrorLog(ex.Message, "GetAllTravellerCheckInDetails");
            }


            return(objResult);
        }
Beispiel #8
0
        public object GetGallery(int hostelId)
        {
            object        objResult = null;
            DataTable     dtResult  = null;
            IDbConnection con       = null;

            try
            {
                con      = DALHelper.GetConnection();
                dtResult = _hostelDL.GetGallery(hostelId, con);
                if (dtResult.Rows.Count > 0)
                {
                    objResult = dtResult;
                }
                else
                {
                    objResult = "No gallery found";
                }
            }
            catch (Exception ex)
            {
                ErrorLogDL.InsertErrorLog(ex.Message, "GetGallery");
            }

            return(objResult);
        }
Beispiel #9
0
        public object GetHostelProfile(int hostelId)
        {
            object    objResult = null;
            DataTable dtResult  = null;
            Dictionary <string, object> dsResult = new Dictionary <string, object>();
            IDbConnection con = null;

            try
            {
                con      = DALHelper.GetConnection();
                dtResult = _hostelDL.GetHostelProfile(hostelId, con);
                if (dtResult.Rows.Count > 0)
                {
                    objResult = dtResult;
                    dsResult.Add("Profile", dtResult);
                    dtResult = _hostelDL.GetGallery(hostelId, con);
                    dsResult.Add("Gallery", dtResult);
                }
                else
                {
                    objResult = "No data found";
                }
            }
            catch (Exception ex)
            {
                ErrorLogDL.InsertErrorLog(ex.Message, "GetHostelProfile");
            }

            return(dsResult);
        }
Beispiel #10
0
        public Boolean InsertHelpUs(Int64 userId, string title, string message)
        {
            bool           IsSuccess   = true;
            bool           result      = false;
            IDbTransaction transaction = null;

            try
            {
                transaction = DALHelper.GetTransaction();

                Int64 resultID = _loginDL.InsertHelpUs(userId, title, message, transaction);

                if (resultID > 0)
                {
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            catch (Exception ex)
            {
                IsSuccess = false;
                ErrorLogDL.InsertErrorLog(ex.Message, "InsertHelpUs");
                throw;
            }
            finally
            {
                DALHelper.CloseDB(transaction, IsSuccess);
            }

            return(result);
        }
Beispiel #11
0
        public object GetHostels(string key)
        {
            object        objResult = null;
            DataTable     dtResult  = null;
            IDbConnection con       = null;

            try
            {
                con      = DALHelper.GetConnection();
                dtResult = _hostelDL.GetHostelsByKey(key, con);
                if (dtResult.Rows.Count > 0)
                {
                    objResult = dtResult;
                }
                else
                {
                    objResult = null;
                }
            }
            catch (Exception ex)
            {
                ErrorLogDL.InsertErrorLog(ex.Message, "GetHostels");
            }

            return(objResult);
        }
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         CAPTCHA.Validate();
         if (CAPTCHA.UserValidated)
         {
             MembershipUser user = Membership.GetUser(txtUserName.Text);
             if (user == null)
             {
                 ErrorLabel.Text = "Unknown userid";
             }
             else
             {
                 string password = user.ResetPassword();
                 SendMailDL.SendMail(user.Email, user.Email, "Reset password from Art Gallery Site",
                                     string.Format("Your new password is {0}", password), false);
                 ErrorLabel.Text = "Your new password has been emailed to you.";
             }
         }
         else
         {
             ErrorLabel.Text = "The code you entered did not match up with the image provided; please try again with this new image.";
         }
     }
     catch (Exception ex)
     {
         ErrorLabel.Text = "Process Error";
         ErrorLogDL.Insert(ex);
     }
     up1.Update();
 }
Beispiel #13
0
        public DataTable GetTravellerProfile(Int64 travellerID, IDbConnection con)
        {
            DataSet dsResult = new DataSet();

            try
            {
                IDbDataParameter[] paramData;

                paramData = DALHelperParameterCache.GetSpParameterSet(con, "GetTravellerProfile"); foreach (IDbDataParameter Item in paramData)
                {
                    switch (Item.ParameterName)
                    {
                    case "TravellerId":
                        Item.Value = travellerID;

                        break;
                    }
                }
                DALHelper.FillDataset(con, CommandType.StoredProcedure, "GetTravellerProfile", dsResult, new string[] { "TravellerProfile" }, paramData);

                return(dsResult.Tables.Contains("TravellerProfile") ? dsResult.Tables["TravellerProfile"] : null);
            }
            catch (Exception ex)
            {
                ErrorLogDL.InsertErrorLog(ex.Message, "GetTravellerProfile");
                throw ex;
            }
        }
Beispiel #14
0
        public object AddTravellerCheckInDetails(TravellerCheckIn _traveller)
        {
            bool           IsSuccess   = true;
            IDbTransaction transaction = null;
            object         objResult   = null;
            DataTable      dtResult    = null;
            IDbConnection  con         = null;

            try
            {
                transaction = DALHelper.GetTransaction();
                con         = DALHelper.GetConnection();

                Int64 resultID = _travellerDL.AddTravellerCheckInDetails(_traveller, transaction);

                if (resultID > 0)
                {
                    if (_traveller.Action == "1") // Check In
                    {
                        dtResult  = _travellerDL.GetTravellerChekInInfo(_traveller, transaction, "4");
                        objResult = dtResult;
                    }
                    else if (_traveller.Action == "2") // Check Out
                    {
                        dtResult  = _travellerDL.GetTravellerChekInInfo(_traveller, transaction, "5");
                        objResult = dtResult;
                    }
                }
                else if (resultID == -1)
                {
                    objResult = "Traveller already Checked In";
                }
                else if (resultID == -3)
                {
                    objResult = "Traveller is not Checked In";
                }
                else if (resultID == -4)
                {
                    objResult = "QRCode not found";
                }
            }
            catch (Exception ex)
            {
                ErrorLogDL.InsertErrorLog(ex.Message, "AddTravellerCheckInDetails");

                IsSuccess = false;
                throw;
            }
            finally
            {
                DALHelper.CloseDB(transaction, IsSuccess);
            }
            return(objResult);
        }
Beispiel #15
0
        public Int16 AddTravellerCheckInDetails(TravellerCheckIn _traveller, IDbTransaction transaction)
        {
            try
            {
                IDbDataParameter[] paramData;
                Int16 Result = 0;
                paramData = DALHelperParameterCache.GetSpParameterSet(transaction, "InsertTravellerCheckInCheckOutDetails"); foreach (IDbDataParameter Item in paramData)
                {
                    switch (Item.ParameterName)
                    {
                    case "HostelId":
                        Item.Value = _traveller.hostelId;

                        break;

                    case "QRCode":
                        Item.Value = _traveller.travellerQRCode;
                        break;

                    case "Status":
                        Item.Value = _traveller.Action;
                        break;

                    case "checkInDate":
                        Item.Value = _traveller.checkInDate;
                        break;

                    case "checkOutDate":
                        Item.Value = _traveller.checkOutDate;
                        break;

                    case "TrackingId":
                        Item.Value = _traveller.trackingId;
                        break;

                    case "IsPointsSpent":
                        Item.Value = _traveller.isPontsSpent;
                        break;

                    case "NoOfPointsSpent":
                        Item.Value = _traveller.NoOfPointsSpent;
                        break;
                    }
                }
                Result = Convert.ToInt16(DALHelper.ExecuteNonQuery(transaction, CommandType.StoredProcedure, "InsertTravellerCheckInCheckOutDetails", paramData));
                return(Result);
            }
            catch (Exception ex)
            {
                ErrorLogDL.InsertErrorLog(ex.Message, "AddTravellerCheckInDetails");
                throw ex;
            }
        }
        /// <summary>
        /// Assuming no error, after the insert occurs, the user is sent to the picture edit
        /// page for this newly inserted record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ObjectDataSource1_Inserted(object sender, ObjectDataSourceStatusEventArgs e)
        {
            if (e.Exception != null)
            {
                ErrorLogDL.Insert(e.Exception);
                e.ExceptionHandled = true;
                return;
            }
            string id = e.ReturnValue.ToString();

            Response.Redirect("EditPicture.aspx?id=" + id, true);
        }
Beispiel #17
0
        public Int16 RegisterTravellerUser(Traveller _traveller, IDbTransaction transaction)
        {
            try
            {
                IDbDataParameter[] paramData;
                Int16 Result = 0;
                paramData = DALHelperParameterCache.GetSpParameterSet(transaction, "InsertTravellerProfile"); foreach (IDbDataParameter Item in paramData)
                {
                    switch (Item.ParameterName)
                    {
                    case "UserId":
                        Item.Value = _traveller.UserId;
                        break;

                    case "Password":
                        Item.Value = _traveller.password;
                        break;

                    case "EmailId":
                        Item.Value = _traveller.emailId;
                        break;

                    case "Address":
                        Item.Value = "";
                        break;

                    case "UserType":
                        Item.Value = "Traveller";
                        break;

                    case "FirstName":
                        Item.Value = _traveller.firstName;
                        break;

                    case "LastName":
                        Item.Value = _traveller.lastName;
                        break;
                    }
                }
                Result = Convert.ToInt16(DALHelper.ExecuteNonQuery(transaction, CommandType.StoredProcedure, "InsertTravellerProfile", paramData));
                return(Result);
            }
            catch (Exception ex)
            {
                ErrorLogDL.InsertErrorLog(ex.Message, "RegisterTravellerUser");
                throw ex;
            }
        }
        public override void OnException(HttpActionExecutedContext actionExecutedContext)
        {
            if (actionExecutedContext.Exception is APIException)
            {
                APIException exceptionData = (APIException)actionExecutedContext.Exception;

                //The Response Message Set by the Action During Ececution
                var res = exceptionData.Message;

                //Define the Response Message

                HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.Accepted)
                {
                    Content      = new StringContent(exceptionData.ToString()),
                    StatusCode   = HttpStatusCode.Accepted,
                    ReasonPhrase = res
                };

                response.Headers.Add("ValidationMessageType", ((byte)exceptionData.MessageType).ToString());

                //Create the Error Response

                actionExecutedContext.Response = response;

                string exception = actionExecutedContext.Exception.ToString();
                ErrorLogDL.InsertErrorLog(exception, actionExecutedContext.Exception.Message.ToString());
            }
            else
            {
                ///exception loging

                string exception = actionExecutedContext.Exception.ToString();
                ErrorLogDL.InsertErrorLog(exception, actionExecutedContext.Exception.Message.ToString());

                var res = actionExecutedContext.Exception.Message;
                HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content      = new StringContent(res),
                    StatusCode   = HttpStatusCode.InternalServerError,
                    ReasonPhrase = res
                };

                //Create the Error Response
                actionExecutedContext.Response = response;
            }
        }
Beispiel #19
0
        public string RegisterTravellerUser(Traveller _traveller)
        {
            bool           IsSuccess   = true;
            string         message     = "";
            IDbTransaction transaction = null;

            try
            {
                transaction = DALHelper.GetTransaction();

                Int64 resultID = _travellerDL.RegisterTravellerUser(_traveller, transaction);

                if (resultID > 0)
                {
                    message = "Profile Updated Successfully";
                }
                else
                {
                    message = "error";
                }
            }
            catch (SqlException ex)
            {
                IsSuccess = false;
                if (ex.Message.Contains("UNIQUE KEY"))
                {
                    message = "Email already taken";
                }
                else
                {
                    IsSuccess = false;
                    ErrorLogDL.InsertErrorLog(ex.Message, "TravellerBL:RegisterTravellerUser");
                    throw;
                }
            }
            finally
            {
                DALHelper.CloseDB(transaction, IsSuccess);
            }

            return(message);
        }
Beispiel #20
0
        public string RegisterUser(User _user)
        {
            bool           IsSuccess   = true;
            string         message     = "";
            IDbTransaction transaction = null;

            try
            {
                transaction = DALHelper.GetTransaction();

                Int64 Result = _loginDL.RegisterUser(_user, transaction);

                if (Result > 0)
                {
                    message = Result.ToString();
                    Email.SendMail("Dear " + _user.username + " your account has been created successfully", _user.email, "Account Registration");
                }
                else
                {
                    message = "unable to create user please contact provider support";
                }
            }
            catch (SqlException ex)
            {
                IsSuccess = false;
                if (ex.Message.Contains("UNIQUE KEY"))
                {
                    message = "User already registered";
                }
                else
                {
                    IsSuccess = false;
                    ErrorLogDL.InsertErrorLog(ex.Message, "LoginBL : RegisterUser");
                    throw;
                }
            }
            finally
            {
                DALHelper.CloseDB(transaction, IsSuccess);
            }
            return(message);
        }
Beispiel #21
0
        public DataTable GetTravellerChekInInfo(TravellerCheckIn _traveller, IDbTransaction transaction, string mode)
        {
            DataSet dsResult = new DataSet();

            try
            {
                IDbDataParameter[] paramData;

                paramData = DALHelperParameterCache.GetSpParameterSet(transaction, "GetTravellerCheckinDetails"); foreach (IDbDataParameter Item in paramData)
                {
                    switch (Item.ParameterName)
                    {
                    case "TravellerId":
                        Item.Value = 0;
                        break;

                    case "TravellerQrCode":
                        Item.Value = _traveller.travellerQRCode;
                        break;

                    case "HostelId":
                        Item.Value = _traveller.hostelId;
                        break;

                    case "Mode":
                        Item.Value = mode;

                        break;
                    }
                }
                DALHelper.FillDataset(transaction, CommandType.StoredProcedure, "GetTravellerCheckinDetails", dsResult, new string[] { "Traveller" }, paramData);

                return(dsResult.Tables.Contains("Traveller") ? dsResult.Tables["Traveller"] : null);
            }
            catch (Exception ex)
            {
                ErrorLogDL.InsertErrorLog(ex.Message, "GetTravellerChekInInfo");
                throw ex;
            }
        }
Beispiel #22
0
        public DataTable Login(User _user)
        {
            IDbConnection con    = null;
            DataSet       dsData = new DataSet();
            DataTable     fromdt = new DataTable();
            Dictionary <string, object> dsResult = new Dictionary <string, object>();

            try
            {
                con = DALHelper.GetConnection();
                return(_loginDL.Login(_user, con));
            }
            catch (Exception ex)
            {
                ErrorLogDL.InsertErrorLog(ex.Message, "LoginBL:Login");

                throw;
            }
            finally
            {
                DALHelper.CloseDB(con);
            }
        }
Beispiel #23
0
        public string UpdateHostelUser(Hostel _hostel)
        {
            bool           IsSuccess   = true;
            string         message     = "";
            IDbTransaction transaction = null;

            try
            {
                transaction = DALHelper.GetTransaction();

                Int64 resultID = _hostelDL.UpdateHostelUser(_hostel, transaction);
                if (resultID > 0)
                {
                    message = "Hostel updated successfully";
                }
            }
            catch (SqlException ex)
            {
                IsSuccess = false;
                if (ex.Message.Contains("UNIQUE KEY"))
                {
                    message = "cannot insert hostel name with same name";
                }
                else
                {
                    IsSuccess = false;
                    ErrorLogDL.InsertErrorLog(ex.Message, "HostelBL : UpdateHostelUser");
                    throw;
                }
            }
            finally
            {
                DALHelper.CloseDB(transaction, IsSuccess);
            }
            return(message);
        }
Beispiel #24
0
        private void InsertGalery(DataTable dt, Int32 hostelId)
        {
            bool           IsSuccess   = true;
            IDbTransaction transaction = null;

            try
            {
                transaction = DALHelper.GetTransaction();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    Int64 resultID = _hostelDL.AddGallery(dt.Rows[i], transaction, hostelId);
                }
            }
            catch (Exception ex)
            {
                ErrorLogDL.InsertErrorLog(ex.Message, "AddGallery");
                IsSuccess = false;
                throw;
            }
            finally
            {
                DALHelper.CloseDB(transaction, IsSuccess);
            }
        }
Beispiel #25
0
        public async Task <IHttpActionResult> CheckInCheckOut()
        {
            TravellerCheckIn _traveller = new TravellerCheckIn();

            // Check if the request contains multipart/form-data.
            if (!Request.Content.IsMimeMultipartContent())
            {
                throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
            }

            var provider = await Request.Content.ReadAsMultipartAsync <InMemoryMultipartFormDataStreamProvider>(new InMemoryMultipartFormDataStreamProvider());

            //access form data
            NameValueCollection formData = provider.FormData;

            try
            {
                _traveller.hostelId        = Convert.ToInt32(formData["hostelId"]);
                _traveller.travellerQRCode = formData["travellerQRCode"];
                _traveller.trackingId      = string.IsNullOrEmpty(formData["trackingId"]) ? 0 : Convert.ToInt64(formData["trackingId"]);

                //   _traveller.checkInDate = string.IsNullOrEmpty(formData["checkInDate"]) ? Convert.ToDateTime(formData["checkInDate"]) : System.DateTime.Now;
                //  _traveller.checkOutDate = string.IsNullOrEmpty(formData["checkOutDate"]) ? Convert.ToDateTime(formData["checkOutDate"]) : System.DateTime.Now;

                _traveller.Action = formData["status"];


                if (!string.IsNullOrEmpty(formData["checkInDate"]))
                {
                    _traveller.checkInDate = Convert.ToDateTime(formData["checkInDate"].ToString());
                }
                else
                {
                    _traveller.checkInDate = System.DateTime.Now;
                }
                if (!string.IsNullOrEmpty(formData["checkOutDate"]))
                {
                    _traveller.checkOutDate = Convert.ToDateTime(formData["checkOutDate"].ToString());
                }
                else
                {
                    _traveller.checkOutDate = System.DateTime.Now;
                }

                _traveller.isPontsSpent    = Convert.ToBoolean(formData["isPointsSpent"]);
                _traveller.NoOfPointsSpent = (string.IsNullOrEmpty(formData["noOfPoints"].ToString())) ? 0 : Convert.ToInt16(formData["noOfPoints"]);
            }
            catch (Exception ex)
            {
                ErrorLogDL.InsertErrorLog(ex.Message, "Error Is Logged without conversion " + formData["checkInDate"].ToString());

                ErrorLogDL.InsertErrorLog(ex.Message, "Error Is Logged with conversion" + Convert.ToDateTime(formData["checkInDate"].ToString()));

                ErrorLogDL.InsertErrorLog(ex.Message, formData["hostelId"]);

                ErrorLogDL.InsertErrorLog(ex.Message, formData["trackingId"]);

                ErrorLogDL.InsertErrorLog(ex.Message, formData["status"]);
            }
            return(Ok(travellerBL.AddTravellerCheckInDetails(_traveller)));
        }