Ejemplo n.º 1
0
        public SigmaResultType AddCustomFieldWithEquipmentCustomField(TypeCustomField objCustomField)
        {
            TypeUserInfo userinfo = AuthMgr.GetUserInfo();

            TransactionScope scope = null;
            SigmaResultType result = new SigmaResultType();
            SigmaResultType customField = new SigmaResultType();
            SigmaResultType EquipmentCustomField = new SigmaResultType();
            TypeEquipmentCustomField typeEquipmentCustomField = new TypeEquipmentCustomField();

            typeEquipmentCustomField.EquipmentId = objCustomField.Parentid;
            typeEquipmentCustomField.Value = objCustomField.Value;
            typeEquipmentCustomField.CreatedBy = userinfo.SigmaUserId;
            typeEquipmentCustomField.UpdatedBy = userinfo.SigmaUserId;

            using (scope = new TransactionScope(TransactionScopeOption.Required))
            {
                CustomFieldMgr custom = new CustomFieldMgr();

                customField = custom.AddCustomField(objCustomField);
                typeEquipmentCustomField.CustomFieldId = customField.ScalarValue;
                EquipmentCustomField = AddEquipmentCustomField(typeEquipmentCustomField);

                scope.Complete();
            }

            return result;
        }
Ejemplo n.º 2
0
        private bool CheckEquipmentCustomField(DataTable Exceldt, string ColName, int EquipmentId, string CustomFieldValue)
        {
            CommonCodeMgr common = new CommonCodeMgr();
            CustomFieldMgr customFieldMgr = new CustomFieldMgr();
            EquipmentMgr equipmentMgr = new EquipmentMgr();
            MaterialCustomFieldMgr materialCustomFieldMgr = new MaterialCustomFieldMgr();

            TypeCustomField customField = new TypeCustomField();
            TypeEquipmentCustomField equipmentCustomField = new TypeEquipmentCustomField();

            SigmaResultType mResult = new SigmaResultType();
            SigmaResultType cResult = new SigmaResultType();

            DataSet CustomFiledSD = materialCustomFieldMgr.ListMaterialCustomFieldByFieldName(ColName);
            DataRow CustomFiledSR = CustomFiledSD.Tables[0].Rows[0];

            if (CustomFiledSD.Tables[0].Rows.Count > 0)
            {
                equipmentCustomField.EquipmentId = EquipmentId;
                equipmentCustomField.CustomFieldId = Convert.ToInt32(CustomFiledSR["CustomFieldId"].ToString());
                equipmentCustomField.Value = CustomFieldValue;
                equipmentCustomField.CreatedBy = userinfo.SigmaUserId;

                mResult = equipmentMgr.AddEquipmentCustomField(equipmentCustomField);
            }
            else
            {
                customField.FieldName = ColName;
                customField.IsDisplayable = "Y";
                customField.CreatedBy = userinfo.SigmaUserId;

                cResult = customFieldMgr.AddCustomField(customField);

                if (cResult.IsSuccessful)
                {
                    equipmentCustomField.EquipmentId = EquipmentId;
                    equipmentCustomField.CustomFieldId = cResult.ScalarValue;
                    equipmentCustomField.Value = CustomFieldValue;
                    equipmentCustomField.CreatedBy = userinfo.SigmaUserId;

                    mResult = equipmentMgr.AddEquipmentCustomField(equipmentCustomField);
                }
            }

            return mResult.IsSuccessful;
        }
Ejemplo n.º 3
0
        private bool CheckMaterialCustomField(DataTable Exceldt, string ColName, int MaterialId, string CustomFieldValue)
        {
            CommonCodeMgr common = new CommonCodeMgr();
            CustomFieldMgr customFieldMgr = new CustomFieldMgr();
            MaterialMgr materialMgr = new MaterialMgr();
            MaterialCustomFieldMgr materialCustomFieldMgr = new MaterialCustomFieldMgr();

            TypeCustomField customField = new TypeCustomField();
            TypeMaterialCustomField materialCustomField = new TypeMaterialCustomField();

            SigmaResultType mResult = new SigmaResultType();
            SigmaResultType cResult = new SigmaResultType();

            DataSet CustomFiledSD = materialCustomFieldMgr.ListMaterialCustomFieldByFieldName(ColName);

            if (CustomFiledSD.Tables[0].Rows.Count > 0)  // CustomField Table 동일 FieldName이 있으면 MaterialCustomField Table 입력
            {
                DataRow CustomFiledSR = CustomFiledSD.Tables[0].Rows[0];
                materialCustomField.MaterialId = MaterialId;
                materialCustomField.CustomFieldId = Convert.ToInt32(CustomFiledSR["CustomFieldId"].ToString());
                materialCustomField.Value = CustomFieldValue;
                materialCustomField.CreatedBy = userinfo.SigmaUserId;

                mResult = materialMgr.AddMaterialCustomField(materialCustomField);
            }
            else // CustomField Table & MaterialCustomField Table 에 입력
            {
                customField.FieldName = ColName;
                customField.IsDisplayable = "Y";
                customField.CreatedBy = userinfo.SigmaUserId;

                cResult = customFieldMgr.AddCustomField(customField);

                if (cResult.IsSuccessful)
                {
                    materialCustomField.MaterialId = MaterialId;
                    materialCustomField.CustomFieldId = cResult.ScalarValue;
                    materialCustomField.Value = CustomFieldValue;
                    materialCustomField.CreatedBy = userinfo.SigmaUserId;

                    mResult = materialMgr.AddMaterialCustomField(materialCustomField);
                }
            }

            return mResult.IsSuccessful;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Excel File 항목중에서 "UD-" 시작하는 이름은 CustomField Table 에서 유무확인후 ComponentCustomField Table에 입력
        /// </summary>
        /// <returns></returns>
        private bool CheckCustomField(DataTable Exceldt, string ColName, int ComponentId, string CustomFieldValue)
        {
            bool bResult = false;
            CommonCodeMgr common = new CommonCodeMgr();
            TypeCustomField Typecf = new TypeCustomField();
            CustomFieldMgr CustFieldMgr = new CustomFieldMgr();
            TypeComponentCustomField Typeccf = new TypeComponentCustomField();
            ComponentCustomFieldMgr ccfMgr = new ComponentCustomFieldMgr();

            string CustomFieldWhere = string.Empty;
            DataRow[] cfRow = null;

            CustomFieldWhere = "WHERE FieldName like '" + ColName + "'";
            cfRow = common.GetCommonCode("CustomFieldId, FieldName", "CustomField", CustomFieldWhere).Select();

            if (cfRow.Length > 0)//CustomField Table에 있으면 ComponentCustomField Table에만 입력
            {
                Typeccf.ComponentId = ComponentId;
                Typeccf.CustomFieldId = Convert.ToInt32(cfRow[0][0]);
                Typeccf.Value = CustomFieldValue;
                Typeccf.CreatedBy = userinfo.SigmaUserId;
                bResult = ccfMgr.AddComponentCustomField(Typeccf).IsSuccessful;

            }
            else //CustomField Table & ComponentCustomField Table 에 입력
            {
                Typecf.FieldType = "STRING";
                Typecf.FieldName = ColName;
                Typecf.IsDisplayable = "Y";
                Typecf.CreatedBy = userinfo.SigmaUserId;

                bResult = CustFieldMgr.AddCustomField(Typecf).IsSuccessful;

                if (bResult == true)
                {
                    int CustomFieldId = Convert.ToInt32(CustFieldMgr.AddCustomField(Typecf).ScalarValue.ToString());

                    Typeccf.ComponentId = ComponentId;
                    Typeccf.CustomFieldId = CustomFieldId;
                    Typeccf.Value = CustomFieldValue;
                    Typeccf.CreatedBy = userinfo.SigmaUserId;
                    bResult = ccfMgr.AddComponentCustomField(Typeccf).IsSuccessful;
                }

            }

            return bResult;
        }