Ejemplo n.º 1
0
 public static bool DeleteTableInfo(string tablename, string columnname)
 {
     try
     {
         var q = (from PMSTableFieldInfo in PMSDBStructure.PMSCenterDataContext.s_TableFieldInfo
                  where PMSTableFieldInfo.TableGuid == MESCenterFunctions.fn_GetGuidFromTableName(tablename) &&
                  PMSTableFieldInfo.FieldName == columnname
                  select PMSTableFieldInfo);
         if (q.Count() == 0)
         {
             return(true);
         }
         s_TableFieldInfo info = q.First();
         PMSDBStructure.PMSCenterDataContext.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, info);
         if (info != null)
         {
             PMSDBStructure.PMSCenterDataContext.DeleteObject(info);
             PMSDBStructure.PMSCenterDataContext.SaveChanges();
         }
     }
     catch (System.Exception e)
     {
         PMS.Libraries.ToolControls.PMSPublicInfo.Message.Error(PMS.Libraries.ToolControls.PMSPublicInfo.CurrentPrjInfo.CurrentLoginUserID, e.Message, true);
         return(false);
     }
     return(true);
 }
Ejemplo n.º 2
0
 public static bool UploadTableFieldInfo(s_TableFieldInfo TableFieldInfo)
 {
     try
     {
         PMSDBStructure.PMSCenterDataContext.AddTos_TableFieldInfo(TableFieldInfo);
         PMSDBStructure.PMSCenterDataContext.SaveChanges();
     }
     catch (System.Exception e)
     {
         PMS.Libraries.ToolControls.PMSPublicInfo.Message.Error(PMS.Libraries.ToolControls.PMSPublicInfo.CurrentPrjInfo.CurrentLoginUserID, e.Message, true);
         return(false);
     }
     return(true);
 }
Ejemplo n.º 3
0
        public static bool UploadTableFieldInfo(PMS.Libraries.ToolControls.PMSPublicInfo.PMSDBFieldPropCollection fpc, Guid tableGuid)
        {
            try
            {
                foreach (PMS.Libraries.ToolControls.PMSPublicInfo.PMSDBFieldProp fp in fpc)
                {
                    s_TableFieldInfo FieldInfo = new s_TableFieldInfo();
                    FieldInfo.FieldGuid        = System.Guid.NewGuid();
                    FieldInfo.TableGuid        = tableGuid;
                    FieldInfo.FieldID          = fp.IFildID;
                    FieldInfo.FieldName        = fp.StrFieldName;
                    FieldInfo.FieldType        = fp.StrFieldType;
                    FieldInfo.FieldLength      = fp.IFieldLength.ToString();
                    FieldInfo.FieldPrimaryKey  = fp.BFieldPrimaryKey;
                    FieldInfo.FieldIdentity    = fp.BFieldIdentity;
                    FieldInfo.FieldNullAble    = fp.BFieldNullable;
                    FieldInfo.FieldIsSystem    = fp.BFieldIsSystem;
                    FieldInfo.FieldDefault     = fp.StrFieldDefault;
                    FieldInfo.FieldDescription = fp.StrFieldDescription;
                    if (fp.ExProps != null)
                    {
                        foreach (KeyValuePair <string, PMSDBExtendedProp> entry in fp.ExProps)
                        {
                            s_TableFieldProperty FieldProperty = new s_TableFieldProperty();
                            FieldProperty.PropertyGuid  = System.Guid.NewGuid();
                            FieldProperty.FieldGuid     = FieldInfo.FieldGuid;
                            FieldProperty.PropertyName  = entry.Value.StrPropName;
                            FieldProperty.PropertyValue = entry.Value.StrPropValue;
                            PMSDBStructure.PMSCenterDataContext.AddTos_TableFieldProperty(FieldProperty);
                        }
                    }

                    PMSDBStructure.PMSCenterDataContext.AddTos_TableFieldInfo(FieldInfo);
                }

                PMSDBStructure.PMSCenterDataContext.SaveChanges();
            }
            catch (System.Exception e)
            {
                PMS.Libraries.ToolControls.PMSPublicInfo.Message.Error(PMS.Libraries.ToolControls.PMSPublicInfo.CurrentPrjInfo.CurrentLoginUserID, e.Message, true);
                return(false);
            }
            return(true);
        }