public SigmaResultType GetMaterialFile(string filePath, string exportFilePath)
        {
            SigmaResultType result = new SigmaResultType();

            try
            {
                ImportMgr materialMgr = new ImportMgr();
                result = materialMgr.ImportMeterialLib(filePath, exportFilePath);
                return result;
            }
            catch (Exception ex)
            {
                // Log Exception
                ExceptionHelper.logException(ex);
                result.IsSuccessful = false;
                result.ErrorMessage = ex.Message;
                return result;
            }
        }
Beispiel #2
0
        public SigmaResultType ImportFile()
        {
            SigmaResultType result = new SigmaResultType();
            try
            {
                var queryStr = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters;
                string fileType = queryStr["filetype"];
                string filePath = queryStr["filepath"];

                //string rootPath = System.Web.Configuration.WebConfigurationManager.AppSettings["DocumentUpload"];
                //string targetPath = System.Web.Configuration.WebConfigurationManager.AppSettings["DocumentFolderRoot"];

                string rootPath = ConfigMgr.GetImportFilePath();

                filePath = rootPath + filePath;

                //fileType = "DrawingImage";

                // ImportFile
                switch (fileType)
                {
                    case "Drawing":
                        //importDrawing importDrawing = new ImportDrawing();
                        ImportDrawingMgr importDrawing = new ImportDrawingMgr();
                        result = importDrawing.AddDrawing(filePath, ConfigMgr.GetExportFilePath());
                        break;
                    case "DrawingImage":
                        //ImportDrawing importDrawingImage = new ImportDrawing();
                        ImportDrawingMgr importDrawingImage = new ImportDrawingMgr();
                        //result = importDrawingImage.AddDrawingImage(filePath, targetPath);
                        result = importDrawingImage.AddDrawingImage(filePath, ConfigMgr.GetTargetPath());
                        break;
                    case "MTO":
                        ImportMgr importMgr = new ImportMgr();
                        result = importMgr.ImportMTOFromExcel(filePath, ConfigMgr.GetExportFilePath());
                        break;
                    case "CostCode":
                        CostCodeMgr costcodeMgr = new CostCodeMgr();
                        result = costcodeMgr.ImportCostCodeFromExcel(filePath, ConfigMgr.GetExportFilePath());
                        break;
                    case "ProjectCostCode":
                        CostCodeMgr projectcostcodeMgr = new CostCodeMgr();
                        result = projectcostcodeMgr.ImportProjectCostCodeFromExcel(filePath, ConfigMgr.GetExportFilePath());
                        break;
                    case "ClientCostCode":
                        CostCodeMgr clientcostcodeMgr = new CostCodeMgr();
                        result = clientcostcodeMgr.ImportClientCostCodeFromExcel(filePath, ConfigMgr.GetExportFilePath());
                        break;
                    case "HR":
                        PersonnelMgr personnelMgr = new PersonnelMgr();
                        result = personnelMgr.ImportPersonnelFromExcel(filePath, ConfigMgr.GetExportFilePath());
                        break;
                    case "User":
                        SigmaUserMgr sigmauserMgr = new SigmaUserMgr();
                        result = sigmauserMgr.ImportSigmaUserFromExcel(filePath, ConfigMgr.GetExportFilePath());
                        break;
                    case "MeterialLibrary":
                        ImportMgr importMeterial = new ImportMgr();
                        result = importMeterial.ImportMeterialLib(filePath, ConfigMgr.GetExportFilePath());
                        break;
                    case "EquipmentLibrary":
                        ImportMgr importEquipment = new ImportMgr();
                        result = importEquipment.ImportEquipmentLib(filePath, ConfigMgr.GetExportFilePath());
                        break;
                    case "ConsumableLibrary":
                        ImportMgr importConsumable = new ImportMgr();
                        result = importConsumable.ImportConsumableLib(filePath, ConfigMgr.GetExportFilePath());
                        break;
                    case "DrawingType":
                        ImportMgr importDrawingType = new ImportMgr();
                        result = importDrawingType.ImportDrawingTypeLib(filePath, ConfigMgr.GetExportFilePath());
                        break;
                    default:
                        break;
                }
                return result;

            }
            catch (Exception ex)
            {
                // Log Exception
                ExceptionHelper.logException(ex);
                result.IsSuccessful = false;
                result.ErrorMessage = ex.Message;
                return result;
            }
        }
 /// <summary>
 /// Edit MTO : Edit Material Information
 /// </summary>
 /// <param name="objComonent"></param>
 /// <param name="objMaterial"></param>
 /// <returns></returns>
 public SigmaResultType UpdateMTO(TypeComponent objComonent, TypeMaterial objMaterial)
 {
     SigmaResultType sResult = new SigmaResultType();
     ImportMgr UpdateMTO = new ImportMgr();
     return sResult = UpdateMTO.UpdateMTO(objComonent, objMaterial);
 }
 /// <summary>
 /// 2014-02-21 
 /// Import MTO Maunal
 /// </summary>
 /// <param name="objComponent"></param>
 /// <param name="objComponetCustomField"></param>
 /// <param name="objImportHistory"></param>
 /// <param name="objMaterial"></param>
 /// <returns></returns>
 public SigmaResultType SaveMTO(TypeComponent objComponent, TypeMaterial objMaterial)
 {
     SigmaResultType sResult = new SigmaResultType();
     ImportMgr SaveImport = new ImportMgr();
     return sResult = SaveImport.SaveMTO(objComponent, objMaterial);
 }
        /// <summary>
        /// 2014-03-10
        /// Data > MTO > Get Associated Tag Number Combo
        /// </summary>
        /// <param name="DrawingId"></param>
        /// <returns></returns>
        public SigmaResultType GetTagNumberCombo(string DrawingId, string Gubun)
        {
            SigmaResultType Result = new SigmaResultType();

            try
            {
                ImportMgr MTOMgr = new ImportMgr();
                Result = MTOMgr.GetTagNumberCombo(int.Parse(DrawingId), int.Parse(Gubun));
                return Result;
            }
            catch (Exception ex)
            {
                ExceptionHelper.logException(ex);
                Result.IsSuccessful = false;
                Result.ErrorMessage = ex.Message;
                return Result;
            }
        }
        /// <summary>
        /// Get Discipline
        /// </summary>
        /// <param name="CwpName"></param>
        /// <param name="CwpId"></param>
        /// <returns></returns>
        public SigmaResultType GetDiscipline(string CwpName, string CwpId)
        {
            SigmaResultType Result = new SigmaResultType();

            try
            {
                ImportMgr MTOMgr = new ImportMgr();
                Result = MTOMgr.GetDiscipline(CwpName, CwpId);
                return Result;
            }
            catch (Exception ex)
            {
                ExceptionHelper.logException(ex);
                Result.IsSuccessful = false;
                Result.ErrorMessage = ex.Message;
                return Result;
            }
        }
 public SigmaResultType DeleteMTO(List<TypeComponent> listCom)
 {
     SigmaResultType sResult = new SigmaResultType();
     ImportMgr DeleteMTO = new ImportMgr();
     return sResult = DeleteMTO.DeleteMTO(listCom);
 }