예제 #1
0
        void SaveOpration() {
            try {
                
                foreach (var _opration in lstTempOpration) 
                {
                    GenaricRepository<OperationPool> _ORepository = new GenaricRepository<OperationPool>(new ItrackContext());
                    foreach (var item in _CompanyRepository.GetAll().Where(x => x.isDefaultCompany == true))
                    {
                        _Company.CompanyID = item.CompanyID;

                    }
                    _Operation.CompanyID = _Company.CompanyID;
                    _Operation.OperationPoolID = _opration.OprationID;
                    _Operation.OpationName = _opration.OparationName;
                    _Operation.SMV = _opration.SMV;
                    _Operation.SMVType = _opration.SMVType;
                    _Operation.MachineType = _opration.MachineType;
                    _Operation.Remark = _opration.Remark;
                    _Operation.OprationRole = _opration.OprationRole;
                    _Operation.OprationGrade = _opration.OprationGrade;
                    _Operation.PartName = _opration.PartName;

                    _ORepository.Insert(_Operation);

                    GenaricRepository<TempOpration> _tOpration = new GenaricRepository<TempOpration>(new ItrackContext());
                    TempOpration t = new TempOpration();
                    t.TempOprationID = _opration.TempOprationID;
                   _tOpration.Delete(t);
                  

                }
            }
            catch(Exception ex){
                Debug.WriteLine(ex.Message);
            }
        }
예제 #2
0
        private void Remove(int id)
        {
            try {
                GenaricRepository<CuttingItem> _CuttingItemRepository = new GenaricRepository<CuttingItem>(new ItrackContext());
             
                _cuttingItem.CuttingItemID = id;
                _CuttingItemRepository.Delete(_cuttingItem);
            }
            catch(Exception ex){

                Debug.WriteLine(ex.Message);
            }
        }
예제 #3
0
        void saveOparation() {
            try {

                GenaricRepository<DividingPlanHeader> _dHeaderRepo = new GenaricRepository<DividingPlanHeader>(new ItrackContext());
                DividingPlanHeader dHeader = new DividingPlanHeader();
                dHeader.LineNo = txtLineNo.Text;
                dHeader.ProductionPerHour =Convert.ToInt16( txtProductionPerHour.Text);
                dHeader.StyleID = txtStyleNo.Text;
                dHeader.TotalEmployee =Convert.ToInt16( txtTotalEmployee.Text);
                dHeader.Target =Convert.ToInt16(txtTarget.Text);

                _dHeaderRepo.Add(dHeader);

                dHeader.DividingPlanheaderID = _dHeaderRepo.GetAll().ToList().Last().DividingPlanheaderID;
                
                
                
                for (int i = 0; i < gridView3.RowCount; i++)
                {
                   
                    GenaricRepository<DividingPlanItem> _dItemRepo = new GenaricRepository<DividingPlanItem>(new ItrackContext());
                    
                    DividingPlanItem dItem = new DividingPlanItem();
                   
                    dItem.OprationNo = gridView3.GetRowCellValue(i, "OprationNo").ToString();
                    dItem.OprationName = gridView3.GetRowCellValue(i, "OprationName").ToString();
                    dItem.SMVType = gridView3.GetRowCellValue(i, "SMVType").ToString();
                    dItem.MachineType = gridView3.GetRowCellValue(i, "MachineType").ToString();
                    dItem.SMV =Convert.ToDouble( gridView3.GetRowCellValue(i, "SMV").ToString());
                    dItem.DividingPlanHeaderID = dHeader.DividingPlanheaderID;
                    dItem.PartName = gridView3.GetRowCellValue(i, "PartName").ToString();
                    
                    string status = gridView3.GetRowCellValue(i, "Selected").ToString();
                    GenaricRepository<DividingPlanTemp> _dItemTempRepo = new GenaricRepository<DividingPlanTemp>(new ItrackContext());
                    DividingPlanTemp dTemp = new DividingPlanTemp();
                    dTemp.DividingPlanTempID = Convert.ToInt16(gridView3.GetRowCellValue(i, "DividingPlanTempID").ToString());
                    if (status == "True")
                    {
                        _dItemRepo.Insert(dItem);
                        _dItemTempRepo.Delete(dTemp);
                    }
                    else { 
                        
                    }

                    
                }
            }
            catch(Exception ex){
                Debug.WriteLine(ex.Message);
            }
        }