예제 #1
0
        public ActionResult GetLastRequest(string Type)
        {
            object result = "";

            try
            {
                var temp = new B_ServicesRequests().GetUserLastRequest(CurrentUser.Id, Type);
                if (temp != null)
                {
                    result = temp;
                }
            }
            catch (Exception ex)
            {
                M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_USER_WEB_APPLICATION, E_LogType.ERROR, ex);
                result = "Error";
                if (ex.Source == E_LogType.SYSTEM_ERROR.ToString())
                {
                    exx.LogType = E_LogType.SYSTEM_ERROR;
                    result      = exx;
                }
                L_Log.SubmitLog(exx);
            }
            return(Json(result));
        }
예제 #2
0
        public ActionResult GetLastRequestUser()
        {
            object result = "";

            try
            {
                var temp = new B_ServicesRequests().GetUserLastRequest(CurrentUser.Id, E_PublicCategory.REQUEST_STATUS.CLOSED);
                if (temp != null && (bool)temp.ShowRatingDialog == false && temp.PersonelId != null)
                {
                    result = new { Request = temp, Point = new B_ServicesRequestItems().GetItemsPoint(temp.Id), Personel = new B_Personels().GetPersonelById((int)temp.PersonelId) }
                }
                ;
            }
            catch (Exception ex)
            {
                M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_USER_WEB_APPLICATION, E_LogType.ERROR, ex);
                result = "Error";
                if (ex.Source == E_LogType.SYSTEM_ERROR.ToString())
                {
                    exx.LogType = E_LogType.SYSTEM_ERROR;
                    result      = exx;
                }
                L_Log.SubmitLog(exx);
            }
            return(Json(result));
        }
예제 #3
0
        public ActionResult GetRequestHistory()
        {
            object result = "";

            try
            {
                var obj      = new List <object>();
                var requests = new B_ServicesRequests().GetServicesRequests(CurrentUser.Id, null).Where(x => x.Status == E_PublicCategory.REQUEST_STATUS.CLOSED).ToList().OrderByDescending(x => x.CreateDate);
                if (requests.Count() > 0 && requests != null)
                {
                    foreach (var li in requests)
                    {
                        obj.Add(new
                        {
                            Date   = li.CreateDate.ConvertMiladiToShamsi(),
                            Number = li.Id,
                            Point  = new B_ServicesRequestItems().GetItemsPoint(li.Id)
                        });
                    }
                }
                result = obj;
            }
            catch (Exception ex)
            {
                M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_USER_WEB_APPLICATION, E_LogType.ERROR, ex);
                result = "Error";
                if (ex.Source == E_LogType.SYSTEM_ERROR.ToString())
                {
                    exx.LogType = E_LogType.SYSTEM_ERROR;
                    result      = exx;
                }
                L_Log.SubmitLog(exx);
            }
            return(Json(result));
        }
예제 #4
0
        public ActionResult GetServiceMapPointes(int Id)
        {
            object result = "";

            try
            {
                B_ServicesRequests bPersonel = new B_ServicesRequests();
                var points = bPersonel.GetServiceMapPointes(Id);
                var objs   = new List <object>();
                foreach (var li in points)
                {
                    objs.Add(new {
                        popupContent = "<p></p>",
                        center       = new { lat = li.Split(',')[0].Trim(), lng = li.Split(',')[1].Trim() },
                        iconOpts     = new { iconUrl = "/Areas/Admin/Images/MapMarkerNew.png", iconRetinaUrl = "/Areas/Admin/Images/MapMarkerNew.png", iconSize = new int[] { 30, 38 } }
                    });
                }
                result = objs;
            }
            catch (Exception ex)
            {
                M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_WEB_APPLICATION, E_LogType.ERROR, ex);
                result = "Error";
                if (ex.Source == E_LogType.SYSTEM_ERROR.ToString())
                {
                    exx.LogType = E_LogType.SYSTEM_ERROR;
                    result      = exx;
                }
                L_Log.SubmitLog(exx);
            }
            return(Json(result));
        }
        public ActionResult Modify(M_ServicesRequests ServicesRequests, List <M_ServicesRequestItems> RequestList)
        {
            object result = "";

            try
            {
                var request = new B_ServicesRequests().GetServicesRequests(ServicesRequests.Id);
                if (request != null)
                {
                    request.Address            = ServicesRequests.Address;
                    request.Description        = ServicesRequests.Description;
                    request.ImmediatelyRequest = ServicesRequests.ImmediatelyRequest;
                    request.PlaqueNumber       = ServicesRequests.PlaqueNumber;
                    request.UnitNumber         = ServicesRequests.UnitNumber;
                    request.UpdateDate         = DateTime.Now;
                    new B_ServicesRequests().Edit(request, false);
                }
                var bItems   = new B_ServicesRequestItems();
                var oldItems = bItems.GetItems(ServicesRequests.Id, E_PublicCategory.SYSTEM_USER_TYPE.NORMAL_USER);
                foreach (var li in oldItems)
                {
                    bItems.Delete(li.Id);
                }
                foreach (var li in RequestList)
                {
                    if (!li.CategoryId.HasValue)
                    {
                        throw F_ExeptionFactory.MakeExeption("مقادیر دسته بندی های انتخاب شده صحیح نیست لطفا مراتب را سریعتر به تیم فنی پروژه گزارش دهید", Enums.Loging.E_LogType.SYSTEM_ERROR);
                    }
                    var category = new B_ServicesCategories().GetServicesCategories(li.CategoryId.Value);
                    li.CategoryId         = category.Id;
                    li.CreateDate         = category.CreateDate;
                    li.ImageName          = category.ImageName;
                    li.IsFailed           = false;
                    li.RequestId          = ServicesRequests.Id;
                    li.ScorePerUnit       = category.ScorePerUnit;
                    li.ScorePerUnitDriver = category.ScorePerUnitDriver;
                    li.Title    = category.Title;
                    li.Unit     = category.Unit;
                    li.UserId   = request.UserId;
                    li.UserType = E_PublicCategory.SYSTEM_USER_TYPE.NORMAL_USER;
                    li.Id       = 0;
                    bItems.Add(li);
                }

                result = "Success";
            }
            catch (Exception ex)
            {
                M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_WEB_APPLICATION, E_LogType.ERROR, ex);
                result = "Error";
                if (ex.Source == E_LogType.SYSTEM_ERROR.ToString())
                {
                    exx.LogType = E_LogType.SYSTEM_ERROR;
                    result      = exx;
                }
                L_Log.SubmitLog(exx);
            }
            return(Json(result));
        }
예제 #6
0
 public object LocationDriver(int RequestId)
 {
     try
     {
         var request = new B_ServicesRequests().GetServicesRequests(RequestId);
         if (request == null)
         {
             return(false);
         }
         var clientRecipment = Users.Where(c => c.Id == request.UserId).ToList();
         if (clientRecipment == null)
         {
             return(false);
         }
         var cController = new ServicesRequestsController();
         return(cController.getRequestDetail(request.Id, request.UserId));
     }
     catch (Exception ex)
     {
         M_SystemLog exx = new M_SystemLog(E_SystemType.SIGNALR_HUB, E_LogType.ERROR, ex);
         if (ex.Source == E_LogType.SYSTEM_ERROR.ToString())
         {
             exx.LogType = E_LogType.SYSTEM_ERROR;
         }
         L_Log.SubmitLog(exx);
         return(false);
     }
 }
예제 #7
0
        public ActionResult DoneRequest(int Id)
        {
            object result = "";

            try
            {
                var bReq = new B_ServicesRequests();
                bReq.CloseRequestByPortal(Id);
                result = true;
                try
                {
                    var req           = bReq.GetServicesRequests(Id);
                    var hubConnection = new HubConnection(url: SignalRUrl);
                    var chat          = hubConnection.CreateHubProxy(hubName: "Reqeust");

                    hubConnection.Start().Wait();

                    chat.Invoke <bool>("RequestChangedStatus", req, req.UserId);
                }
                catch { }
            }
            catch (Exception ex)
            {
                M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_BOOTH_RIDER_APPLICATION, E_LogType.ERROR, ex);
                result = "Error";
                if (ex.Source == E_LogType.SYSTEM_ERROR.ToString())
                {
                    exx.LogType = E_LogType.SYSTEM_ERROR;
                    result      = exx;
                }
                L_Log.SubmitLog(exx);
            }
            return(Json(result));
        }
        public ActionResult Modify(int Id)
        {
            ViewBag.Route = new List <MFRoute>
            {
                new MFRoute {
                    ActionName = "Index", ControllerName = "ServicesRequests", Title = "لیست درخواست ها", Priority = 1
                }
            };

            var request = new B_ServicesRequests().GetServicesRequests(Id);

            if (request == null)
            {
                return(RedirectToAction("Index"));
            }
            if (request.Status == E_PublicCategory.REQUEST_STATUS.CLOSED)
            {
                return(RedirectToAction("Index"));
            }

            ViewBag.ServiceCategoryList = new B_ServicesCategories().GetServicesCategories(false);
            ViewBag.ServiceRequestItems = new B_ServicesRequestItems().GetItems(Id);

            var           date1 = DateTime.Now;
            var           bDate = new B_Pouriya_Date();
            List <object> obj   = new List <object>();

            for (int i = 0; i < 7; i++)
            {
                if (i != 0)
                {
                    date1 = date1.AddDays(1);
                }
                var date = bDate.GetDate(date1);
                if (date == null)
                {
                    date = bDate.Add(date1);
                }
                obj.Add(new
                {
                    Title = date1.ConvertToPesianDateName(),
                    Id    = date.Id,
                    Hours = new List <object> {
                        new { Hour = "8 تا 11", Id = (int)E_PublicCategory.SERVICE_TIME.Time_8_11, IsActive = isPast(date1.AddDays(i), E_PublicCategory.SERVICE_TIME.Time_8_11) },
                        new { Hour = "11 تا 14", Id = (int)E_PublicCategory.SERVICE_TIME.Time_11_14, IsActive = isPast(date1.AddDays(i), E_PublicCategory.SERVICE_TIME.Time_11_14) },
                        new { Hour = "14 تا 17", Id = (int)E_PublicCategory.SERVICE_TIME.Time_14_17, IsActive = isPast(date1.AddDays(i), E_PublicCategory.SERVICE_TIME.Time_14_17) },
                        new { Hour = "17 تا 20", Id = (int)E_PublicCategory.SERVICE_TIME.Time_17_20, IsActive = isPast(date1.AddDays(i), E_PublicCategory.SERVICE_TIME.Time_17_20) },
                        new { Hour = "20 تا 22", Id = (int)E_PublicCategory.SERVICE_TIME.Time_20_22, IsActive = isPast(date1.AddDays(i), E_PublicCategory.SERVICE_TIME.Time_20_22) }
                    }
                });
            }
            ViewBag.Times = Json(obj);

            return(View(request));
        }
예제 #9
0
        public ActionResult EditRequest(int RequestId, List <M_ServicesRequestItems> RequestItems)
        {
            object result = "";

            try
            {
                var bItem    = new B_ServicesRequestItems();
                var oldItems = bItem.GetItems(RequestId, E_PublicCategory.SYSTEM_USER_TYPE.NORMAL_USER);
                var userId   = new B_ServicesRequests().GetServicesRequests(RequestId).UserId;
                foreach (var li in oldItems)
                {
                    bItem.Delete(li.Id);
                }
                if (RequestItems != null && RequestItems.Count > 0)
                {
                    foreach (var li in RequestItems)
                    {
                        if (li.Value != 0)
                        {
                            var category = new B_ServicesCategories().GetServicesCategories(li.Id);
                            if (category != null)
                            {
                                bItem.Add(new M_ServicesRequestItems
                                {
                                    CreateDate   = DateTime.Now,
                                    RequestId    = RequestId,
                                    UserType     = E_PublicCategory.SYSTEM_USER_TYPE.NORMAL_USER,
                                    Value        = li.Value,
                                    ImageName    = category.ImageName,
                                    ScorePerUnit = category.ScorePerUnit,
                                    Title        = category.Title,
                                    Unit         = category.Unit,
                                    IsFailed     = false,
                                    UserId       = userId,
                                    CategoryId   = category.Id
                                });
                            }
                        }
                    }
                }
                result = true;
            }
            catch (Exception ex)
            {
                M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_BOOTH_RIDER_APPLICATION, E_LogType.ERROR, ex);
                result = "Error";
                if (ex.Source == E_LogType.SYSTEM_ERROR.ToString())
                {
                    exx.LogType = E_LogType.SYSTEM_ERROR;
                    result      = exx;
                }
                L_Log.SubmitLog(exx);
            }
            return(Json(result));
        }
        public ActionResult NewRequests()
        {
            ViewBag.Route = new List <MFRoute>
            {
                new MFRoute {
                    ActionName = "Index", ControllerName = "ServicesRequests", Title = "لیست درخواست ها", Priority = 1
                }
            };
            var requsts = new B_ServicesRequests().GetFullNewServicesRequests(CurrentUser.PersonelType == E_PublicCategory.PERSONEL_TYPE.SUM_CENER ? CurrentUser.Id : 0);

            return(View(requsts.OrderBy(c => c.Id).ToList()));
        }
예제 #11
0
        public ActionResult Index()
        {
            var bStatictics = new B_Statistics();
            var requestData = bStatictics.GetRequestStatisticsPastMonth();

            ViewBag.ReqData     = "";
            ViewBag.ReqCategory = "";
            foreach (var li in requestData)
            {
                ViewBag.ReqData     += ViewBag.ReqData == "" ? li.Item2 + "" : "," + li.Item2;
                ViewBag.ReqCategory += ViewBag.ReqCategory == "" ? "'" + li.Item1 + "'" : ",'" + li.Item1 + "'";
            }
            ViewBag.UserCount = bStatictics.GetUsersCount();

            var markers = "";

            foreach (var li in new B_ServicesRequests().GetFullLast30Request())
            {
                markers += "{ 'popupContent': '" + getMapPupWindow(li) + "', 'center': { 'lat': " + li.GeographicalCoordinates.Split(',')[0].Trim() + " ,'lng': " + li.GeographicalCoordinates.Split(',')[1].Trim() + " }, 'iconOpts': { 'iconUrl': '/Areas/Admin/Images/MapMarker" + (li.Status == Enums.E_PublicCategory.REQUEST_STATUS.NEW_REQUEST ? "New" : "Other") + ".png', 'iconRetinaUrl': '/Areas/Admin/Images/MapMarker" + (li.Status == Enums.E_PublicCategory.REQUEST_STATUS.NEW_REQUEST ? "New" : "Other") + ".png', 'iconSize': [30, 38] } },";
            }

            ViewBag.LastestRequest = markers;

            var chartTypeRes = new B_ServicesRequests().GetForChartType();
            var reqStatus    = new B_PublicCategory().GetPublicCategory(E_PublicCategory.PUBLIC_CATEGORY_PARENT.REQUEST_STATUS);

            foreach (var li in chartTypeRes)
            {
                ViewBag.ForChartType += "['" + reqStatus.Where(c => c.Id == (int)li.Item2).FirstOrDefault().Title + "', " + li.Item1 + "],";
            }


            var chartTypePay   = new B_UserPayment().GetForChartType();
            var chartStatusPay = new B_UserPayment().GetForChartStatus();
            var payType        = new B_PublicCategory().GetPublicCategory(E_PublicCategory.PUBLIC_CATEGORY_PARENT.PAYMENT_TYPE);
            var payStatus      = new B_PublicCategory().GetPublicCategory(E_PublicCategory.PUBLIC_CATEGORY_PARENT.PAYMENT_STATUS);

            foreach (var li in chartTypePay)
            {
                ViewBag.ForChartPayType += "['" + payType.Where(c => c.Id == (int)li.Item2).FirstOrDefault().Title + "', " + li.Item1 + "],";
            }
            foreach (var li in chartStatusPay)
            {
                ViewBag.ForChartPayStatus += "['" + payStatus.Where(c => c.Id == (int)li.Item2).FirstOrDefault().Title + "', " + li.Item1 + "],";
            }

            ViewBag.BoothCount = bStatictics.GetBoothCount();

            return(View());
        }
예제 #12
0
        public ActionResult RideModeProceed()
        {
            var request = new B_ServicesRequests().GetUserLastRequest(CurrentUser.Id, "CAR");

            if (request != null)
            {
                if (request.Status == E_PublicCategory.REQUEST_STATUS.CLOSED)
                {
                    return(RedirectToAction("RideMode"));
                }
                var driver = new B_Personels().GetPersonelById(request.PersonelId.HasValue ? (int)request.PersonelId : 0);
                if (driver != null)
                {
                    var car = new B_CarInfo().GetCarInfo(driver.Id);
                    ViewBag.DriverName  = driver.FirstName + " " + driver.LastName;
                    ViewBag.DriverCode  = "کد راننده : " + driver.Id;
                    ViewBag.DriverImage = new E_FTPRoutes(BaseUrl).PERSONELS + driver.ImageName;
                    ViewBag.Car         = car.Name + " - " + car.Color;
                    ViewBag.TagFirst    = car.TagFirst;
                    ViewBag.TagMiddle   = car.TagMiddle;
                    ViewBag.TagLast     = car.TagLast;
                    ViewBag.NationalTag = car.TagNational;
                    ViewBag.PhoneNumber = driver.MobileNumber;
                }
                else
                {
                    ViewBag.DriverName         = " --- ";
                    ViewBag.DriverImage        = new E_FTPRoutes(BaseUrl).PERSONELS + "Default.jpg";
                    ViewBag.DriverCode         = "کد راننده : ---";
                    ViewBag.Car                = " --- ";
                    ViewBag.LicensePlaceNumber = "------";
                    ViewBag.NationalTag        = "--";
                    ViewBag.PhoneNumber        = "";
                }
                ViewBag.Status             = getRequestStatus(request.Status);
                ViewBag.LatUser            = request.GeographicalCoordinates.Split(',')[0];
                ViewBag.LngUser            = request.GeographicalCoordinates.Split(',')[1];
                ViewBag.RequestId          = request.Id;
                ViewBag.Disrespectful      = (int)E_PublicCategory.FEEDBACK.DISRESPECTFUL_BEHAVIOR;
                ViewBag.PersonalReasons    = (int)E_PublicCategory.FEEDBACK.PERSONAL_REASONS;
                ViewBag.GetToYourPlaceLate = (int)E_PublicCategory.FEEDBACK.GET_TO_YOUR_PLACE_LATE;
                ViewBag.Request            = request;
                ViewBag.RequestItems       = new B_ServicesRequestItems().GetItems(request.Id, E_PublicCategory.SYSTEM_USER_TYPE.NORMAL_USER);
            }
            else
            {
                return(RedirectToAction("RideMode"));
            }
            return(View());
        }
예제 #13
0
        private bool isValidUserForInsertRequest(string Type)
        {
            B_ServicesRequests bRequest = new B_ServicesRequests();
            var requests = bRequest.GetServicesRequests(CurrentUser.Id, null);
            var temp     = requests.Where(x => x.Status != E_PublicCategory.REQUEST_STATUS.CLOSED && x.Status != E_PublicCategory.REQUEST_STATUS.CANCEL && x.Pouriya_Type == Type).ToList();

            if (temp.Count != 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
예제 #14
0
        public ActionResult CancelRequest(int RequestId, int DeleteMessageId, string MessageText)
        {
            object result = "";

            try
            {
                new B_ServicesRequests().CancelRequestUser(MessageText, RequestId, CurrentUser.Id, DeleteMessageId);
                var request = new B_ServicesRequests().GetServicesRequests(RequestId);
                if (request.PersonelId.HasValue)
                {
                    try
                    {
                        var hubConnection = new HubConnection(url: SignalRUrl);
                        var chat          = hubConnection.CreateHubProxy(hubName: "Reqeust");

                        hubConnection.Start().Wait();
                        chat.Invoke <bool>("RequestChangedStatusPersonel", request, request.PersonelId);
                    }
                    catch { }
                }
                else
                {
                    try
                    {
                        var hubConnection = new HubConnection(url: SignalRUrl);
                        var chat          = hubConnection.CreateHubProxy(hubName: "Reqeust");

                        hubConnection.Start().Wait();
                        chat.Invoke <bool>("NewRequestDriver", request);
                    }
                    catch { }
                }
            }
            catch (Exception ex)
            {
                M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_USER_WEB_APPLICATION, E_LogType.ERROR, ex);
                result = "Error";
                if (ex.Source == E_LogType.SYSTEM_ERROR.ToString())
                {
                    exx.LogType = E_LogType.SYSTEM_ERROR;
                    result      = exx;
                }
                L_Log.SubmitLog(exx);
            }
            return(Json(result));
        }
예제 #15
0
        public ActionResult StationModeProceed()
        {
            var request = new B_ServicesRequests().GetUserLastRequest(CurrentUser.Id, "BOOTH");

            if (request != null)
            {
                if (request.Status == E_PublicCategory.REQUEST_STATUS.CLOSED)
                {
                    return(RedirectToAction("StationMode"));
                }
                var personel = new B_Personels().GetPersonelById(request.PersonelId.HasValue ? (int)request.PersonelId : 0);
                var booth    = new B_Booth().GetBoothByPersonelId(request.PersonelId.HasValue ? (int)request.PersonelId : 0);
                if (booth != null)
                {
                    ViewBag.PersonelName  = personel.FirstName + " " + personel.LastName;
                    ViewBag.PersonelImage = new E_FTPRoutes(BaseUrl).PERSONELS + personel.ImageName;
                    ViewBag.StationName   = booth.Name;
                    ViewBag.PhoneNumber   = personel.MobileNumber;
                    ViewBag.BoothAddress  = booth.Address;
                    ViewBag.StationCode   = "کد مرکز : " + booth.Id;
                }
                else
                {
                    ViewBag.PersonelName  = "---";
                    ViewBag.PersonelImage = new E_FTPRoutes(BaseUrl).PERSONELS + personel.ImageName;
                    ViewBag.StationName   = "---";
                    ViewBag.PhoneNumber   = "";
                    ViewBag.StationCode   = "کد مرکز : ---";
                }
                ViewBag.Status          = getRequestStatus(request.Status).Replace("#", booth.Id.ToString());
                ViewBag.Lat             = request.GeographicalCoordinates.Split(',')[0];
                ViewBag.Lng             = request.GeographicalCoordinates.Split(',')[1];
                ViewBag.RequestId       = request.Id;
                ViewBag.Disrespectful   = (int)E_PublicCategory.FEEDBACK.DISRESPECTFUL_BEHAVIOR;
                ViewBag.PersonalReasons = (int)E_PublicCategory.FEEDBACK.PERSONAL_REASONS;
                ViewBag.Request         = request;
                ViewBag.RequestItems    = new B_ServicesRequestItems().GetItems(request.Id, E_PublicCategory.SYSTEM_USER_TYPE.NORMAL_USER);
            }
            else
            {
                return(RedirectToAction("StationMode"));
            }
            return(View());
        }
        public ActionResult ShowDetails(int Id, bool FromNew)
        {
            var route = new List <MFRoute>
            {
                new MFRoute {
                    ActionName = "Index", ControllerName = "ServicesRequests", Title = "لیست درخواست ها", Priority = 1
                }
            };

            if (FromNew)
            {
                route.Add(new MFRoute {
                    ActionName = "NewRequests", ControllerName = "ServicesRequests", Title = "درخوات های جدید", Priority = 2
                });
            }
            ViewBag.Route = route;
            var requst = new B_ServicesRequests().GetFullServicesRequests(Id);

            if (requst == null)
            {
                return(RedirectToAction("Index"));
            }
            if (requst.PersonelId.HasValue)
            {
                requst.ResponsiblePersonel = new B_Personels().GetPersonelById(requst.PersonelId.Value);
            }
            ViewBag.UserList     = new B_ServicesRequestItems().GetItems(requst.Id, E_PublicCategory.SYSTEM_USER_TYPE.NORMAL_USER);
            ViewBag.PersonelList = new B_ServicesRequestItems().GetItems(requst.Id, E_PublicCategory.SYSTEM_USER_TYPE.PERSONEL);

            B_Personels bPersonel = new B_Personels();

            if (requst.ResponsiblePersonel != null)
            {
                ViewBag.DriverList = bPersonel.GetPersonels().Where(c => c.PersonelType == (requst.Pouriya_Type == "BOOTH" ? E_PublicCategory.PERSONEL_TYPE.SUM_CENER : E_PublicCategory.PERSONEL_TYPE.DRIVER) && c.Id != requst.ResponsiblePersonel.Id).ToList();
            }
            else
            {
                ViewBag.DriverList = bPersonel.GetPersonels().Where(c => c.PersonelType == (requst.Pouriya_Type == "BOOTH" ? E_PublicCategory.PERSONEL_TYPE.SUM_CENER : E_PublicCategory.PERSONEL_TYPE.DRIVER)).ToList();
            }

            return(View(requst));
        }
예제 #17
0
        public ActionResult FinishRequestFromUser(int RequestId, int Rate, List <int> MessageId, string Comment)
        {
            object result = "";

            try
            {
                result = new B_ServicesRequests().FinishRequestUser(RequestId, Comment, Rate, MessageId);
            }
            catch (Exception ex)
            {
                M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_USER_WEB_APPLICATION, E_LogType.ERROR, ex);
                result = "Error";
                if (ex.Source == E_LogType.SYSTEM_ERROR.ToString())
                {
                    exx.LogType = E_LogType.SYSTEM_ERROR;
                    result      = exx;
                }
                L_Log.SubmitLog(exx);
            }
            return(Json(result));
        }
        public ActionResult GetRequests(int StatusId, string FirstName, string LastName, DateTime?FromCreateDate, DateTime?ToCreateDate, int PageNumber)
        {
            object result = "";

            try
            {
                result = new B_ServicesRequests().GetFullServicesRequests(StatusId, FirstName, LastName, FromCreateDate, ToCreateDate, PageNumber, CurrentUser.PersonelType == E_PublicCategory.PERSONEL_TYPE.SUM_CENER ? CurrentUser.Id : 0);
            }
            catch (Exception ex)
            {
                M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_WEB_APPLICATION, E_LogType.ERROR, ex);
                result = "Error";
                if (ex.Source == E_LogType.SYSTEM_ERROR.ToString())
                {
                    exx.LogType = E_LogType.SYSTEM_ERROR;
                    result      = exx;
                }
                L_Log.SubmitLog(exx);
            }
            return(Json(result));
        }
예제 #19
0
        public ActionResult GetRequests()
        {
            object result = "";

            try
            {
                result = new B_ServicesRequests().GetServicesRequestsForPersonel(CurrentUser.Id, CurrentUser.PersonelType);
            }
            catch (Exception ex)
            {
                M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_BOOTH_RIDER_APPLICATION, E_LogType.ERROR, ex);
                result = "Error";
                if (ex.Source == E_LogType.SYSTEM_ERROR.ToString())
                {
                    exx.LogType = E_LogType.SYSTEM_ERROR;
                    result      = exx;
                }
                L_Log.SubmitLog(exx);
            }
            return(Json(result));
        }
        public ActionResult DoneRequest(int Id)
        {
            object result = "";

            try
            {
                var bReq = new B_ServicesRequests();
                bReq.CloseRequestByPortal(Id);
                result = true;
            }
            catch (Exception ex)
            {
                M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_WEB_APPLICATION, E_LogType.ERROR, ex);
                result = "Error";
                if (ex.Source == E_LogType.SYSTEM_ERROR.ToString())
                {
                    exx.LogType = E_LogType.SYSTEM_ERROR;
                    result      = exx;
                }
                L_Log.SubmitLog(exx);
            }
            return(Json(result));
        }
예제 #21
0
        public ActionResult AddRequestCar(RequestModelAddRequest Data)
        {
            object result = "";

            try
            {
                if (!isValidUserForInsertRequest("CAR"))
                {
                    throw F_ExeptionFactory.MakeExeption("کاربر گرامی تا اتمام درخواست قبلی،امکان ثبت درخواست جدید میسر نمیباشد",
                                                         ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "PhoneNumber", Enums.Loging.E_LogType.SYSTEM_ERROR);
                }
                if (string.IsNullOrEmpty(Data.Address))
                {
                    throw F_ExeptionFactory.MakeExeption("آدرس وارد شده صحیح نیست",
                                                         ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "PhoneNumber", Enums.Loging.E_LogType.SYSTEM_ERROR);
                }
                if (Data.DayId == 0)
                {
                    throw F_ExeptionFactory.MakeExeption("روز انتخاب شده صحیح نیست",
                                                         ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "PhoneNumber", Enums.Loging.E_LogType.SYSTEM_ERROR);
                }
                if (Data.TimeId == 0)
                {
                    throw F_ExeptionFactory.MakeExeption("ساعت انتخاب شده صحیح نیست",
                                                         ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "PhoneNumber", Enums.Loging.E_LogType.SYSTEM_ERROR);
                }
                //if (string.IsNullOrEmpty(Data.Description))
                //    throw F_ExeptionFactory.MakeExeption("توضیحات وارد شده صحیح نیست",
                //        ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "PhoneNumber", Enums.Loging.E_LogType.SYSTEM_ERROR);
                if (Data.UnitNumber == 0)
                {
                    throw F_ExeptionFactory.MakeExeption("شماره واحد وارد شده صحیح نیست",
                                                         ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "PhoneNumber", Enums.Loging.E_LogType.SYSTEM_ERROR);
                }
                if (Data.PlaqueNumber == 0)
                {
                    throw F_ExeptionFactory.MakeExeption("شماره پلاک وارد شده صحیح نیست",
                                                         ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "PhoneNumber", Enums.Loging.E_LogType.SYSTEM_ERROR);
                }
                bool rqItems = true;
                if (Data.RequestItems.Count > 0)
                {
                    foreach (var li in Data.RequestItems)
                    {
                        if (li.Value > 0)
                        {
                            rqItems = false;
                        }
                    }
                }
                if (rqItems)
                {
                    throw F_ExeptionFactory.MakeExeption("پسماندهای خود را به دسته بندی اضافه کنید",
                                                         ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "PhoneNumber", Enums.Loging.E_LogType.SYSTEM_ERROR);
                }
                var bServicesRequests = new B_ServicesRequests();
                var request           = new M_ServicesRequests
                {
                    Address                 = Data.Address,
                    Description             = Data.Description,
                    GeographicalCoordinates = Data.Lat + "," + Data.Lng,
                    PlaqueNumber            = Data.PlaqueNumber.ToString(),
                    Pouriya_DateId          = 0,
                    Pouriya_TimeId          = 0,
                    Pouriya_Type            = "CAR",
                    Status     = E_PublicCategory.REQUEST_STATUS.NEW_REQUEST,
                    UnitNumber = Data.UnitNumber.ToString(),
                    UserId     = CurrentUser.Id,
                    PersonelId = null,
                    CreateDate = DateTime.Now,
                };
                request = bServicesRequests.Add(request);
                var bItem = new B_ServicesRequestItems();
                if (Data.RequestItems != null && Data.RequestItems.Count > 0)
                {
                    foreach (var li in Data.RequestItems)
                    {
                        if (li.Value != 0)
                        {
                            var category = new B_ServicesCategories().GetServicesCategories(li.Id);
                            if (category != null)
                            {
                                bItem.Add(new M_ServicesRequestItems
                                {
                                    CreateDate   = DateTime.Now,
                                    RequestId    = request.Id,
                                    UserType     = E_PublicCategory.SYSTEM_USER_TYPE.NORMAL_USER,
                                    Value        = li.Value,
                                    ImageName    = category.ImageName,
                                    ScorePerUnit = category.ScorePerUnit,
                                    Title        = category.Title,
                                    Unit         = category.Unit,
                                    IsFailed     = false,
                                    UserId       = CurrentUser.Id,
                                    CategoryId   = category.Id
                                });
                            }
                        }
                    }
                }

                try
                {
                    var hubConnection = new HubConnection(url: SignalRUrl);
                    var chat          = hubConnection.CreateHubProxy(hubName: "Reqeust");

                    hubConnection.Start().Wait();

                    chat.Invoke <bool>("NewRequestDriver", request);
                }
                catch { }
            }
            catch (Exception ex)
            {
                M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_USER_WEB_APPLICATION, E_LogType.ERROR, ex);
                result = "Error";
                if (ex.Source == E_LogType.SYSTEM_ERROR.ToString())
                {
                    exx.LogType = E_LogType.SYSTEM_ERROR;
                    result      = exx;
                }
                L_Log.SubmitLog(exx);
            }
            return(Json(result));
        }