IsNull() public method

Gets a value indicating whether the specified contains a null value.
public IsNull ( DataColumn column ) : bool
column DataColumn
return bool
Example #1
0
 /// <summary>
 /// convert one row to Form1
 /// warning: this row must include all the columns of table(form_1)
 /// </summary>
 /// <param name="row">a data row that include all the column of table(form_1)</param>
 /// <returns>an entity of Form1</returns>
 public void FillEntityByRow(Form1Info entity, System.Data.DataRow row)
 {
     if (!row.IsNull("form_no"))
     {
         entity.FormNo = (int)row["form_no"];
     }
     else
     {
     }
     if (!row.IsNull("amount"))
     {
         entity.Amount = (int)row["amount"];
     }
     else
     {
     }
     if (!row.IsNull("leader"))
     {
         entity.Leader = (string)row["leader"];
     }
     else
     {
     }
     if (!row.IsNull("manager"))
     {
         entity.Manager = (string)row["manager"];
     }
     else
     {
     }
 }
Example #2
0
 /// <summary>
 /// convert one row to Participant
 /// warning: this row must include all the columns of table(participant)
 /// </summary>
 /// <param name="row">a data row that include all the column of table(participant)</param>
 /// <returns>an entity of Participant</returns>
 public void FillEntityByRow(ParticipantInfo entity, System.Data.DataRow row)
 {
     if (!row.IsNull("participant_id"))
     {
         entity.ParticipantId = (string)row["participant_id"];
     }
     else
     {
     }
     if (!row.IsNull("participant_kind"))
     {
         entity.ParticipantKind = (string)row["participant_kind"];
     }
     else
     {
     }
     if (!row.IsNull("relation_id"))
     {
         entity.RelationId = (string)row["relation_id"];
     }
     else
     {
     }
     if (!row.IsNull("active_id"))
     {
         entity.ActiveId = (string)row["active_id"];
     }
     else
     {
     }
 }
Example #3
0
 /// <summary>
 /// convert one row to SysCodeList
 /// warning: this row must include all the columns of table(sys_code_list)
 /// </summary>
 /// <param name="row">a data row that include all the column of table(sys_code_list)</param>
 /// <returns>an entity of SysCodeList</returns>
 public void FillEntityByRow(SysCodeList entity, System.Data.DataRow row)
 {
     if (!row.IsNull("main_key"))
     {
         entity.MainKey = (string)row["main_key"];
     }
     else
     {
     }
     if (!row.IsNull("sub_key"))
     {
         entity.SubKey = (string)row["sub_key"];
     }
     else
     {
     }
     if (!row.IsNull("content"))
     {
         entity.Content = (string)row["content"];
     }
     else
     {
     }
     if (!row.IsNull("description"))
     {
         entity.Description = (string)row["description"];
     }
     else
     {
     }
 }
Example #4
0
 /// <summary>
 /// convert one row to SysGroup
 /// warning: this row must include all the columns of table(sys_group)
 /// </summary>
 /// <param name="row">a data row that include all the column of table(sys_group)</param>
 /// <returns>an entity of SysGroup</returns>
 public void FillEntityByRow(SysGroupInfo entity, System.Data.DataRow row)
 {
     if (!row.IsNull("group_id"))
     {
         entity.GroupId = (string)row["group_id"];
     }
     else
     {
     }
     if (!row.IsNull("group_name"))
     {
         entity.GroupName = (string)row["group_name"];
     }
     else
     {
     }
     if (!row.IsNull("is_admin"))
     {
         entity.IsAdmin = (string)row["is_admin"];
     }
     else
     {
     }
     if (!row.IsNull("description"))
     {
         entity.Description = (string)row["description"];
     }
     else
     {
     }
 }
Example #5
0
 /// <summary>
 /// convert one row to SysDept
 /// warning: this row must include all the columns of table(sys_dept)
 /// </summary>
 /// <param name="row">a data row that include all the column of table(sys_dept)</param>
 /// <returns>an entity of SysDept</returns>
 public void FillEntityByRow(SysDeptInfo entity, System.Data.DataRow row)
 {
     if (!row.IsNull("dept_id"))
     {
         entity.DeptId = (string)row["dept_id"];
     }
     else
     {
     }
     if (!row.IsNull("dept_code"))
     {
         entity.DeptCode = (string)row["dept_code"];
     }
     else
     {
     }
     if (!row.IsNull("dept_name"))
     {
         entity.DeptName = (string)row["dept_name"];
     }
     else
     {
     }
     if (!row.IsNull("parent_id"))
     {
         entity.ParentId = (string)row["parent_id"];
     }
     else
     {
     }
 }
 /// <summary>
 /// convert one row to WorkflowActivity
 /// warning: this row must include all the columns of table(WorkFlow_Activity)
 /// </summary>
 /// <param name="row">a data row that include all the column of table(WorkFlow_Activity)</param>
 /// <returns>an entity of WorkflowActivity</returns>
 public void FillEntityByRow(WorkflowActivityInfo entity, System.Data.DataRow row)
 {
     if (!row.IsNull("ActivityID"))
     {
         entity.Activityid = (string)row["ActivityID"];
     }
     else
     {
     }
     if (!row.IsNull("ActivityName"))
     {
         entity.Activityname = (string)row["ActivityName"];
     }
     else
     {
     }
     if (!row.IsNull("WorkFlowID"))
     {
         entity.Workflowid = (string)row["WorkFlowID"];
     }
     else
     {
     }
     if (!row.IsNull("ActivityType"))
     {
         entity.Activitytype = (string)row["ActivityType"];
     }
     else
     {
     }
 }
Example #7
0
        private static Channel DataRowToChannel(DataRow r)
        {
            int id = 0;
            if (!(r.IsNull("ch_id")))
            {
                id = Convert.ToInt32(r["ch_id"]);
            }
            int stationId = Convert.ToInt32(r["st_id"]);
            int variableId = Convert.ToInt32(r["var_id"]);
            string stName = Convert.ToString(r["st_name"]);
            string stUrl = Convert.ToString(r["st_uri"]);
            long riverId = 0;
            if (!(r.IsNull("riv_id")))
            {
                riverId = Convert.ToInt64(r["riv_id"]);
            }
            string op = Convert.ToString(r["operator_name"]);

            Channel ch = new Channel(id, stationId, variableId, TimeInterval.Missing);
            Station st = new Station(stationId, stName, stUrl, riverId, op);
            Variable v = VariableManager.GetItemById(variableId);

            ch.Station = st;
            ch.Variable = v;

            //also load river for hydrologic stations
            if (riverId > 0)
            {
                st.River = RiverManager.GetItemByStation(st.Id, true);
            }

            return ch;
        }
Example #8
0
 /// <summary>
 /// convert one row to FormCodeList
 /// warning: this row must include all the columns of table(form_code_List)
 /// </summary>
 /// <param name="row">a data row that include all the column of table(form_code_List)</param>
 /// <returns>an entity of FormCodeList</returns>
 public void FillEntityByRow(FormCodeListInfo entity, System.Data.DataRow row)
 {
     if (!row.IsNull("form_kind"))
     {
         entity.FormKind = (string)row["form_kind"];
     }
     else
     {
     }
     if (!row.IsNull("code_kind"))
     {
         entity.CodeKind = (string)row["code_kind"];
     }
     else
     {
     }
     if (!row.IsNull("code_detail_des"))
     {
         entity.CodeDetailDes = (string)row["code_detail_des"];
     }
     else
     {
     }
     if (!row.IsNull("code_detail_value"))
     {
         entity.CodeDetailValue = (string)row["code_detail_value"];
     }
     else
     {
     }
 }
Example #9
0
 /// <summary>
 /// convert one row to Active
 /// warning: this row must include all the columns of table(active)
 /// </summary>
 /// <param name="row">a data row that include all the column of table(active)</param>
 /// <returns>an entity of Active</returns>
 public void FillEntityByRow(ActiveInfo entity, System.Data.DataRow row)
 {
     if (!row.IsNull("active_id"))
     {
         entity.ActiveId = (string)row["active_id"];
     }
     else
     {
     }
     if (!row.IsNull("active_name"))
     {
         entity.ActiveName = (string)row["active_name"];
     }
     else
     {
     }
     if (!row.IsNull("active_type"))
     {
         entity.ActiveType = (string)row["active_type"];
     }
     else
     {
     }
     if (!row.IsNull("form_id"))
     {
         entity.FormId = (int)row["form_id"];
     }
     else
     {
     }
 }
Example #10
0
        public GradeObject(DataColumnCollection columns, DataRow row)
        {
            this.grade = columns.Contains("grade") ? Convert.ToInt32(row["grade"]) : -1;
            this.rubricId = columns.Contains("rubric_id") ? Convert.ToInt32(row["rubric_id"]) : -1;
            this.studentId = columns.Contains("student_id") ? Convert.ToInt32(row["student_id"]) : -1;
            this.teacherId = columns.Contains("teacher_id") ? Convert.ToInt32(row["teacher_id"]) : -1;
            this.date = (columns.Contains("date") && !row.IsNull("date")) ? Convert.ToString(row["date"]) : "-";
            this.note = (columns.Contains("note") && !row.IsNull("note")) ? Convert.ToString(row["note"]) : "-";

            if (!this.date.Equals("-"))
                this.date = this.date.Substring(0, this.date.IndexOf(' ') + 1);
        }
Example #11
0
        /// <summary>
        ///  Map a DataRow to a UserGroup Entity.
        /// </summary>
        /// <returns></returns>
        public static UserGroup Row2Entity(System.Data.DataRow row)
        {
            if (row == null)
            {
                return(null);
            }

            UserGroup entity = new UserGroup();

            if (!row.IsNull("Group_ID"))
            {
                entity._groupId = (int)(row["Group_ID"]);
            }
            if (!row.IsNull("Parent_ID"))
            {
                entity._parentId = (int)(row["Parent_ID"]);
            }
            if (!row.IsNull("Name"))
            {
                entity._name = (string)(row["Name"]);
            }
            if (!row.IsNull("Description"))
            {
                entity._description = (string)(row["Description"]);
            }
            if (!row.IsNull("Group_Type"))
            {
                entity._groupType = (UserGroupType)Enum.Parse(typeof(UserGroupType), (row["Group_Type"]).ToString());
            }
            if (!row.IsNull("Group_Level"))
            {
                entity._groupLevel = (short)(row["Group_Level"]);
            }
            if (!row.IsNull("Create_Time"))
            {
                entity._createTime = (DateTime)(row["Create_Time"]);
            }
            if (!row.IsNull("Modify_Time"))
            {
                entity._modifyTime = (DateTime)(row["Modify_Time"]);
            }
            if (!row.IsNull("Create_By"))
            {
                entity._createBy = (int)(row["Create_By"]);
            }
            if (!row.IsNull("Modify_By"))
            {
                entity._modifyBy = (int)(row["Modify_By"]);
            }

            return(entity);
        }
Example #12
0
    internal Column(DataRow row, Table source)
    {
      _table = source;
      _unique = new Unique(this, row);

      if (row.IsNull("AUTOINCREMENT") == false && (bool)row["AUTOINCREMENT"] == true)
        _table.PrimaryKey.AutoIncrement = true;

      _dataType = (row.IsNull("DATA_TYPE") == false) ? row["DATA_TYPE"].ToString() : String.Empty;
      _columnName = row["COLUMN_NAME"].ToString();
      _origName = _columnName;
      _allowNulls = (bool)row["IS_NULLABLE"];
      _defaultValue = (row.IsNull("COLUMN_DEFAULT") == false) ? row["COLUMN_DEFAULT"].ToString() : String.Empty;
      _collate = (row.IsNull("COLLATION_NAME") == false) ? row["COLLATION_NAME"].ToString() : String.Empty;

      string edmtype = (row.IsNull("EDM_TYPE") == false) ? row["EDM_TYPE"].ToString() : String.Empty;
      if (edmtype == "nvarchar" || edmtype == "varchar" || edmtype == "blob" || edmtype == "nchar" || edmtype == "char")
      {
        int size = (row.IsNull("CHARACTER_MAXIMUM_LENGTH") == false) ? Convert.ToInt32(row["CHARACTER_MAXIMUM_LENGTH"]) : int.MaxValue;
        if (size != int.MaxValue)
          _dataType = string.Format("{0}({1})", _dataType, size);
      }
      else if (edmtype == "decimal")
      {
        int size = (row.IsNull("NUMERIC_PRECISION") == false) ? Convert.ToInt32(row["NUMERIC_PRECISION"]) : 53;
        int scale = (row.IsNull("NUMERIC_SCALE") == false) ? Convert.ToInt32(row["NUMERIC_SCALE"]) : int.MaxValue;

        if (size != 53)
        {
          string scalestr = (scale == int.MaxValue) ? "" : String.Format(",{0}", scale);
          _dataType = string.Format("{0}({1}{2})", _dataType, size, scalestr);
        }
      }
    }
Example #13
0
        public void CreateFrom(DataRow dr)
        {
            if (dr.Table.Columns.Contains(ConstantInfo.TBL_PERMISSION_PERMISSION_ID) &&
                !dr.IsNull(ConstantInfo.TBL_PERMISSION_PERMISSION_ID))
            {
                this.PermissionID = Convert.ToInt32(dr[ConstantInfo.TBL_PERMISSION_PERMISSION_ID]);
            }

            if (dr.Table.Columns.Contains(ConstantInfo.TBL_PERMISSION_PERMISSION) &&
                !dr.IsNull(ConstantInfo.TBL_PERMISSION_PERMISSION))
            {
                this.Permission = dr[ConstantInfo.TBL_PERMISSION_PERMISSION].ToString();
            }
        }
Example #14
0
 /// <summary>
 /// convert one row to SysMenu
 /// warning: this row must include all the columns of table(sys_menu)
 /// </summary>
 /// <param name="row">a data row that include all the column of table(sys_menu)</param>
 /// <returns>an entity of SysMenu</returns>
 public void FillEntityByRow(SysMenu entity, System.Data.DataRow row)
 {
     if (!row.IsNull("menu_id"))
     {
         entity.MenuId = (string)row["menu_id"];
     }
     else
     {
     }
     if (!row.IsNull("menu_name"))
     {
         entity.MenuName = (string)row["menu_name"];
     }
     else
     {
     }
     if (!row.IsNull("description"))
     {
         entity.Description = (string)row["description"];
     }
     else
     {
     }
     if (!row.IsNull("parent_id"))
     {
         entity.ParentId = (string)row["parent_id"];
     }
     else
     {
     }
     if (!row.IsNull("type_id"))
     {
         entity.TypeId = (int)row["type_id"];
     }
     else
     {
     }
     if (!row.IsNull("url"))
     {
         entity.Url = (string)row["url"];
     }
     else
     {
     }
     if (!row.IsNull("is_valid"))
     {
         entity.IsValid = (string)row["is_valid"];
     }
     else
     {
     }
     if (!row.IsNull("display_order"))
     {
         entity.DisplayOrder = (int)row["display_order"];
     }
     else
     {
     }
 }
 /// <summary>
 /// convert one row to FormHeader
 /// warning: this row must include all the columns of table(form_header)
 /// </summary>
 /// <param name="row">a data row that include all the column of table(form_header)</param>
 /// <returns>an entity of FormHeader</returns>
 public void FillEntityByRow(FormHeaderInfo entity, System.Data.DataRow row)
 {
     if (!row.IsNull("form_header_id"))
     {
         entity.FormHeaderId = (string)row["form_header_id"];
     }
     else
     {
     }
     if (!row.IsNull("form_no"))
     {
         entity.FormNo = (int)row["form_no"];
     }
     else
     {
     }
     if (!row.IsNull("form_id"))
     {
         entity.FormId = (int)row["form_id"];
     }
     else
     {
     }
     if (!row.IsNull("form_status"))
     {
         entity.FormStatus = (string)row["form_status"];
     }
     else
     {
     }
     if (!row.IsNull("begin_date"))
     {
         entity.BeginDate = (System.DateTime)row["begin_date"];
     }
     else
     {
     }
     if (!row.IsNull("end_date"))
     {
         entity.EndDate = (System.DateTime)row["end_date"];
     }
     else
     {
     }
     if (!row.IsNull("applyer"))
     {
         entity.Applyer = (string)row["applyer"];
     }
     else
     {
     }
     if (!row.IsNull("filler"))
     {
         entity.Filler = (string)row["filler"];
     }
     else
     {
     }
 }
Example #16
0
 /// <summary>
 /// convert one row to SysSiteList
 /// warning: this row must include all the columns of table(sys_site_list)
 /// </summary>
 /// <param name="row">a data row that include all the column of table(sys_site_list)</param>
 /// <returns>an entity of SysSiteList</returns>
 public void FillEntityByRow(SysSiteListInfo entity, System.Data.DataRow row)
 {
     if (!row.IsNull("site_serial"))
     {
         entity.SiteSerial = (int)row["site_serial"];
     }
     else
     {
     }
     if (!row.IsNull("site_name"))
     {
         entity.SiteName = (string)row["site_name"];
     }
     else
     {
     }
     if (!row.IsNull("current_upload_path_id"))
     {
         entity.CurrentUploadPathId = (int)row["current_upload_path_id"];
     }
     else
     {
     }
     if (!row.IsNull("site_type"))
     {
         entity.SiteType = (string)row["site_type"];
     }
     else
     {
     }
     if (!row.IsNull("site_desc"))
     {
         entity.SiteDesc = (string)row["site_desc"];
     }
     else
     {
     }
     if (!row.IsNull("flower_engineservice"))
     {
         entity.FlowerEngineservice = (string)row["flower_engineservice"];
     }
     else
     {
     }
     if (!row.IsNull("flower_flowerapi"))
     {
         entity.FlowerFlowerapi = (string)row["flower_flowerapi"];
     }
     else
     {
     }
     if (!row.IsNull("flower_formcradle"))
     {
         entity.FlowerFormcradle = (string)row["flower_formcradle"];
     }
     else
     {
     }
 }
Example #17
0
 public Player(DataRow row)
 {
     this.Id = (long)row["Id"];
     this.Name = (string)row["Name"];
     this.SiteId = (long)row["SiteId"];
     if (!row.IsNull("Notes"))
     {
         this.Notes = (string)row["Notes"];
     }
     this.DateAdded = new UnixTimestamp((long)row["DateAdded"]);
     if (!row.IsNull("DateUpdated"))
     {
         this.DateUpdated = new UnixTimestamp((long)row["DateUpdated"]);
     }
 }
Example #18
0
        public PokerSite(DataRow row)
        {
            this.Id = (long)row["Id"];
            this.Name = (string)row["Name"];

            if (!row.IsNull("Abbreviation"))
            {
                this.Abbreviation = (string)row["Abbreviation"];
            }
            this.DateAdded = new UnixTimestamp((long)row["DateAdded"]);
            if (!row.IsNull("DateUpdated"))
            {
                this.DateUpdated = new UnixTimestamp((long)row["DateUpdated"]);
            }
        }
Example #19
0
            /// <summary>
            /// ��ָ����DataRow�����ﱣ�������ת��������ʵ����
            /// </summary>
            /// <param name="row">DataRow����</param>
            /// <param name="instance">����ʵ��</param>
            /// <returns>�Ƿ�ɹ�</returns>
            public static bool DataRowToObject(DataRow row, object instance)
            {
                if (row == null || row.Table == null || instance == null)
                    return false;
                DataColumnCollection columns = row.Table.Columns;
                if (columns == null || columns.Count <= 0)
                    return false;
                PropertyInfo[] properties = instance.GetType().GetProperties();
                foreach (PropertyInfo property in properties)
                {
                    if (!property.CanWrite)
                        continue;

                    foreach (DataColumn column in columns)
                    {
                        if (string.Compare(column.ColumnName, property.Name, false) != 0)
                            continue;
                        object propertyValue = null;
                        if (!row.IsNull(column))
                            propertyValue = row[column];
                        GlobalMethods.Reflect.SetPropertyValue(instance, property, propertyValue);
                        break;
                    }
                }
                return true;
            }
Example #20
0
        public static string GetFieldValue(DataRow dr, string FieldName)
        {
            string result = "";
            if (dr != null)
                result = dr.IsNull(FieldName) ? "" : dr[FieldName].ToString().Trim();

            return result;
        }
Example #21
0
 /// <summary>
 /// convert one row to SysConfig
 /// warning: this row must include all the columns of table(sys_config)
 /// </summary>
 /// <param name="row">a data row that include all the column of table(sys_config)</param>
 /// <returns>an entity of SysConfig</returns>
 public void FillEntityByRow(SysConfig entity, System.Data.DataRow row)
 {
     if (!row.IsNull("config_id"))
     {
         entity.ConfigId = (string)row["config_id"];
     }
     else
     {
     }
     if (!row.IsNull("config_value"))
     {
         entity.ConfigValue = (string)row["config_value"];
     }
     else
     {
     }
 }
Example #22
0
        public TestInfo(DataRow dr)
        {
            _id = (int)dr["Id"];
            _classId = (int)dr["ClassId"];

            if (!dr.IsNull("Title"))
                _title = (string)dr["Title"];
            if (!dr.IsNull("Description"))
                _description = (string)dr["Description"];
            _minPassingScorePercentage = (int)dr["MinPassingScorePercentage"];
            _visible = (bool)dr["Visible"];
            _createdTimestamp = (DateTime)dr["CreatedTimestamp"];
            if (!dr.IsNull("UpdatedTimestamp"))
                _updatedTimestamp = (DateTime)dr["UpdatedTimestamp"];
            //if (!dr.IsNull("QuestionCount"))
            //    _questionCount = (int)dr["QuestionCount"];
        }
 /// <summary>
 /// convert one row to SysMenuGroup
 /// warning: this row must include all the columns of table(sys_menu_group)
 /// </summary>
 /// <param name="row">a data row that include all the column of table(sys_menu_group)</param>
 /// <returns>an entity of SysMenuGroup</returns>
 public void FillEntityByRow(SysMenuGroupInfo entity, System.Data.DataRow row)
 {
     if (!row.IsNull("menu_id"))
     {
         entity.MenuId = (string)row["menu_id"];
     }
     else
     {
     }
     if (!row.IsNull("group_id"))
     {
         entity.GroupId = (string)row["group_id"];
     }
     else
     {
     }
 }
 /// <summary>
 /// convert one row to ParticipantOrg
 /// warning: this row must include all the columns of table(participant_org)
 /// </summary>
 /// <param name="row">a data row that include all the column of table(participant_org)</param>
 /// <returns>an entity of ParticipantOrg</returns>
 public void FillEntityByRow(ParticipantOrgInfo entity, System.Data.DataRow row)
 {
     if (!row.IsNull("participant_id"))
     {
         entity.ParticipantId = (string)row["participant_id"];
     }
     else
     {
     }
     if (!row.IsNull("user_id"))
     {
         entity.UserId = (string)row["user_id"];
     }
     else
     {
     }
 }
Example #25
0
 /// <summary>
 /// convert one row to SysObjects
 /// warning: this row must include all the columns of table(sys_objects)
 /// </summary>
 /// <param name="row">a data row that include all the column of table(sys_objects)</param>
 /// <returns>an entity of SysObjects</returns>
 public void FillEntityByRow(SysObjectsInfo entity, System.Data.DataRow row)
 {
     if (!row.IsNull("object_type"))
     {
         entity.ObjectType = (string)row["object_type"];
     }
     else
     {
     }
     if (!row.IsNull("max_id"))
     {
         entity.MaxId = (int)row["max_id"];
     }
     else
     {
     }
 }
Example #26
0
 /// <summary>
 /// convert one row to MdOrg
 /// warning: this row must include all the columns of table(md_org)
 /// </summary>
 /// <param name="row">a data row that include all the column of table(md_org)</param>
 /// <returns>an entity of MdOrg</returns>
 public void FillEntityByRow(MdOrgInfo entity, System.Data.DataRow row)
 {
     if (!row.IsNull("model_id"))
     {
         entity.ModelId = (string)row["model_id"];
     }
     else
     {
     }
     if (!row.IsNull("user_id"))
     {
         entity.UserId = (string)row["user_id"];
     }
     else
     {
     }
 }
 /// <summary>
 /// convert one row to SysGroupUser
 /// warning: this row must include all the columns of table(sys_group_user)
 /// </summary>
 /// <param name="row">a data row that include all the column of table(sys_group_user)</param>
 /// <returns>an entity of SysGroupUser</returns>
 public void FillEntityByRow(SysGroupUserInfo entity, System.Data.DataRow row)
 {
     if (!row.IsNull("group_id"))
     {
         entity.GroupId = (string)row["group_id"];
     }
     else
     {
     }
     if (!row.IsNull("user_id"))
     {
         entity.UserId = (string)row["user_id"];
     }
     else
     {
     }
 }
 /// <summary>
 /// convert one row to SysCodeMaster
 /// warning: this row must include all the columns of table(sys_code_master)
 /// </summary>
 /// <param name="row">a data row that include all the column of table(sys_code_master)</param>
 /// <returns>an entity of SysCodeMaster</returns>
 public void FillEntityByRow(SysCodeMaster entity, System.Data.DataRow row)
 {
     if (!row.IsNull("main_key"))
     {
         entity.MainKey = (string)row["main_key"];
     }
     else
     {
     }
     if (!row.IsNull("description"))
     {
         entity.Description = (string)row["description"];
     }
     else
     {
     }
 }
Example #29
0
 internal Unique(Column col, DataRow row)
 {
   _column = col;
   if (row != null)
   {
     _isUnique = (row.IsNull("UNIQUE") == false) ? (bool)row["UNIQUE"] : false;
   }
 }
 /// <summary>
 /// convert one row to SysBatchUpload
 /// warning: this row must include all the columns of table(sys_batch_upload)
 /// </summary>
 /// <param name="row">a data row that include all the column of table(sys_batch_upload)</param>
 /// <returns>an entity of SysBatchUpload</returns>
 public void FillEntityByRow(SysBatchUpload entity, System.Data.DataRow row)
 {
     if (!row.IsNull("batch_id"))
     {
         entity.BatchId = (string)row["batch_id"];
     }
     else
     {
     }
     if (!row.IsNull("attachment_id"))
     {
         entity.AttachmentId = (string)row["attachment_id"];
     }
     else
     {
     }
 }
        private static void AddPartnerContent(ref PartnerContent defaultContent, DataRow row)
        {
            if(!row.IsNull("description"))
                defaultContent.Description = row.ReadNullableTrimmedString("description");

            if (!row.IsNull("title"))
                defaultContent.Title = row.ReadNullableTrimmedString("title");

            if (!row.IsNull("keywords"))
                defaultContent.Keywords = row.ReadNullableTrimmedString("keywords");

            if (!row.IsNull("footer"))
                defaultContent.Footer = row.ReadNullableTrimmedString("footer");

            if (!row.IsNull("header"))
                defaultContent.Header = row.ReadNullableTrimmedString("header");

            if (!row.IsNull("background_image_name"))
                defaultContent.ImageName = row.ReadNullableTrimmedString("background_image_name");

            if (!row.IsNull("partner_id"))
                defaultContent.PartnerId = row.ReadInt("partner_id");

            if (!row.IsNull("partner_user_id"))
                defaultContent.UserId = row.ReadInt("partner_user_id");
        }
Example #32
0
        public FlawImageControl(DataRow drFlaw, ref List<NowUnit> units)
        {
            InitializeComponent();
            Boolean isSelectedTab = false;
            this._drFlaw = drFlaw;
            this._units = units;
            IsDrawBorder = false;
            lblFlawID.Text += drFlaw["FlawID"].ToString();
            _pb = new PictureBox[JobHelper.JobInfo.NumberOfStations];
            _pbRatio = new double[JobHelper.JobInfo.NumberOfStations];
            _srcImages = new Image[JobHelper.JobInfo.NumberOfStations];

            for (int i = 0; i < JobHelper.JobInfo.NumberOfStations; i++)
            {
                tabImages.TabPages.Add("S" + ((i + 1).ToString()));
                _pb[i] = new PictureBox();
                _pb[i].SizeMode = PictureBoxSizeMode.Zoom;
                _pb[i].Location = new Point(0, 0);
                _pb[i].BackColor = Color.Transparent;
                _pb[i].MouseClick += new MouseEventHandler(pb_Click);
                _pb[i].MouseDoubleClick += new MouseEventHandler(pb_MouseDoubleClick);
                tabImages.TabPages[i].AutoScroll = true;
                tabImages.TabPages[i].Controls.Add(_pb[i]);
                tabImages.TabPages[i].BackColor = Color.Transparent;
                tabImages.TabPages[i].Tag = 100;  // Zoom Multiplier value.
            }
            if (!drFlaw.IsNull("Images"))
            {
                IList<IImageInfo> images = drFlaw["Images"] as IList<IImageInfo>;
                foreach (IImageInfo image in images)
                {
                    _srcImages[image.Station] = image.Image;
                    _pbRatio[image.Station] = Init_Image(image.Image, tabImages.TabPages[image.Station], _pb[image.Station]);
                    if (!isSelectedTab)
                    {
                        tabImages.SelectedTab = tabImages.TabPages[image.Station];
                        isSelectedTab = true;
                    }
                }
                for (int i = 0; i < JobHelper.JobInfo.NumberOfStations; i++)
                {
                    if (_srcImages[i] == null)
                    {
                        _srcImages[i] = Resources.NoImage;
                        _pbRatio[i] = Init_Image(Resources.NoImage, tabImages.TabPages[i], _pb[i]);
                    }
                }
            }
            else
            {
                for (int i = 0; i < JobHelper.JobInfo.NumberOfStations; i++)
                {
                    _srcImages[i] = Resources.NoImage;
                    _pbRatio[i] = Init_Image(Resources.NoImage, tabImages.TabPages[i], _pb[i]);
                }
            }
        }
Example #33
0
       public CategoryInfo(DataRow dr)
       {
           Id = (int)dr["Id"];

           if(!dr.IsNull("Name"))
            CategoryName = (string)dr["Name"];

           Visible =(bool)dr["Visible"];
       }
Example #34
0
        public UserObject(DataColumnCollection columns, DataRow row)
        {
            this.id = columns.Contains("id") ? Convert.ToInt32(row["id"]) : -1;
            this.classId = (columns.Contains("class_id") && !row.IsNull("class_id")) ? Convert.ToInt32(row["class_id"]) : -1;
            this.userTypeId = columns.Contains("user_type_id") ? Convert.ToInt32(row["user_type_id"]) : -1;
            this.worksIn = (columns.Contains("works_in") && !row.IsNull("works_in")) ? Convert.ToInt32(row["works_in"]) : -1;

            this.name = columns.Contains("name") ? Convert.ToString(row["name"]) : "-";
            this.lastname = columns.Contains("lastname") ? Convert.ToString(row["lastname"]) : "-";
            this.username = columns.Contains("username") ? Convert.ToString(row["username"]) : "-";
            this.password = columns.Contains("password") ? Convert.ToString(row["password"]) : "-";

            String userType = columns.Contains("user_type_name") ? Convert.ToString(row["user_type_name"]) : "-";
            if (userType.ToLower().Contains("admin"))
                this.userType = UserType.Admin;
            else
                this.userType = (userType.Contains("student") ? UserType.Student : UserType.Teacher);
        }
Example #35
0
 public WorkbookInfo(DataRow dr)
 {
     _id = (int)dr["Id"];
     _classID = (int)dr["ClassID"];
     _title = (string)dr["Title"];
     _body = (string)dr["Body"];
     _visible = (bool)dr["Visible"];
     _createdTimestamp = (DateTime)dr["CreatedTimestamp"];
     if (!dr.IsNull("UpdatedTimestamp"))
         _updatedTimestamp = (DateTime)dr["UpdatedTimestamp"];
 }
Example #36
0
 public void Write(JSONObject target, DataRow row)
 {
     if (row.IsNull(_index))
     {
         target.AddNull(_name);
     }
     else
     {
         writeProperty(_name, row[_index], target);
     }
 }
 public PersonDetails(DataRow row, String fieldName)
 {
     Name = "";
     FirstName = "";
     LastName = "";
     if (!row.IsNull(fieldName + "ID"))
     {
         _id = Convert.ToInt32(row[fieldName + "ID"]);
         LoadFromID();
     }
 }
Example #38
0
        public Setting(DataRow row)
        {
            long id = (long)row["Id"];
            string value = row.IsNull("Value") ? null : (string)row["Value"];
            long dateAdded = (long)row["DateAdded"];
            long? dateUpdated = null;
            if (!row.IsNull("DateUpdated"))
            {
                dateUpdated = (long)row["DateUpdated"];
            }

            this.Id = id;
            this.Name = (string)row["Name"];
            this.Value = value;
            this.DateAdded = new UnixTimestamp(dateAdded);
            if (dateUpdated != null)
            {
                this.DateUpdated = new UnixTimestamp(dateUpdated.Value);
            }
        }
Example #39
0
 public Hand(DataRow row)
 {
     this.Id = (long)row["Id"];
     this.HandNumber = (string)row["HandNumber"];
     this.SiteId = (long)row["SiteId"];
     this.DateAdded = new UnixTimestamp((long)row["DateAdded"]);
     if (!row.IsNull("DateUpdated"))
     {
         this.DateUpdated = new UnixTimestamp((long)row["DateUpdated"]);
     }
 }
Example #40
0
        protected string GetText(List<ColumnType> columnTypes, DataRow dataRow, int i)
        {
            var factory = new CellFormatterFactory();
            var formatter = factory.GetObject(columnTypes[i]);

            var text = string.Empty;
            if (dataRow.IsNull(i))
                text = formatter.Format(DBNull.Value);
            else
                text = formatter.Format(dataRow.ItemArray[i]);
            return text;
        }
Example #41
0
		/// <summary>
		/// 根据主键比较两个 Row 是否相等。要求至少 r1 所在表必须有主键列定义。
		/// </summary>
		public static bool CompareRow(DataRow r1, DataRow r2)
		{
			DataTable t1 = r1.Table, t2 = r2.Table;
			DataColumn[] pk1 = t1.PrimaryKey;
			if (pk1 == null || pk1.Length == 0 || t2.Columns.Count < pk1.Length) return false;
			foreach (DataColumn c1 in pk1)
			{
				DataColumn c2 = t2.Columns[c1.ColumnName];
				if (c2 == null || c1.DataType != c2.DataType || r2.IsNull(c2) || r1[c1] != r2[c2]) return false;
			}
			return true;
		}
Example #42
0
        public void CreateFrom(DataRow dr)
        {
            if (dr.Table.Columns.Contains(ConstantInfo.TBL_USER_USERID) && !dr.IsNull(ConstantInfo.TBL_USER_USERID))
            {
                this.UserID = Convert.ToInt32(dr[ConstantInfo.TBL_USER_USERID]);
            }
            if (dr.Table.Columns.Contains(ConstantInfo.TBL_USER_NAME) && !dr.IsNull(ConstantInfo.TBL_USER_NAME))
            {
                this.Name = dr[ConstantInfo.TBL_USER_NAME].ToString();
            }

            if (dr.Table.Columns.Contains(ConstantInfo.TBL_USER_BIRTHDAY) && !dr.IsNull(ConstantInfo.TBL_USER_BIRTHDAY))
            {
                this.Birthday = Convert.ToDateTime(dr[ConstantInfo.TBL_USER_BIRTHDAY]);
            }

            if (dr.Table.Columns.Contains(ConstantInfo.TBL_USER_ADDRESS) && !dr.IsNull(ConstantInfo.TBL_USER_ADDRESS))
            {
                this.Address = dr[ConstantInfo.TBL_USER_ADDRESS].ToString();
            }
            if (dr.Table.Columns.Contains(ConstantInfo.TBL_USER_EMAIL) && !dr.IsNull(ConstantInfo.TBL_USER_EMAIL))
            {
                this.Email = dr[ConstantInfo.TBL_USER_EMAIL].ToString();
            }
            if (dr.Table.Columns.Contains(ConstantInfo.TBL_USER_PHONE_NUMBER) && !dr.IsNull(ConstantInfo.TBL_USER_PHONE_NUMBER))
            {
                this.PhoneNumber = dr[ConstantInfo.TBL_USER_PHONE_NUMBER].ToString();
            }
            if (dr.Table.Columns.Contains(ConstantInfo.TBL_USER_USERNAME) && !dr.IsNull(ConstantInfo.TBL_USER_USERNAME))
            {
                this.UserName = dr[ConstantInfo.TBL_USER_USERNAME].ToString();
            }
            if (dr.Table.Columns.Contains(ConstantInfo.TBL_USER_PASSWORD) && !dr.IsNull(ConstantInfo.TBL_USER_PASSWORD))
            {
                this.Password = dr[ConstantInfo.TBL_USER_PASSWORD].ToString();
            }

            if (dr.Table.Columns.Contains(ConstantInfo.TBL_PERMISSION_PERMISSION) && !dr.IsNull(ConstantInfo.TBL_PERMISSION_PERMISSION))
            {
                this.Permission = dr[ConstantInfo.TBL_PERMISSION_PERMISSION].ToString();
            }

            if (dr.Table.Columns.Contains(ConstantInfo.TBL_PERMISSION_PERMISSION_ID) && !dr.IsNull(ConstantInfo.TBL_PERMISSION_PERMISSION_ID))
            {
                this.PermissionID = Convert.ToInt32(dr[ConstantInfo.TBL_PERMISSION_PERMISSION_ID]);
            }
            if (dr.Table.Columns.Contains(ConstantInfo.TBL_USER_IS_ACTIVE) && !dr.IsNull(ConstantInfo.TBL_USER_IS_ACTIVE))
            {
                this.IsActive = Convert.ToBoolean(dr[ConstantInfo.TBL_USER_IS_ACTIVE]);
            }
        }
Example #43
0
 public static void FillAttributes(DataRow row, Dictionary<string, string> attributes)
 {
     attributes.Clear();
     foreach(DataColumn col in row.Table.Columns) {
         if (col.ColumnName == "Part_num") {
             continue;
         }
         if (col.DataType != System.Type.GetType("System.String")) {
             Console.WriteLine("Warning: Ignoring column {0} due to non-string data-type: {1}", col, col.DataType);
             continue;
         }
         attributes[col.ColumnName] = (row.IsNull(col) ? null : (string)row[col]);
     }
 }
        public HandHistoryFile(DataRow row)
        {
            this.Id = (long)row["Id"];
            this.Name = (string)row["Name"];
            this.Path = (string)row["Path"];
            this.LineNumber = (long)row["LineNumber"];
            this.SiteId = (long)row["SiteId"];

            if (!row.IsNull("MachineName"))
            {
                this.MachineName = (string)row["MachineName"];
            }
            if (!row.IsNull("User"))
            {
                this.User = (string)row["User"];
            }
            this.DateCreated = new UnixTimestamp((long)row["DateCreated"]);
            this.DateAdded = new UnixTimestamp((long)row["DateAdded"]);
            if (!row.IsNull("DateUpdated"))
            {
                this.DateUpdated = new UnixTimestamp((long)row["DateUpdated"]);
            }
        }
            public void AddRow(DataRow x)
            {
                XSSFRow row = this._Sheet.CreateRow(this._WriteRowIndex) as XSSFRow;

                row.CreateCell(00, CellType.NUMERIC).SetCellValue(this._RowIndex + 1);
                row.CreateCell(01, CellType.NUMERIC).SetCellValue(x.Field<int>("REGID"));
                row.CreateCell(02, CellType.STRING).SetCellValue(x.Field<string>("CLINombre"));
                row.CreateCell(03, CellType.STRING).SetCellValue(x.Field<string>("REGCaja"));
                row.CreateCell(04, CellType.STRING).SetCellValue(x.Field<string>("REGNumero"));
                row.CreateCell(05, CellType.NUMERIC).SetCellValue(x.Field<string>("REGCodigo"));
                row.CreateCell(06, CellType.STRING).SetCellValue(x.Field<string>("RESDescripcion"));
                row.CreateCell(07, CellType.NUMERIC).SetCellValue(Convert.ToDouble(x.Field<decimal>("REGValor")));
                row.CreateCell(08, CellType.STRING).SetCellValue(x.Field<string>("REGObservacion"));
                row.CreateCell(09, CellType.STRING).SetCellValue(!x.IsNull("REGFechaRecibido") ? x.Field<DateTime>("REGFechaRecibido").ToString("dd/MM/yyyy HH:mm.ss") : null);
                row.CreateCell(10, CellType.STRING).SetCellValue(!x.IsNull("REGFechaEntrega") ? x.Field<DateTime>("REGFechaEntrega").ToString("dd/MM/yyyy HH:mm.ss") : null);
                row.CreateCell(11, CellType.STRING).SetCellValue(x.Field<string>("ReclamanteTipoDocumento"));
                row.CreateCell(12, CellType.STRING).SetCellValue(x.Field<string>("REGReclamanteNumeroDocumento"));
                row.CreateCell(13, CellType.STRING).SetCellValue(x.Field<string>("REGReclamanteNombre"));
                row.CreateCell(14, CellType.STRING).SetCellValue(x.Field<string>("PacienteTipoDocumento"));
                row.CreateCell(15, CellType.STRING).SetCellValue(x.Field<string>("REGPacienteNumeroDocumento"));
                row.CreateCell(16, CellType.STRING).SetCellValue(x.Field<string>("REGPacienteNombre"));
                row.CreateCell(17, CellType.STRING).SetCellValue(x.Field<string>("UsuarioCreacion"));
                row.CreateCell(18, CellType.STRING).SetCellValue(x.Field<DateTime>("REGFechaCreacion").ToString("dd/MM/yyyy HH:mm.ss"));
                row.CreateCell(19, CellType.STRING).SetCellValue(x.Field<string>("REGUsuarioModificacion"));
                row.CreateCell(20, CellType.STRING).SetCellValue(x.Field<DateTime>("REGFechaModificacion").ToString("dd/MM/yyyy HH:mm.ss"));
                row.CreateCell(21, CellType.STRING).SetCellValue(x.Field<Guid>("RIMImagenCodigo").ToString());
                row.CreateCell(22, CellType.STRING).SetCellValue(x.Field<string>("TIMCodigo"));
                row.CreateCell(23, CellType.STRING).SetCellValue(x.Field<string>("TIMNombre"));
                row.CreateCell(24, CellType.STRING).SetCellValue(x.Field<string>("RIMImagenNombre"));
                row.CreateCell(25, CellType.STRING).SetCellValue(x.Field<string>("RIMImagenTipo"));
                row.CreateCell(26, CellType.NUMERIC).SetCellValue(x.Field<long>("RIMImagenPeso"));
                row.CreateCell(27, CellType.STRING).SetCellValue(x.Field<string>("ImagenUsuarioCreacion"));
                row.CreateCell(28, CellType.STRING).SetCellValue(x.Field<DateTime>("RIMFechaCreacion").ToString("dd/MM/yyyy HH:mm.ss"));

                this._RowIndex++;
                this._WriteRowIndex++;
            }
Example #46
0
        /// <summary>
        /// Retrieve a DataTime from a DataRow
        /// </summary>
        /// <param name="row">The DataRow to read the string from</param>
        /// <param name="columnName">The name of the column</param>
        /// <param name="valueIfNull">The value to return if the column is null</param>
        public static DateTime RetrieveDateTime(DataRow row,string columnName,DateTime valueIfNull)
        {
            DateTime retVal = valueIfNull;

            try
            {
                retVal = row.IsNull(columnName) ? valueIfNull:Convert.ToDateTime(row[columnName]);
            }
            catch (SqlException e)
            {
                throw new DatabaseException(_DatabaseExceptionUserMessage, "SqlException occured while retrieving the column:" + columnName, "RetrieveDateTime", e);
            }

            return retVal;
        }
Example #47
0
 private void TagsDGV_SelectionChanged(object sender, System.EventArgs e)
 {
     if (this.TagsDGV.CurrentRow != null)
     {
         System.Data.DataRow row = (this.TagsDGV.CurrentRow.DataBoundItem as System.Data.DataRowView).Row;
         if (!row.IsNull("Element"))
         {
             this.ElementSelected((BrowseElement)row["Element"]);
         }
     }
     else
     {
         this.ElementSelected(null);
     }
 }
Example #48
0
 /// <summary>
 /// convert one row to SysMenuLanguage
 /// warning: this row must include all the columns of table(sys_menu_language)
 /// </summary>
 /// <param name="row">a data row that include all the column of table(sys_menu_language)</param>
 /// <returns>an entity of SysMenuLanguage</returns>
 public void FillEntityByRow(SysMenuLanguage entity, System.Data.DataRow row)
 {
     if (!row.IsNull("menu_id"))
     {
         entity.MenuId = (string)row["menu_id"];
     }
     else
     {
     }
     if (!row.IsNull("language_id"))
     {
         entity.LanguageId = (string)row["language_id"];
     }
     else
     {
     }
     if (!row.IsNull("menu_name"))
     {
         entity.MenuName = (string)row["menu_name"];
     }
     else
     {
     }
 }
Example #49
0
 /// <summary>
 /// convert one row to SysDocPath
 /// warning: this row must include all the columns of table(sys_doc_path)
 /// </summary>
 /// <param name="row">a data row that include all the column of table(sys_doc_path)</param>
 /// <returns>an entity of SysDocPath</returns>
 public void FillEntityByRow(SysDocPath entity, System.Data.DataRow row)
 {
     if (!row.IsNull("path_id"))
     {
         entity.PathId = (int)row["path_id"];
     }
     else
     {
     }
     if (!row.IsNull("site_serial"))
     {
         entity.SiteSerial = (int)row["site_serial"];
     }
     else
     {
     }
     if (!row.IsNull("doc_path"))
     {
         entity.DocPath = (string)row["doc_path"];
     }
     else
     {
     }
 }
Example #50
0
 /// <summary>
 /// convert one row to ParticipantField
 /// warning: this row must include all the columns of table(participant_field)
 /// </summary>
 /// <param name="row">a data row that include all the column of table(participant_field)</param>
 /// <returns>an entity of ParticipantField</returns>
 public void FillEntityByRow(ParticipantFieldInfo entity, System.Data.DataRow row)
 {
     if (!row.IsNull("participant_id"))
     {
         entity.ParticipantId = (string)row["participant_id"];
     }
     else
     {
     }
     if (!row.IsNull("field_name"))
     {
         entity.FieldName = (string)row["field_name"];
     }
     else
     {
     }
     if (!row.IsNull("table_name"))
     {
         entity.TableName = (string)row["table_name"];
     }
     else
     {
     }
 }
Example #51
0
 /// <summary>
 /// convert one row to TestBak
 /// warning: this row must include all the columns of table(Test_bak)
 /// </summary>
 /// <param name="row">a data row that include all the column of table(Test_bak)</param>
 /// <returns>an entity of TestBak</returns>
 public void FillEntityByRow(TestBakInfo entity, System.Data.DataRow row)
 {
     if (!row.IsNull("a"))
     {
         entity.A = (string)row["a"];
     }
     else
     {
     }
     if (!row.IsNull("b"))
     {
         entity.B = (int)row["b"];
     }
     else
     {
     }
     if (!row.IsNull("form_no"))
     {
         entity.FormNo = (int)row["form_no"];
     }
     else
     {
     }
 }
Example #52
0
 /// <summary>
 /// convert one row to MdField
 /// warning: this row must include all the columns of table(md_field)
 /// </summary>
 /// <param name="row">a data row that include all the column of table(md_field)</param>
 /// <returns>an entity of MdField</returns>
 public void FillEntityByRow(MdFieldInfo entity, System.Data.DataRow row)
 {
     if (!row.IsNull("model_id"))
     {
         entity.ModelId = (string)row["model_id"];
     }
     else
     {
     }
     if (!row.IsNull("field_name"))
     {
         entity.FieldName = (string)row["field_name"];
     }
     else
     {
     }
     if (!row.IsNull("table_name"))
     {
         entity.TableName = (string)row["table_name"];
     }
     else
     {
     }
 }
 /// <summary>
 /// convert one row to WorkflowProcess
 /// warning: this row must include all the columns of table(WorkFlow_Process)
 /// </summary>
 /// <param name="row">a data row that include all the column of table(WorkFlow_Process)</param>
 /// <returns>an entity of WorkflowProcess</returns>
 public void FillEntityByRow(WorkflowProcessInfo entity, System.Data.DataRow row)
 {
     if (!row.IsNull("WorkFlowID"))
     {
         entity.Workflowid = (string)row["WorkFlowID"];
     }
     else
     {
     }
     if (!row.IsNull("WorkFlowName"))
     {
         entity.Workflowname = (string)row["WorkFlowName"];
     }
     else
     {
     }
     if (!row.IsNull("WorkFlowXML"))
     {
         entity.Workflowxml = (string)row["WorkFlowXML"];
     }
     else
     {
     }
 }
Example #54
0
 public ClassInSchoolObject(DataColumnCollection columns, DataRow row)
 {
     this.id = columns.Contains("id") ? Convert.ToInt32(row["id"]) : -1;
     this.classId = (columns.Contains("class_id") && !row.IsNull("class_id")) ? Convert.ToInt32(row["class_id"]) : -1;
     this.schoolId = (columns.Contains("school_id") && !row.IsNull("school_id")) ? Convert.ToInt32(row["school_id"]) : -1;
     this.teacherId = (columns.Contains("teacher_id") && !row.IsNull("teacher_id")) ? Convert.ToInt32(row["teacher_id"]) : -1;
     this.className = (columns.Contains("class_name") && !row.IsNull("class_name")) ? Convert.ToString(row["class_name"]) : "-";
     this.schoolName = (columns.Contains("school_name") && !row.IsNull("school_name")) ? Convert.ToString(row["school_name"]) : "-";
     this.teacherName = (columns.Contains("teacher") && !row.IsNull("teacher")) ? Convert.ToString(row["teacher"]) : "-";
 }
        /// <summary>
        /// Applies the filter on the column corresponding to the variable in the given datarow 
        /// </summary>
        internal override Boolean ApplyFilter(DataRow row, Boolean applyNegation) {
            Boolean keepRow = true;

            //Check is performed only if the row contains a column named like the filter's variable
            if (row.Table.Columns.Contains(this.Variable.ToString())) {

                //Successfull match if the variable is bound to a value
                keepRow     = !row.IsNull(this.Variable.ToString());

                //Apply the eventual negation
                if (applyNegation) {
                    keepRow = !keepRow;
                }
            }

            return keepRow;
        }
Example #56
0
 public static string ValidateValue(String defaultValue, System.Data.DataRow row, String fieldName)
 {
     try
     {
         if (row.IsNull(fieldName))
         {
             return(defaultValue);
         }
         else
         {
             return((String)row[fieldName]);
         }
     }
     catch
     {
         return(defaultValue);
     }
 }
Example #57
0
        /// <summary>
        ///     Generates the bot from row.
        /// </summary>
        /// <param name="row">The row.</param>
        /// <returns>RoomBot.</returns>
        internal static RoomBot GenerateBotFromRow(DataRow row)
        {
            if (row == null)
                return null;

            uint id = Convert.ToUInt32(row["id"]);

            List<string> speeches = null;

            if (!row.IsNull("speech") && !string.IsNullOrEmpty(row["speech"].ToString()))
                speeches = row["speech"].ToString().Split(';').ToList();

            RoomBot bot = new RoomBot(id, (uint)row["user_id"], AiType.Generic, row["bot_type"].ToString());

            bot.Update((uint)row["room_id"], row["walk_mode"].ToString(), (string) row["name"], (string) row["motto"], (string) row["look"], int.Parse(row["x"].ToString()), int.Parse(row["y"].ToString()), int.Parse(row["z"].ToString()), 4, 0, 0, 0, 0, speeches, null, row["gender"].ToString(), (uint) row["dance"], (uint) row["speaking_interval"], (int)row["automatic_chat"] == 1, (int)row["mix_phrases"] == 1);

            return bot;
        }
Example #58
0
 public static Int64 ValidateValue(Int64 defaultValue, System.Data.DataRow row, String fieldName)
 {
     try
     {
         if (row.IsNull(fieldName))
         {
             return(defaultValue);
         }
         else
         {
             return(Convert.ToInt64(row[fieldName]));
         }
     }
     catch
     {
         return(defaultValue);
     }
 }
Example #59
0
        private static Column SchemaRowToColumn(Table table, DataRow row)
        {
            var sqlDbType = row.IsNull("type_name") ? SqlDbType.Udt : DbTypeFromInformationSchemaTypeName((string)row["type_name"]);
            var size = (short)row["max_length"];
            switch (sqlDbType)
            {
                case SqlDbType.Image:
                case SqlDbType.NText:
                case SqlDbType.Text:
                    size = -1;
                    break;
                case SqlDbType.NChar:
                case SqlDbType.NVarChar:
                    size = (short)(size / 2);
                    break;
            }

            return new SqlColumn(row["name"].ToString(), table, (bool)row["is_identity"], sqlDbType, size);
        }
Example #60
0
 public static double ValidateValue(double defaultValue, System.Data.DataRow row, String fieldName)
 {
     try
     {
         if (row.IsNull(fieldName))
         {
             return(defaultValue);
         }
         else
         {
             NumberFormatInfo provider = new NumberFormatInfo();
             provider.NumberDecimalSeparator = ",";
             return(Convert.ToDouble(row[fieldName].ToString().Replace(".", ","), provider));
         }
     }
     catch
     {
         return(defaultValue);
     }
 }