Ejemplo n.º 1
0
        internal bool Create(ExcelMessageList initialML, string name)
        {
            if (initialML == null)
                return false;

            ResetAll();
            this.massMsgName = name;

            string ttempl = initialML.GetSingleValue(Settings.Default.msg_row, Settings.Default.msg_col);

            if (!(ttempl != null && ttempl != ""))
            {
                throw new InternalException("Невозможно получить доступ к шаблонному тексту. Проверьте координаты текста");
            }
            rcvList = new List<TargetInfo>();
            paramList = new List<string>();
            ParseTemplateString(ttempl);
            //AddMessageList(initialML);

            return true;
        }
Ejemplo n.º 2
0
        private ExcelMessageList LoadMessageList(string fileName)
        {
            if (!File.Exists(fileName))
                return null;
            templateFilePath = fileName;

            if (curES != null)
            {
                curES.CloseDocument();
            }
            curES = new ExcelMessageList(fileName);
            TraceHelper.Report(fileName + " загружен");
            return curES;
        }
Ejemplo n.º 3
0
 internal void AddMessageList(ExcelMessageList curES, ChangeProgressNotifier changeProgressDel)
 {
     int row = Settings.Default.list_row, col = Settings.Default.list_col;
     changeProgressDel(0);
     List<string> header = new List<string>();
     if (paramList.Count != 0)
         header.AddRange(curES.GetRange(row, col, row, col + (int)paramList.Count));
     else
         header.Add(curES.GetSingleValue(row, col));
     int vrow = row+1;
     int numIdx = (int)header.IndexOf("num")+1;
     int parIdx;
     do {
         TargetInfo ti = new TargetInfo();
         if (!MassMsgStorage.CheckNumber(curES.GetSingleValue(vrow, numIdx), ref ti.phoneNumber))
         {
             ti.preStatus = MessageStatus.IncorrectNumber;
         }
         if (ti.phoneNumber == String.Empty)
             break;
         foreach(string s in paramList)
         {
             parIdx = header.IndexOf(s);
             if (parIdx<0)
                 throw new Exception("There is no necessary variable in the list");
             string paramVal = curES.GetSingleValue(vrow, parIdx + 1);
             if (translitEnabled)
                 paramVal = Translit.Convert(paramVal);
             ti.paramList.Add(paramVal);
         }
         //ti.message = String.Format(templateStringCS, ti.paramList.ToArray());
         ti.message = templateStringCS;
         //if (ti.status == MessageStatus.IncorrectNumber)
         //    reportAdded(ti.phoneNumber, ti.paramList[0], ti.message, ti.status.ToString());
         rcvList.Add(ti);
         vrow++;
     } while (true);
     changeProgressDel(100);
 }
Ejemplo n.º 4
0
        private bool LoadDoc(string fileName)
        {
            if (!File.Exists(fileName))
                return false;
            templateFilePath = fileName;

            if (curES == null)
            {
                curES = new ExcelMessageList(templateFilePath);
            }
            else
            {
                if (DialogResult.Yes == MessageBox.Show("Вы хотите создать новую рассылку?", "Внимание", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                {
                    ResetAll();
                    curES = new ExcelMessageList(templateFilePath);
                }
            }
            TraceHelper.Report( templateFilePath + " загружен");
            return true;
        }