Esempio n. 1
0
        public Int64 RegisterCurrentUser(RegisterUserDto dto)
        {
            try
            {
                Logger.Info("Just entered RegisterCurrentUser function " + dto.Email);

                var dateRegistered = DateTime.Now.ToString();

                using (var db = new EOneContext())
                {
                    Int64 a = 0;
                    Logger.Info("***About to call stored procedure dbo.register_dispatch_rider, with values Email Address " + dto.Email + " Device Id " + dto.DeviceId + " Status " + dto.Status);
                    var cmd = db.Database.Connection.CreateCommand();
                    cmd.CommandText = "dbo.register_dispatch_rider";
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add(new SqlParameter("@email", dto.Email.Trim()));
                    cmd.Parameters.Add(new SqlParameter("@DeviceId", dto.DeviceId.Trim()));
                    cmd.Parameters.Add(new SqlParameter("@RegisterStatus", dto.Status.Trim()));

                    try
                    {
                        Logger.Info("Opening the connection " + dto.Email);

                        ((IObjectContextAdapter)db).ObjectContext.Connection.Open();

                        a = Convert.ToInt64(cmd.ExecuteNonQuery());
                        Logger.Info(dto.Email + " Rider was successfully registered, Number of Rows Affected is " + a);
                    }
                    catch (Exception ex)
                    {
                        Logger.Info("Entered an exeption code block when calling stored procedure dbo.register_dispatch_rider " + dto.Email);
                        Logger.Error(ex);
                        return(-1);
                    }
                    finally
                    {
                        Logger.Info("Closing the connection to the EOne DB after insertion " + dto.Email);
                        db.Database.Connection.Close();
                    }
                    Logger.Info("About to return Id afer registering Dispatch Rider " + dto.Email);

                    return(a);
                }
            }
            catch (Exception ex)
            {
                Logger.Error("GetAllRequestForUser function entered an exception " + dto.Email);
                Logger.Error(ex);
                return(-1);
            }
        }
Esempio n. 2
0
        public Int64 SubmitMailroomPickUpOnDB(SubmitMailroomPickupRequestDto dto)
        {
            try
            {
                Logger.Info("Just entered SubmitMailroomPickUpOnDB function " + dto.MailRoomName);

                var dateRegistered = DateTime.Now.ToString();

                using (var db = new EOneContext())
                {
                    Int64 a = 0;
                    Logger.Info("***About to call stored procedure dbo.submit_mailroom_pickup_request, with values Email Address " + dto.MailRoomName + " QRCode " + dto.QrCode);
                    var cmd = db.Database.Connection.CreateCommand();
                    cmd.CommandText = "dbo.submit_mailroom_pickup_request";
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add(new SqlParameter("@qrCode", dto.QrCode.Trim()));
                    cmd.Parameters.Add(new SqlParameter("@mailRoomName", dto.MailRoomName.Trim()));

                    try
                    {
                        Logger.Info("Opening the connection, for mailroom officer" + dto.MailRoomName);

                        ((IObjectContextAdapter)db).ObjectContext.Connection.Open();

                        a = Convert.ToInt64(cmd.ExecuteNonQuery());
                        Logger.Info(dto.MailRoomName + " Mailroom pickup request was successfully submitted, Number of Rows Affected is " + a);
                    }
                    catch (Exception ex)
                    {
                        Logger.Info("Entered an exeption code block when calling stored procedure dbo.submit_mailroom_pickup_request " + dto.MailRoomName);
                        Logger.Error(ex);
                        return(-1);
                    }
                    finally
                    {
                        Logger.Info("Closing the connection to the EOne DB after insertion " + dto.MailRoomName);
                        db.Database.Connection.Close();
                    }
                    Logger.Info("About to return Id afer submitting Mailroom officer pickup request " + dto.MailRoomName);

                    return(a);
                }
            }
            catch (Exception ex)
            {
                Logger.Error("SubmitMailroomPickUpOnDB function entered an exception " + dto.MailRoomName);
                Logger.Error(ex);
                return(-1);
            }
        }
Esempio n. 3
0
        public IEnumerable <AllUserDto> GetAllNames()
        {
            try
            {
                Logger.Info("Just entered GetAllNames function");

                using (var db = new EOneContext())
                {
                    var list = db.ExecuteQuery <AllUserDto>("select Courier_Name, Units_Branches, Phone_Numbers, Email_Address,Status, Branch_Code from Dispatch_Riders_Lagos", new Object[] { }).ToList();
                    return(list);
                }
            }
            catch (Exception ex)
            {
                Logger.Error("GetAllNames function entered an exception");
                Logger.Error(ex);
                return(null);
            }
        }
Esempio n. 4
0
        public IEnumerable <GetAllRequestForUserDto> GetMailroomRequestList(GetMailroomRequestDto dto)
        {
            try
            {
                Logger.Info("Just entered GetMailroomRequestList function");

                using (var db = new EOneContext())
                {
                    var list = db.ExecuteQuery <GetAllRequestForUserDto>("select * from Courier_Tracker where Dispatch_Rider_Name is not Null and Dispatch_Rider_Pickup_DateTime is not Null and Central_Mailroom_Officer is Null and Central_Mailroom_Date is Null", new Object[] { }).ToList();
                    return(list);
                }
            }
            catch (Exception ex)
            {
                Logger.Error("GetMailroomRequestList function entered an exception");
                Logger.Error(ex);
                return(null);
            }
        }
Esempio n. 5
0
        public IEnumerable <GetAllRequestForUserDto> GetRiderRequestList(GetRiderRequestDto dto)
        {
            try
            {
                Logger.Info("Just entered GetRiderRequestList function" + dto.RiderEmail);

                using (var db = new EOneContext())
                {
                    var list = db.ExecuteQuery <GetAllRequestForUserDto>("select * from Courier_Tracker where PickUp_Branch ='" + dto.BranchCode.Trim() + "' and Dispatch_Rider_Name is Null and Dispatch_Rider_Pickup_DateTime is Null ", new Object[] { }).ToList();
                    return(list);
                }
            }
            catch (Exception ex)
            {
                Logger.Error("GetRiderRequestList function entered an exception" + dto.RiderEmail);
                Logger.Error(ex);
                return(null);
            }
        }