예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("repair_ID,repair_description,repair_prioritystatus,repair_completionstatus,repair_createddate")] repair repair)
        {
            if (id != repair.repair_ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(repair);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!repairExists(repair.repair_ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(repair));
        }
        public ActionResult Save(repair com)
        {
            bool status = false;

            if (ModelState.IsValid)
            {
                using (TCMSDBEntities dc = new TCMSDBEntities())
                {
                    if (com.MachineNO > 0)
                    {
                        // Edit
                        var v = dc.repairs.Where(a => a.repair_id == com.repair_id).FirstOrDefault();
                        if (v != null)
                        {
                            v.MachineNO   = com.MachineNO;
                            v.cost        = com.cost;
                            v.description = com.description;
                            v.repair_date = com.repair_date;
                        }
                        else
                        {
                            //Save
                            dc.repairs.Add(com);
                        }

                        dc.SaveChanges();
                        status = true;
                    }
                }
            }
            return(new JsonResult {
                Data = new { status = status, message = "Saved Successfully" }
            });
            //return Json(new { status = true, message = "Saved Successfully" }, JsonRequestBehavior.AllowGet);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            repair repair = db.repairs.Find(id);

            db.repairs.Remove(repair);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "ID,jobname,descript,datetime,status,studentid,roomno,choich")] repair repair)
 {
     if (ModelState.IsValid)
     {
         db.Entry(repair).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(repair));
 }
예제 #5
0
 public ActionResult Edit([Bind(Include = "RepairID,CheckID,ItemID,Code,Name,FamilyID,FamilyName,Model,PartNo,Problem,Pic,AddDate,AddUserID,AddUserName,RepairDate,RepairUserName,RepairState")] repair repair)
 {
     if (ModelState.IsValid)
     {
         db.Entry(repair).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(repair));
 }
예제 #6
0
        public async Task <IActionResult> Create([Bind("repair_ID,repair_description,repair_prioritystatus,repair_completionstatus,repair_createddate")] repair repair)
        {
            if (ModelState.IsValid)
            {
                _context.Add(repair);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(repair));
        }
        public ActionResult Create([Bind(Include = "ID,jobname,descript,datetime,status,studentid,roomno,choich")] repair repair)
        {
            if (ModelState.IsValid)
            {
                db.repairs.Add(repair);

                db.SaveChanges();

                return(RedirectToAction("Index"));
            }

            return(View(repair));
        }
예제 #8
0
        public ActionResult Create([Bind(Include = "RepairID,CheckID,ItemID,Code,Name,FamilyID,FamilyName,Model,PartNo,Problem,Pic,AddDate,AddUserID,AddUserName,RepairDate,RepairUserName,RepairState")] repair repair)
        {
            if (ModelState.IsValid)
            {
                repair.AddDate     = DateTime.Now;
                repair.RepairState = "新增";
                db.repair.Add(repair);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(repair));
        }
예제 #9
0
        //
        // GET: /RepairSub/

        public ActionResult saveRepair()
        {
            MsgBox mb = new MsgBox();
            repair r  = new repair();

            r.ID         = Guid.NewGuid().ToString();
            r.labName    = Request["labName"] == null ? "" : Request["labName"].ToString();
            r.repairName = Request["repairName"] == null ? "" : Request["repairName"].ToString();
            r.account    = System.Web.HttpContext.Current.Session["account"].ToString();
            r.isDone     = 0;
            mb           = new RepairManager().saveRepair(r);
            return(Json(mb));
        }
        // GET: repairs/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            repair repair = db.repairs.Find(id);

            if (repair == null)
            {
                return(HttpNotFound());
            }
            return(View(repair));
        }
예제 #11
0
        public ActionResult changeJigitemState(int?itemid, string statename)
        {
            if (itemid == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            repair repair = db.repair.Find(itemid);

            if (repair == null)
            {
                return(HttpNotFound());
            }
            var otherController = DependencyResolver.Current.GetService <JigitemsController>();
            var action          = otherController.changeItemState(itemid, statename);

            return(action);
        }
예제 #12
0
        public ActionResult Create([Bind(Include = "RepairID,CheckID,ItemID,Code,Name,FamilyID,FamilyName,Model,PartNo,Problem,Pic,AddDate,AddUserID,AddUserName,RepairDate,RepairUserName,RepairState")] repair repair)
        {
            if (ModelState.IsValid)
            {
                repair.AddDate     = DateTime.Now;
                repair.RepairState = "新增";
                Employee user = (Employee)System.Web.HttpContext.Current.Session["user"];
                repair.AddUserID   = user.EmployeeID;
                repair.AddUserName = user.EmployeeName;
                db.repair.Add(repair);
                db.SaveChanges();
                changeJigitemState(repair.ItemID, "维修");
                return(RedirectToAction("Index"));
            }

            return(View(repair));
        }
예제 #13
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        string qq = "Data Source=gz-20150728tajv\\sqlexpress;Initial Catalog=Student1;Integrated Security=True ";
        SqlConnection Conn = new SqlConnection(qq);
        Conn.Open();
        string SQL = "UPDATE repair SET 是否处理='已处理' where 编号='" + TextBox1.Text + "'";
        SqlCommand cmd = new SqlCommand(SQL, Conn);
        cmd.ExecuteNonQuery();
        Conn.Close();

        repair ad = new repair();
        DataSet abc = ad.GetAll();

        GridView1.DataSource = abc;
        GridView1.DataBind();

        TextBox1.Text = "";
    }
예제 #14
0
        public ActionResult RepairSuccess(int?id)           /*修复成功*/
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            repair repair = db.repair.Find(id);

            if (repair == null)
            {
                return(HttpNotFound());
            }
            repair.RepairState    = "修复";
            repair.RepairDate     = DateTime.Now;
            repair.RepairUserName = "******";
            db.SaveChanges();
            changeJigitemState(repair.ItemID, "库存");
            return(RedirectToAction("Index"));
        }
예제 #15
0
        public IActionResult AddRepairToAvto(AddRepairViewModel model, string type, string worker)
        {
            repair repair = new repair()
            {
                date           = model.date,
                avto           = _context.avtoes.Where(e => e.Avto_Key == model.Avto_key).FirstOrDefault(),
                type_of_repair = _context.type_of_repair.Where(e => e.name == type).FirstOrDefault(),
                work_data      = _context.work_data.Where(e => e.worker.fullname == worker).FirstOrDefault()
            };

            repair.Avto_Key           = model.Avto_key;
            repair.Type_of_repair_Key = repair.type_of_repair.Type_of_repair_Key;
            repair.Work_data_Key      = repair.work_data.Work_data_Key;

            _context.repairs.Add(repair);
            _context.SaveChanges();

            return(RedirectToAction("ShowAvto", "Shows", new { id = model.Avto_key }));
        }
예제 #16
0
 internal new void Initialize(ShipModel[] ships)
 {
     _NowShipLength = ships.Length;
     noShips.transform.localScale = ((_NowShipLength != 0) ? Vector3.zero : Vector3.one);
     _before_s = string.Empty;
     _rep      = ((Component)base.gameObject.transform.parent.parent.parent).GetComponent <repair>();
     mKeyController.ClearKeyAll();
     if (SortButton.isActiveAndEnabled)
     {
         SortButton.Initialize(ships);
         SortButton.SetClickable(clickable: true);
         if (!mCallFirstInitialze)
         {
             SortButton.SetSortKey(SortKey.DAMAGE);
             mCallFirstInitialze = true;
         }
         SortButton.SetCheckClicableDelegate(CheckSortButtonClickable);
         SortButton.SetOnSortedShipsListener(OnSorted);
         SortButton.ReSort();
     }
 }
 internal void Initialize(ShipModel[] ships)
 {
     this._NowShipLength = ships.Length;
     this.noShips.get_transform().set_localScale((this._NowShipLength != 0) ? Vector3.get_zero() : Vector3.get_one());
     this._before_s = string.Empty;
     this._rep      = base.get_gameObject().get_transform().get_parent().get_parent().get_parent().GetComponent <repair>();
     this.mKeyController.ClearKeyAll();
     if (this.SortButton.get_isActiveAndEnabled())
     {
         this.SortButton.Initialize(ships);
         this.SortButton.SetClickable(true);
         if (!this.mCallFirstInitialze)
         {
             this.SortButton.SetSortKey(SortKey.DAMAGE);
             this.mCallFirstInitialze = true;
         }
         this.SortButton.SetCheckClicableDelegate(new UIShipSortButton.CheckClickable(this.CheckSortButtonClickable));
         this.SortButton.SetOnSortedShipsListener(new Action <ShipModel[]>(this.OnSorted));
         this.SortButton.ReSort();
     }
 }
예제 #18
0
        public ActionResult RepairFail(int?id)          /*修复失败*/
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            repair repair = db.repair.Find(id);

            if (repair == null)
            {
                return(HttpNotFound());
            }
            repair.RepairState = "未修复";
            repair.RepairDate  = DateTime.Now;

            Employee user = (Employee)System.Web.HttpContext.Current.Session["user"];

            repair.RepairUserName = user.EmployeeName;

            db.SaveChanges();
            changeJigitemState(repair.ItemID, "报废");
            return(RedirectToAction("Index"));
        }
예제 #19
0
        public MsgBox saveRepair(repair r)
        {
            MsgBox mb = new MsgBox();

            if (string.IsNullOrEmpty(r.ID))
            {
                r.ID = Guid.NewGuid().ToString();
            }
            try
            {
                lab_info li = new Repository <lab_info>().Get(r.labName);
                r.labName = li.lab_name;
                new Repository <repair>().Insert(r);
                mb.status = true;
                mb.msg    = "报修成功。";
            }
            catch (Exception e)
            {
                mb.status = false;
                mb.msg    = e.Message;
            }
            return(mb);
        }