Esempio n. 1
0
    Int32 DisplayStocks(string CarModelFilter)
    {
        Int32    ModelNo;  //var to store the primary key
        string   CarModel; //var to store the phone type
        string   BHP;      //var to store the phone number
        DateTime DateAdded;
        //; //create an onstance of the phone book class
        //create an instance of the phone collection class
        clsStockCollection StockBook = new clsStockCollection();

        StockBook.ReportByCarModel(CarModelFilter);
        Int32 RecordCount;                                    // var to store the count of records
        Int32 Index = 0;                                      // var to store the index for the loop

        RecordCount = StockBook.Count;                        // get the count of records
        lstStock.Items.Clear();
        while (Index < RecordCount)                           // while there are records to process
        {
            ModelNo   = StockBook.StockList[Index].ModelNo;   // get the primary key
            CarModel  = StockBook.StockList[Index].CarModel;  // get the phone type
            BHP       = StockBook.StockList[Index].BHP;       // get the phone name
            DateAdded = StockBook.StockList[Index].DateAdded; // get the phone name
            //create a new entry for the list box
            ListItem NewEntry = new ListItem(CarModel + " " + BHP + " " + DateAdded, ModelNo.ToString());
            lstStock.Items.Add(NewEntry); // ADD THE PHONE TO THE LIST
            Index++;
        }
        return(RecordCount); //return the count of records found
    }
Esempio n. 2
0
        public ActionResult DeleteConfirmed(long id)
        {
            ModelNo modelno = db.ModelNos.Find(id);

            db.ModelNos.Remove(modelno);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
        //
        // GET: /ModelNo/Delete/5

        public ActionResult Delete(long id = 0)
        {
            ModelNo modelno = db.ModelNos.Find(id);

            if (modelno == null)
            {
                return(HttpNotFound());
            }
            return(View(modelno));
        }
Esempio n. 4
0
 public ActionResult Edit(ModelNo modelno)
 {
     if (ModelState.IsValid)
     {
         db.Entry(modelno).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(modelno));
 }
Esempio n. 5
0
        public int CompareTo(MailingLabelRow other)
        {
            int result = Manufacturer.CompareTo(other.Manufacturer);

            if (result == 0)
            {
                result = ModelNo.CompareTo(other.ModelNo);
            }

            return(result);
        }
Esempio n. 6
0
        public ActionResult Create(ModelNo modelno)
        {
            if (ModelState.IsValid)
            {
                db.ModelNos.Add(modelno);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(modelno));
        }
Esempio n. 7
0
        private async Task <BPFCEstablishDto> AddBPFC(BPFCEstablishDtoForImportExcel bPFCEstablishDto)
        {
            var result = new BPFCEstablishDto();

            // make model name, model no, article no, process
            using (var scope = new TransactionScope(TransactionScopeOption.Required,
                                                    new TransactionOptions {
                IsolationLevel = IsolationLevel.ReadCommitted
            }, TransactionScopeAsyncFlowOption.Enabled))
            {
                // make model name
                var modelName = await _repoModelName.FindAll().FirstOrDefaultAsync(x => x.Name.ToUpper().Equals(bPFCEstablishDto.ModelName.ToUpper()));

                if (modelName != null)
                {
                    result.ModelNameID = modelName.ID;
                }
                else
                {
                    var modelNameModel = new ModelName {
                        Name = bPFCEstablishDto.ModelName
                    };
                    _repoModelName.Add(modelNameModel);
                    await _repoModelNo.SaveAll();

                    result.ModelNameID = modelNameModel.ID;
                }
                // end make model no

                // Make model no
                var modelNo = await _repoModelNo.FindAll().FirstOrDefaultAsync(x => x.Name.ToUpper().Equals(bPFCEstablishDto.ModelNo.ToUpper()) && x.ModelNameID == result.ModelNameID);

                if (modelNo != null)
                {
                    result.ModelNoID = modelNo.ID;
                }
                else
                {
                    var modelNoModel = new ModelNo {
                        Name = bPFCEstablishDto.ModelNo, ModelNameID = result.ModelNameID
                    };
                    _repoModelNo.Add(modelNoModel);
                    await _repoModelNo.SaveAll();

                    result.ModelNoID = modelNoModel.ID;
                }
                // end make model NO

                // end make articleNO

                var artNo = await _repoArticleNo.FindAll().FirstOrDefaultAsync(x => x.Name.ToUpper().Equals(bPFCEstablishDto.ArticleNo.ToUpper()) && x.ModelNoID == result.ModelNoID);

                if (artNo != null)
                {
                    result.ArticleNoID = artNo.ID;
                }
                else
                {
                    // make art no
                    var articleNoModel = new ArticleNo {
                        Name = bPFCEstablishDto.ArticleNo, ModelNoID = result.ModelNoID
                    };
                    _repoArticleNo.Add(articleNoModel);
                    await _repoArticleNo.SaveAll();

                    result.ArticleNoID = articleNoModel.ID;
                }
                // end articleNO
                //  make Art Process

                var artProcess = await _repoArtProcess.FindAll().FirstOrDefaultAsync(x => x.ProcessID.Equals(bPFCEstablishDto.Process.ToUpper() == "STF" ? 2 : 1) && x.ArticleNoID == result.ArticleNoID);

                if (artProcess != null)
                {
                    result.ArtProcessID = artProcess.ID;
                }
                else
                {
                    // make art process
                    var artProcessModel = new ArtProcess {
                        ArticleNoID = result.ArticleNoID, ProcessID = bPFCEstablishDto.Process.ToUpper() == "STF" ? 2 : 1
                    };
                    _repoArtProcess.Add(artProcessModel);
                    await _repoArtProcess.SaveAll();

                    result.ArtProcessID = artProcessModel.ID;
                }
                //End  make Art Process

                result.CreatedBy = bPFCEstablishDto.CreatedBy;
                scope.Complete();
                return(result);
            }
        }