Esempio n. 1
0
        //[ValidateAntiForgeryToken]
        public async Task <dynamic> AddWarrantyComplaint(Warranty warranty)
        {
            NewWarrantyComplaintManager _warranty = new NewWarrantyComplaintManager();
            var response = await _warranty.AddWarrantyComplaint(warranty);

            return(response);
        }
 internal static void CommitWarrenty(Warranty warranty)
 {
     using (Connection Connection = new Connection())
     {
         Connection.BeginTransaction();
         try
         {
             foreach (var x in warranty)
             {
                 try
                 {
                     x.WarrentyNumber =
                         Connection.Insert(x, warranty.Reciept.RecieptID, warranty.CustomerName, warranty.Email, warranty.Phone, warranty.Address, warranty.Country);
                 }
                 catch (Exception ex) { throw ex; }
             }
             try
             {
                 using (HQConnection x = new HQConnection())
                 {
                     HQConnection.UpdateWarrenties();
                 }
             }
             catch (Exception)
             {
             }
             Connection.CommitTransaction();
         }
         catch (Exception ex)
         {
             Connection.RollbackTransaction();
             throw ex;
         }
     }
 }
Esempio n. 3
0
 public AssetType()
 {
     //init inner object for warranty.
     Warranty = new Warranty {
         GuarantorLabor = new ContactKey(), GuarantorParts = new ContactKey()
     };
 }
Esempio n. 4
0
        /// <summary>
        /// metodo para enviar por email los pdf invoice y warranty
        /// </summary>
        /// <param name="invoice">invoice a enviar</param>
        /// <param name="deviceOwner">email del client</param>
        /// <param name="warranty">warranty a enviar</param>
        public void sendPDF(Invoice invoice, string deviceOwner, Warranty warranty)
        {
            byte[] ibytes = this.PrepareReport(invoice);
            byte[] wbytes = this.PrepareReportW(warranty);

            string      from = "*****@*****.**";
            string      to   = deviceOwner;
            MailMessage mm   = new MailMessage(from, to);

            mm.Subject = "SmartHome Invoice And Warranty";
            mm.Body    = "Purchase PDF Attachment";
            mm.Attachments.Add(new Attachment(new MemoryStream(ibytes), "Invoice.pdf"));
            mm.Attachments.Add(new Attachment(new MemoryStream(wbytes), "Warranty.pdf"));
            mm.IsBodyHtml = true;
            SmtpClient smtp = new SmtpClient();

            smtp.Host      = "smtp.live.com";
            smtp.EnableSsl = true;
            NetworkCredential NetworkCred = new NetworkCredential();

            NetworkCred.UserName = "******";
            NetworkCred.Password = "******";
            smtp.Credentials     = NetworkCred;
            smtp.Port            = 587;
            smtp.Send(mm);
        }
Esempio n. 5
0
        public ActionResult FinishDate(Warranty record)
        {
            var           result  = false;
            var           message = "Lưu thông tin không thành công";
            WarrantyModel model   = null;

            if (AccountInfo.Type != LoginType.Sale && AccountInfo.Username != "admin")
            {
                message = "Bạn chưa có quyền sử dụng chức năng này";
            }
            else if (result = record.SaveFinishDate(UserID, Employee.ID))
            {
                message = "Lưu thông tin thành công";
                model   = Warranty.Get(UserID, Employee.ID, record.ID);
                var login = Login.Get(UserID);
                model.ViewInternalNote = login.Type == LoginType.Mechanic || login.Type == LoginType.Office || login.Username == "admin";
            }
            if (Request.IsAjaxRequest())
            {
                return(Json(new
                {
                    result = result,
                    message = message,
                    html = result ? RenderPartialViewToString(Views.Detail, model) : null
                }, JsonRequestBehavior.DenyGet));
            }
            var list = new WarrantyList();

            list.Current = model;
            return(View(Views.History, list));
        }
Esempio n. 6
0
        public bool Add(Bill bill, CustomerInfo customer)
        {
            foreach (var item in Basket.Instance.Details)
            {
                BillDetail billDetail = new BillDetail()
                {
                    BillID    = bill.BillID,
                    ProductId = item.ProductId,
                    Amount    = item.Quantity,
                    UnitPrice = item.UnitPrice
                };
                bill.BillDetails.Add(billDetail);

                //Thêm vào bảng bảo hành
                Warranty war = new Warranty()
                {
                    PhoneNumber = customer.PhoneNumber,
                    ProductID   = item.ProductId,
                    StartDate   = bill.BillDate,
                    EndDate     = bill.BillDate.AddDays(StaticData.ONEYEAR)
                };
                warrantyDAO.Add(war);
            }

            billDAO.Add(bill);
            return(true);
        }
Esempio n. 7
0
 public static void UpdateWarranty(this Warranty warranty, WarrantyViewModel warrantyVM)
 {
     warranty.ID          = warrantyVM.ID;
     warranty.Name        = warrantyVM.Name;
     warranty.Description = warrantyVM.Description;
     warranty.Status      = warrantyVM.Status;
 }
        public async Task AddListWarranty()
        {
            Warranty warranty1 = new Warranty()
            {
                Name      = "Watrelot",
                StoreName = "Boulanger",
                Url       = @"C:\Users\micka\Pictures\20160319_175103.jpg"
            };

            await DbConnection.InsertOrReplaceAsync(warranty1);


            Warranty warranty2 = new Warranty()
            {
                Name      = "Watrelot",
                StoreName = "Auchan",
                Url       = "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0b/ReceiptSwiss.jpg/200px-ReceiptSwiss.jpg"
            };

            await DbConnection.InsertOrReplaceAsync(warranty2);

            Warranty warranty3 = new Warranty()
            {
                Name      = "Watrelot",
                StoreName = "Darty",
                Url       = "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0b/ReceiptSwiss.jpg/200px-ReceiptSwiss.jpg"
            };

            await DbConnection.InsertOrReplaceAsync(warranty3);
        }
Esempio n. 9
0
        public async Task <IActionResult> PutWarranty([FromRoute] int id, [FromBody] Warranty warranty)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != warranty.Id)
            {
                return(BadRequest());
            }

            _context.Entry(warranty).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!WarrantyExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 10
0
        public ActionResult OldOrder(Warranty record)
        {
            if (String.IsNullOrEmpty(record.OrderCode))
            {
                record.Messages = new List <string>()
                {
                    "Chưa có mã hóa đơn"
                }
            }
            ;
            var model = new WarrantyModel();

            model.SelectedProduct = ProductInfo.Get(UserID, Employee.ID, record.ProductID, false, DbAction.Warranty.Create);
            model.Record          = record;
            var login = Login.Get(UserID);

            model.Editable = login.Type == LoginType.Office || login.Username == "admin";
            if (Request.IsAjaxRequest())
            {
                return(Json(new
                {
                    html = RenderPartialViewToString("SelectedProduct", model)
                }, JsonRequestBehavior.DenyGet));
            }
            return(View(Views.Save, model));
        }
Esempio n. 11
0
 public async Task <IActionResult> Edit(int id, [Bind("Id,CompanyName,Details,PhoneNumber")] Warranty warranty)
 {
     if (id != warranty.Id)
     {
         return(NotFound());
     }
     if (ModelState.IsValid)
     {
         try
         {
             _context.Update(warranty);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!WarrantyExists(warranty.Id))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction(nameof(Index)));
     }
     return(View(warranty));
 }
Esempio n. 12
0
 private void addWarrentyButton1_Click(object sender, EventArgs e)
 {
     try
     {
         WarrentyItemSelction WarrentyItemSelction = new WarrentyItemSelction();
         WarrentyItemSelction.Item = addWarrentyButton1.Item;
         var result =
             WarrentyItemSelction.ShowDialog(this);
         if (result == System.Windows.Forms.DialogResult.OK)
         {
             if (Warranties == null)
             {
                 Warranties = new Warranty();
             }
             try
             {
                 Warranties.AddWarrenty(WarrentyItemSelction.WarrentyItem);
             }
             catch (Exception ex)
             {
                 MessageBox.Show(this, "Error Occurred While Adding Warranty. "
                                 + Environment.NewLine
                                 + "Please Check the Error Message." + Environment.NewLine
                                 + "Please take a screen shot and send to System Administrator" + Environment.NewLine + Environment.NewLine
                                 + ex.Message, "Error Occurred");
             }
         }
     }
     catch (LSExtendedWarrenty.AppBase.DataHelper.NoWarrentySettingFoundException ex)
     {
         MessageBox.Show(ex.InnerException.Message, ex.Message);
     }
 }
Esempio n. 13
0
        static void Main(string[] args)
        {
            Store objStore = new Store("The Good Store");

            objStore.ProductsEvent += OnProductsChanged;


            Person objPerson1 = new Person("Bob Smith", "*****@*****.**", 06123456);

            Warranty objWarranty1 = new Warranty(DateTime.Now, DateTime.Now.AddDays(14), objPerson1);
            Hardware objHardware1 = new Hardware(50, EHardwareType.Keyboard, objWarranty1, 50, 20, 10, 105, "Keyboard 2000", "A cool mecahnical keyboard", 29.99);

            objStore.AddProduct(objHardware1);

            Warranty objWarranty2 = new Warranty(DateTime.Now, DateTime.Now.AddDays(14), objPerson1);
            Hardware objHardware2 = new Hardware(50, EHardwareType.Other, objWarranty2, 50, 20, 10, 20, "Mousepad XXL", "The biggest mousepad in the store!", 81.99);

            objStore.AddProduct(objHardware2);
            Console.WriteLine(objStore.ProductsToString());

            objStore.RemoveProduct(objHardware2);
            Console.WriteLine(objStore.ProductsToString());


            Console.ReadKey();


            void OnProductsChanged(string action)
            {
                Console.WriteLine(action);
            }
        }
Esempio n. 14
0
    protected void btnSave_Click(object sender, System.EventArgs e)
    {
        byte SysMessageTypeId = 0;
        int  SysMessageId     = 0;

        System.Int16 EditId;
        Warranty     m_Warranty = new Warranty();

        if (Request.QueryString["id"] == null)
        {
            EditId = 0;
        }
        else
        {
            EditId = System.Int16.Parse(Request.QueryString["id"].ToString());
            m_Warranty.WarrantyId = EditId;
            m_Warranty            = m_Warranty.Get();
        }
        try
        {
            if (txWarrantyName.Text == "")
            {
                JSAlertHelpers.Alert("Mời bạn nhập các thông tin bắt buộc!", this);
                return;
            }


            m_Warranty.CrUserId = ActUserId;

            if (txWarrantyName.Text != "")
            {
                m_Warranty.WarrantyName = txWarrantyName.Text;
            }

            if (txWarrantyDesc.Text != "")
            {
                m_Warranty.WarrantyDesc = txWarrantyDesc.Text;
            }

            m_Warranty.DisplayOrder = short.Parse(txDisplayOrder.Text);

            m_Warranty.WarrantyId = EditId;
            SysMessageTypeId      = m_Warranty.InsertOrUpdate(ConstantHelpers.Replicated, ActUserId, ref SysMessageId);

            StringBuilder       csText = new StringBuilder();
            Type                cstype = this.GetType();
            ClientScriptManager cs     = Page.ClientScript;
            csText.Clear();
            csText.Append("<script type=\"text/javascript\">");
            csText.Append("window.parent.jQuery('#divEdit').dialog('close');");
            csText.Append("</script>");
            cs = Page.ClientScript;
            cs.RegisterClientScriptBlock(this.GetType(), "system_message", csText.ToString());
        }
        catch (Exception ex)
        {
            sms.utils.LogFiles.LogError(((new System.Diagnostics.StackTrace()).GetFrames()[0]).GetMethod().Name + "\t" + ex.ToString());
            JSAlertHelpers.Alert(ex.Message, this);
        }
    }
Esempio n. 15
0
        public ActionResult WarrantHistory(int id, string code)
        {
            var list = Warranty.GetHistory(UserID, id, code);

            return(Json(new
            {
                html = RenderPartialViewToString("WarrantHistory", list)
            }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 16
0
        public void Consume(WarrantyAddedEvent ev)
        {
            var currentProposal = _repo.GetById(ev.ProposalId);
            var warranty        = new Warranty(ev);

            currentProposal.Warranties.Add(warranty);
            currentProposal.Events.Add(ev);
            _repo.Update(currentProposal);
        }
        internal DialogResult ShowDialog(FormExtendedWarrenty Owner, ref Warranty warranty)
        {
            this.Warranties = warranty;
            //this.textBoxPaymentSummary.Text = this.Warranties.GetPayementSummary();
            DataTable table = this.Warranties.GetPayementSummaryTabular();

            this.dataGridView.DataSource = table;
            return(ShowDialog(Owner));
        }
Esempio n. 18
0
        public ActionResult GetProducts(int id)
        {
            var model = Warranty.GetProducts(UserID, Employee.ID, id);

            return(Json(new
            {
                result = true,
                html = RenderPartialViewToString("WarrantyProduct", model)
            }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 19
0
 private void Cleaning()
 {
     NodeBrand.Clear();
     NodeModel.Clear();
     NodePrice.Clear();
     Maintenance.Clear();
     Warranty.Clear();
     Material.Clear();
     Year.Clear();
 }
Esempio n. 20
0
        public void Delete(int id)
        {
            var Warranty = new Warranty
            {
                WarrantyId = id
            };

            unitOfWork.WarrantyRepository.Delete(Warranty);
            unitOfWork.Save();
        }
Esempio n. 21
0
        public void Create(WarrantyViewModel warrantyVM)
        {
            var Warranty = new Warranty
            {
                WarrantyPeriod = warrantyVM.WarrantyName
            };

            unitOfWork.WarrantyRepository.Insert(Warranty);
            unitOfWork.Save();
        }
        public async Task AddImageWarranty(Warranty warranty)
        {
            ImageWarranty warranty1 = new ImageWarranty()
            {
                IDWarranty = warranty.ID,
                Url        = @"C:\Users\micka\Pictures\20160319_175103.jpg"
            };

            await DbConnection.InsertOrReplaceAsync(warranty1);
        }
Esempio n. 23
0
        public ActionResult SaveMechanicNote(WarrantyNote note, string subID)
        {
            var notes = Warranty.SaveMechanicNote(UserID, Employee.ID, note);

            notes.ID        = subID;
            notes.RemoveUrl = "RemoveMechanicNote";
            return(Json(new
            {
                html = RenderPartialViewToString("WarrantyNotes", notes)
            }, JsonRequestBehavior.DenyGet));
        }
Esempio n. 24
0
        public async Task <IActionResult> Create([Bind("Id,CompanyName,Details,PhoneNumber")] Warranty warranty)
        {
            if (ModelState.IsValid)
            {
                _context.Add(warranty);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(warranty));
        }
Esempio n. 25
0
        public async Task <dynamic> AddWarrantyComplaint(Warranty warranty)
        {
            var ComplaintID = await this._newWarranty.AddWarrantyComplaint(warranty);

            //if(ComplaintID != null)
            //{
            //    return await GetComplaintById(ComplaintID.ToString());
            //}

            return(ComplaintID);
        }
Esempio n. 26
0
        public void Update(WarrantyViewModel warrantyVM)
        {
            var Warranty = new Warranty
            {
                WarrantyId     = warrantyVM.WarrantyId,
                WarrantyPeriod = warrantyVM.WarrantyName
            };

            unitOfWork.WarrantyRepository.Update(Warranty);
            unitOfWork.Save();
        }
Esempio n. 27
0
        public ActionResult RemoveInternalNote(int id, string subID)
        {
            var notes = Warranty.RemoveInternalNote(UserID, Employee.ID, id);

            notes.ID        = subID;
            notes.RemoveUrl = "RemoveInternalNote";
            return(Json(new
            {
                html = RenderPartialViewToString("WarrantyNotes", notes)
            }, JsonRequestBehavior.AllowGet));
        }
 public override void Edit()
 {
     if (this.CurrentId != 0)
     {
         Warranty    warranty = Databases.Tables.Warranties[this.CurrentId];
         frmWarranty form     = new frmWarranty(warranty);
         if (form.ShowDialog(this) == DialogResult.OK)
         {
             Init();
         }
     }
 }
 public override void Delete()
 {
     if (this.CurrentId != 0)
     {
         if (MessageBox.Show("Вы действительно хотите удалить запись?", "Удаление записи", MessageBoxButtons.OKCancel).Equals(DialogResult.OK))
         {
             Warranty warranty = Databases.Tables.Warranties[this.CurrentId];
             warranty.Delete();
             Init();
         }
     }
 }
Esempio n. 30
0
        public async Task <IActionResult> PostWarranty([FromBody] Warranty warranty)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.Warranties.Add(warranty);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetWarranty", new { id = warranty.Id }, warranty));
        }
Esempio n. 31
0
        private Boolean DoCheckWarranty()
        {
            var strBdAddress = _device.BdAddress;
            var strUrl = string.Format(_endpoint, "", strBdAddress);
            RestClient restClient = new RestClient(strUrl);

            RestRequest request = new RestRequest(Method.GET);

            request.AddHeader("Authorization", Credentials());
            request.AddParameter("FirmwareVersion", _device.Version);
            request.AddParameter("hostPlatform", "WinNT-" + Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE"));
            request.AddParameter("osVersion", GetOsVersion());
            request.AddParameter("ScanApiType", "ScanAPI SDK");
            request.AddParameter("ScanApiVersion", _strScanApiVersion);
            RestResponse<WarrantyRequest> response2 =
                (RestResponse<WarrantyRequest>)restClient.Execute<WarrantyRequest>(request);
            if (response2.StatusCode == System.Net.HttpStatusCode.OK && response2.Data != null && response2.Data.Warranty != null)
            {
                MessageBox.Show(
                    String.Format(
                        "Your Scanner is {0}eligible for an extra year of Warranty {2} currently your end date is {1:M/d/yyyy}",
                                        response2.Data.Warranty.ExtensionEligible ? "" : "NOT ",
                                        response2.Data.Warranty.EndDate,
                                        response2.Data.Warranty.Description));
                LastWarranty = response2.Data.Warranty;
                // Show the product info here.
                if (response2.Data.Product != null)
                {
                    ProductInfo product = response2.Data.Product;
                    MessageBox.Show("Your Scanner is as follows: " + product.SKUNumber + " " + product.ProductNumber + ", " + product.PartNumber + "-" + product.SerialNumber + ":" + product.Description + " UPC=" + product.UPC);
                }
                return true;
            }
            else // Must be error 4xx or 5xx (or 000)
            {
                MessageBox.Show(GetErrorMessage(response2.StatusCode, response2.StatusDescription ?? response2.ErrorMessage));
                return false;
            }
        }