public GetAgentDriverResponse GetAgentDriver(GetAgentDriverRequest request)
        {
            GetAgentDriverResponse response = new GetAgentDriverResponse();
            Driver driver = null;

            try
            {
                if (!CheckAuthDriver(request.user_id, request.auth_token))
                {
                    _userServices.MakeNouserResponse(response);
                    return(response);
                }
                using (DriverDao dao = new DriverDao())
                {
                    driver = dao.FindById(request.user_id);
                    DTOs.Driver.DriverDetailsDto dto = new DTOs.Driver.DriverDetailsDto();
                    DriverHelper.CopyFromEntity(dto, driver);
                    response.code           = 0;
                    response.has_resource   = 1;
                    response.driver_details = dto;
                    response.message        = MessagesSource.GetMessage("got.agent.driver");
                }
            }
            catch (Exception ex)
            {
                response.MakeExceptionResponse(ex);
            }

            return(response);
        }
        public static OrderInvoiceDto GetOrderInvoiceOrReciept(int user_id, OrdersServices.OrderType order_type, int order_id, bool isConReceipt)
        {
            OrderInvoiceDto response = new OrderInvoiceDto();

            if (order_type == OrdersServices.OrderType.OrderApp)
            {
                using (OrderDao dao = new OrderDao())
                {
                    //Order ord = (isConReceipt ? dao.GetConsumerOrder(user_id, order_id) : dao.GetAgentOrder(user_id, order_id));
                    Order           ord = dao.GetDriverOrder(user_id, order_id);
                    OrderInvoiceDto dto = new OrderInvoiceDto();
                    DriverHelper.CopyFromEntity(dto, ord);
                    response = dto;
                }
            }
            else if (order_type == OrdersServices.OrderType.OrderTelp)
            {
                using (TeleOrderDao dao = new TeleOrderDao())
                {
                    TeleOrder       ord = dao.GetDriverOrder(user_id, order_id);
                    OrderInvoiceDto dto = new OrderInvoiceDto();
                    DriverHelper.CopyFromEntity(dto, ord);
                    response = dto;
                }
            }
            return(response);
        }
        public LoginResponse Login(LoginRequest request)
        {
            request.mobile_number = Common.GetStandardMobileNumber(request.mobile_number);
            LoginResponse response     = new LoginResponse();
            Driver        driver       = null;
            string        hashPassword = TokenGenerator.GetHashedPassword(request.password, 49);

            try
            {
                using (DriverDao dao = new DriverDao())
                {
                    //driver = dao.FindByMobileNumber(request.mobile_number);
                    driver = dao.FindByMobileNumberAndPassword(request.mobile_number, hashPassword);

                    if (driver == null)
                    {
                        MakeNoDriverResponse(response);
                        return(response);
                    }

                    driver.AppID     = request.app_id;
                    driver.AppToken  = request.push_token;
                    driver.LastLogin = DateTime.Now;
                    driver.AccToken  = TokenGenerator.GenerateToken(driver.DriverName, driver.Password, driver.MobileNumber);
                    dao.Update(driver);
                    response.code             = 0;
                    response.user_login       = new UserLoginDto();
                    response.driver_details   = new DriverDetails();
                    response.reminder_details = new ReminderDetailsDto();

                    var reminder = dao.GetRemindersForDriver();
                    response.has_reminder = (reminder == null ? 0 : 1);
                    //if (reminder == null)
                    //{
                    //    reminder = new Reminder();
                    //}
                    DriverHelper.CopyFromEntity(response, driver, reminder);

                    response.has_resource = 1;
                    response.message      = MessagesSource.GetMessage("login.ok");
                    return(response);
                }
            }
            catch (Exception ex)
            {
                response.MakeExceptionResponse(ex);
            }

            return(response);
        }