Esempio n. 1
0
        public SigmaResultType ImportEquipmentLib(string filePath, string exportfilepath)
        {
            EquipmentMgr equipmentMgr = new EquipmentMgr();
            SigmaCodeMgr sigmaCodeMgr = new SigmaCodeMgr();
            SigmaResultType sigmaResult = new SigmaResultType();
            TypeEquipment typeEquipment = new TypeEquipment();
            DataLoaderEquipmentLib loader = new DataLoaderEquipmentLib();

            DataTable Exceldt = Element.Shared.Common.ImportHelper.ImportWorkSheet(filePath, true);
            DataTable ErrDataTable = SetErrTable(Exceldt);

            int failCount = 0;
            int rowCount = Exceldt.Rows.Count;
            int columnCount = Exceldt.Columns.Count;

            if (rowCount > 0)
            {
                loader = MTOImportHelper.GetDataLoaderEquipmentLib(Exceldt);

                string parentCodeCategory = "EQUIP%";
                string categoryName = "ALL";
                string codeCategory = "EQUIP_%";

                DataSet SigmaCodeCategoryDS = sigmaCodeMgr.ListSigmaCodeCategoryByParentCodeCategory(parentCodeCategory, categoryName);
                DataSet SigmaCodeDS = sigmaCodeMgr.ListSigmaCodeForEquipment(codeCategory);

                foreach (DataRow row in Exceldt.Rows)
                {
                    bool isValidation = true;

                    #region Mandatory Check (*)

                    for (int i = 0; i < columnCount; i++)
                    {
                        if (Exceldt.Columns[i].ToString().Substring(0, 1).ToUpper() == "*" && string.IsNullOrEmpty(row.ItemArray.GetValue(i).ToString()))
                        {
                            ErrDataTable.Rows.Add(row.ItemArray);
                            ErrDataTable.Rows[ErrDataTable.Rows.Count - 1]["Fail Reason"] = "The value of [" + Exceldt.Columns[i].ToString() + "] is required.";
                            failCount = failCount + 1;
                            isValidation = false;
                            break;
                        }
                    }

                    #endregion Mandatory Check

                    #region Reference Check (SigmaCodeCategory Table)

                    DataRow EquipmentCodeMain = null;
                    DataRow EquipmentCodeSub = null;
                    DataRow ThirdLevel = null;
                    if (isValidation)
                    {
                        EquipmentCodeMain = SigmaCodeCategoryDS.Tables[0].Select("CategoryName = '" + row[loader.Ord_EquipCodeMain] + "'").FirstOrDefault();
                        if (EquipmentCodeMain == null)
                        {
                            ErrDataTable.Rows.Add(row.ItemArray);
                            ErrDataTable.Rows[ErrDataTable.Rows.Count - 1]["Fail Reason"] = "There is no item in the library to match up with the value of [" + row[loader.Ord_EquipCodeMain].ToString() + "]";
                            failCount = failCount + 1;
                            isValidation = false;
                        }
                    }
                    if (isValidation)
                    {
                        EquipmentCodeSub = SigmaCodeCategoryDS.Tables[0].Select("ParentCodeCategory = '" + EquipmentCodeMain["CodeCategory"] + "' AND CategoryName = '" + row[loader.Ord_EquipCodeSub] + "'").FirstOrDefault();
                        if (EquipmentCodeSub == null)
                        {
                            ErrDataTable.Rows.Add(row.ItemArray);
                            ErrDataTable.Rows[ErrDataTable.Rows.Count - 1]["Fail Reason"] = "There is no item in the library to match up with the value of [" + row[loader.Ord_EquipCodeSub].ToString() + "]";
                            failCount = failCount + 1;
                            isValidation = false;
                        }
                    }
                    if (isValidation && !string.IsNullOrEmpty(row[loader.Ord_ThirdLevel].ToString()))
                    {
                        ThirdLevel = SigmaCodeDS.Tables[0].Select("CodeCategory = '" + EquipmentCodeSub["CodeCategory"] + "' AND CodeName = '" + row[loader.Ord_ThirdLevel] + "'").FirstOrDefault();
                        if (ThirdLevel == null)
                        {
                            ErrDataTable.Rows.Add(row.ItemArray);
                            ErrDataTable.Rows[ErrDataTable.Rows.Count - 1]["Fail Reason"] = "There is no item in the library to match up with the value of [" + row[loader.Ord_ThirdLevel].ToString() + "]";
                            failCount = failCount + 1;
                            isValidation = false;
                        }
                    }

                    #endregion Reference Check

                    #region Duplication Check

                    if (isValidation)
                    {
                        string equipmentCodeMain = row[loader.Ord_EquipCodeMain].ToString();
                        string equipmentCodeSub = row[loader.Ord_EquipCodeSub].ToString();
                        string thirdLevel = row[loader.Ord_ThirdLevel].ToString();
                        string spec = row[loader.Ord_Spec].ToString().Replace("'", "’");
                        string equipmentType = row[loader.Ord_EquipmentType].ToString();

                        DataSet EquipmentDS = equipmentMgr.ListMaterialByEquipmentCodeMain(equipmentCodeMain, equipmentCodeSub, thirdLevel, spec, equipmentType);

                        if (EquipmentDS.Tables[0].Rows.Count > 0)
                        {
                            ErrDataTable.Rows.Add(row.ItemArray);
                            ErrDataTable.Rows[ErrDataTable.Rows.Count - 1]["Fail Reason"] = "This data[Equipment] is duplicated.";
                            failCount = failCount + 1;
                            isValidation = false;
                        }
                    }

                    #endregion Duplication Check

                    #region AddEquipment

                    if (isValidation)
                    {
                        typeEquipment.EquipmentCodeMain = EquipmentCodeMain["CodeCategory"].ToString();
                        typeEquipment.EquipmentCodeSub = EquipmentCodeSub["CodeCategory"].ToString();
                        typeEquipment.ThirdLevel = (ThirdLevel == null) ? "" :ThirdLevel["Code"].ToString().Trim() ;
                        typeEquipment.Spec = row[loader.Ord_Spec].ToString().Replace("'", "’");
                        typeEquipment.EquipmentType = row[loader.Ord_EquipmentType].ToString();
                        typeEquipment.ModelNumber = row[loader.Ord_ModelNumber].ToString();
                        typeEquipment.Description = row[loader.Ord_Description].ToString();
                        typeEquipment.CreatedBy = userinfo.SigmaUserId;

                        sigmaResult = equipmentMgr.AddEquipment(typeEquipment);

                        if (sigmaResult.IsSuccessful)
                        {
                            // CustomField
                            for (int i = 0; i < columnCount; i++)
                            {
                                if (Exceldt.Columns[i].ToString().Substring(0, 3).ToUpper() == "UD_")
                                {
                                    string RowValue = row.ItemArray.GetValue(i).ToString();
                                    sigmaResult.IsSuccessful = CheckEquipmentCustomField(Exceldt, Exceldt.Columns[i].ToString().Trim(), sigmaResult.ScalarValue, RowValue);
                                }
                            }
                        }
                    }

                    #endregion AddEquipment

                }

                // Set ImportHistory(SuccessCount/FailCount)
                sigmaResult = AddImportHistory(Exceldt.Rows.Count, failCount, Path.GetFileName(filePath).ToString(), "EquipmentLibrary");

                // ConvertExcel file && CSV file
                Export2Excel.ConvertExcelfromData(ErrDataTable, sigmaResult.ScalarValue.ToString() + ".xlsx", exportfilepath);
                Export2Excel.ConvertCSVFile(ErrDataTable, sigmaResult.ScalarValue.ToString() + ".csv", exportfilepath);

                sigmaResult.IsSuccessful = true;
            }
            else
            {
                sigmaResult.IsSuccessful = false;
                sigmaResult.ErrorMessage = "no record from file.";
            }

            return sigmaResult;
        }
Esempio n. 2
0
        public SigmaResultType ImportMeterialLib(string filePath, string exportfilepath)
        {
            MaterialMgr materialMgr = new MaterialMgr();
            CostCodeMgr costCodeMgr = new CostCodeMgr();
            SigmaCodeMgr sigmaCodeMgr = new SigmaCodeMgr();
            TaskCategoryMgr taskCategoryMgr = new TaskCategoryMgr();
            SigmaResultType sigmaResult = new SigmaResultType();
            TypeMaterial typeMaterial = new TypeMaterial();

            DataLoaderMaterialLib loader = new DataLoaderMaterialLib();

            DataTable Exceldt = Element.Shared.Common.ImportHelper.ImportWorkSheet(filePath, true);
            DataTable ErrDataTable = SetErrTable(Exceldt);

            int failCount = 0;
            int rowCount = Exceldt.Rows.Count;
            int columnCount = Exceldt.Columns.Count;

            if (rowCount > 0)
            {
                loader = MTOImportHelper.GetDataLoaderMaterialLib(Exceldt);

                string codeName = "ALL";
                string codeCategoryUOM = "UOM";
                string codeCategoryDiscipline = "DISCIPLINE";

                DataSet CostCodeDS = costCodeMgr.ListCostCodeForMaterial();
                DataSet SigmaCodeDisciplineDS = sigmaCodeMgr.ListSigmaCodeByCodeCategory(codeName, codeCategoryDiscipline);
                DataSet SigmaCodeUOMDS = sigmaCodeMgr.ListSigmaCodeByCodeCategory(codeName, codeCategoryUOM);
                DataRow DisciplineCode = SigmaCodeDisciplineDS.Tables[0].Select("CodeName = '" + Exceldt.Rows[0][loader.Ord_Disicipline] + "'").FirstOrDefault();
                DataSet TaskCategoryDS = taskCategoryMgr.ListTaskCategoryByDisciplineCode(DisciplineCode[0].ToString());
                DataSet TaskTypeDS = taskCategoryMgr.ListTaskTypeByDisciplineCode(DisciplineCode[0].ToString());

                foreach (DataRow row in Exceldt.Rows)
                {
                    bool isValidation = true;

                    #region Mandatory Check (*)

                    for (int i = 0; i < columnCount; i++)
                    {
                        if (Exceldt.Columns[i].ToString().Substring(0, 1).ToUpper() == "*" && string.IsNullOrEmpty(row.ItemArray.GetValue(i).ToString()))
                        {
                            ErrDataTable.Rows.Add(row.ItemArray);
                            ErrDataTable.Rows[ErrDataTable.Rows.Count - 1]["Fail Reason"] = "The value of [" + Exceldt.Columns[i].ToString() + "] is required.";
                            failCount = failCount + 1;
                            isValidation = false;
                            break;
                        }
                    }

                    #endregion Mandatory Check

                    #region Reference Check (SigmaCode Table)

                    DataRow Discipline = null;
                    if (isValidation)
                    {
                        Discipline = SigmaCodeDisciplineDS.Tables[0].Select("CodeName = '" + row[loader.Ord_Disicipline] + "'").FirstOrDefault();
                        if (Discipline == null)
                        {
                            ErrDataTable.Rows.Add(row.ItemArray);
                            ErrDataTable.Rows[ErrDataTable.Rows.Count - 1]["Fail Reason"] = "There is no item in the library to match up with the value of [" + row[loader.Ord_Disicipline].ToString() + "]";
                            failCount = failCount + 1;
                            isValidation = false;
                        }
                    }

                    DataRow TaskCategory = null;
                    if (isValidation)
                    {
                        TaskCategory = TaskCategoryDS.Tables[0].Select("TaskCategoryName = '" + row[loader.Ord_TaskCategory] + "'").FirstOrDefault();
                        if (TaskCategory == null)
                        {
                            ErrDataTable.Rows.Add(row.ItemArray);
                            ErrDataTable.Rows[ErrDataTable.Rows.Count - 1]["Fail Reason"] = "There is no item in the library to match up with the value of [" + row[loader.Ord_TaskCategory].ToString() + "]";
                            failCount = failCount + 1;
                            isValidation = false;
                        }
                    }

                    DataRow TaskType = null;
                    if (isValidation)
                    {
                        TaskType = TaskTypeDS.Tables[0].Select("TaskTypeName = '" + row[loader.Ord_TaskType] + "'").FirstOrDefault();
                        if (TaskType == null)
                        {
                            ErrDataTable.Rows.Add(row.ItemArray);
                            ErrDataTable.Rows[ErrDataTable.Rows.Count - 1]["Fail Reason"] = "There is no item in the library to match up with the value of [" + row[loader.Ord_TaskType].ToString() + "]";
                            failCount = failCount + 1;
                            isValidation = false;
                        }
                    }

                    DataRow UOM = null;
                    if (isValidation)
                    {
                        UOM = SigmaCodeUOMDS.Tables[0].Select("CodeShortName = '" + row[loader.Ord_UOM] + "' OR CodeName = '" + row[loader.Ord_UOM] + "'").FirstOrDefault();
                        if (UOM == null)
                        {
                            ErrDataTable.Rows.Add(row.ItemArray);
                            ErrDataTable.Rows[ErrDataTable.Rows.Count - 1]["Fail Reason"] = "There is no item in the library to match up with the value of [" + row[loader.Ord_UOM].ToString() + "]";
                            failCount = failCount + 1;
                            isValidation = false;
                        }
                    }

                    DataRow CostCode = null;
                    if (isValidation && !string.IsNullOrEmpty(row[loader.Ord_CostCode].ToString()))
                    {
                        CostCode = CostCodeDS.Tables[0].Select("CostCode = '" + row[loader.Ord_CostCode] + "'").FirstOrDefault();
                        if (CostCode == null)
                        {
                            ErrDataTable.Rows.Add(row.ItemArray);
                            ErrDataTable.Rows[ErrDataTable.Rows.Count - 1]["Fail Reason"] = "There is no item in the library to match up with the value of [" + row[loader.Ord_CostCode].ToString() + "]";
                            failCount = failCount + 1;
                            isValidation = false;
                        }
                    }

                    #endregion Reference Check

                    #region Duplication Check

                    if (isValidation)
                    {
                        string disciplineCode = Discipline["Code"].ToString().Trim();
                        string taskCategoryId = TaskCategory["TaskCategoryId"].ToString();
                        string taskTypeId = TaskType["TaskTypeId"].ToString();
                        string uomCode = UOM["Code"].ToString().Trim();
                        string description = row[loader.Ord_MaterialDescription] == null ? "" : row[loader.Ord_MaterialDescription].ToString();

                        DataSet MaterialDS = materialMgr.ListMaterialByDisciplineTaskCategory(disciplineCode, taskCategoryId, taskTypeId, description, uomCode);

                        if (MaterialDS.Tables[0].Rows.Count > 0)
                        {
                            ErrDataTable.Rows.Add(row.ItemArray);
                            ErrDataTable.Rows[ErrDataTable.Rows.Count - 1]["Fail Reason"] = "This data[Materail] is duplicated.";
                            failCount = failCount + 1;
                            isValidation = false;
                        }
                    }

                    #endregion Duplication Check

                    #region AddMaterial

                    if (isValidation)
                    {
                        typeMaterial.DisciplineCode = Discipline["Code"].ToString().Trim();
                        typeMaterial.TaskCategoryId = Utilities.ToInt32(TaskCategory["TaskCategoryId"].ToString().Trim());
                        typeMaterial.TaskTypeId = Utilities.ToInt32(TaskType["TaskTypeId"].ToString().Trim());
                        typeMaterial.Manhours = Utilities.ToDecimal(row[loader.Ord_ManHour].ToString().Trim());
                        typeMaterial.UomCode = UOM["Code"].ToString().Trim();
                        typeMaterial.Vendor = row[loader.Ord_Vendor].ToString();
                        typeMaterial.Description = row[loader.Ord_MaterialDescription].ToString().Trim();
                        typeMaterial.PartNumber = row[loader.Ord_PartNumber].ToString().Trim();
                        typeMaterial.CostCodeId = (CostCode == null) ? 0 : Utilities.ToInt32(CostCode["CostCodeId"].ToString().Trim());
                        typeMaterial.CreatedBy = userinfo.SigmaUserId;

                        sigmaResult = materialMgr.AddMaterial(typeMaterial);

                        if (sigmaResult.IsSuccessful)
                        {
                            // CustomField
                            for (int i = 0; i < columnCount; i++)
                            {
                                if (Exceldt.Columns[i].ToString().Substring(0, 3).ToUpper() == "UD_")
                                {
                                    string RowValue = row.ItemArray.GetValue(i).ToString();
                                    if (!string.IsNullOrEmpty(RowValue))
                                    {
                                        sigmaResult.IsSuccessful = CheckMaterialCustomField(Exceldt, Exceldt.Columns[i].ToString().Trim(), sigmaResult.ScalarValue, RowValue);
                                    }
                                }
                            }
                        }
                    }

                    #endregion AddMaterial

                }

                // Set ImportHistory(SuccessCount/FailCount)
                sigmaResult = AddImportHistory(Exceldt.Rows.Count, failCount, Path.GetFileName(filePath).ToString(), "MaterialLibrary");

                // ConvertExcel file && CSV file
                Export2Excel.ConvertExcelfromData(ErrDataTable, sigmaResult.ScalarValue.ToString() + ".xlsx", exportfilepath);
                Export2Excel.ConvertCSVFile(ErrDataTable, sigmaResult.ScalarValue.ToString() + ".csv", exportfilepath);

                sigmaResult.IsSuccessful = true;
            }
            else
            {
                sigmaResult.IsSuccessful = false;
                sigmaResult.ErrorMessage = "no record from file.";
            }

            return sigmaResult;
        }
 public SigmaResultType GetSigmaCode(string code, string codeCategory)
 {
     SigmaResultType result = new SigmaResultType();
     try
     {
         SigmaCodeMgr sigmaCodeMgr = new SigmaCodeMgr();
         result = sigmaCodeMgr.GetSigmaCode(code ,codeCategory);
         return result;
     }
     catch (Exception ex)
     {
         // Log Exception
         ExceptionHelper.logException(ex);
         result.IsSuccessful = false;
         result.ErrorMessage = ex.Message;
         return result;
     }
 }
Esempio n. 4
0
        public SigmaResultType ImportDrawingTypeLib(string filePath, string exportfilepath)
        {
            SigmaCodeMgr sigmaCodeMgr = new SigmaCodeMgr();
            CommonCodeMgr commonCodeMgr = new CommonCodeMgr();
            SigmaResultType sigmaResult = new SigmaResultType();
            TypeSigmaCode typeSigmaCode = new TypeSigmaCode();

            DataLoaderDrawingType loader = new DataLoaderDrawingType();

            DataTable Exceldt = Element.Shared.Common.ImportHelper.ImportWorkSheet(filePath, true);
            DataTable ErrDataTable = SetErrTable(Exceldt);

            int failCount = 0;
            int rowCount = Exceldt.Rows.Count;
            int columnCount = Exceldt.Columns.Count;

            if (rowCount > 0)
            {
                loader = MTOImportHelper.GetDataLoaderDrawingType(Exceldt);

                string codeCategory = "DRAWING_TYPE";

                foreach (DataRow row in Exceldt.Rows)
                {
                    bool isValidation = true;

                    #region Mandatory Check (*)

                    for (int i = 0; i < columnCount; i++)
                    {
                        if (Exceldt.Columns[i].ToString().Substring(0, 1).ToUpper() == "*" && string.IsNullOrEmpty(row.ItemArray.GetValue(i).ToString()))
                        {
                            ErrDataTable.Rows.Add(row.ItemArray);
                            ErrDataTable.Rows[ErrDataTable.Rows.Count - 1]["Fail Reason"] = "The value of [" + Exceldt.Columns[i].ToString() + "] is required.";
                            failCount = failCount + 1;
                            isValidation = false;
                            break;
                        }
                    }

                    #endregion Mandatory Check

                    #region Reference Check (SigmaCode Table)

                    //DataRow DrawingType = null;
                    //if (isValidation)
                    //{
                    //    DrawingType = SigmaCodeDT.Select("CodeName = '" + row[loader.Ord_DrawingType] + "'").FirstOrDefault();
                    //    if (DrawingType == null)
                    //    {
                    //        ErrDataTable.Rows.Add(row.ItemArray);
                    //        ErrDataTable.Rows[ErrDataTable.Rows.Count - 1]["Fail Reason"] = "There is no item in the library to match up with the value of [" + row[loader.Ord_DrawingType].ToString() + "]";
                    //        failCount = failCount + 1;
                    //        isValidation = false;
                    //    }
                    //}

                    #endregion Reference Check

                    #region Duplication Check

                    if (isValidation)
                    {
                        string codeName = row[loader.Ord_DrawingType].ToString();

                        DataSet SigmaCodeDS = sigmaCodeMgr.ListSigmaCodeByCodeCategory(codeName, codeCategory);

                        if (SigmaCodeDS.Tables[0].Rows.Count > 0)
                        {
                            ErrDataTable.Rows.Add(row.ItemArray);
                            ErrDataTable.Rows[ErrDataTable.Rows.Count - 1]["Fail Reason"] = "This data[Drawing Type] is duplicated.";
                            failCount = failCount + 1;
                            isValidation = false;
                        }
                    }

                    #endregion Duplication Check

                    #region AddSigmaCode

                    if (isValidation)
                    {
                        typeSigmaCode.Code = "";
                        typeSigmaCode.CodeCategory = codeCategory;
                        typeSigmaCode.CodeName = row[loader.Ord_DrawingType].ToString().Trim();
                        typeSigmaCode.CodeShortName = row[loader.Ord_DrawingType].ToString().Trim();
                        typeSigmaCode.RefChar = "";
                        typeSigmaCode.RefNo = "";
                        typeSigmaCode.Description = row[loader.Ord_Description].ToString();
                        typeSigmaCode.IsActive = "Y";
                        typeSigmaCode.SortOrder = "";
                        typeSigmaCode.SigmaOperation = "C";
                        typeSigmaCode.CreatedBy = userinfo.SigmaUserId;

                        sigmaResult = sigmaCodeMgr.AddSigmaCode(typeSigmaCode);
                    }

                    #endregion AddSigmaCode

                }

                // Set ImportHistory(SuccessCount/FailCount)
                sigmaResult = AddImportHistory(Exceldt.Rows.Count, failCount, Path.GetFileName(filePath).ToString(), "DrawingType");

                // ConvertExcel file && CSV file
                Export2Excel.ConvertExcelfromData(ErrDataTable, sigmaResult.ScalarValue.ToString() + ".xlsx", exportfilepath);
                Export2Excel.ConvertCSVFile(ErrDataTable, sigmaResult.ScalarValue.ToString() + ".csv", exportfilepath);

                sigmaResult.IsSuccessful = true;
            }
            else
            {
                sigmaResult.IsSuccessful = false;
                sigmaResult.ErrorMessage = "no record from file.";
            }

            return sigmaResult;
        }
 public SigmaResultType AddSigmaCodeCategory(TypeSigmaCodeCategory objSigmaCodeCategory)
 {
     SigmaResultType result = new SigmaResultType();
     try
     {
         SigmaCodeMgr sigmaCodeMgr = new SigmaCodeMgr();
         result = sigmaCodeMgr.AddSigmaCodeCategory(objSigmaCodeCategory);
         return result;
     }
     catch (Exception ex)
     {
         // Log Exception
         ExceptionHelper.logException(ex);
         result.IsSuccessful = false;
         result.ErrorMessage = ex.Message;
         return result;
     }
 }
        public SigmaResultType RemoveSigmaCode(TypeSigmaCode objSigmaCode)
        {
            SigmaResultType result = new SigmaResultType();

            try
            {
                SigmaCodeMgr sigmaCodeMgr = new SigmaCodeMgr();
                result = sigmaCodeMgr.RemoveSigmaCode(objSigmaCode);
                return result;
            }
            catch (Exception ex)
            {
                // Log Exception
                ExceptionHelper.logException(ex);
                result.IsSuccessful = false;
                result.ErrorMessage = ex.Message;
                return result;
            }
        }
        public SigmaResultType MultiSigmaCodeCategory(List<TypeSigmaCodeCategory> listObj)
        {
            SigmaResultType result = new SigmaResultType();

            try
            {
                SigmaCodeMgr sigmaCodeMgr = new SigmaCodeMgr();
                result = sigmaCodeMgr.MultiSigmaCodeCategory(listObj);
                return result;
            }
            catch (Exception ex)
            {
                // Log Exception
                ExceptionHelper.logException(ex);
                result.IsSuccessful = false;
                result.ErrorMessage = ex.Message;
                return result;
            }
        }
        public SigmaResultType ListSigmaCodeCategory()
        {
            SigmaResultType result = new SigmaResultType();
            try
            {
                var queryStr = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters;
                string max = queryStr["max"];
                string offset = queryStr["offset"];
                string s_option = queryStr["s_option"];
                string s_key = queryStr["s_key"];
                string o_option = queryStr["o_option"];
                string o_desc = queryStr["o_desc"];

                SigmaCodeMgr sigmaCodeMgr = new SigmaCodeMgr();
                result = sigmaCodeMgr.ListSigmaCodeCategory(offset, max, s_option, s_key, o_option, o_desc);
                return result;
            }
            catch (Exception ex)
            {
                // Log Exception
                ExceptionHelper.logException(ex);
                result.IsSuccessful = false;
                result.ErrorMessage = ex.Message;
                return result;
            }
        }
        public SigmaResultType ListSigmaCode()
        {
            SigmaResultType result = new SigmaResultType();
            try
            {
                var queryStr = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters;

                SigmaCodeMgr sigmaCodeMgr = new SigmaCodeMgr();
                result = sigmaCodeMgr.ListSigmaCode(WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters);
                return result;
            }
            catch (Exception ex)
            {
                // Log Exception
                ExceptionHelper.logException(ex);
                result.IsSuccessful = false;
                result.ErrorMessage = ex.Message;
                return result;
            }
        }