Exemple #1
0
        /// <summary>
        /// 加载历史工程列表
        /// </summary>
        public void LoadProjectList()
        {
            try
            {
                // 历史文件模型
                HistoryModels models = HistoryModels.Open();

                models.Sort((model1, model2) =>
                {
                    return(model1.LastModified > model2.LastModified ? -1
                    : model1.LastModified == model2.LastModified ? 0 : 1);
                });

                BindingSource bindingSource = new BindingSource();
                foreach (var item in models)
                {
                    if (false == File.Exists(item.FilePath))
                    {
                        continue;
                    }
                    bindingSource.Add(item);
                }

                gridRecent.DataSource = bindingSource;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #2
0
 private void FinishSearch()
 {
     if (String.IsNullOrEmpty(ClientNumber) == false)
     {
         HistoryModels = new BindableCollection <HistoryModel>(HistoryModels.ToList().Where(x => x.Client.PhoneNumber.Contains(ClientNumber)));
     }
     if (String.IsNullOrEmpty(ClientName) == false)
     {
         HistoryModels = new BindableCollection <HistoryModel>(HistoryModels.ToList().Where(x => x.Client.Name.Contains(ClientName)));
     }
     if (String.IsNullOrEmpty(ClientSurname) == false)
     {
         HistoryModels = new BindableCollection <HistoryModel>(HistoryModels.ToList().Where(x => x.Client.Surname.Contains(ClientSurname)));
     }
     if (String.IsNullOrEmpty(ProductFactoryNumber) == false)
     {
         HistoryModels = new BindableCollection <HistoryModel>(HistoryModels.ToList().Where(x => x.FactoryNumber.Contains(ProductFactoryNumber)));
     }
     if (String.IsNullOrEmpty(ProductName) == false)
     {
         HistoryModels = new BindableCollection <HistoryModel>(HistoryModels.ToList().Where(x => x.Name.Contains(ProductName)));
     }
     if (String.IsNullOrEmpty(ProductSet) == false)
     {
         HistoryModels = new BindableCollection <HistoryModel>(HistoryModels.ToList().Where(x => x.Set.Contains(ProductSet)));
     }
     isOpenPopup = false;
     EmptySearchParameters();
     if (HistoryModels.Count == 0)
     {
         RefreshView();
         MessageBox.Show("Жодного результату за вашим пошуком");
     }
 }
Exemple #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            HistoryModels roomModels = db.HistoryModels.Find(id);

            db.HistoryModels.Remove(roomModels);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #4
0
 private void CountSums()
 {
     SumOfEarnings   = 0;
     SumOfNetPrices  = 0;
     SumOfSellPrices = 0;
     HistoryModels.ToList().ForEach(x => SumOfSellPrices += x.ProductSellPrice * x.ProductQuantity);
     HistoryModels.ToList().ForEach(x => SumOfNetPrices  += x.ProductNetPrice * x.ProductQuantity);
     SumOfEarnings = SumOfSellPrices - SumOfNetPrices;
 }
Exemple #5
0
 public ActionResult Edit([Bind(Include = "ID,Name,Peopel,Coustomer,StartTime,EndTime,Tips,Person")] HistoryModels roomModels)
 {
     if (ModelState.IsValid)
     {
         db.Entry(roomModels).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(roomModels));
 }
Exemple #6
0
        public ActionResult Create([Bind(Include = "ID,Name,Peopel,Coustomer,StartTime,EndTime,Tips,Person")] HistoryModels roomModels)
        {
            if (ModelState.IsValid)
            {
                //db.HistoryModels.Add(roomModels);
                //db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(roomModels));
        }
Exemple #7
0
        // GET: RoomPage/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HistoryModels roomModels = db.HistoryModels.Find(id);

            if (roomModels == null)
            {
                return(HttpNotFound());
            }
            return(View(roomModels));
        }
Exemple #8
0
        public bool WriteHis([Bind(Include = "Id,RoomId,RoomName,Peopel,Coustomer,StartTime,EndTime,Tips")] RoomModels rm)
        {
            HistoryModels room = new HistoryModels();

            room.RoomId    = rm.ID;
            room.RoomName  = rm.Name;
            room.Peopel    = rm.Peopel;
            room.Coustomer = rm.Coustomer;
            room.StartTime = rm.StartTime;
            room.EndTime   = rm.EndTime;
            room.Tips      = rm.Tips;
            if (ModelState.IsValid)
            {
                db.HistoryModels.Add(room);
                db.SaveChanges();
                return(true);
            }
            return(false);
        }