예제 #1
0
 public Component(string clientID)
 {
     ClientID      = clientID;
     ComponentID   = "";
     TableID       = "";
     PrimaryKeys   = "";
     ck            = new ClientServer(clientID);
     State         = ComponentState.draft;
     dataComponent = new Data.Component.Component(ck.GetServer().Connection());
     Attributes    = new List <ComponentAttribute>();
 }
예제 #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="clientID"></param>
 /// <param name="componentType"></param>
 public Component(string clientID,
                  string name,
                  ComponentType componentType,
                  string title,
                  string titleformat
                  , string category)
 {
     ClientID           = clientID;
     ComponentID        = "";
     TableID            = "";
     PrimaryKeys        = "";
     this.Title         = title;
     this.TitleFormat   = titleformat;
     this.ComponentName = name;
     this.Category      = category;
     this.ComponentType = componentType;
     ck            = new ClientServer(clientID);
     State         = ComponentState.draft;
     dataComponent = new Data.Component.Component(ck.GetServer().Connection());
     Attributes    = new List <ComponentAttribute>();
 }
예제 #3
0
        public static List <Component> GetComponentList(string clientID)
        {
            var ck            = new ClientServer(clientID);
            var dataComponent = new Data.Component.Component(ck.GetServer().Connection());
            var dtFields      = new DataTable();
            var dt            = dataComponent.GetCompnents(clientID);
            var dttable       = dt.DefaultView.ToTable(true,
                                                       "ComponentID",
                                                       "ComponentName",
                                                       "ComponentType",
                                                       "Title",
                                                       "TableID",
                                                       "PrimaryKeys",
                                                       "TitleFormat",
                                                       "Category",
                                                       "IsGlobal"
                                                       );
            var clist = new List <Component>();

            dtFields = dt.DefaultView.ToTable(true, "FieldID",
                                              "AttributeName",
                                              "ComponentID",
                                              "IsRequired",
                                              "IsUnique",
                                              "IsCore",
                                              "IsReadOnly",
                                              "IsSecured",
                                              "IsAuto",
                                              "DefaultValue",
                                              "FileExtension",
                                              "RegExp",
                                              "AttributeType"

                                              );
            foreach (DataRow dr in dttable.Rows)
            {
                var c = new Component(clientID);
                c.ComponentID   = dr.IsNull("ComponentID") ? "" : dr["ComponentID"].ToString();
                c.ComponentName = dr.IsNull("ComponentName") ? "" : dr["ComponentName"].ToString();
                c.ComponentType = dr.IsNull("ComponentType") ? Tz.Core.ComponentType.none : (Tz.Core.ComponentType)dr["ComponentType"];
                c.Title         = dr.IsNull("Title") ? "" : dr["Title"].ToString();
                c.TableID       = dr.IsNull("TableID") ? "" : dr["TableID"].ToString();
                c.PrimaryKeys   = dr.IsNull("PrimaryKeys") ? "" : dr["PrimaryKeys"].ToString();
                c.TitleFormat   = dr.IsNull("TitleFormat") ? "" : dr["TitleFormat"].ToString();
                c.Category      = dr.IsNull("Category") ? "" : dr["Category"].ToString();
                c.IsGlobal      = dr.IsNull("IsGlobal") ? false : Convert.ToBoolean(dr["IsGlobal"]);
                c.State         = dr.IsNull("ComponentState") ? ComponentState.draft  : (ComponentState)(dr["ComponentState"]);

                foreach (DataRow drow in dtFields.Rows)
                {
                    string _fieldid = "";
                    _fieldid = drow.IsNull("FieldID") ? "" : drow["FieldID"].ToString();
                    ComponentAttribute ca = new ComponentAttribute(clientID, c.TableID, _fieldid);
                    ca.AttributeName = drow.IsNull("AttributeName") ? "" : drow["AttributeName"].ToString();
                    // ca.FieldName = drow.IsNull("FieldName") ? "" : drow["FieldName"].ToString();
                    ca.IsRequired    = drow.IsNull("IsRequired") ? false : Convert.ToBoolean(drow["IsRequired"]);
                    ca.IsUnique      = drow.IsNull("IsUnique") ? false : Convert.ToBoolean(drow["IsUnique"]);
                    ca.IsCore        = drow.IsNull("IsCore") ? false : Convert.ToBoolean(drow["IsCore"]);
                    ca.IsReadOnly    = drow.IsNull("IsReadOnly") ? false : Convert.ToBoolean(drow["IsReadOnly"]);
                    ca.IsSecured     = drow.IsNull("IsSecured") ? false : Convert.ToBoolean(drow["IsSecured"]);
                    ca.IsAuto        = drow.IsNull("IsAuto") ? false : Convert.ToBoolean(drow["IsAuto"]);
                    ca.DefaultValue  = drow.IsNull("DefaultValue") ? "" : drow["DefaultValue"].ToString();
                    ca.FileExtension = drow.IsNull("FileExtension") ? "" : drow["FileExtension"].ToString();
                    ca.RegExp        = drow.IsNull("RegExp") ? "" : drow["RegExp"].ToString();
                    ca.LookUpID      = dr.IsNull("LookUpID") ? "" : dr["LookUpID"].ToString();
                    ca.AttributeType = drow.IsNull("AttributeType") ? ComponentAttribute.ComoponentAttributeType._string : (ComponentAttribute.ComoponentAttributeType)drow["AttributeType"];
                    //ca.FieldType = drow.IsNull("FieldType") ? DbType.String : (DbType)drow["FieldType"];
                    ca.Length       = drow.IsNull("length") ? -1 : (int)drow["length"];
                    ca.IsNullable   = drow.IsNull("IsNullable") ? false : (bool)drow["IsNullable"];
                    ca.IsPrimaryKey = drow.IsNull("ISPrimaryKey") ? false : (bool)drow["ISPrimaryKey"];
                    c.Attributes.Add(ca);
                }
                clist.Add(c);
            }
            return(clist);
        }