예제 #1
0
        // GET: ErrorListTables/Details/5
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ErrorListTable errorListTable = db.ErrorListTable.Find(id);

            if (errorListTable == null)
            {
                return(HttpNotFound());
            }
            return(View(errorListTable));
        }
예제 #2
0
        public ActionResult DeleteConfirmed(string id)
        {
            ErrorListTable errorListTable = db.ErrorListTable.Find(id);

            // tablodan veriler silinice notification refresh edilir
            DOneTable dOneTable = db.DOneTable.Where(x => x.ErrorNo == errorListTable.ErrorNo).FirstOrDefault();

            sqlHelper.deleteNotification(dOneTable);
            // delete image from project folder and db cascade delete already delete on db
            sqlHelper.deleteImageOnFolder(errorListTable.ErrorNo);

            // delete document from project folder and db cascade delete already delete on db
            sqlHelper.deleteDocumentOnFolder(errorListTable.ErrorNo);

            db.ErrorListTable.Remove(errorListTable);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #3
0
        public ActionResult Create(HttpPostedFileBase[] imageFiles, [Bind(Include = "ID,Company,CreateDate,CloseDate,Creator,ErrorSource,ErrorProduct,WaybillNo,PartNumber,PartName,ErrorNo,ErrorCode,ErrorDefine,ErrorDescription,WrongAmount,ControlledQuantity,Ppm,JunkAmount,JunkProcess,JunkType,SortingDuringProductionAmount,SortingDuringProductionType,CheckingBeforeShipmentAmount,CheckingBeforeShipmentType,SmilarFaultyAvalaible,Contact,Quarantine,QuarantineType,ReferenceNumber,Costumer")] ErrorListTable errorListTable)
        {
            var userModel = common.getCurrentUserModel();

            SqlHelper sqlHelper = new SqlHelper();

            // set Default values
            //errorListTable.CreateDate = DateTime.Now;
            errorListTable.ErrorNo   = sqlHelper.getErrorNo();
            errorListTable.Company   = userModel.Company;
            errorListTable.CloseDate = null;
            errorListTable.Ppm       = (errorListTable.WrongAmount * 1000000) / (errorListTable.ControlledQuantity);
            errorListTable.LastStep  = "D0"; // "D0"
            errorListTable.SaveDate  = DateTime.Now;


            // hata kodunu veri tabanına açıklamasını kaydettiği için bu kod ile düzeltme sağlayacağım
            var errorcode = db.ErrorCodeTable.Where(x => x.ErrorDefine == errorListTable.ErrorDefine && x.Company == userModel.Company).FirstOrDefault().ErrorCode;

            errorListTable.ErrorCode = errorcode;



            if (ModelState.IsValid)
            {
                db.ErrorListTable.Add(errorListTable);
                db.SaveChanges();
                // Add image flie to db------------------
                // save images on ImgesTable
                fileHelper.saveImagesDB(imageFiles, "D0", errorListTable.ErrorNo);

                mailHelper.sendMailForSuperUser(errorListTable.ErrorNo); // hata oluşturulunca super userlara mail gider

                return(RedirectToAction("Index"));
            }

            initViewBags();

            return(View(errorListTable));
        }
예제 #4
0
        public ActionResult Edit([Bind(Include = "ID,Company,Contact,CreateDate,CloseDate,Creator,ErrorSource,ErrorProduct,WaybillNo,PartNumber,PartName,ErrorNo,ErrorCode,ErrorDefine,ErrorDescription,WrongAmount,ControlledQuantity,Ppm,JunkAmount,JunkProcess,JunkType,Quarantine,QuarantineType,SortingDuringProductionAmount,SortingDuringProductionType,CheckingBeforeShipmentAmount,CheckingBeforeShipmentType,SmilarFaultyAvalaible,LastStep,SaveDate,ReferenceNumber,Costumer")] ErrorListTable errorListTable)
        {
            var userModel = common.getCurrentUserModel();

            // hata kodunu veri tabanına açıklamasını kaydettiği için bu kod ile düzeltme sağlayacağım
            var errorcode = db.ErrorCodeTable.Where(x => x.ErrorDefine == errorListTable.ErrorDefine && x.Company == userModel.Company).FirstOrDefault().ErrorCode;

            errorListTable.ErrorCode = errorcode;


            errorListTable.Ppm = (errorListTable.WrongAmount * 1000000) / (errorListTable.ControlledQuantity); // ppm tekrar hesaplandı


            if (ModelState.IsValid)
            {
                db.Entry(errorListTable).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            initViewBags();
            return(View(errorListTable));
        }