예제 #1
0
        public static void  UpdateFlag(DataTable DT, string TableName)
        {
            string OrgId = ConfigurationSettings.AppSettings["OrgId"];
            string idStr = "(";

            if (DT.Rows.Count > 0)
            {
                for (int i = 0; i < DT.Rows.Count; i++)
                {
                    if (i + 1 != DT.Rows.Count)
                    {
                        idStr += "'" + DT.Rows[i]["id"].ToString() + "',";
                    }
                    else
                    {
                        idStr += "'" + DT.Rows[i]["id"].ToString() + "')";
                    }
                }
                string SqlStr = "update " + TableName + " set flag = 1 where orgid = '" + OrgId + "' and id  in " + idStr;
                SqlDeal.NonQuery(SqlStr);
            }
        }
예제 #2
0
        public static DataTable UploadData(McHttpDto dto, string SqlStr, string resource)
        {
            Int64     _OrgId   = Int64.Parse(ConfigurationSettings.AppSettings["_OrgId"]);
            string    jsonData = string.Empty;
            DataTable DT       = SqlDeal.Query(SqlStr).Tables[0];

            // 处理转化
            for (int i = 0; i < DT.Rows.Count; i++)
            {
                if (i + 1 != DT.Rows.Count)
                {
                    jsonData += GetJson(DT.Rows[i]) + ",";
                }
                else
                {
                    jsonData += GetJson(DT.Rows[i]);
                }
            }
            // jsonData = JsonConvert.SerializeObject(DT);
            Console.WriteLine(jsonData);
            jsonData = "{\"" + resource + "\":{\"orgId\":" + _OrgId + ",\"data\": [" + jsonData + "] }}";
            //dto.apiStr = "external/mquantitys-upload?tag=mix&resource=" + resource + "&version=1";
            //dto.ParasStr = "external/mquantitys-upload?tag=mix&resource=" + resource + "&version=1";
            dto.apiStr   = "/api/mquantity/mquantitys-upload?resource=" + resource + "&tag=mix&version=1";
            dto.ParasStr = "/api/mquantity/mquantitys-upload?&resource=" + resource + "&tag=mixversion=1";
            YLHttpHelperMc client = new YLHttpHelperMc(null);
            ResultDto      result = JsonConvert.DeserializeObject <ResultDto>(client.HttpPost(dto, jsonData));

            if (result.success)
            {
                return(DT);
            }
            else
            {
                return(new DataTable());
            }
        }