Beispiel #1
0
        private void ResetAll()
        {
            CloseDocument();

            docView.VirtualListSize = 0;
            docView.Columns.Clear();
            ///
            logSB = new StringBuilder();

            mainProgressBar.Value = 0;
            massMsg = new MassMsgStorage();
            msm = new MySqlKannelManager();
            massMsg.TranslitEnabled = smsSetts.NeedTransliteration;
            //massMsg.progressChanged += new ChangeProgress(ProgressChangedEventHandler);
            //massMsg.reportAdded+=new ReportTransl(addStringToLog);

            docView.ClearCache();
            UpdateWinCap();
        }
Beispiel #2
0
        //internal void UpdateStatuses(MySqlKannelManager msm, ChangeProgressNotifier changeProgressDel)
        //{
        //    if (msm == null)
        //        return;
        //    if(IsEmpty)
        //        return;
        //    Dictionary<string, TargetInfo> fastStorage = new Dictionary<string,TargetInfo>(rcvList.Count);
        //    foreach(TargetInfo ti in rcvList)
        //    {
        //        fastStorage.Add(ti.phoneNumber, ti);
        //    }
        //    msm.GetDlrMessages();
        //    int updatedCnt = 0;
        //    for (int i = 0; i < msm.MsgList.Count; i++ )
        //    {
        //        SqlDataContainer sqdc = msm.MsgList[i];
        //        int dlrmask = int.Parse(sqdc[SqlBoxColId.dlr_mask]);
        //        if (fastStorage.ContainsKey(sqdc[SqlBoxColId.receiver]))
        //        {
        //            fastStorage[sqdc[SqlBoxColId.receiver]].dlr = (DLRStatus)dlrmask;
        //            updatedCnt++;
        //        }
        //        if (changeProgressDel != null)
        //            changeProgressDel.Invoke((int)((((double)i / (double)msm.MsgList.Count)) * 100));
        //    }
        //}
        internal void UpdateStatuses(MySqlKannelManager msm, ChangeProgressNotifier changeProgressDel)
        {
            if (msm == null)
                return;
            if (IsEmpty)
                return;

            msm.GetDlrMessages();
            Dictionary<string, SqlDataContainer> fastStorage = new Dictionary<string, SqlDataContainer>(msm.MsgList.Count);

            foreach (SqlDataContainer ans in msm.MsgList)
            {
                fastStorage[ans[SqlBoxColId.receiver]] = ans;
            }

            int updatedCnt = 0;

            for (int i = 0; i < rcvList.Count; i++)
            {
                SqlDataContainer sqdc;
                if (fastStorage.TryGetValue(rcvList[i].phoneNumber, out sqdc))
                {
                    int dlrmask = int.Parse(sqdc[SqlBoxColId.dlr_mask]);
                    rcvList[i].dlr = (DLRStatus)dlrmask;
                    updatedCnt++;
                }
                else
                {
                    if (rcvList[i].preStatus == MessageStatus.Accepted || rcvList[i].preStatus == MessageStatus.Sent)
                        rcvList[i].dlr = DLRStatus.DeliveredToPhone;
                }
                if (changeProgressDel != null)
                    changeProgressDel.Invoke((int)((((double)i / rcvList.Count)) * 100));

            }
            changeProgressDel.Invoke(0);
        }
Beispiel #3
0
 private void InitSqlBoxConnection()
 {
     try
     {
         if (msm == null)
         {
             msm = new MySqlKannelManager();
         }
         if (smsSetts.MySqlServerAddress == null ||
             smsSetts.MySqlUser == null ||
             smsSetts.SqlBoxDbName == null )
         {
             InfoMsg("Не заполнены все параметры подключения к серверу MySql");
             return;
         }
         if (msm.Connect(smsSetts.MySqlServerAddress, smsSetts.MySqlUser, smsSetts.MySqlPass, smsSetts.SqlBoxDbName))
         {
             TraceHelper.Report(string.Format("Подключение к MySql-серверу {0} прошло успешно", smsSetts.MySqlServerAddress));
             massMsg.UpdateStatuses(msm, new ChangeProgressNotifier(this.ProgressChangedEventHandler));
             msm.GetFullReport();
         }
     }
     catch (System.Exception e)
     {
         InfoMsg(e.Message);
     }
     UpdateSqlView();
 }