Exemple #1
0
        private void TimerFunction()
        {
            //判断是否到了刷新时间段
            if (!IsInFreshduration())
            {
                m_bIsInFreshduration = false;
                return;
            }
            if (m_bIsInFreshduration == false)
            {
                ShowLogString(string.Format("首次进入当日的刷新时间段,初始化数据"));
                //刚进入时间段,需要初始化次数
                m_iHaveFreshedTime = 0;
                DataContrl.InitFreshTime(m_iGetPage);
                //ShowInfo
                string[]       strArray = DataContrl.GetAllAccount().Split(',');
                _GoodsFreshStr goodInfo = new _GoodsFreshStr();
                foreach (string strAcc in strArray)
                {
                    if (strAcc == "")
                    {
                        break;
                    }
                    bool bRet = DataContrl.GetDataCache(strAcc, ref goodInfo);
                }
            }
            m_bIsInFreshduration = true;
            if (m_iHaveFreshedTime >= m_iGetPage)
            {
                ShowLogString(string.Format("已经达到设定的当日刷新次数"));
                return;
            }
            //判断是否超过了刷新间隔
            TimeSpan tSpan = DateTime.Now - m_dLastFreshTime;
            int      i     = (int)tSpan.TotalMinutes;

            if (i < m_iRefreshInterval * 60)   //未到刷新间隔
            {
                return;
            }
            m_dLastFreshTime = DateTime.Now;
            //将列表中的所有账号加入等待刷新队列
            DataContrl.InitFreshAccount();
            m_iHaveFreshedTime++;
            ShowLogString(string.Format("达到刷新间隔时间,初始化刷新账号队列,刷新类型:{0}", m_iFreshType == 0?"一键刷新":"自定义刷新"));
        }
Exemple #2
0
        private void listView_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            ListViewHitTestInfo info = listView.HitTest(e.X, e.Y);

            if (info.Item != null)
            {
                string    strAcc = info.Item.SubItems[1].Text;
                Hashtable hTable = new Hashtable();
                bool      bRet   = DataContrl.GetNeedAddData(strAcc, ref hTable);
                if (bRet)
                {
                    if (hTable.Count > 0)
                    {
                        StringBuilder   strBuilder = new StringBuilder();
                        _GoodsModifyStr objModify  = new _GoodsModifyStr();
                        int             iCount     = 0;
                        foreach (DictionaryEntry dEntry in hTable)
                        {
                            objModify = (_GoodsModifyStr)dEntry.Value;
                            string strInfo = "";
                            if (objModify.iFailFlag != 3 && objModify.iFailFlag != 2)
                            {
                                strInfo = "";
                                strBuilder.Append(string.Format("{0}  {1} {2}\r\n", objModify.strNoEx, objModify.fPrice, strInfo));
                                iCount++;
                            }
                        }
                        string strDirectory = System.AppDomain.CurrentDomain.BaseDirectory + "needaddfile";
                        WriteInfo(strDirectory, strBuilder, strAcc);
                        string strFileName = strAcc + ".txt";
                        strFileName = strDirectory + "\\" + strFileName;
                        string strInfoShow = strBuilder.ToString();
                        if (strInfoShow.Length > 200)
                        {
                            strInfoShow = strInfoShow.Substring(0, 200) + ".....";
                        }
                        string strShow = string.Format("待添加信息{0}条\r\n请在 needaddfile\\{1}.txt 中查看\r\n{2}", iCount, strAcc, strInfoShow);
                        MessageBox.Show(strShow);
                    }
                }
            }
        }
Exemple #3
0
        private void SynchroGoodInfo_Click(object sender, EventArgs e)
        {
            if (!m_bIsStartFresh)
            {
                MessageBox.Show("请先启动线程!");
                return;
            }
            if (DataContrl.GetAccCount() < 1)
            {
                MessageBox.Show("请先导入帐号!");
                return;
            }
            string strShow = string.Format("此操作将会对未同步过的账号进行商品同步,完成后需要重启程序,要执行吗?");

            if (DialogResult.OK != MessageBox.Show(strShow, "询问", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
            {
                return;
            }
            //同步商品信息
            //开始同步商品信息,只对未同步过的账号进行同步
            DataContrl.InitSynAccount();
        }
Exemple #4
0
        private void btnModifyPrice_Click(object sender, EventArgs e)
        {
            if (!m_bIsStartFresh)
            {
                MessageBox.Show("请先启动线程!");
                return;
            }
            if (DataContrl.GetAccCount() < 1)
            {
                MessageBox.Show("请先导入帐号!");
                return;
            }
            int iCount = DataContrl.GetModifyCount();

            if (iCount > 0)
            {
                MessageBox.Show("正在修改中,请等待修改完后再执行此操作!");
                return;
            }
            //添加
            DataContrl.InitModifyAccount();
        }
Exemple #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            // _GoodsFreshStr objInfoEx = new _GoodsFreshStr();
            //objInfoEx.strAcc = "aaa";
            TestStr1 bulder = new TestStr1();

            bulder.strAcc = "AAA";
            Hashtable tblHash = new Hashtable();

            bulder.strAcc = "AAABBB";

            _GoodsFreshStr objInfoExEx = new _GoodsFreshStr();

            string strDirectoryXls = System.AppDomain.CurrentDomain.BaseDirectory + "xlsfile";

            SaveToExcel(strDirectoryXls, null, "aaaaa");
            return;

            GoodsFresh    objFreshEx = new GoodsFresh();
            ClassHttpPost webPost    = new ClassHttpPost();

            objFreshEx.SetWebPost(webPost);

            string strDirect = System.AppDomain.CurrentDomain.BaseDirectory + "pic";

            if (!Directory.Exists(strDirect))
            {
                Directory.CreateDirectory(strDirect);
            }

            return;

            //string str = System.Web.HttpUtility.UrlEncode("你好", Encoding.GetEncoding("gb2312"));
            string str = string.Format("{0}    {1}", 519.0, 535.01);

            MessageBox.Show(str);
            return;

            TimerFunction();
            return;

            string         strAcc  = "heilongjiangjt";
            _GoodsFreshStr objInfo = new _GoodsFreshStr();

            DataContrl.GetDataCache(strAcc, ref objInfo);
            MessageBox.Show(objInfo.iFreshCount.ToString());
            objInfo.iFreshCount = 2;
            //DataContrl.InitFreshTime();
            DataContrl.GetDataCache(strAcc, ref objInfo);
            MessageBox.Show(objInfo.iFreshCount.ToString());
            return;

            IsSetIllegal(); return;

            _GoodsFreshStr goodInfo = new _GoodsFreshStr();
            bool           bRet     = DataContrl.GetDataCache("heilongjiangjt", ref goodInfo);

            if (!bRet)
            {
                return;
            }
            GoodsFresh objFresh = new GoodsFresh();

            objFresh.SetWebPost(goodInfo.webPost);
            bRet = objFresh.Login(goodInfo.strAcc, goodInfo.strPwd, true);
            string strError = "";

            objFresh.FreshQuick(out strError, out strError);
        }