コード例 #1
0
 public static void FillObject(Business.DataObjectCommunity item, SqlDataReader sqlReader)
 {
     if (sqlReader["VirtualURL"] != DBNull.Value)
     {
         item.VirtualURL = sqlReader["VirtualURL"].ToString();
     }
     item.Managed         = (bool)sqlReader["Managed"];
     item.CreateGroupUser = (_4screen.CSB.Common.CommunityUsersType)Enum.Parse(typeof(_4screen.CSB.Common.CommunityUsersType), sqlReader["CreateGroupUser"].ToString());
     item.UploadUsers     = (_4screen.CSB.Common.CommunityUsersType)Enum.Parse(typeof(_4screen.CSB.Common.CommunityUsersType), sqlReader["UploadUsers"].ToString());
     if (sqlReader["Emphasis"] != DBNull.Value)
     {
         item.emphasisListXml.LoadXml(sqlReader["Emphasis"].ToString());
     }
 }
コード例 #2
0
 private static void SetParameters(Business.DataObjectCommunity item, SqlParameterCollection parameters)
 {
     if (!string.IsNullOrEmpty(item.VirtualURL))
     {
         parameters.AddWithValue("@VirtualURL", item.VirtualURL);
     }
     else
     {
         parameters.AddWithValue("@VirtualURL", DBNull.Value);
     }
     parameters.AddWithValue("@Managed", item.Managed);
     parameters.AddWithValue("@CreateGroupUser", item.CreateGroupUser);
     parameters.AddWithValue("@UploadUsers", item.UploadUsers);
     parameters.AddWithValue("@Emphasis", item.emphasisListXml.OuterXml);
 }
コード例 #3
0
        private bool SetEmphasisCommunity(Guid? communityID, Dictionary<int, int> dicThreshold, UserDataContext udc)
        {
            int intTotal = 0;
            SqlDataReader sqlReader = null;
            try
            {
                Dictionary<int, int> list = new Dictionary<int, int>();

                sqlReader = Data.InfoObjects.GetReader(null, communityID, null, null);
                while (sqlReader.Read())
                {
                    int enuObjectType = Convert.ToInt32(sqlReader["OBJ_Type"]);
                    if (!dicThreshold.ContainsKey(enuObjectType))
                        continue;

                    int intCount = Convert.ToInt32(sqlReader["OBJ_Count"].ToString());
                    if (intCount < dicThreshold[enuObjectType])
                        continue;

                    list.Add(enuObjectType, intCount);
                    intTotal += intCount;
                }

                Business.DataObjectCommunity objCty = Business.DataObject.Load<Business.DataObjectCommunity>(communityID.Value, null, false);
                if (objCty.State == ObjectState.Saved)
                {
                    List<int> keys = new List<int>(list.Keys);
                    foreach (int key in keys)
                    {
                        list[key] = (int)Math.Round(100.0 / intTotal * list[key]);
                    }

                    objCty.EmphasisList = list;
                    //objCty.UpdateSpezialXml();
                }
            }
            finally
            {
                if (sqlReader != null)
                    sqlReader.Close();
                sqlReader = null;
            }

            return (intTotal > 0);
        }
コード例 #4
0
 public static string GetUpdateSQL(Business.DataObjectCommunity item, SqlParameterCollection parameters)
 {
     SetParameters(item, parameters);
     return("UPDATE hiobj_Community SET [VirtualURL] = @VirtualURL, [Managed] = @Managed, [CreateGroupUser] = @CreateGroupUser, [UploadUsers] =  @UploadUsers, [Emphasis] = @Emphasis");
 }
コード例 #5
0
 public static string GetInsertSQL(Business.DataObjectCommunity item, SqlParameterCollection parameters)
 {
     SetParameters(item, parameters);
     return("INSERT INTO hiobj_Community ([OBJ_ID],[VirtualURL],[Managed],[CreateGroupUser],[UploadUsers],[Emphasis]) VALUES (@OBJ_ID,@VirtualURL,@Managed,@CreateGroupUser,@UploadUsers,@Emphasis)");
 }