예제 #1
0
        private void SaveApproveData()
        {
            string       data           = Request.Form["data"];
            Login        login          = (Login)Session[DataCleaningConstant.LoginInfoSession];
            var          jsonSerialiser = new JavaScriptSerializer();
            FullCardInfo info           = jsonSerialiser.Deserialize <FullCardInfo>(data);

            if (info != null)
            {
                info.approve_address1 = HttpUtility.HtmlDecode(info.approve_address1);
                info.approve_address2 = HttpUtility.HtmlDecode(info.approve_address2);
                info.approve_address3 = HttpUtility.HtmlDecode(info.approve_address3);
                info.approve_address4 = HttpUtility.HtmlDecode(info.approve_address4);
            }
            DataProcessHelper dataProcessHelper = new DataProcessHelper();
            TimeSpan          totalTime         = DateTime.Parse(info.endtime).Subtract(DateTime.Parse(info.starttime));
            double            total             = totalTime.TotalSeconds;
            int result = dataProcessHelper.SaveApproveData(info.management_id, info.data_process_id, info.approve_address1, info.approve_address2, info.approve_address3, info.approve_address4, login.UserLogin.user_name, info.starttime, info.endtime, total, info.step, info.data_id);

            Response.Write(result.ToString());
            Response.End();
        }
예제 #2
0
        static void Main(string[] args)
        {
            var serializer             = new XmlSerializer(typeof(List <XmlInfoPart>));
            List <FullCardInfo> fLisst = new List <FullCardInfo>();

            for (int i = 0; i < rowCnt; ++i)
            {
                var tmp = FullCardInfo.CreateNewRand();
                fLisst.Add(tmp);
            }
            fLisst = fLisst.Distinct(new CardInfoComparer()).ToList();
            Random r         = new Random();
            var    permXList = fLisst.Select(x => x.xml).OrderBy(x => r.Next()).ToList();
            var    permCList = fLisst.Select(x => x.csv).OrderBy(x => r.Next()).ToList();

            var cnt = 0;

            while (cnt < rowCnt)
            {
                var batchSize = r.Next(1000, 5000);
                var batch     = permXList.Skip(cnt).Take(batchSize);
                using (FileStream fs = new FileStream($"{dir}/{Guid.NewGuid().ToString("N")}.xml", FileMode.CreateNew))
                    serializer.Serialize(fs, batch.ToList());
                cnt += batchSize;
            }

            cnt = 0;
            while (cnt < rowCnt)
            {
                var batchSize = r.Next(1000, 5000);
                var batch     = permCList.Skip(cnt).Take(batchSize);
                using (StreamWriter sw = new StreamWriter($"{dir}/{Guid.NewGuid().ToString("N")}.csv"))
                    sw.WriteLine(string.Join(Environment.NewLine, batch));
                cnt += batchSize;
            }
        }