Exemplo n.º 1
0
        public PostData getPostData()
        {
            PostData data = new PostData();

            Func.putPassWord(data);
            data.Add("tab", tab);
            data.Add("isnew", isnew);

            String tags = "";

            foreach (string key in dicTags.Keys)
            {
                Object obj = dicTags[key];
                if (obj is int)
                {
                    if (string.IsNullOrEmpty(tags))
                    {
                        tags = String.Format(" {0}={1} ", key, obj.ToString());
                    }
                    else
                    {
                        tags += String.Format(" AND {0}={1} ", key, obj.ToString());
                    }
                }
                else if (obj is string)
                {
                    if (string.IsNullOrEmpty(tags))
                    {
                        tags = String.Format(" {0}='{1}' ", key, obj.ToString());
                    }
                    else
                    {
                        tags += String.Format(" AND {0}='{1}' ", key, obj.ToString());
                    }
                }
            }
            data.Add("tags", tags);

            String fieldsupdate = "";

            foreach (string key in dicFeilds.Keys)
            {
                Object obj = dicFeilds[key];
                if (obj is int)
                {
                    if (string.IsNullOrEmpty(fieldsupdate))
                    {
                        fieldsupdate = String.Format(" {0}={1} ", key, obj.ToString());
                    }
                    else
                    {
                        fieldsupdate += String.Format(" AND {0}={1} ", key, obj.ToString());
                    }
                }
                else if (obj is string)
                {
                    if (string.IsNullOrEmpty(fieldsupdate))
                    {
                        fieldsupdate = String.Format(" {0}='{1}' ", key, obj.ToString());
                    }
                    else
                    {
                        fieldsupdate += String.Format(" AND {0}='{1}' ", key, obj.ToString());
                    }
                }
            }
            data.Add("fieldsupdate", fieldsupdate);

            String fieldsinsert1 = "";
            String fieldsinsert2 = "";

            foreach (string key in dicFeilds.Keys)
            {
                Object obj = dicFeilds[key];
                //key
                if (string.IsNullOrEmpty(fieldsinsert1))
                {
                    fieldsinsert1 = String.Format("{0}", key);
                }
                else
                {
                    fieldsinsert1 += String.Format(",{0}", key);
                }

                //value
                if (obj is int)
                {
                    if (string.IsNullOrEmpty(fieldsinsert2))
                    {
                        fieldsinsert2 = String.Format("{0}", obj.ToString());
                    }
                    else
                    {
                        fieldsinsert2 += String.Format(",{0}", obj.ToString());
                    }
                }
                else if (obj is string)
                {
                    if (string.IsNullOrEmpty(fieldsinsert2))
                    {
                        fieldsinsert2 = String.Format("'{0}'", obj.ToString());
                    }
                    else
                    {
                        fieldsinsert2 += String.Format(",'{0}'", obj.ToString());
                    }
                }
            }
            data.Add("fieldsinsert", String.Format(" {0} values {1} ", fieldsinsert1, fieldsinsert2));

            return(data);
        }
Exemplo n.º 2
0
        public PostData getPostData()
        {
            PostData data = new PostData();

            Func.putPassWord(data);
            data.Add("tab", tab);
            if (!String.IsNullOrEmpty(order) && !String.IsNullOrEmpty(desc))
            {
                data.Add("order", order);
                data.Add("desc", desc);
            }
            if (!String.IsNullOrEmpty(start) && !String.IsNullOrEmpty(count))
            {
                data.Add("start", start);
                data.Add("count", count);
            }

            String tags = "";

            foreach (string key in dicTags.Keys)
            {
                Object obj = dicTags[key];
                if (obj is int)
                {
                    if (string.IsNullOrEmpty(tags))
                    {
                        tags = String.Format(" {0}={1} ", key, obj.ToString());
                    }
                    else
                    {
                        tags += String.Format(" AND {0}={1} ", key, obj.ToString());
                    }
                }
                else if (obj is string)
                {
                    if (string.IsNullOrEmpty(tags))
                    {
                        tags = String.Format(" {0}='{1}' ", key, obj.ToString());
                    }
                    else
                    {
                        tags += String.Format(" AND {0}='{1}' ", key, obj.ToString());
                    }
                }
            }
            data.Add("tags", tags);

            String fields = "";

            foreach (string str in lsFeilds)
            {
                if (string.IsNullOrEmpty(fields))
                {
                    fields = str;
                }
                else
                {
                    fields += "," + str;
                }
            }
            data.Add("fields", fields);
            return(data);
        }