Exemplo n.º 1
0
        public static DBgl_FriendRequestCollection GetAllItem()
        {
            string key  = SETTINGS_ALL_KEY;
            object obj2 = dtpCache.Get(key);

            if ((obj2 != null))
            {
                return((DBgl_FriendRequestCollection)obj2);
            }
            DBgl_FriendRequestCollection ItemCollection = new DBgl_FriendRequestCollection();
            Database  db        = SqlHelper.CreateConnection(SqlHelper.MyConnection);
            DbCommand dbCommand = db.GetStoredProcCommand("gl_FriendRequest_GetAll");

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBgl_FriendRequest item = GetItemFromReader(dataReader);
                    ItemCollection.Add(item);
                }
            }

            dtpCache.Max(key, ItemCollection);

            return(ItemCollection);
        }
Exemplo n.º 2
0
        public static DBgl_FriendRequestCollection GetAllItemFromUser(string fromUser)
        {
            string key  = string.Format(SETTINGS_ALL_FrmUser_KEY, fromUser);
            object obj2 = dtpCache.Get(key);

            if ((obj2 != null))
            {
                return((DBgl_FriendRequestCollection)obj2);
            }
            DBgl_FriendRequestCollection ItemCollection = new DBgl_FriendRequestCollection();
            Database  db        = SqlHelper.CreateConnection(SqlHelper.MyConnection);
            DbCommand dbCommand = db.GetStoredProcCommand("gl_FriendRequest_GetAllApproveByFromUser");

            db.AddInParameter(dbCommand, "FromUser", DbType.String, fromUser);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBgl_FriendRequest item = GetItemFromReader(dataReader);
                    ItemCollection.Add(item);
                }
            }

            dtpCache.Max(key, ItemCollection);

            return(ItemCollection);
        }
Exemplo n.º 3
0
        public static DBgl_FriendRequestCollection GetAllItemByWfId(Guid WorkflowId)
        {
            string key  = String.Format(SETTINGS_WorkflowId_KEY, WorkflowId);
            object obj2 = dtpCache.Get(key);

            if ((obj2 != null))
            {
                return((DBgl_FriendRequestCollection)obj2);
            }
            DBgl_FriendRequestCollection ItemCollection = new DBgl_FriendRequestCollection();
            Database  db        = SqlHelper.CreateConnection(SqlHelper.MyConnection);
            DbCommand dbCommand = db.GetStoredProcCommand("gl_FriendRequest_GetAllByWfId");

            db.AddInParameter(dbCommand, "WorkflowID", DbType.Guid, WorkflowId);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBgl_FriendRequest item = GetItemFromReader(dataReader);
                    ItemCollection.Add(item);
                }
            }

            dtpCache.Max(key, ItemCollection);

            return(ItemCollection);
        }
Exemplo n.º 4
0
        public static string GetJson(DBgl_FriendRequestCollection itemCollection)
        {
            StringBuilder builder = new StringBuilder();

            if (itemCollection.Count > 0)
            {
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                System.IO.StringWriter    sw = new System.IO.StringWriter(sb);
                using (JsonWriter jsonWriter = new JsonTextWriter(sw))
                {
                    jsonWriter.Formatting = Formatting.Indented;
                    jsonWriter.WriteStartObject();
                    jsonWriter.WritePropertyName("results");
                    jsonWriter.WriteStartArray();
                    itemCollection.ForEach(delegate(DBgl_FriendRequest objItem)
                    {
                        jsonWriter.WriteStartObject();
                        jsonWriter.WritePropertyName("RequestId");
                        jsonWriter.WriteValue(objItem.RequestId.ToString());
                        jsonWriter.WritePropertyName("FromUser");
                        jsonWriter.WriteValue(objItem.FromUser.ToString());
                        jsonWriter.WritePropertyName("toUser");
                        jsonWriter.WriteValue(objItem.toUser.ToString());
                        jsonWriter.WritePropertyName("Email");
                        jsonWriter.WriteValue(objItem.Email.ToString());
                        jsonWriter.WritePropertyName("requesttoken");
                        jsonWriter.WriteValue(objItem.requesttoken.ToString());
                        jsonWriter.WritePropertyName("createdDate");
                        jsonWriter.WriteValue(objItem.createdDate.ToString());
                        jsonWriter.WritePropertyName("createdUser");
                        jsonWriter.WriteValue(objItem.createdUser.ToString());
                        jsonWriter.WritePropertyName("WorkflowId");
                        jsonWriter.WriteValue(objItem.WorkflowId.ToString());
                        jsonWriter.WritePropertyName("isClick");
                        jsonWriter.WriteValue(objItem.isClick.ToString());
                        jsonWriter.WritePropertyName("IsApprove");
                        jsonWriter.WriteValue(objItem.IsApprove.ToString());
                        jsonWriter.WritePropertyName("isCancel");
                        jsonWriter.WriteValue(objItem.isCancel.ToString());
                        jsonWriter.WritePropertyName("comment");
                        jsonWriter.WriteValue(objItem.comment.ToString());
                        jsonWriter.WritePropertyName("RType");
                        jsonWriter.WriteValue(objItem.RType.ToString());

                        jsonWriter.WriteEndObject();
                    });
                    jsonWriter.WriteEndArray();

                    jsonWriter.WriteEndObject();
                    builder.AppendLine(sw.ToString());
                }
            }
            else
            {
                //  builder.AppendLine(@"{""results"":[{""id"":""-1"",""myvalue"":""" + MainFunction.ngonngu("gl.nodata") + @"""}]}");
            }
            return(builder.ToString());
        }
Exemplo n.º 5
0
        public static DBgl_FriendRequest GetUserInRequestList(Guid WorkflowId, Guid RequestTokenId)
        {
            DBgl_FriendRequest           objItem = null;
            DBgl_FriendRequestCollection objcol  = DBgl_FriendRequestManager.GetAllItemByWfId(WorkflowId);

            for (int i = 0; i < objcol.Count; i++)
            {
                if (objcol[i].requesttoken == RequestTokenId)
                {
                    objItem = objcol[i];
                    break;
                }
            }
            return(objItem);
        }
Exemplo n.º 6
0
        public static DBgl_FriendRequestCollection GetItemPagging(int page, int rec, string strSearch, out int TotalRecords)
        {
            TotalRecords = 0;
            DBgl_FriendRequestCollection ItemCollection = new DBgl_FriendRequestCollection();
            Database  db        = SqlHelper.CreateConnection(SqlHelper.MyConnection);
            DbCommand dbCommand = db.GetStoredProcCommand("gl_FriendRequest_Paging");

            db.AddInParameter(dbCommand, "Page", DbType.Int32, page);
            db.AddInParameter(dbCommand, "RecsPerPage", DbType.Int32, rec);
            db.AddInParameter(dbCommand, "SearchValue", DbType.String, strSearch);
            db.AddOutParameter(dbCommand, "TotalRecords", DbType.Int32, 0);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBgl_FriendRequest item = GetItemFromReader(dataReader);
                    ItemCollection.Add(item);
                }
            }
            TotalRecords = Convert.ToInt32(db.GetParameterValue(dbCommand, "@TotalRecords"));
            return(ItemCollection);
        }