void buttonNew_Click(object sender, EventArgs e)
        {
            try
            {
                ItemForm newForm = new ItemForm(true, false);
                newForm.Text = "Add New Item";
                newForm.lableRegDate.Text = DateTime.Now.ToString();

                newForm.ShowDialog();
                LoadPhoneBookItems();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error occurred: {0}", ex);
            }
        }
Esempio n. 2
0
        void buttonEdit_Click(object sender, EventArgs e)
        {
            try
            {
                if (listView1.SelectedItems.Count < 1)
                {
                    return;
                }

                string id = listView1.SelectedItems[0].Name.Replace("Item", "");

                var item = (from q in Variables.xDocument.Descendants("Item")
                            where q.Attribute("UserID").Value == Variables.CurrentUserID && q.Attribute("ID").Value == id
                            select q).First();
                if (item == null)
                {
                    return;
                }

                ItemForm editForm = new ItemForm(false, true);

                editForm.Font = new Font(this.Font.Name, this.FontSize, this.Font.Style, this.Font.Unit, this.Font.GdiCharSet, this.Font.GdiVerticalFont);
                editForm.Text = "Edit Item";

                editForm.textBoxAddress.Text = item.Attribute("Address").Value;
                editForm.textBoxEMail.Text   = item.Attribute("Email").Value;
                editForm.textBoxMobile.Text  = item.Attribute("Mobile").Value;
                editForm.textBoxName.Text    = item.Attribute("Name").Value;
                editForm.textBoxPhone.Text   = item.Attribute("Phone").Value;
                editForm.lableRegDate.Text   = christianToolStripMenuItem.Checked ? item.Attribute("RegDate").Value : ConvertToPersianDate(item.Attribute("RegDate").Value);

                editForm.ItemID = id;

                editForm.ShowDialog();

                LoadPhoneBookItems();
            }
            catch (Exception ex)
            {
                StackFrame file_info = new StackFrame(true);
                Messages.error(ref file_info, ex.Message, this);
            }
        }
Esempio n. 3
0
 void buttonNew_Click(object sender, EventArgs e)
 {
     try
     {
         ItemForm newForm = new ItemForm(true, false);
         newForm.Font = new Font(this.Font.Name, this.FontSize, this.Font.Style, this.Font.Unit, this.Font.GdiCharSet, this.Font.GdiVerticalFont);
         newForm.Text = "Add New Item";
         newForm.lableRegDate.Text = christianToolStripMenuItem.Checked ? DateTime.Now.ToString() : ConvertToPersianDate(DateTime.Now.ToString());
         newForm.ShowDialog();
         LoadPhoneBookItems();
         int contactsNumbers = Variables.xDocument.Descendants("Item").Where(q => q.Attribute("UserID").Value == Variables.CurrentUserID).Count();
         this.Text = Variables.Caption + Variables.CurrentUserName + " : " + contactsNumbers.ToString() + " Contacts";
     }
     catch (Exception ex)
     {
         StackFrame file_info = new StackFrame(true);
         Messages.error(ref file_info, ex.Message, this);
     }
 }
        void buttonEdit_Click(object sender, EventArgs e)
        {
            try
            {
                if (listView1.SelectedItems.Count < 1)
                {
                    return;
                }

                string id = listView1.SelectedItems[0].Name.Replace("Item", "");

                var item = (from q in xDocument.Descendants("Item")
                            where q.Attribute("ID").Value == id
                            select q).First();
                if (item == null)
                {
                    return;
                }

                ItemForm editForm = new ItemForm(false, true);
                editForm.Text = "Edit Item";
                editForm.textBoxAddress.Text = item.Attribute("Address").Value;
                editForm.textBoxEMail.Text   = item.Attribute("Email").Value;
                editForm.textBoxMobile.Text  = item.Attribute("Mobile").Value;
                editForm.textBoxName.Text    = item.Attribute("Name").Value;
                editForm.textBoxPhone.Text   = item.Attribute("Phone").Value;
                editForm.lableRegDate.Text   = item.Attribute("RegDate").Value;
                editForm.ItemID = id;

                editForm.ShowDialog();
                LoadPhoneBookItems();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error occurred: {0}", ex);
            }
        }
        void buttonEdit_Click(object sender, EventArgs e)
        {
            try
            {
                if (listView1.SelectedItems.Count < 1) return;

                string id = listView1.SelectedItems[0].Name.Replace("Item", "");

                var item = (from q in xDocument.Descendants("Item")
                            where q.Attribute("ID").Value == id
                            select q).First();
                if (item == null) return;

                ItemForm editForm = new ItemForm(false, true);
                editForm.Text = "Edit Item";
                editForm.textBoxAddress.Text = item.Attribute("Address").Value;
                editForm.textBoxEMail.Text = item.Attribute("Email").Value;
                editForm.textBoxMobile.Text = item.Attribute("Mobile").Value;
                editForm.textBoxName.Text = item.Attribute("Name").Value;
                editForm.textBoxPhone.Text = item.Attribute("Phone").Value;
                editForm.lableRegDate.Text = item.Attribute("RegDate").Value;
                editForm.ItemID = id;

                editForm.ShowDialog();
                LoadPhoneBookItems();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error occurred: {0}", ex);
            }
        }
        void buttonNew_Click(object sender, EventArgs e)
        {
            try
            {
                ItemForm newForm = new ItemForm(true, false);
                newForm.Text = "Add New Item";
                newForm.lableRegDate.Text = DateTime.Now.ToString();

                newForm.ShowDialog();
                LoadPhoneBookItems();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error occurred: {0}", ex);
            }
        }