コード例 #1
0
        public ActionResult AdditionalProcessRemove(int processid_)
        {
            GetUserInfo();
            AdditionalProcessingViewModel viewModel = new AdditionalProcessingViewModel
            {
                AdditionalProcess = _additionalprocessesRepository.AdditionalProcess.FirstOrDefault(a => a.ProcessingID == processid_),
                PartSetUpID       = _additionalprocessesRepository.AdditionalProcess.FirstOrDefault(z => z.ProcessingID == processid_).PartSetUpID
            };

            var partsetup = _partsetupRepository.PartSetUp.FirstOrDefault(a => a.PartSetUpID == viewModel.PartSetUpID);

            viewModel.PartSetUp = partsetup;
            viewModel.AdditionalProcess.IsActive = false;

            viewModel.AdditionalProcess.LastEditedBy = username;
            viewModel.AdditionalProcess.LastEditDate = DateTime.Now;
            _additionalprocessesRepository.Update(viewModel.AdditionalProcess);

            string partid = viewModel.PartSetUp.PartID;
            //send user back to partmaintenance index
            TravelCardViewModel viewModelTC = new TravelCardViewModel
            {
                ItemID = partid,
                ShowPartSetUpDetails = true
            };

            return(RedirectToAction("PartMaintenanceIndexShowSavedResult", "TravelCard", viewModelTC));
        }
コード例 #2
0
        public ActionResult PartSpecificationRemove(int specificationid_)
        {
            GetUserInfo();
            PartSpecificationViewModel viewModel = new PartSpecificationViewModel
            {
                PartSpecification = _partspecificationRepository.PartSpecification.FirstOrDefault(a => a.SpecificationID == specificationid_),
                PartSetUpID       = _partspecificationRepository.PartSpecification.FirstOrDefault(z => z.SpecificationID == specificationid_).PartSetUpID
            };
            int partsetupid = viewModel.PartSpecification.PartSetUpID;
            var partsetup   = _partsetupRepository.PartSetUp.FirstOrDefault(a => a.PartSetUpID == viewModel.PartSetUpID);

            viewModel.PartSetUp = partsetup;
            viewModel.PartSpecification.IsActive = false;

            viewModel.PartSpecification.LastEditBy   = username;
            viewModel.PartSpecification.LastEditDate = DateTime.Now;
            _partspecificationRepository.Update(viewModel.PartSpecification);

            string partid = viewModel.PartSetUp.PartID;
            //send user back to partmaintenance index
            TravelCardViewModel viewModelTC = new TravelCardViewModel
            {
                ItemID = partid,
                ShowPartSetUpDetails = true
            };

            return(RedirectToAction("PartMaintenanceIndexShowSavedResult", "TravelCard", viewModelTC));
        }
コード例 #3
0
        public ActionResult BackToPartSetUp(string _itemid, Int16 _partsetupid)
        {
            //send user back to partmaintenance index
            TravelCardViewModel viewModelTC = new TravelCardViewModel
            {
                ItemID      = _itemid,
                PartSetUpID = _partsetupid
            };

            return(RedirectToAction("PartMaintenanceIndexShowSavedResult", "TravelCard", viewModelTC));
        }
コード例 #4
0
        public ActionResult SaveClonedProcesses(AdditionalProcessingViewModel viewModel, FormCollection result)
        {
            string itemid = viewModel.ItemID;

            Int16 partsetupid = viewModel.PartSetUp.PartSetUpID;

            GetUserInfo();
            try
            {
                var selecteditems = from x in result.AllKeys
                                    where result[x] != "false"

                                    select x;


                foreach (var item in selecteditems)
                {
                    if (item.Contains("ProcesstoClone_"))
                    {
                        string theitem = item.ToString();

                        theitem = theitem.Replace("ProcesstoClone_", "");


                        int      theprocesstoclone  = Convert.ToInt16(theitem);
                        var      processtoclone     = _additionalprocessesRepository.AdditionalProcess.FirstOrDefault(a => a.ProcessingID == theprocesstoclone);
                        string   descriptionEnglish = processtoclone.Description;
                        string   sequenceid         = processtoclone.SequenceID;
                        string   descriptionSpanish = processtoclone.DescriptionES;
                        string   notes        = "";
                        DateTime lasteditdate = DateTime.Now;
                        string   lasteditedby = username;
                        _additionalprocessesRepository.InsertClonedAdditionalProcess(partsetupid, descriptionEnglish, descriptionSpanish, notes, sequenceid, lasteditedby, lasteditdate);
                        processtoclone = null;
                        this.ShowSaveSuccessfull();
                    }
                }


                //send user back to partmaintenance index
                TravelCardViewModel viewModelTC = new TravelCardViewModel
                {
                    ItemID = itemid,
                    ShowPartSetUpDetails = true
                };
                return(RedirectToAction("PartMaintenanceIndexShowSavedResult", "TravelCard", viewModelTC));
            }
            catch (Exception ex)
            {
                //TODO: did not save. deal with error
                return(RedirectToAction("PartMaintenanceIndexShowSavedResult", "TravelCard"));
            }
        }
コード例 #5
0
        public ActionResult PrintTravelCard_US(string ItemID)


        {
            ItemID = ItemID.ToUpper();
            int  count   = 0;
            bool canedit = CanUserEdit();

            if (ItemID.Length > 0)
            {
                GetUserInfo();
                string name = username.ToLower().Trim();

                TravelCardViewModel viewModel = new TravelCardViewModel
                {
                    UserSetting = _usersettingRepository.UserSetting.FirstOrDefault(a => a.UserName == name),
                    PartSetUp   = _partsetupRepository.PartSetUp.FirstOrDefault(x => x.PartID == ItemID),
                    ItemID      = ItemID,
                    CanUserEdit = canedit,
                };

                viewModel.Plant = _plantRepository.Plant.FirstOrDefault(a => a.PlantCodeID == viewModel.UserSetting.PlantCodeID);
                string plant = viewModel.Plant.PlantCode;
                // viewModel.Component = _componentsRepository.GetByID(ItemID,plant);
                viewModel.Part = _partsRepository.GetByID(ItemID, plant);
                // viewModel.Component.Where(a => a.Id != ItemID);
                //    viewModel.ParentComponent = _componentsRepository.GetParentComponentByID(viewModel.ItemID, plant);
                count = viewModel.Part.Count();

                if (count > 0)
                {
                    if (viewModel.PartSetUp == null)
                    {
                        var message = "A Travel Card for this part could not be found.<br > Please contact the quality department.";
                        ViewData["NoResultMessage"] = message;
                    }
                    return(View("PrintTravelCard_US", viewModel));
                }
                if (count == 0)
                {
                    var message = "Your search returned no results. Please try again.";
                    ViewData["NoResultMessage"] = message;
                    ViewData["PartID"]          = ItemID;

                    return(View("PrintTravelCard_US", viewModel));
                }
            }

            return(View());
        }
コード例 #6
0
        public ActionResult PartMaintenanceIndexShowSavedResult(TravelCardViewModel viewModelTC)
        {
            int    count   = 0;
            string ItemID  = viewModelTC.ItemID;
            bool   canedit = CanUserEdit();


            if (ItemID.Length > 0)
            {
                GetUserInfo();
                string name = username.ToLower().Trim();

                var viewModel = new TravelCardViewModel
                {
                    UserSetting          = _usersettingRepository.UserSetting.FirstOrDefault(a => a.UserName == name),
                    PartSetUp            = _partsetupRepository.PartSetUp.FirstOrDefault(x => x.PartID == ItemID),
                    ShowPartSetUpDetails = true,
                    ItemID       = ItemID,
                    CanUserEdit  = canedit,
                    returnanchor = viewModelTC.returnanchor
                };

                viewModel.Plant = _plantRepository.Plant.FirstOrDefault(a => a.PlantCodeID == viewModel.UserSetting.PlantCodeID);
                string plant = viewModel.Plant.PlantCode;

                viewModel.Component = _componentsRepository.GetByID(ItemID, plant);
                viewModel.Part      = _partsRepository.GetByID(ItemID, plant);


                viewModel.ParentComponent = _componentsRepository.GetParentComponentByID(viewModel.ItemID, plant);
                count = viewModel.Part.Count();
                string anchor = viewModel.returnanchor;
                if (count > 0)
                {
                    return(View("PartMaintenanceIndex", viewModel));
                }

                if (count == 0)
                {
                    var message = "Your search returned no results. Please try again";
                    ViewData["NoResultMessage"] = message;
                    ViewData["PartID"]          = ItemID;
                    return(View("PartMaintenanceIndex", viewModel));
                }
            }

            return(View());
        }
コード例 #7
0
        public ActionResult Imprimir_Tarjeta_de_Viaje_MX(string ItemID)
        {
            ItemID = ItemID.ToUpper();
            int  count   = 0;
            bool canedit = CanUserEdit();

            if (ItemID.Length > 0)
            {
                GetUserInfo();
                string name = username.ToLower().Trim();

                TravelCardViewModel viewModel = new TravelCardViewModel
                {
                    UserSetting = _usersettingRepository.UserSetting.FirstOrDefault(a => a.UserName == name),
                    PartSetUp   = _partsetupRepository.PartSetUp.FirstOrDefault(x => x.PartID == ItemID),
                    ItemID      = ItemID,
                    CanUserEdit = canedit,
                };

                viewModel.Plant = _plantRepository.Plant.FirstOrDefault(a => a.PlantCodeID == viewModel.UserSetting.PlantCodeID);
                string plant = viewModel.Plant.PlantCode;
                // viewModel.Component = _componentsRepository.GetByID(ItemID,plant);
                viewModel.Part = _partsRepository.GetByID(ItemID, plant);
                // viewModel.Component.Where(a => a.Id != ItemID);
                //    viewModel.ParentComponent = _componentsRepository.GetParentComponentByID(viewModel.ItemID, plant);
                count = viewModel.Part.Count();

                if (count > 0)
                {
                    if (viewModel.PartSetUp == null)
                    {
                        var message = "Una Tarjeta de viaje para este numero de parte no pudo ser encontrada. Favor de contactar al Departamento de Calidad o Ingenieria de Producto.";
                        ViewData["NoResultMessage"] = message;
                    }
                    return(View("Imprimir_Tarjeta_de_Viaje_MX", viewModel));
                }
                if (count == 0)
                {
                    var message = "Su busqueda retorno sin resultaods.  Favor de tratar nuevamente.";
                    ViewData["NoResultMessage"] = message;
                    ViewData["PartID"]          = ItemID;

                    return(View("Imprimir_Tarjeta_de_Viaje_MX", viewModel));
                }
            }

            return(View());
        }
コード例 #8
0
        public ActionResult AdditionalProcessessCreate(AdditionalProcessingViewModel viewModel_)
        {
            GetUserInfo();
            if (viewModel_.AdditionalProcess.Description == null)
            {
                ModelState.AddModelError("AdditionalProcessesAdd", "Description of the Additional Process is required.");
            }


            //if (viewModel_.AdditionalProcess.SequenceID.)
            //{
            //    ModelState.AddModelError("AdditionalProcessMissingSequenceID", "Please select a display order for this process.");
            //}

            if (ModelState.IsValid)
            {
                string itemid       = viewModel_.PartSetUp.PartID;
                Int16  setupid      = viewModel_.PartSetUp.PartSetUpID;
                int    processingid = 0;
                viewModel_.AdditionalProcess.PartSetUpID   = setupid;
                viewModel_.AdditionalProcess.LastEditDate  = DateTime.Now;
                viewModel_.AdditionalProcess.LastEditedBy  = username;
                viewModel_.AdditionalProcess.SequenceID    = viewModel_.AdditionalProcess.SequenceID;
                viewModel_.AdditionalProcess.Description   = viewModel_.AdditionalProcess.Description.ToUpper();
                viewModel_.AdditionalProcess.DescriptionES = viewModel_.AdditionalProcess.DescriptionES;
                viewModel_.AdditionalProcess.DescriptionCN = viewModel_.AdditionalProcess.DescriptionCN;
                viewModel_.AdditionalProcess.IsActive      = viewModel_.IsActive;
                processingid = _additionalprocessesRepository.Insert(viewModel_.AdditionalProcess);
                string anchor = "process" + processingid.ToString();



                this.ShowSaveSuccessfull();
                //send user back to partmaintenance index
                TravelCardViewModel viewModelTC = new TravelCardViewModel
                {
                    ItemID = itemid,
                    ShowPartSetUpDetails = true,
                    returnanchor         = anchor
                };
                return(RedirectToAction("PartMaintenanceIndexShowSavedResult", "TravelCard", viewModelTC));
            }
            else
            {
                ViewData["SequenceID"] = new SelectList(viewModel_.AdditionalProcessingSequence.Select(a => a.Text));
                return(View(viewModel_));
            }
        }
コード例 #9
0
        public string GetComponentName(IPartsRepository <Part> partsRepository_, string partid)
        {
            GetUserInfo();
            string name      = username.ToString().Trim();
            var    viewModel = new TravelCardViewModel
            {
                UserSetting = _usersettingRepository.UserSetting.FirstOrDefault(a => a.UserName == name),
            };

            viewModel.Plant = _plantRepository.Plant.FirstOrDefault(a => a.PlantCodeID == viewModel.UserSetting.PlantCodeID);
            string plant = viewModel.Plant.PlantCode;
            var    componentdescription     = partsRepository_.GetByID(partid, plant);
            string componenttextdescription = componentdescription.Select(x => x.ITMDESC).ToString();

            return(componenttextdescription);
        }
コード例 #10
0
        public ActionResult TravelCardPrint(string ItemID)
        {
            ItemID = ItemID.ToUpper();

            string message = "";
            string partid  = "";

            if (String.IsNullOrEmpty(ItemID))
            {
                message = "Please enter an item id and try again.";
                partid  = ItemID;
                //send the user back to the search screen
                ViewData["NoResultMessage"] = message;
                ViewData["PartID"]          = partid;
                return(RedirectToAction("Index", "TravelCard"));
            }
            else
            {
                var viewModel = new TravelCardViewModel
                {
                    PartSetUp    = _partsetupRepository.PartSetUp.FirstOrDefault(x => x.PartID == ItemID),
                    Frequencies  = _frequencyRepository.Frequency.Where(a => a.IsActive),
                    UsersCulture = ResolveCulture(),
                };
                viewModel.TCBarCodes = _tcbarcodeRepository.TCBarCode.Where(a => a.PartSetUpID == viewModel.PartSetUp.PartSetUpID);

                int maxid = viewModel.TCBarCodes.Max(a => a.TCBarCodeID);
                viewModel.MaxBarCodeforSetUP = maxid;

                viewModel.Plant = _plantRepository.Plant.FirstOrDefault(a => a.PlantCodeID == viewModel.UserSetting.PlantCodeID);
                string plant = viewModel.Plant.PlantCode;
                viewModel.Component   = _componentsRepository.GetByID(ItemID, plant);
                viewModel.Part        = _partsRepository.GetByID(ItemID, plant);
                viewModel.PartSetUpID = _partsetupRepository.PartSetUp.Where(x => x.PartID == ItemID).Select(a => a.PartSetUpID).FirstOrDefault();
                var partsetupid = viewModel.PartSetUpID;
                viewModel.PartSpecifications = _partspecificationRepository.PartSpecification.Where(a => a.PartSetUpID == partsetupid)
                                               .OrderBy(c => c.SequenceID).Where(c => c.IsPartCharacteristic);
                viewModel.AdditionalProcesses = _additionalprocessesRepository.AdditionalProcess.Where(a => a.PartSetUpID == partsetupid).Where(b => b.IsActive).OrderBy(c => c.SequenceID);
                viewModel.PartSpecifications  = viewModel.PartSpecifications.Where(a => a.IsActive);
                viewModel.AdditionalProcesses = viewModel.AdditionalProcesses.Where(a => a.IsActive);

                return(View("TravelCardPrint", viewModel));
            }
        }
コード例 #11
0
        public ActionResult AdditionalProcessesEdit(AdditionalProcessingViewModel viewModel)
        {
            if (viewModel.AdditionalProcess.Description == null)
            {
                ModelState.AddModelError("AdditionalProcessesEdit", "Description of the Additional Process is required.");
            }

            GetUserInfo();
            if (ModelState.IsValid)
            {
                //  string itemid = viewModel.PartSetUp.PartID;
                string itemid = viewModel.PartSetUp.PartID;
                //  viewModel.AdditionalProcess.PartSetUpID = viewModel.AdditionalProcess.PartSetUpID;
                //  viewModel.AdditionalProcess.ProcessingID = viewModel.AdditionalProcess.ProcessingID;
                viewModel.AdditionalProcess.Description   = viewModel.AdditionalProcess.Description.ToUpper();
                viewModel.AdditionalProcess.DescriptionES = viewModel.AdditionalProcess.DescriptionES;
                viewModel.AdditionalProcess.DescriptionCN = viewModel.AdditionalProcess.DescriptionCN;
                viewModel.AdditionalProcess.Notes         = viewModel.AdditionalProcess.Notes;
                viewModel.AdditionalProcess.IsActive      = viewModel.AdditionalProcess.IsActive;
                viewModel.AdditionalProcess.SequenceID    = viewModel.AdditionalProcess.SequenceID;
                viewModel.AdditionalProcess.LastEditedBy  = username;
                viewModel.AdditionalProcess.LastEditDate  = DateTime.Now;
                _additionalprocessesRepository.Update(viewModel.AdditionalProcess);
                this.ShowSaveSuccessfull();
                string anchor = "process" + viewModel.AdditionalProcess.ProcessingID.ToString();
                //send user back to partmaintenance index
                TravelCardViewModel viewModelTC = new TravelCardViewModel
                {
                    ItemID = itemid,
                    ShowPartSetUpDetails = true,
                    returnanchor         = anchor
                };
                return(RedirectToAction("PartMaintenanceIndexShowSavedResult", "TravelCard", viewModelTC));
            }
            else

            {
                ViewData["SequenceID"] = new SelectList(viewModel.AdditionalProcessingSequence.Select(a => a.Text));
                return(View(viewModel));
            }
        }
コード例 #12
0
        public ActionResult PartSpecificationEdit(PartSpecificationViewModel viewModel, FormCollection result)
        {
            // int partspecificationid = Convert.ToInt16(result["specification.SpecificationID"]);

            if (ModelState["PartSpecification.SequenceID"] != null)
            {
                ModelState["PartSpecification.SequenceID"].Errors.Clear();
            }

            if (viewModel.PartSpecification.Characteristic == null)
            {
                ModelState.AddModelError("PartSpecificationEdit", "Characteristic is required..");
            }
            //   if (viewModel.PartSpecification.MeasurementMethodID == null)



            if (ModelState.IsValid)
            {
                GetUserInfo();
                string parentid = viewModel.ParentPartID;

                //  viewModel.PartSpecification.SequenceID = "01";
                viewModel.PartSpecification.Notes            = viewModel.PartSpecification.Notes;
                viewModel.PartSpecification.Characteristic   = viewModel.PartSpecification.Characteristic.ToUpper();
                viewModel.PartSpecification.CharacteristicES = viewModel.PartSpecification.CharacteristicES;
                viewModel.PartSpecification.CharacteristicCN = viewModel.PartSpecification.CharacteristicCN;
                viewModel.PartSpecification.LowSpec          = viewModel.PartSpecification.LowSpec;
                viewModel.PartSpecification.LowSpecES        = viewModel.PartSpecification.LowSpecES;
                viewModel.PartSpecification.unitID           = viewModel.PartSpecification.unitID;
                viewModel.PartSpecification.HighSpec         = viewModel.PartSpecification.HighSpec;
                viewModel.PartSpecification.HighSpecES       = viewModel.PartSpecification.HighSpecES;
                if (viewModel.PartSpecification.OperationCode != null)
                {
                    viewModel.PartSpecification.OperationCode = Convert.ToInt16(viewModel.PartSpecification.OperationCode);
                }
                viewModel.PartSpecification.MeasurementMethodID = viewModel.PartSpecification.MeasurementMethodID;
                //  viewModel.PartSpecification.MeasurementMethod = viewModel.PartSpecification.MeasurementMethod;
                //  viewModel.PartSpecification.MeasurementMethodES = viewModel.PartSpecification.MeasurementMethodES;
                if (viewModel.PartSpecification.Gauges == null || viewModel.PartSpecification.Gauges == String.Empty)
                {
                    viewModel.PartSpecification.Gauges = "None";
                }
                else
                {
                    viewModel.PartSpecification.Gauges = viewModel.PartSpecification.Gauges;
                }
                viewModel.PartSpecification.GaugesES     = viewModel.PartSpecification.GaugesES;
                viewModel.PartSpecification.SampleSize   = viewModel.PartSpecification.SampleSize;
                viewModel.PartSpecification.SampleSizeES = viewModel.PartSpecification.SampleSizeES;
                viewModel.PartSpecification.FrequencyID  = viewModel.PartSpecification.FrequencyID;

                viewModel.PartSpecification.IsActive = viewModel.PartSpecification.IsActive;
                viewModel.PartSpecification.IsComponentCharacteristic    = viewModel.PartSpecification.IsComponentCharacteristic;
                viewModel.PartSpecification.IsPartCharacteristic         = viewModel.PartSpecification.IsPartCharacteristic;
                viewModel.PartSpecification.IsMachineSetUpCharacteristic = viewModel.PartSpecification.IsMachineSetUpCharacteristic;
                viewModel.PartSpecification.IsDieSetUpCharcteristic      = viewModel.PartSpecification.IsDieSetUpCharcteristic;
                viewModel.PartSpecification.LastEditBy   = username;
                viewModel.PartSpecification.LastEditDate = DateTime.Now;
                _partspecificationRepository.Update(viewModel.PartSpecification);
                this.ShowSaveSuccessfull();

                int    specificationid = viewModel.PartSpecification.SpecificationID;
                string anchor          = "specification" + specificationid.ToString();

                //send user back to partmaintenance index
                TravelCardViewModel viewModelTC = new TravelCardViewModel
                {
                    ItemID = parentid,
                    ShowPartSetUpDetails = true,
                    returnanchor         = anchor
                };

                return(RedirectToAction("PartMaintenanceIndexShowSavedResult", "TravelCard", viewModelTC));
            }
            else
            {
                viewModel.MeasurementMethods = _measurementmethodRepository.MeasurementMethod;
                viewModel.MeasurementUnits   = _measurementunitRepository.MeasurementUnit;
                viewModel.Frequencies        = _frequencyRepository.Frequency;
                return(View("PartSpecificationEdit", viewModel));
            }
        }
コード例 #13
0
        public ActionResult PartSpecificationCreate(PartSpecificationViewModel viewModel_)
        {
            if (ModelState["PartSpecification.SpecificationID"] != null)
            {
                ModelState["PartSpecification.SpecificationID"].Errors.Clear();
            }

            if (ModelState["PartSpecification.IsActive"] != null)
            {
                ModelState["PartSpecification"].Errors.Clear();
            }

            if (viewModel_.PartSpecification.Characteristic == null)
            {
                ModelState.AddModelError("PartSpecificationError", "Characteristic is required..");
            }

            if (viewModel_.PartSpecification.MeasurementMethodID == null)
            {
                ModelState.AddModelError("PartSpecification.MeasurementMethodID", "Please select a measurement method..");
            }

            if (viewModel_.PartSpecification.SequenceID == null)
            {
                ModelState.AddModelError("PartSpecification.SequenceIDError", "Display order is required..");
            }



            if (ModelState.IsValid)
            {
                GetUserInfo();
                string itemid          = viewModel_.PartSetUp.PartID;
                Int16  setupid         = viewModel_.PartSetUp.PartSetUpID;
                int    specificationid = 0;
                viewModel_.PartSpecification.PartSetUpID         = setupid;
                viewModel_.PartSpecification.LastEditDate        = DateTime.Now;
                viewModel_.PartSpecification.SequenceID          = viewModel_.PartSpecification.SequenceID;
                viewModel_.PartSpecification.MeasurementMethodID = viewModel_.PartSpecification.MeasurementMethodID;
                viewModel_.PartSpecification.Notes            = viewModel_.PartSpecification.Notes;
                viewModel_.PartSpecification.Characteristic   = viewModel_.PartSpecification.Characteristic.ToUpper();
                viewModel_.PartSpecification.CharacteristicES = viewModel_.PartSpecification.CharacteristicES;
                viewModel_.PartSpecification.unitID           = viewModel_.PartSpecification.unitID;
                viewModel_.PartSpecification.FrequencyID      = viewModel_.PartSpecification.FrequencyID;
                viewModel_.PartSpecification.CharacteristicCN = viewModel_.PartSpecification.CharacteristicCN;
                viewModel_.PartSpecification.LowSpec          = viewModel_.PartSpecification.LowSpec;
                viewModel_.PartSpecification.LowSpecES        = viewModel_.PartSpecification.LowSpecES;
                viewModel_.PartSpecification.HighSpec         = viewModel_.PartSpecification.HighSpec;
                viewModel_.PartSpecification.HighSpecES       = viewModel_.PartSpecification.HighSpecES;


                viewModel_.PartSpecification.OperationCode = viewModel_.PartSpecification.OperationCode;

                if (viewModel_.PartSpecification.Gauges == null || viewModel_.PartSpecification.Gauges == "")
                {
                    viewModel_.PartSpecification.Gauges = "None";
                }
                else
                {
                    viewModel_.PartSpecification.Gauges = viewModel_.PartSpecification.Gauges;
                }
                viewModel_.PartSpecification.GaugesES     = viewModel_.PartSpecification.GaugesES;
                viewModel_.PartSpecification.SampleSize   = viewModel_.PartSpecification.SampleSize;
                viewModel_.PartSpecification.SampleSizeES = viewModel_.PartSpecification.SampleSizeES;

                viewModel_.PartSpecification.IsActive                     = viewModel_.IsActive;
                viewModel_.PartSpecification.IsPartCharacteristic         = viewModel_.IsPartCharacteristic;
                viewModel_.PartSpecification.IsComponentCharacteristic    = viewModel_.PartSpecification.IsComponentCharacteristic;
                viewModel_.PartSpecification.IsMachineSetUpCharacteristic = viewModel_.PartSpecification.IsMachineSetUpCharacteristic;
                viewModel_.PartSpecification.IsDieSetUpCharcteristic      = viewModel_.PartSpecification.IsDieSetUpCharcteristic;
                viewModel_.PartSpecification.LastEditBy                   = username;
                specificationid = _partspecificationRepository.Insert(viewModel_.PartSpecification);

                string anchor = "specification" + specificationid.ToString();

                this.ShowSaveSuccessfull();
                //send user back to partmaintenance index
                TravelCardViewModel viewModelTC = new TravelCardViewModel
                {
                    ItemID = itemid,
                    ShowPartSetUpDetails = true,
                    returnanchor         = anchor
                };
                return(RedirectToAction("PartMaintenanceIndexShowSavedResult", "TravelCard", viewModelTC));
            }
            else
            {
                viewModel_.MeasurementMethods         = _measurementmethodRepository.MeasurementMethod;
                viewModel_.PartSpecificationSequences = _partspecificationsequenceRepository.PartSpecificationSequence;
                viewModel_.MeasurementUnits           = _measurementunitRepository.MeasurementUnit;
                viewModel_.Frequencies = _frequencyRepository.Frequency;
                return(View("PartSpecificationCreate", viewModel_));
            }
        }
コード例 #14
0
        public ActionResult SaveClonedPartSpecifications(PartSpecificationViewModel viewModel, FormCollection result)
        {
            string itemid = viewModel.ItemID;

            Int16 partsetupid = viewModel.PartSetUp.PartSetUpID;


            try
            {
                var selecteditems = from x in result.AllKeys
                                    where result[x] != "false"

                                    select x;


                foreach (var item in selecteditems)
                {
                    if (item.Contains("SpecificationtoClone_"))
                    {
                        GetUserInfo();
                        string theitem = item.ToString();

                        theitem = theitem.Replace("SpecificationtoClone_", "");


                        int               thespecificationtoclone = Convert.ToInt16(theitem);
                        var               specificationtoclone    = _partspecificationRepository.PartSpecification.FirstOrDefault(a => a.SpecificationID == thespecificationtoclone);
                        string            descriptionEnglish      = specificationtoclone.Characteristic;
                        string            descriptionSpanish      = specificationtoclone.CharacteristicES;
                        string            descriptionCHinese      = specificationtoclone.CharacteristicCN;
                        int?              operationcode           = Convert.ToInt32(specificationtoclone.OperationCode);
                        int?              unitofmeasure           = Convert.ToInt16(specificationtoclone.unitID);
                        int?              frequencyid             = Convert.ToInt16(specificationtoclone.FrequencyID);
                        string            sequenceid   = specificationtoclone.SequenceID;
                        string            notes        = "";
                        DateTime          lasteditdate = DateTime.Now;
                        string            lasteditedby = username;
                        PartSpecification partspecs_   = new PartSpecification

                        {
                            PartSetUpID         = partsetupid,
                            Characteristic      = descriptionEnglish,
                            CharacteristicES    = descriptionSpanish,
                            SequenceID          = sequenceid,
                            Notes               = "",
                            unitID              = Convert.ToInt16(unitofmeasure),
                            LowSpec             = specificationtoclone.LowSpec,
                            LowSpecES           = specificationtoclone.LowSpecES,
                            HighSpec            = specificationtoclone.HighSpec,
                            HighSpecES          = specificationtoclone.HighSpecES,
                            SampleSize          = specificationtoclone.SampleSize,
                            SampleSizeES        = specificationtoclone.SampleSizeES,
                            FrequencyID         = specificationtoclone.FrequencyID,
                            Gauges              = specificationtoclone.Gauges,
                            OperationCode       = Convert.ToInt16(operationcode),
                            MeasurementMethodID = specificationtoclone.MeasurementMethodID,

                            IsComponentCharacteristic    = specificationtoclone.IsComponentCharacteristic,
                            IsMachineSetUpCharacteristic = specificationtoclone.IsMachineSetUpCharacteristic,
                            IsActive                = true,
                            IsPartCharacteristic    = specificationtoclone.IsPartCharacteristic,
                            IsDieSetUpCharcteristic = specificationtoclone.IsDieSetUpCharcteristic,
                            LastEditBy              = username,
                            LastEditDate            = DateTime.Now
                        };

                        _partspecificationRepository.InsertClonedPartSpecification(partspecs_);
                        partspecs_ = null;
                        this.ShowSaveSuccessfull();
                    }
                }


                //send user back to partmaintenance index
                TravelCardViewModel viewModelTC = new TravelCardViewModel
                {
                    ItemID = itemid,
                    ShowPartSetUpDetails = true
                };
                return(RedirectToAction("PartMaintenanceIndexShowSavedResult", "TravelCard", viewModelTC));
            }
            catch (Exception ex)
            {
                //TODO: did not save. deal with error
                return(RedirectToAction("PartMaintenanceIndexShowSavedResult", "TravelCard"));
            }
        }