Exemple #1
0
        public GetGeneralResponse <SupportView> GetOneSupport(Guid SupportID)
        {
            GetGeneralResponse <SupportView> response = new GetGeneralResponse <SupportView>();

            try
            {
                Support supports = _supportRepository.FindBy(SupportID);

                response.data = supports.ConverttoSupportView();
            }
            catch (Exception)
            {
                throw;
            }
            return(response);
        }
        public GeneralResponse AddSpportTicketWaitingRespone(AddSupportTicketWaitingResponseRequest request,
                                                             Guid CreateemployeeID)
        {
            GeneralResponse response = new GeneralResponse();

            try
            {
                SupportTicketWaitingResponse supportTicketWaitingResponse = new SupportTicketWaitingResponse();

                supportTicketWaitingResponse.ID                         = Guid.NewGuid();
                supportTicketWaitingResponse.Comment                    = request.Comment;
                supportTicketWaitingResponse.CreateDate                 = PersianDateTime.Now;
                supportTicketWaitingResponse.CreateEmployee             = _employeeRepository.FindBy(CreateemployeeID);
                supportTicketWaitingResponse.ResponsePossibilityDate    = request.ResponsePossibilityDate;
                supportTicketWaitingResponse.SendNotificationToCustomer = request.SendNotificationToCustomer;
                supportTicketWaitingResponse.SendTicketDate             = request.SendTicketDate;
                supportTicketWaitingResponse.Support                    = _supportRepository.FindBy(request.SupportID);
                supportTicketWaitingResponse.TicketNumber               = request.TicketNumber;
                supportTicketWaitingResponse.RowVersion                 = 1;



                SupportStatusRelation supportStatusRelation = _supportStatusRelationRepository.FindBy(request.SupportStatusID);
                supportTicketWaitingResponse.Support.SupportStatus          = _supportStatusRepository.FindBy(supportStatusRelation.RelatedSupportStatus.ID);
                supportTicketWaitingResponse.Support.Customer.SupportStatus = supportTicketWaitingResponse.Support.SupportStatus;

                if (supportTicketWaitingResponse.Support.SupportStatus.IsLastSupportState)
                {
                    supportTicketWaitingResponse.Support.Closed = true;
                }

                _supportTicketWitingResponseRepository.Add(supportTicketWaitingResponse);
                _uow.Commit();

                #region Send SMS

                if (supportTicketWaitingResponse.Support.SupportStatus.SendSmsOnEnter)
                {
                    // Threading
                    SmsData smsData = new SmsData()
                    {
                        body = supportTicketWaitingResponse.Support.SupportStatus.SmsText, phoneNumber = supportTicketWaitingResponse.Support.Customer.Mobile1
                    };
                    Thread oThread = new Thread(SendSmsVoid);
                    oThread.Start(smsData);
                }

                #endregion
            }
            catch (Exception ex)
            {
                response.ErrorMessages.Add(ex.Message);
                if (ex.InnerException != null)
                {
                    response.ErrorMessages.Add(ex.InnerException.Message);
                }
            }

            return(response);
        }
        public GeneralResponse AddSupportExpertDispatch(AddSupportExpertDispatchRequest request, Guid CreateemployeeID)
        {
            GeneralResponse response = new GeneralResponse();

            try
            {
                SupportExpertDispatch supportExpertDispatch = new SupportExpertDispatch();

                supportExpertDispatch.ID                = Guid.NewGuid();
                supportExpertDispatch.CreateDate        = PersianDateTime.Now;
                supportExpertDispatch.CreateEmployee    = _employeeRepository.FindBy(CreateemployeeID);
                supportExpertDispatch.Comment           = request.Comment;
                supportExpertDispatch.DispatchDate      = request.DispatchDate;
                supportExpertDispatch.DispatchTime      = request.DispatchTime;
                supportExpertDispatch.ExpertEmployee    = _employeeRepository.FindBy(request.ExpertEmployeeID);
                supportExpertDispatch.CoordinatorName   = request.CoordinatorName;
                supportExpertDispatch.Support           = _supportRepository.FindBy(request.SupportID);
                supportExpertDispatch.Comment           = request.Comment;
                supportExpertDispatch.IsNewInstallation = request.IsNewInstallation;
                supportExpertDispatch.RowVersion        = 1;


                SupportStatusRelation supportStatusRelation = _supportStatusRelationRepository.FindBy(request.SupportStatusID);
                supportExpertDispatch.Support.SupportStatus          = _supportStatusRepository.FindBy(supportStatusRelation.RelatedSupportStatus.ID);
                supportExpertDispatch.Support.Customer.SupportStatus = supportExpertDispatch.Support.SupportStatus;

                if (supportExpertDispatch.Support.SupportStatus.IsLastSupportState)
                {
                    supportExpertDispatch.Support.Closed = true;
                }

                _supportExpertDispatchRepository.Add(supportExpertDispatch);
                _uow.Commit();
            }
            catch (Exception ex)
            {
                response.ErrorMessages.Add(ex.Message);
                if (ex.InnerException != null)
                {
                    response.ErrorMessages.Add(ex.InnerException.Message);
                }
            }

            return(response);
        }
        public GeneralResponse AddSupportInstallationDelay(AddSupportInstallationDelayRequest request,
                                                           Guid CreateEmployeeID)
        {
            GeneralResponse response = new GeneralResponse();

            try
            {
                SupportInstallationDelay supportInstallationDelay = new SupportInstallationDelay();

                supportInstallationDelay.ID                         = Guid.NewGuid();
                supportInstallationDelay.Comment                    = request.Comment;
                supportInstallationDelay.CreateDate                 = PersianDateTime.Now;
                supportInstallationDelay.CreateEmployee             = _employeeRepository.FindBy(CreateEmployeeID);
                supportInstallationDelay.InstallDate                = request.InstallDate;
                supportInstallationDelay.NextCallDate               = request.NextCallDate;
                supportInstallationDelay.RowVersion                 = 1;
                supportInstallationDelay.SendNotificationToCustomer = request.SendNotificationToCustomer;
                supportInstallationDelay.Support                    = _supportRepository.FindBy(request.SupportID);
                supportInstallationDelay.RowVersion                 = 1;



                SupportStatusRelation supportStatusRelation = _supportStatusRelationRepository.FindBy(request.SupportStatusID);
                supportInstallationDelay.Support.SupportStatus          = _supportStatusRepository.FindBy(supportStatusRelation.RelatedSupportStatus.ID);
                supportInstallationDelay.Support.Customer.SupportStatus = supportInstallationDelay.Support.SupportStatus;

                _supportInstallationDelayRepository.Add(supportInstallationDelay);
                _uow.Commit();
            }
            catch (Exception ex)
            {
                response.ErrorMessages.Add(ex.Message);
                if (ex.InnerException != null)
                {
                    response.ErrorMessages.Add(ex.InnerException.Message);
                }
            }

            return(response);
        }
        public GeneralResponse AddSeupportDeliverService(AddSupportDeliverServiceRequest request, Guid CreateEmployeeID)
        {
            GeneralResponse response = new GeneralResponse();

            try
            {
                SupportDeliverService supportDeliverService = new SupportDeliverService();

                supportDeliverService.ID             = Guid.NewGuid();
                supportDeliverService.DeliverDate    = request.DeliverDate;
                supportDeliverService.TimeInput      = request.TimeInput;
                supportDeliverService.TimeOutput     = request.TimeOutput;
                supportDeliverService.AmountRecived  = request.AmountRecived;
                supportDeliverService.Comment        = request.Comment;
                supportDeliverService.CreateDate     = PersianDateTime.Now;
                supportDeliverService.CreateEmployee = _employeeRepository.FindBy(CreateEmployeeID);
                supportDeliverService.RowVersion     = 1;
                supportDeliverService.Support        = _supportRepository.FindBy(request.SupportID);

                #region چک کردن عدم وجود مورد ثبت شده

                if (supportDeliverService.Support.SupportDeliverService.Count() > 0)
                {
                    response.ErrorMessages.Add("برای هر پشتیبانی بیش از یک تحویل سرویس نمیتوانید ثبت کنید");
                    return(response);
                }

                #endregion

                SupportStatusRelation supportStatusRelation = _supportStatusRelationRepository.FindBy(request.SupportStatusID);
                supportDeliverService.Support.SupportStatus          = _supportStatusRepository.FindBy(supportStatusRelation.RelatedSupportStatus.ID);
                supportDeliverService.Support.Customer.SupportStatus = supportDeliverService.Support.SupportStatus;

                if (supportDeliverService.Support.SupportStatus.IsLastSupportState)
                {
                    supportDeliverService.Support.Closed = true;
                }

                _supportDeliverServiceRepository.Add(supportDeliverService);

                #region Send SMS

                if (supportDeliverService.Support.SupportStatus.SendSmsOnEnter)
                {
                    // Threading
                    SmsData smsData = new SmsData()
                    {
                        body = supportDeliverService.Support.SupportStatus.SmsText, phoneNumber = supportDeliverService.Support.Customer.Mobile1
                    };
                    Thread oThread = new Thread(SendSmsVoid);
                    oThread.Start(smsData);
                }

                #endregion

                _uow.Commit();
            }
            catch (Exception ex)
            {
                response.ErrorMessages.Add(ex.Message);
                if (ex.InnerException != null)
                {
                    response.ErrorMessages.Add(ex.InnerException.Message);
                }
            }

            return(response);
        }
Exemple #6
0
        public GeneralResponse AddSupportQc(AddSupportQcRequest request, Guid CreateEmployeeID)
        {
            GeneralResponse response = new GeneralResponse();

            try
            {
                SupportQc supportQc = new SupportQc();

                supportQc.ID             = Guid.NewGuid();
                supportQc.CreateDate     = PersianDateTime.Now;
                supportQc.CreateEmployee = _employeeRepository.FindBy(CreateEmployeeID);
                supportQc.Comment        = request.Comment;
                supportQc.ExpertBehavior = (SupportQc.State)request.ExpertBehavior;
                supportQc.ExpertCover    = (SupportQc.State)request.ExpertCover;
                supportQc.InputTime      = request.InputTime;
                if (string.IsNullOrEmpty(request.Comment))
                {
                    response.ErrorMessages.Add("افزودن توضیحات به فرم الزامیست.");
                    return(response);
                }
                supportQc.OutputTime                 = request.OutputTime;
                supportQc.RecivedCost                = request.RecivedCost;
                supportQc.SaleAndService             = (SupportQc.State)request.SaleAndService;
                supportQc.SendNotificationToCustomer = request.SendNotificationToCustomer;
                supportQc.SendNotificationToMaster   = request.SendNotificationToMaster;
                supportQc.RowVersion                 = 1;

                supportQc.Support = _supportRepository.FindBy(request.SupportID);


                #region چک کردن عدم وجود مورد ثبت شده

                if (supportQc.Support.SupportQc.Count() > 0)
                {
                    response.ErrorMessages.Add("برای هر پشتیبانی بیش از یک فرم QC نمیتوانید ثبت کنید");
                    return(response);
                }

                #endregion

                SupportStatusRelation supportStatusRelation = _supportStatusRelationRepository.FindBy(request.SupportStatusID);
                supportQc.Support.SupportStatus          = _supportStatusRepository.FindBy(supportStatusRelation.RelatedSupportStatus.ID);
                supportQc.Support.Customer.SupportStatus = supportQc.Support.SupportStatus;

                if (supportQc.Support.SupportStatus.IsLastSupportState)
                {
                    supportQc.Support.Closed = true;
                }

                _supportQcRepository.Add(supportQc);
                _uow.Commit();

                #region Send SMS

                if (supportQc.Support.SupportStatus.SendSmsOnEnter)
                {
                    // Threading
                    SmsData smsData = new SmsData()
                    {
                        body = supportQc.Support.SupportStatus.SmsText, phoneNumber = supportQc.Support.Customer.Mobile1
                    };
                    Thread oThread = new Thread(SendSmsVoid);
                    oThread.Start(smsData);
                }

                #endregion
            }
            catch (Exception ex)
            {
                response.ErrorMessages.Add(ex.Message);
                if (ex.InnerException != null)
                {
                    response.ErrorMessages.Add(ex.InnerException.Message);
                }
            }

            return(response);
        }