Exemple #1
0
        public TblSshMachineryServicesResponse IsApproved(string machineryServiceId)
        {
            TblSshMachineryServicesResponse response = new TblSshMachineryServicesResponse();

            var machineryService = context.TblSshMachineryServicesRepository.Get().SingleOrDefault(b => b.MachineryServiceId == Convert.ToInt32(machineryServiceId));

            if (machineryService != null)
            {
                machineryService.IsApproved = true;

                context.TblSshMachineryServicesRepository.Update(machineryService);
                context.Save();
                response.isSuccess = true;
            }
            else
            {
                response.ErrorMessage = "Hata oluştu!! Lütfen tekrar deneyiniz..";
                response.isSuccess    = false;
            }

            return(response);
        }
        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);
            }
        }
Exemple #3
0
        public GetReplacementListResponse SaveReplacementPrice(UpdateReplacementPrice UpdateReplacementPrice)
        {
            GetReplacementListResponse response             = new GetReplacementListResponse();
            TblSshReplacementPartPrice ReplacementPartPrice = new TblSshReplacementPartPrice();

            ReplacementPartPrice.Price           = UpdateReplacementPrice.Price;
            ReplacementPartPrice.PartNo          = UpdateReplacementPrice.PartNo;
            ReplacementPartPrice.EdDrawingItemNo = UpdateReplacementPrice.EdDrawingItemNo;
            ReplacementPartPrice.DryerModel      = UpdateReplacementPrice.DryerModel;
            ReplacementPartPrice.Currency        = UpdateReplacementPrice.Currency;
            ReplacementPartPrice.Qty             = UpdateReplacementPrice.Qty;
            ReplacementPartPrice.Voltage         = UpdateReplacementPrice.Voltage;
            //var dataKontrol = context.TblSshReplacementPartPriceRepository.Get().Where(q => q.PartNo == Convert.ToInt32(UpdateReplacementPrice.PartNo));
            bool kaydedildiMi;

            //if (dataKontrol == null)
            //{
            //     kaydedildiMi = context.TblSshReplacementPartPriceRepository.Insert(ReplacementPartPrice);
            //    context.Save();
            //}
            //else
            //{
            //     kaydedildiMi = context.TblSshReplacementPartPriceRepository.Update(ReplacementPartPrice);
            //    context.Save();
            //}

            kaydedildiMi = context.TblSshReplacementPartPriceRepository.Insert(ReplacementPartPrice);
            context.Save();
            if (kaydedildiMi == false)
            {
                response.isSuccess    = false;
                response.ErrorMessage = "Hata oluştu!!";
                return(response);
            }

            return(response);
        }
Exemple #4
0
        public LoginResponse SavePassword(string password, string UserId)
        {
            LoginResponse response = new LoginResponse();


            var user = context.TblUsersRepository.Get().SingleOrDefault(b => b.UserId == Convert.ToInt32(UserId));

            if (user != null)
            {
                var hashedPass = CreatePasswordHash(password);
                user.UserPassword = hashedPass;

                context.TblUsersRepository.Update(user);
                context.Save();
                response.isSuccess = true;
            }
            else
            {
                response.ErrorMessage = "Hata oluştu!! Lütfen tekrar deneyiniz..";
                response.isSuccess    = false;
            }

            return(response);
        }
        public AddFileUploadMachineHistoryResponse AddFileUploadMachineHistory(FileView request)
        {
            AddFileUploadMachineHistoryResponse response = new AddFileUploadMachineHistoryResponse();
            var MachineryServices = context.TblSshMachineryServicesRepository.Get().SingleOrDefault(q => q.MachineryServiceId == request.MachineryServiceId);

            string fileName = "";

            if (MachineryServices.FileNames == "")
            {
                fileName = "";
            }
            else
            {
                fileName = "||";
            }

            MachineryServices.FileNames = MachineryServices.FileNames + fileName + request.FileNames;

            bool kaydedildiMi = context.TblSshMachineryServicesRepository.Update(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 = "Doküman eklendi..";
            }

            return(response);
        }
Exemple #6
0
        public SelectedItemApprovedResponse SelectedItemApproved(int UserId, string FMList)
        {
            SelectedItemApprovedResponse response = new SelectedItemApprovedResponse();
            var      UserData = context.TblUsersRepository.Get().SingleOrDefault(q => q.UserId == UserId);
            DateTime now      = DateTime.Now;

            try
            {
                if (FMList == null || FMList == "")
                {
                    response.isSuccess    = false;
                    response.ErrorMessage = "Hata oluştu tekrar deneyiniz!";
                }
                else
                {
                    //Fazla Mesaiye katılacak personelleri onaylama
                    var person = FMList.Split(',');
                    foreach (var item in person)
                    {
                        var staff = context.TblFmOvertimeRequestStaffRepository.Get().SingleOrDefault(q => q.OvertimeRequestStaffId == Convert.ToInt32(item));

                        staff.ModifiedBy             = UserData.UserAccount;
                        staff.ModifiedDate           = DateTime.Now;
                        staff.Confirmation           = true;
                        staff.ConfirmationModifiedBy = UserData.UserAccount;
                        context.TblFmOvertimeRequestStaffRepository.Update(staff);
                        context.Save();
                    }
                    response.isSuccess = true;
                }
            }
            catch (Exception)
            {
                response.isSuccess    = false;
                response.ErrorMessage = "Hata oluştu tekrar deneyiniz!";
            }

            return(response);
        }
        public TblSshMachineryServicesResponse AddGuarantee(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.GuaranteeStartDate = DateTime.ParseExact(view.StartDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                    machineryServices.GuaranteeEndDate   = DateTime.ParseExact(view.EndDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                    machineryServices.IsApproved         = true;
                    machineryServices.IsRejected         = false;
                    machineryServices.ReadFlags          = false;
                    machineryServices.ServiceTypeId      = 5;
                    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);
        }
        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 GetPersonelAndRoleListResponse UserChangeRole(UserRoleChangeView view)
        {
            GetPersonelAndRoleListResponse response = new GetPersonelAndRoleListResponse();

            if (view.Type == "UserIsActive")
            {
                var UserData = context.TblUsersRepository.Get().SingleOrDefault(b => b.UserId == view.UserId);

                UserData.IsActive = view.Durum == 1 ? true : false;
                context.TblUsersRepository.Update(UserData);
                context.Save();
                response.isSuccess = true;
            }

            if (view.Type == "TeknikDokuman")
            {
                if (view.Durum == 0)
                {
                    var userRolesData = from userRoles in context.TblUserRolesRepository.Get()
                                        join role in context.TblRolesRepository.Get()
                                        on userRoles.RoleId equals role.RoleId
                                        where userRoles.UserId == view.UserId && role.RoleName == "ACSServiceTekinkDokuman"
                                        select new
                    {
                        userRoles.UserId,
                        userRoles.UserRoleId,
                        role.RoleName,
                    } into selection
                    select selection;
                    var    data = userRolesData.SingleOrDefault();
                    context.TblUserRolesRepository.Delete(data.UserRoleId);
                    context.Save();
                }
                else
                {
                    var          RoleData    = context.TblRolesRepository.Get().SingleOrDefault(b => b.RoleName == "ACSServiceTekinkDokuman");
                    TblUserRoles newUserRole = new TblUserRoles();
                    newUserRole.UserId = view.UserId;
                    newUserRole.RoleId = RoleData.RoleId;
                    context.TblUserRolesRepository.Insert(newUserRole);
                    context.Save();
                }
            }

            if (view.Type == "YedekParca")
            {
                if (view.Durum == 0)
                {
                    var userRolesData = from userRoles in context.TblUserRolesRepository.Get()
                                        join role in context.TblRolesRepository.Get()
                                        on userRoles.RoleId equals role.RoleId
                                        where userRoles.UserId == view.UserId && role.RoleName == "ACSServiceYedekParca"
                                        select new
                    {
                        userRoles.UserId,
                        userRoles.UserRoleId,
                        role.RoleName,
                    } into selection
                    select selection;
                    var    data = userRolesData.SingleOrDefault();
                    context.TblUserRolesRepository.Delete(data.UserRoleId);
                    context.Save();
                }
                else
                {
                    var          RoleData    = context.TblRolesRepository.Get().SingleOrDefault(b => b.RoleName == "ACSServiceYedekParca");
                    TblUserRoles newUserRole = new TblUserRoles();
                    newUserRole.UserId = view.UserId;
                    newUserRole.RoleId = RoleData.RoleId;
                    context.TblUserRolesRepository.Insert(newUserRole);
                    context.Save();
                }
            }

            return(response);
        }
Exemple #10
0
        public AddAuthorizedServiceResponse AddService(AddAuthorizedService view)
        {
            string userId = view.UserId;
            AddAuthorizedServiceResponse response = new AddAuthorizedServiceResponse();

            if (view.Email == null)
            {
                response.isSuccess    = false;
                response.ErrorMessage = "Email alanı zorunludur!";
            }
            else
            {
                try
                {
                    RandomPasswordGenerator randomPasswordGenerator = new RandomPasswordGenerator();

                    TblUsers userData = new TblUsers();
                    userData.UserAccount = view.Email;
                    userData.UserEmail   = view.Email;
                    userData.CompanyName = view.CompanyName;
                    userData.UserName    = view.UserName + ' ' + view.UserLastName;
                    userData.CreatedDate = DateTime.Now;
                    userData.IsActive    = true;
                    var randomPassword = randomPasswordGenerator.GeneratePassword(true, true, true, true, 8);

                    var hashedPass = CreatePasswordHash(randomPassword);

                    userData.UserPassword = hashedPass;

                    bool UserKaydedildiMi = context.TblUsersRepository.Insert(userData);
                    context.Save();

                    if (UserKaydedildiMi == true)
                    {
                        var getRol = context.TblRolesRepository.Get().SingleOrDefault(a => a.RoleName == "ACSService");

                        TblUserRoles userRolesData = new TblUserRoles();
                        userRolesData.RoleId = getRol.RoleId;
                        userRolesData.UserId = userData.UserId;
                        bool UserRoleKaydedildiMi = context.TblUserRolesRepository.Insert(userRolesData);
                        context.Save();

                        if (UserRoleKaydedildiMi == true)
                        {
                            var getMenu      = context.TblMenusRepository.Get().SingleOrDefault(a => a.MenuName == "Anasayfa");
                            var getMenuItems = context.TblMenuItemsRepository.Get().Where(a => a.MenuId == getMenu.MenuId).ToList();

                            foreach (var item in getMenuItems)
                            {
                                if (item.MenuItemDescription == "Anasayfa" || item.MenuItemDescription == "Service")
                                {
                                    TblUserMenuItem userMenuItemData = new TblUserMenuItem();
                                    userMenuItemData.UserId     = userData.UserId;
                                    userMenuItemData.MenuItemId = item.MenuItemId;
                                    bool UserMenuItemKaydedildiMi = context.TblUserMenuItemRepository.Insert(userMenuItemData);
                                    context.Save();
                                    if (UserMenuItemKaydedildiMi == false)
                                    {
                                        //Rol atamada bir sorun oluşmuş ise oluşturulan kullanıcı kaldırılıyor.
                                        context.TblUsersRepository.Delete(userData.UserId);
                                        //Menu atamada bir sorun oluşmuş ise oluşturulan menu kaldırılıyor.
                                        context.TblUsersRepository.Delete(userMenuItemData.UserMenuItemId);
                                        response.isSuccess    = false;
                                        response.ErrorMessage = "Hata oluştu! Lütfen tekrar deneyiniz..";
                                        return(response);
                                    }
                                }
                            }


                            Tools  tls  = new Tools();
                            string body = "<style>*{margin:0;padding:0;font-family:'HelveticaNeue','Helvetica',Helvetica,Arial,sans-serif;box-sizing:border-box;font-size:14px;}img{max-width:100%;}body{-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:none;width:100%!important;height:100%;line-height:1.6;}/*Let'smakesurealltableshavedefaults*/tabletd{vertical-align:top;}body{background-color:#f6f6f6;}.body-wrap{background-color:#f6f6f6;width:100%;}.container{display:block!important;max-width:600px!important;margin:0auto!important;/*makesitcentered*/clear:both!important;}.content{max-width:600px;margin:0auto;display:block;padding:20px;}.main{background:#fff;border:1pxsolid#e9e9e9;border-radius:3px;}.content-wrap{padding:20px;}.content-block{padding:0020px;}.header{width:100%;margin-bottom:20px;}.footer{width:100%;clear:both;color:#999;padding:20px;}.footera{color:#999;}.footerp,.footera,.footerunsubscribe,.footertd{font-size:12px;}h1,h2,h3{font-family:'HelveticaNeue',Helvetica,Arial,'LucidaGrande',sans-serif;color:#000;margin:40px00;line-height:1.2;font-weight:400;}h1{font-size:32px;font-weight:500;}h2{font-size:24px;}h3{font-size:18px;}h4{font-size:14px;font-weight:600;}p,ul,ol{margin-bottom:10px;font-weight:normal;}pli,ulli,olli{margin-left:5px;list-style-position:inside;}a{color:#1ab394;text-decoration:underline;}.btn-primary{text-decoration:none;color:#FFF;background-color:#1ab394;border:solid#1ab394;border-width:5px10px;line-height:2;font-weight:bold;text-align:center;cursor:pointer;display:inline-block;border-radius:5px;text-transform:capitalize;}.last{margin-bottom:0;}.first{margin-top:0;}.aligncenter{text-align:center;}.alignright{text-align:right;}.alignleft{text-align:left;}.clear{clear:both;}.alert{font-size:16px;color:#fff;font-weight:500;padding:20px;text-align:center;border-radius:3px3px00;}.alerta{color:#fff;text-decoration:none;font-weight:500;font-size:16px;}.alert.alert-warning{background:#f8ac59;}.alert.alert-bad{background:#ed5565;}.alert.alert-good{background:#1ab394;}.invoice{margin:40pxauto;text-align:left;width:80%;}.invoicetd{padding:5px0;}.invoice.invoice-items{width:100%;}.invoice.invoice-itemstd{border-top:#eee1pxsolid;}.invoice.invoice-items.totaltd{border-top:2pxsolid#333;border-bottom:2pxsolid#333;font-weight:700;}@mediaonlyscreenand(max-width:640px){h1,h2,h3,h4{font-weight:600!important;margin:20px05px!important;}h1{font-size:22px!important;}h2{font-size:18px!important;}h3{font-size:16px!important;}.container{width:100%!important;}.content,.content-wrap{padding:10px!important;}.invoice{width:100%!important;}}</style>" +
                                          "<table class='body-wrap'>" +
                                          "<tr>" +
                                          "<td></td>" +
                                          "<td class='container' width='600'>" +
                                          "<div class='content'>" +
                                          "<table class='main' width='100%' cellpadding='0' cellspacing='0'>" +
                                          "<tr>" +
                                          "<td class='content-wrap'>" +
                                          "<table cellpadding = '0' cellspacing='0'>" +
                                          "<tr>" +
                                          "<td  style='background: #2f3236; padding: 30px;text-align: center; '>" +
                                          "<img class='img-responsive' src='https://mikropor.com.tr/assets/img/mikropor-main_145x84.png'/>" +
                                          "</td>" +
                                          "</tr>" +
                                          "<tr>" +
                                          "<td class='content-block'>" +
                                          "<h3>Satış Sonrası Hizmetlere Hoş Geldiniz.</h3>" +
                                          "</td>" +
                                          "</tr>" +
                                          "<tr>" +
                                          "<td class='content-block'>" +
                                          "Sayın " + userData.UserName + ",<br><br>" +
                                          "Kullanıcı adı ve şifre bilgileriniz aşığıda paylaşılmıştır.Giriş yaptıktan sonra lütfen şifrenizi değiştiriniz." +
                                          "<br><br>" +
                                          "<strong>Email:</strong> " + userData.UserEmail + " <br>" +
                                          "<strong>Şifre:</strong> " + randomPassword + " <br>" +
                                          "</td>" +
                                          "</tr>" +
                                          "<tr>" +
                                          "<td class='content-block aligncenter'>" +
                                          "<a href = '#' class='btn-primary'>Giriş Yap</a>" +
                                          "</td>" +
                                          "</tr>" +
                                          "</table>" +
                                          "</td>" +
                                          "</tr>" +
                                          "</table>" +
                                          "<div class='footer'>" +
                                          "<table width = '100%' >" +
                                          "<tr>" +
                                          "<td class='aligncenter content-block'>© Copyright MIKROPOR.All Rights Reserved</td>" +
                                          "</tr>" +
                                          "</table>" +
                                          "</div></div>" +
                                          "</td>" +
                                          "<td></td>" +
                                          "</tr>" +
                                          "</table>";
                            var aliciList = "*****@*****.**";

                            string sonuc = tls.SendMail(aliciList, body, "Satış Sonrası Hizmetler");

                            if (!string.IsNullOrEmpty(sonuc))
                            {
                                TblSshMailExceptions exc = new TblSshMailExceptions();
                                exc.CreateDate      = DateTime.Now;
                                exc.ExceptionDetail = sonuc;
                                exc.Subject         = "Yetersiz Stok";
                                exc.Body            = body;
                                bool TblSshMailKaydedildiMi = context.TblSshMailExceptionsRepository.Insert(exc);
                                context.Save();
                                response.isSuccess    = true;
                                response.ErrorMessage = "";
                                return(response);
                            }
                        }
                        else
                        {
                            //Rol atamada bir sorun oluşmuş ise oluşturulan kullanıcı kaldırılıyor.
                            context.TblUsersRepository.Delete(userData.UserId);
                            response.isSuccess    = false;
                            response.ErrorMessage = "Hata oluştu! Lütfen tekrar deneyiniz..";
                            return(response);
                        }
                    }
                    else
                    {
                        response.isSuccess    = false;
                        response.ErrorMessage = "Hata oluştu! Lütfen tekrar deneyiniz..";
                        return(response);
                    }
                }
                catch (Exception ex)
                {
                    response.isSuccess    = false;
                    response.ErrorMessage = "Hata oluştu! Lütfen tekrar deneyiniz..";
                }
            }

            return(response);
        }
Exemple #11
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);
            }
        }