예제 #1
0
 public void ListTest([Range(1, 1, 1)]  int counter) {
     XWDPXLIA lprm = new XWDPXLIA();
     lprm.CMD = "LIST";
     XWDPXLOA lres = SyncService.XWDPXL0N(lprm);
     //Assert.AreEqual(lres.VOLIST.Count, 20);
     foreach (XWDPXLOADPLIST item in lres.DPLIST) {
         System.Console.WriteLine(item.DPCODE + " " + item.DPBUHCODE + " " + item.DPNAME);
     }
     //Assert.AreEqual(count, 20);
 }
예제 #2
0
        protected void DoWorkCore(LongOperation longOperation)
        {
            //Random random = new Random();
            IObjectSpace os = Application.CreateObjectSpace();
            //            IList<FullyAuditedBatchCreationObject> collection = updatingObjectSpace.GetObjects<FullyAuditedBatchCreationObject>();
            int index = 0;

            try {
                HTTPSyncService syncservice = new HTTPSyncService(ConfigurationManager.AppSettings["IBS.SyncService"]);
                XWDPXLIA        msg_in      = new XWDPXLIA();
                msg_in.CMD = "LIST";
                XWDPXLOA msg_out = syncservice.XWDPXL0N(msg_in);
                foreach (XWDPXLOADPLIST dps in msg_out.DPLIST)
                {
                    hrmDepartment         dp;
                    IList <hrmDepartment> dpl = os.GetObjects <hrmDepartment>(new BinaryOperator("BuhCode", dps.DPBUHCODE.ToString(), BinaryOperatorType.Equal));
                    if (dpl.Count > 0)
                    {
                        dp = dpl[0];
                    }
                    else
                    {
                        dp = os.CreateObject <hrmDepartment>();
                    }
                    if (dp.Code != dps.DPCODE)
                    {
                        dp.Code = dps.DPCODE;
                    }
                    if (dp.BuhCode != dps.DPBUHCODE.ToString())
                    {
                        dp.BuhCode = dps.DPBUHCODE.ToString();
                    }
                    if (dp.Name != dps.DPNAME)
                    {
                        dp.Name = dps.DPNAME;
                    }
                    if (dp.IsClosed != dps.DPISCLOSED)
                    {
                        dp.IsClosed = dps.DPISCLOSED;
                    }
                    os.CommitChanges();
                    //
                    if (longOperation.Status == LongOperationStatus.InProgress)
                    {
                        longOperation.RaiseProgressChanged((int)((++index * 100) / msg_out.DPLIST.Count), "Update Departnent " + index.ToString() + " from " + msg_out.DPLIST.Count.ToString());
//                        longOperation.RaiseProgressChanged((int)((++index * 100) / dpl.Count), "Update Departnent " + index.ToString() + " from " + msg_out.DPLIST.Count.ToString());
                    }
                    if (longOperation.Status == LongOperationStatus.Cancelling)
                    {
                        return;
                    }
                }
            }
            catch (LongOperationTerminateException) {
                os.Rollback();
                longOperation.CancelAsync();
            }
            catch (Exception e) {
                longOperation.TerminateAsync();
                throw e;
            }
            //os.Rollback();
        }