Пример #1
0
 public void SetStringDataType()
 {
     if (DotNetType == typeof(String))
     {
         if (Globals.IsMatchIdentifier(Globals.Identifier_Url, this))
         {
             DataTypeAttr = System.ComponentModel.DataAnnotations.DataType.Url;
         }
         else if (Globals.IsMatchIdentifier(Globals.Identifier_Email, this))
         {
             DataTypeAttr = System.ComponentModel.DataAnnotations.DataType.EmailAddress;
         }
         else if (Globals.IsMatchIdentifier(Globals.Identifier_File, this) || Globals.IsMatchIdentifier(Globals.Identifier_Image, this) || Globals.IsMatchIdentifier(Globals.Identifier_Photo, this))
         {
             if (Globals.IsMatchIdentifier(Globals.Identifier_Image, this) || Globals.IsMatchIdentifier(Globals.Identifier_Photo, this))
             {
                 this.IsPhoto         = true;
                 ParentTable.HasPhoto = true;
                 ParentTable.PhotosColumns.Add(this);
             }
             else
             {
                 this.IsFile         = true;
                 ParentTable.HasFile = true;
                 ParentTable.FilesColumns.Add(this);
             }
             // add in AllFilesColumns
             ParentTable.AllFilesColumns.Add(this);
             DataTypeAttr = System.ComponentModel.DataAnnotations.DataType.Upload;
         }
         else if (Globals.IsMatchIdentifier(Globals.Identifier_Password, this))
         {
             DataTypeAttr = System.ComponentModel.DataAnnotations.DataType.Password;
         }
         else if (Globals.IsMatchIdentifier(Globals.Identifier_Phone, this))
         {
             DataTypeAttr = System.ComponentModel.DataAnnotations.DataType.PhoneNumber;
         }
         else if (Globals.IsMatchIdentifier(Globals.Identifier_PostalCode, this))
         {
             DataTypeAttr = System.ComponentModel.DataAnnotations.DataType.PostalCode;
         }
         else if (Globals.IsMatchIdentifier(Globals.Identifier_CreditCard, this))
         {
             DataTypeAttr = System.ComponentModel.DataAnnotations.DataType.CreditCard;
         }
         else if (MaxLength > 250)
         {
             DataTypeAttr = System.ComponentModel.DataAnnotations.DataType.MultilineText;
         }
         else
         {
             DataTypeAttr = System.ComponentModel.DataAnnotations.DataType.Text;
         }
         if (Globals.IsMatchIdentifier(Globals.Identifier_Identifier, this))
         {
             IsIdentifier = true;
         }
     }
 }
Пример #2
0
 //-------------------------------------------------------------------
 public EnumInputType SetStringSetInputType()
 {
     if (Globals.IsMatchIdentifier(Globals.Identifier_Url, this))
     {
         return(EnumInputType.url);
     }
     else if (Globals.IsMatchIdentifier(Globals.Identifier_Email, this))
     {
         return(EnumInputType.email);
     }
     else if (Globals.IsMatchIdentifier(Globals.Identifier_File, this) || Globals.IsMatchIdentifier(Globals.Identifier_Image, this) || Globals.IsMatchIdentifier(Globals.Identifier_Photo, this))
     {
         if (Globals.IsMatchIdentifier(Globals.Identifier_Image, this) || Globals.IsMatchIdentifier(Globals.Identifier_Photo, this))
         {
             //file upload that just same name in database and file on server
             return(EnumInputType.UploadedServerPhotoWithThumbnailAndJustNameInDB);
         }
         else
         {
             return(EnumInputType.UploadedServerfileWithJustNameInDB);
         }
     }
     else if (Globals.IsMatchIdentifier(Globals.Identifier_Password, this))
     {
         return(EnumInputType.password);
     }
     else if (Globals.IsMatchIdentifier(Globals.Identifier_Phone, this))
     {
         return(EnumInputType.tel);
     }
     else if (Globals.IsMatchIdentifier(Globals.Identifier_PostalCode, this))
     {
         return(EnumInputType.postalCode);
     }
     else if (Globals.IsMatchIdentifier(Globals.Identifier_CreditCard, this))
     {
         return(EnumInputType.creditCard);
     }
     else if (MaxLength > 250)
     {
         return(EnumInputType.textarea);
     }
     else
     {
         return(EnumInputType.text);
     }
 }
Пример #3
0
        public CustomTable(Table table)
        {
            _dbObject = table;
            _ProgramatlyName = Globals.GetProgramatlyName(NameInDatabase);
            _Columns=new List<CustomColumn>();
            int index = 0;
            CustomColumn temp=null;
            foreach (Column c in _dbObject.Columns)
            {
                temp=new CustomColumn(c, NameInDatabase, _ProgramatlyName);
                _Columns.Add(temp);
                if (c.InPrimaryKey)
                {
                    primaryKeyIndex = index;
                }
                if (firstStringColumnIndex < 0 && temp.DotNetType == typeof(string))
                {
                    firstStringColumnIndex = index;
                    _FirstStringColumnName = temp.ProgramatlyName;
                }
                index++;
            }
            if (firstStringColumnIndex < 0)
            {
                firstStringColumnIndex = 0;
                Column c = _dbObject.Columns[0];
                temp = new CustomColumn(c, NameInDatabase, _ProgramatlyName);
                _FirstStringColumnName = temp.ProgramatlyName;
            }
            _SqlDataPrviderClass = string.Format(_SqlDataPrviderClass, _ProgramatlyName);
            _ModelClass = string.Format(_ModelClass, _ProgramatlyName);
            _FactoryClass = string.Format(_FactoryClass, _ProgramatlyName);
            _ControllerClass = string.Format(_ControllerClass, _ProgramatlyName);
            _ModelObject = string.Format(_ModelObject, _ProgramatlyName);
            _ModelList = string.Format(_ModelList, _ProgramatlyName);
            
            _ProcedureInsert = string.Format(_ProcedureInsert, _ProgramatlyName);
            _ProcedureUpdate = string.Format(_ProcedureUpdate, _ProgramatlyName);
            _ProcedureDelete = string.Format(_ProcedureDelete, _ProgramatlyName);
            _ProcedureGetPageByPage = string.Format(_ProcedureGetPageByPage, _ProgramatlyName);
            _ProcedureGet = string.Format(_ProcedureGet, _ProgramatlyName);

            _FlixyGridID = string.Format(_FlixyGridID, _ProgramatlyName);
            if (ID != null)
            {
                _ModelID = ID.ProgramatlyName;
                _ModelIdDotNetType = ID.DotNetTypeAlias;

                if (ID.DotNetType == typeof(int) ||
                        ID.DotNetType == typeof(short) ||
                        ID.DotNetType == typeof(long))
                {
                    _ModelIDNullValue = "-1";
                }
            }

            _DialogBox = string.Format(_DialogBox, _ProgramatlyName);
            _DialogBoxTitle = string.Format(_DialogBoxTitle, _ProgramatlyName);
            _DialogBoxFormID = string.Format(_DialogBoxFormID, _ProgramatlyName);

            _JsObject = string.Format(_JsObject, _ProgramatlyName);
            _JsForm = string.Format(_JsForm, _ProgramatlyName);

            _PathOfModelClass = string.Format(_PathOfModelClass, _ProgramatlyName, _ModelClass);
            _PathOfFactoryClass = string.Format(_PathOfFactoryClass, _ProgramatlyName, _FactoryClass);
            _PathOfSqlDataPrviderClass = string.Format(_PathOfSqlDataPrviderClass, _ProgramatlyName, _SqlDataPrviderClass);

            _PathOfControllerClass = string.Format(_PathOfControllerClass, _ControllerClass);
            _PathOfStoredProcerduresFile = string.Format(_PathOfStoredProcerduresFile, _ProgramatlyName);
            _PathOfIndexView = string.Format(_PathOfIndexView, _ProgramatlyName);
            _PathOfDialogBoxView = string.Format(_PathOfDialogBoxView, _ProgramatlyName);
        }