Esempio n. 1
0
        public void DoTransfer()
        {
            int handle = 0;

            Global.BCCInit();
            //make a new bcc handle
            handle         = BCCHelper.NewXpackHandle(@"KSLib\cpack.dat");
            importedAmount = 0.0d;
            importedCnt    = 0;
            errors         = new List <string>();
            DateTime start = DateTime.Now;

            foreach (DataRow dr in dataSource.Rows)
            {
                BCCHelper.ResetPackHandle(handle);
                DoSingleEntryTrans(dr, handle);
            }
            AllEntryCompletedEventArgs e = new AllEntryCompletedEventArgs(dataSource.Rows.Count, "All Completed!");
            StringBuilder summary        = new StringBuilder();

            summary.Append(System.Environment.NewLine + "结果汇总:" + System.Environment.NewLine);
            summary.Append("\t原始记录数:" + dataSource.Rows.Count + System.Environment.NewLine);
            summary.Append("\t导入开始时间:" + start.ToString() + System.Environment.NewLine);
            summary.Append("\t导入结束时间:" + DateTime.Now.ToString() + System.Environment.NewLine);
            summary.AppendFormat("\t成功处理:{0}条,总金额:{1} {2}", importedCnt, importedAmount, System.Environment.NewLine);
            summary.Append("\t未能导入的名单如下:" + System.Environment.NewLine);
            summary.AppendFormat("{0}", FormatListToString(errors));
            e.Errors  = errors;
            e.Summary = summary.ToString();
            OnAllEntryCompleted(e);
        }
Esempio n. 2
0
 private void DoSingleWalletRegister(Customer c, int handle)
 {
     BCCHelper.ResetPackHandle(handle);
     BCCHelper.SetIntFieldByName(handle, 0, "lvol0", c.CustomerId);  //客户号
     //BCCHelper.SetIntFieldByName(handle, 0, "lvol1", 888);  //终端号
     if (BCCHelper.SetRequestType(handle, 846331))
     {
         int           errCode       = 0;
         int           retCode       = -1;
         StringBuilder errMsg        = new StringBuilder(255);
         bool          requestStatus = BCCHelper.CallRequest(handle, Global.Drtp_NO, Global.Drtp_Branch, Global.BCC_BaseFunction, 5000, ref errCode, errMsg);
         if (!requestStatus)
         {
             Global.Logger.Warn(string.Format("BCCHelper.CallRequest[846331] failed! errorCode ={0} and errMsg= {1}", errCode, errMsg));
             return;
         }
         BCCHelper.GetRetCode(handle, ref retCode);
         //int ser=0;
         //BCCHelper.GetIntFieldByName(handle, 0, "scust_no", ref ser);
         string ser  = BCCHelper.GetStringFieldByName(handle, 0, "scust_no");
         string pass = BCCHelper.GetStringFieldByName(handle, 0, "scust_limit");
         string msg  = BCCHelper.GetStringFieldByName(handle, 0, "vsmess");
         if (retCode != 0)
         {
             //fail to wallet registration
             frmLoading.NotifyIndicator(string.Format("failed ,customer#{0}:{1}", c.CustomerId, errMsg));
             Global.Logger.Warn(string.Format(" failed ,Customerid ={0} and errMsg= {1}", c.CustomerId, msg));
         }
         else
         {
             //succuess to wallet registration
             Customer target = customers.Find(delegate(Customer o)
             {
                 return(o.CustomerId == c.CustomerId);
             });
             //target.NetAccFlag = "1";
             //target.NetAccFlagDes = "已开通";
             Global.Logger.Info(string.Format("succ ,Customerid# = {0} and Wallet#= {1} ", c.CustomerId, ser));
             frmLoading.NotifyIndicator(string.Format("Customer#{0},ser#:{1} ", c.CustomerId, ser));
         }
     }
     else
     {
         Global.Logger.Info("BCCHelper.SetRequestType[846331] failed!");
     }
     //frmLoading.NotifyIndicator(customers.Count.ToString());
 }