Beispiel #1
0
 protected void Button6_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtSellerName.Text.Trim()))
     {
         Label8.Text = "卖家昵称不能为空!";
         return;
     }
     SellersBLL.SetSyncProcess(txtSellerName.Text.Trim(), 0);
     Label8.Text = "结束成功!";
 }
Beispiel #2
0
        public void DoExec()
        {
            List <string> lsUserName, lsSession, lsTime;

            //获取需要同步会员的卖家信息
            SqlData.GetSyncMemUser(out lsUserName, out lsSession, out lsTime);

            for (int i = 0; i < lsUserName.Count; i++)
            {
                try
                {
                    //设置已经同步过的卖家状态,防止重复同步数据
                    if (lsUserSync.IndexOf(lsUserName[i]) >= 0)
                    {
                        SellersBLL.SetSyncProcess(lsUserName[i], 0);
                        continue;
                    }
                    if (SyncWait.Count >= DeleNum)
                    {
                        WaitHandle.WaitAny(SyncWait.ToArray());
                    }
                    for (int k = 0; k < SyncSync.Length; k++)
                    {
                        if (SyncSync[k] == null || SyncSync[k].IsCompleted)
                        {
                            if (SyncFunc[k] != null)  //委托使用过,进行释放
                            {
                                lsUserSync.Remove(SyncFunc[k].EndInvoke(SyncSync[k]));
                                SyncWait.Remove(SyncSync[k].AsyncWaitHandle);
                                SyncSync[k] = null;
                                SyncFunc[k] = null;
                            }
                            lsUserSync.Add(lsUserName[i]);
                            SyncFunc[k] = new funSyncDele(SyncMemDele);
                            SyncSync[k] = SyncFunc[k].BeginInvoke(lsUserName[i], lsSession[i], lsTime[i], null, null);
                            SyncWait.Add(SyncSync[k].AsyncWaitHandle);
                            break;
                        }
                    }
                }
                catch (Exception err)
                {
                    ExceptionReporter.WriteLog(err, ExceptionPostion.TBApply_Data);
                }
            }
        }
Beispiel #3
0
 public string SyncMemDele(string strUserName, string strSession, string strTime)
 {
     try
     {
         Console.WriteLine("开始同步,卖家:" + strUserName);
         //初始化系统分组
         InitGroup(strUserName);
         //同步系统订单,全部同步
         if (string.IsNullOrEmpty(strTime))
         {
             //获取会员数据量
             string memberNum = BuyerBLL.GetBuyerCount("1", strUserName);
             if (memberNum.Equals("0") == true)
             {//如果会员数量为0则添加一个表
                 //获取id
                 string seller_id = SellersBLL.GetSellerIdByNick(strUserName);
                 if (string.IsNullOrEmpty(seller_id) == false)
                 {//如果seller_id不为空则创建一个新表
                     SellersDAL.addBuyer(seller_id);
                 }
             }
             BuyerBLL buyerObj = new BuyerBLL();
             if (buyerObj.SynicBuyersInformation(strUserName, strSession))
             {
                 //将最新同步数据时间更新写入DB
                 Sellers objSeller = new Sellers();
                 objSeller.Nick = strUserName;
                 SellersBLL.UpdateSellerSynDate(objSeller);
                 SellersBLL.SetSyncProcess(strUserName, 0);
             }
         }
     }
     catch (Exception err)
     {
         ExceptionReporter.WriteLog(err, ExceptionPostion.TBApply_Data);
     }
     return(strUserName);
 }