コード例 #1
0
        void Register(AdressType type, Uri address)
        {
            if (m_Views.ContainsKey(type)) //update
            {
                m_Views[type] = address;
                return;
            }

            m_Views.Add(type, address); //add
        }
コード例 #2
0
        public void NavigateTo(AdressType type)
        {
            if (!m_Views.ContainsKey(type))
                return;

            Uri address = m_Views[type];

            //magic code here!
            PhoneApplicationFrame root = Application.Current.RootVisual as PhoneApplicationFrame;
            Debug.Assert(root != null, "Root is null");
            root.Navigate(address);
        }
コード例 #3
0
        public static string GetAdressTypeEnumToString(AdressType adressTypeEnum)
        {
            var adressTypesString = new Dictionary <AdressType, string>
            {
                { AdressType.ActualAdress, "Адрес фактический" },
                { AdressType.RegistrationAddress, "Адрес по прописке" }
            };


            string selectedValue;

            adressTypesString.TryGetValue(adressTypeEnum, out selectedValue);

            return(selectedValue);
        }
コード例 #4
0
        private void CreateAndAddRowAdress()
        {
            AdressType adressType = DictionaryForRefreshDataTables.GetAdressTypeByValueAdressTypeComboBox(_typeAdress);
            Adress     newAdress  = new Adress()
            {
                adressType = adressType,
                city       = _cityProperty,
                postindex  = _porsIndexProperty,
                street     = _streetProperty
            };

            _crudStudent.CreateNewAdress(newAdress);

            AddRowsDataTableAdress(_crudStudent.GetAdressList(), _dataTableAdress);
        }
コード例 #5
0
ファイル: Form_main.cs プロジェクト: fil-dv/Letter_Generator
        private void button_load_file_Click(object sender, EventArgs e)
        {
            comboBox_creditors.Enabled = false;
            Stream myStream = null;
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Title = "Open Text File";
            ofd.Filter = "TXT files|*.txt";
            ofd.InitialDirectory = @"C:\";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    if ((myStream = ofd.OpenFile()) != null)
                    {
                        if (!CheckReadyToLoadData())
                        {
                            MessageBox.Show("Не указан тип адреса или шаблон письма.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        string template = comboBox_template.SelectedItem.ToString();
                        AdressType adrtype = (AdressType)comboBox_adr.SelectedIndex;
                        List<RecordToInsert> recList = new List<RecordToInsert>();

                        using (myStream)
                        {
                            var lines = File.ReadLines(ofd.FileName);
                            foreach (var line in lines)
                            {
                                RecordToInsert rec = new RecordToInsert { DealId = line, TemplateId = template, AdrType = adrtype };
                                recList.Add(rec);
                            }
                        }
                        LetterManager.AddPinFromFile(recList);
                    }
                    else
                    {
                        comboBox_creditors.Enabled = true;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Не удается прочитать файл. " + ex.Message);                   
                }
            }               
        }
コード例 #6
0
        /// <summary>
        /// Konstruktor mit Angabe eines Adress-Typs.
        /// </summary>
        /// <param name="t">Der Adress-Typ.</param>
        public Addresses(AdressType t)
        {
            switch (t)
            {
            case AdressType.Billing:
                Billing  = new List <Address>();
                Shipping = null;
                break;

            case AdressType.Shipping:
                Shipping = new List <Address>();
                Billing  = null;
                break;

            default:
                Billing  = new List <Address>();
                Shipping = new List <Address>();
                break;
            }
        }
コード例 #7
0
ファイル: Form_main.cs プロジェクト: fil-dv/Letter_Generator
 private void button_add_reg_Click(object sender, EventArgs e)
 {
     decimal id = -1;
     string regName = comboBox_regs.SelectedItem.ToString();
     if (CheckIsRegNameCorrect(ref regName, ref id))
     {
         if (!CheckReadyToLoadData())
         {
             MessageBox.Show("Не указан тип адреса или шаблон письма.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         string template = comboBox_template.SelectedItem.ToString();
         AdressType adrtype = (AdressType)comboBox_adr.SelectedIndex;
         RecordToInsert record = new RecordToInsert();
         record.Reestr = new Reg();
         record.Reestr.Id = id;
         record.AdrType = adrtype;
         record.TemplateId = template;
         LetterManager.ChangeRegForGenerate(record, Operation.Insert);
         comboBox_ready_regs.Items.Add(regName);
         comboBox_regs.Items.Remove(regName);
         comboBox_regs.Text = "";
         button_add_reg.Enabled = false;        
     }
 }
コード例 #8
0
 void UnRegister(AdressType type)
 {
     if (m_Views.ContainsKey(type))
         m_Views.Remove(type);
 }
コード例 #9
0
 public string GetName()
 {
     return(Server + "::" + Name + "::" + AdressType.ToString());
 }
コード例 #10
0
        public static async System.Threading.Tasks.Task SendEmail(CommonLibrary.DatabaseModels.Task task, CommonLibrary.DatabaseModels.Action action, AdressType type)
        {
            var address = new[] {
                "http://172.20.10.6:8002/mail/new_enquiry/",
                "http://172.20.10.6:8002/mail/change_status/"
            };

            var subjects = new[] {
                "Создана новая заявка: {0}",
                "Статус заявки '{0}' изменился на {1}"
            };

            var adress  = address[(int)type];
            var subject = subjects[(int)type];

            using (HttpClient client = new HttpClient())
            {
                var res = await client.PostAsJsonAsync(adress, new EmailCreate
                {
                    to      = task.Email,
                    subject = string.Format(subject, task.Description, action.State),
                    payload = new PayLoad
                    {
                        date   = DateTime.Now,
                        id     = task.ID,
                        status = action.State.ToString()
                    }
                });

                var resp = await res.Content.ReadAsStringAsync();
            }
        }