public TblSshMachineryServicesResponse AddCallCenter(CallCenterView view)
        {
            TblSshMachineryServicesResponse response = new TblSshMachineryServicesResponse();
            string userId = view.UserId;

            TblSshMachineryServices machinery = new TblSshMachineryServices();
            var machineDetail = _dbContext.sp_SSH_GetSkuBySerial.FromSqlInterpolated($"EXECUTE dbo.sp_SSH_GetSkuBySerial {view.SerialNo}").ToList();

            if (machineDetail.Count > 0)
            {
                view.SkuCode     = machineDetail[0].Sku;
                view.TracingName = Convert.ToString(machineDetail[0].SkuId);
            }


            machinery.SkuCode               = view.SkuCode;
            machinery.TracingName           = view.TracingName;
            machinery.SerialNo              = view.SerialNo;
            machinery.CallCenterComment     = view.CallCenterComment;
            machinery.CompressorInformation = view.CompressorInformation;
            machinery.RelatedPersonName     = view.RelatedPersonName;
            machinery.CompanyName           = view.CompanyName;
            machinery.RelatedPersonLastName = view.RelatedPersonLastName;
            machinery.RelatedPersonEmail    = view.RelatedPersonEmail;
            machinery.RelatedPersonPhone    = view.RelatedPersonPhone;
            machinery.ReadFlags             = false;
            machinery.IsApproved            = false;
            machinery.IsRejected            = false;
            machinery.CreatedBy             = Convert.ToInt32(userId);
            machinery.CreatedDate           = DateTime.Now;
            machinery.ServiceTypeId         = 4;
            machinery.FileNames             = view.FileNames;


            bool kaydedildiMi = context.TblSshMachineryServicesRepository.Insert(machinery);

            context.Save();
            if (kaydedildiMi == false)
            {
                response.isSuccess    = false;
                response.ErrorMessage = "Hata oluştu!! Lütfen tekrar deneyiniz..";
                return(response);
            }
            else
            {
                response.isSuccess    = true;
                response.ErrorMessage = "";
                return(response);
            }
        }
        public TblSshMachineryServicesResponse AddMachine(InstallationView view)
        {
            string userId = view.UserId;
            TblSshMachineryServicesResponse response = new TblSshMachineryServicesResponse();


            bool machineControl = context.TblSshMachinesRepository.Get().Where(a => a.SerialNo == view.SerialNo).Any();

            if (machineControl == true)
            {
                response.ErrorMessage = view.SerialNo + " " + "Seri numarasına ait makine kurulumu bulunmaktadır.";
                response.isSuccess    = false;
            }
            else
            {
                try
                {
                    var machineDetail = _dbContext.sp_SSH_GetSkuBySerial.FromSqlInterpolated($"EXECUTE dbo.sp_SSH_GetSkuBySerial {view.SerialNo}").ToList();
                    view.SkuCode     = machineDetail[0].Sku;
                    view.TracingName = Convert.ToString(machineDetail[0].SkuId);

                    TblSshMachines          machines          = new TblSshMachines();
                    TblSshMachineryServices machineryServices = new TblSshMachineryServices();

                    //makine bilgileri
                    machines.CreatedBy             = Convert.ToInt32(userId);
                    machines.CreatedDate           = DateTime.Now;
                    machines.MachineStartedDate    = DateTime.ParseExact(view.MachineStartedDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                    machines.SerialNo              = view.SerialNo;
                    machines.ModelNo               = view.ModelNo;
                    machines.AirDryerType          = view.AirDryerType;
                    machines.CompressorInformation = view.CompressorInformation;
                    machines.StaffName             = view.StaffName;
                    machines.StaffLastName         = view.StaffLastName;
                    machines.Comment               = view.MachineComment;
                    context.TblSshMachinesRepository.Insert(machines);
                    context.Save();
                    //makine hizmetleri tablosunu kurulum olarak kaydediyoruz
                    machineryServices.MachineId             = machines.MachineId;
                    machineryServices.SkuCode               = view.SkuCode;
                    machineryServices.SerialNo              = view.SerialNo;
                    machineryServices.TracingName           = view.TracingName;
                    machineryServices.Date                  = DateTime.ParseExact(view.MachineStartedDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                    machineryServices.CompressorInformation = view.CompressorInformation;
                    machineryServices.StaffName             = view.StaffName;
                    machineryServices.StaffLastName         = view.StaffLastName;
                    machineryServices.MachineComment        = view.MachineComment;
                    machineryServices.ChangedPartsComment   = view.ChangedPartsComment;
                    machineryServices.CustomerComplaint     = view.CustomerComplaint;
                    machineryServices.CaringCompanyName     = view.CaringCompanyName;
                    machineryServices.CompanyName           = view.CompanyName;
                    machineryServices.RelatedPersonName     = view.RelatedPersonName;
                    machineryServices.RelatedPersonLastName = view.RelatedPersonLastName;
                    machineryServices.RelatedPersonEmail    = view.RelatedPersonEmail;
                    machineryServices.RelatedPersonTitle    = view.RelatedPersonTitle;
                    machineryServices.RelatedPersonPhone    = view.RelatedPersonPhone;
                    machineryServices.CompanyAdress         = view.CompanyAdress;
                    machineryServices.CustomerComment       = view.Comment;
                    machineryServices.IsApproved            = false;
                    machineryServices.IsRejected            = false;
                    machineryServices.ReadFlags             = false;
                    machineryServices.ServiceTypeId         = 1;
                    machineryServices.FileNames             = view.FileNames;
                    machineryServices.CreatedBy             = Convert.ToInt32(userId);
                    machineryServices.CreatedDate           = DateTime.Now;

                    bool kaydedildiMi = context.TblSshMachineryServicesRepository.Insert(machineryServices);
                    context.Save();


                    if (kaydedildiMi == false)
                    {
                        response.isSuccess    = false;
                        response.ErrorMessage = "Hata oluştu!! Kurulum yapılamadı.. Lütfen tekrar deneyiniz..";
                    }
                    else
                    {
                        response.isSuccess    = true;
                        response.ErrorMessage = "";
                    }
                }
                catch (Exception)
                {
                    response.isSuccess    = false;
                    response.ErrorMessage = "Hata oluştu!! Kurulum yapılamadı.. Lütfen tekrar deneyiniz..";
                }
            }
            return(response);
        }
        public TblSshMachineryServicesResponse AddBanGuarantee(GuaranteeView view)
        {
            string userId = view.UserId;
            TblSshMachineryServicesResponse response = new TblSshMachineryServicesResponse();


            var machineControl = context.TblSshMachinesRepository.Get().SingleOrDefault(a => a.SerialNo == view.SerialNo);

            if (machineControl == null)
            {
                response.ErrorMessage = view.SerialNo + " " + "Seri numarasına ait makine kurulumu bulunmaktadır.";
                response.isSuccess    = false;
            }
            else
            {
                try
                {
                    var machineDetail = _dbContext.sp_SSH_GetSkuBySerial.FromSqlInterpolated($"EXECUTE dbo.sp_SSH_GetSkuBySerial {view.SerialNo}").ToList();
                    view.SkuCode     = machineDetail[0].Sku;
                    view.TracingName = Convert.ToString(machineDetail[0].SkuId);

                    TblSshMachineryServices machineryServices = new TblSshMachineryServices();

                    //makine hizmetleri tablosunu kurulum olarak kaydediyoruz
                    machineryServices.MachineId        = machineControl.MachineId;
                    machineryServices.SkuCode          = view.SkuCode;
                    machineryServices.SerialNo         = view.SerialNo;
                    machineryServices.TracingName      = view.TracingName;
                    machineryServices.GuaranteeComment = view.Comment;
                    machineryServices.GuaranteeBanDate = DateTime.ParseExact(view.BanDate, "dd/mm/yyyy", CultureInfo.InvariantCulture);
                    machineryServices.IsApproved       = true;
                    machineryServices.IsRejected       = false;
                    machineryServices.ReadFlags        = false;
                    machineryServices.ServiceTypeId    = 6;
                    machineryServices.FileNames        = view.FileNames;
                    machineryServices.CreatedBy        = Convert.ToInt32(userId);
                    machineryServices.CreatedDate      = DateTime.Now;

                    bool kaydedildiMi = context.TblSshMachineryServicesRepository.Insert(machineryServices);
                    context.Save();


                    if (kaydedildiMi == false)
                    {
                        response.isSuccess    = false;
                        response.ErrorMessage = "Hata oluştu! Lütfen tekrar deneyiniz..";
                    }
                    else
                    {
                        response.isSuccess    = true;
                        response.ErrorMessage = "";
                    }
                }
                catch (Exception)
                {
                    response.isSuccess    = false;
                    response.ErrorMessage = "Hata oluştu! Lütfen tekrar deneyiniz..";
                }
            }
            return(response);
        }
Exemplo n.º 4
0
        public TblSshMachineryServicesResponse AddRepairAndMaintenance(RepairAndMaintenanceView view)
        {
            TblSshMachineryServicesResponse response = new TblSshMachineryServicesResponse();

            var    machineDetail = context.TblSshMachinesRepository.Get().AsNoTracking().FirstOrDefault(q => q.SerialNo == view.SerialNo);
            string userId        = view.UserId;

            if (machineDetail != null)
            {
                var machineDetailSkuCode = _dbContext.sp_SSH_GetSkuBySerial.FromSqlInterpolated($"EXECUTE dbo.sp_SSH_GetSkuBySerial {view.SerialNo}").ToList();
                view.SkuCode     = machineDetailSkuCode[0].Sku;
                view.TracingName = Convert.ToString(machineDetailSkuCode[0].SkuId);

                TblSshMachineryServices machineryServices = new TblSshMachineryServices();

                machineryServices.MachineId             = machineDetail.MachineId;
                machineryServices.SkuCode               = view.SkuCode;
                machineryServices.TracingName           = view.TracingName;
                machineryServices.Date                  = DateTime.ParseExact(view.RepairAndMaintenanceDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                machineryServices.CompressorInformation = view.CompressorInformation;
                machineryServices.SerialNo              = view.SerialNo;
                machineryServices.StaffName             = view.StaffName;
                machineryServices.StaffLastName         = view.StaffLastName;
                machineryServices.MachineComment        = view.MachineComment;
                machineryServices.ChangedPartsComment   = view.ChangedPartsComment;
                machineryServices.CustomerComplaint     = view.CustomerComplaint;
                machineryServices.CaringCompanyName     = view.CaringCompanyName;
                machineryServices.CompanyName           = view.CompanyName;
                machineryServices.RelatedPersonName     = view.RelatedPersonName;
                machineryServices.RelatedPersonLastName = view.RelatedPersonLastName;
                machineryServices.RelatedPersonEmail    = view.RelatedPersonEmail;
                machineryServices.RelatedPersonTitle    = view.RelatedPersonTitle;
                machineryServices.RelatedPersonPhone    = view.RelatedPersonPhone;
                machineryServices.CompanyAdress         = view.CompanyAdress;
                machineryServices.CustomerComment       = view.Comment;
                machineryServices.IsApproved            = false;
                machineryServices.IsRejected            = false;
                machineryServices.ReadFlags             = false;
                machineryServices.ServiceTypeId         = 3;
                machineryServices.FileNames             = view.FileNames;
                machineryServices.CreatedBy             = Convert.ToInt32(userId);
                machineryServices.CreatedDate           = DateTime.Now;

                bool kaydedildiMi = context.TblSshMachineryServicesRepository.Insert(machineryServices);
                context.Save();

                if (kaydedildiMi == false)
                {
                    response.isSuccess    = false;
                    response.ErrorMessage = "Hata oluştu!! Tamir ve/veya Bakım yapılamadı.. Lütfen tekrar deneyiniz..";
                    return(response);
                }
                else
                {
                    response.isSuccess    = true;
                    response.ErrorMessage = "";
                    return(response);
                }
            }
            else
            {
                response.isSuccess    = false;
                response.ErrorMessage = view.SerialNo + "Kurulum tamamlanmadan Tamir ve/veya Bakım işlemi yapılamaz.";
                return(response);
            }
        }