Ejemplo n.º 1
0
 public OCA.Common.DataSets.Kartabl.Attach GetAttachesByName(string Attach_Name, string Mail_Num)
 {
     try
     {
         dsattach.Clear();
         dsattach = mailclass.GetAttachesByName(Attach_Name, Mail_Num);
         return(dsattach);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Ejemplo n.º 2
0
        private void DataGridView_Click(object sender, EventArgs e)
        {
            try
            {
                txtName.Text = DataGridView.SelectedRows[0].Cells["Mail_Name"].Value.ToString().Trim();

                lst_Files.Items.Clear();
                dsattach = mailclass.GetAttaches(DataGridView.SelectedRows[0].Cells["Mail_Num"].Value.ToString().Trim());
                for (int i = 1; i <= dsattach.Tbl_Attach.Rows.Count; i++)
                {
                    if (dsattach.Tbl_Attach[i - 1].Attach_Kind.Trim() == "File")
                    {
                        lst_Files.Items.Add(dsattach.Tbl_Attach[i - 1].Attach_Name.Trim());
                    }
                }
            }
            catch { }
        }
Ejemplo n.º 3
0
        private void lst_Files_DoubleClick(object sender, EventArgs e)
        {
            string temp = Directory.GetCurrentDirectory();

            InputLanguage.CurrentInputLanguage = InputLanguage.InstalledInputLanguages[0];
            try
            {
                string Attach_FileName = lst_Files.SelectedItems[0].ToString().Trim();
                try
                {
                    dsattach = mailclass.GetAttachesByName(Attach_FileName, DataGridView.SelectedRows[0].Cells["Mail_Num"].Value.ToString().Trim());
                }
                catch { throw new Exception("لطفا ابتدا نامه ای که پیوست مربوط به آن است را انتخاب کنید!"); }

                saveFileDialog1.Filter   = "فایل پیوست|*" + Attach_FileName.Substring(Attach_FileName.LastIndexOf("."));
                saveFileDialog1.FileName = Attach_FileName;
                saveFileDialog1.ShowDialog();

                if (saveFileDialog1.FileName != Attach_FileName)
                {
                    if (File.Exists(saveFileDialog1.FileName))
                    {
                        if (mesg.Question("توجه", "فایل " + Attach_FileName + " موجود است ، آیا می خواهید روی آن بازنویسی کنید؟"))
                        {
                            File.WriteAllBytes(saveFileDialog1.FileName, dsattach.Tbl_Attach[0].Attach_File);
                        }
                    }
                    else
                    {
                        File.WriteAllBytes(saveFileDialog1.FileName, dsattach.Tbl_Attach[0].Attach_File);
                    }
                }
            }
            catch (Exception ex)
            {
                if (ex.Message != "Index was outside the bounds of the array.")
                {
                    mesg.Error("خطا", ex.Message);
                }
            }
            InputLanguage.CurrentInputLanguage = InputLanguage.InstalledInputLanguages[1];
            Directory.SetCurrentDirectory(temp);
            dsmail = mailclass.GetReceivedDabirkhanehMails();
        }
Ejemplo n.º 4
0
        private void DataGridView_Click(object sender, EventArgs e)
        {
            try
            {
                txtName.Text       = DataGridView.SelectedRows[0].Cells["Mail_Name"].Value.ToString().Trim();
                txtSignerName.Text = DataGridView.SelectedRows[0].Cells["Mail_SignerName"].Value.ToString().Trim();

                lst_Files.Items.Clear();
                lst_Mails.Items.Clear();
                dsattach = mailclass.GetAttaches(DataGridView.SelectedRows[0].Cells["Mail_Num"].Value.ToString().Trim());
                for (int i = 1; i <= dsattach.Tbl_Attach.Rows.Count; i++)
                {
                    if (dsattach.Tbl_Attach[i - 1].Attach_Kind.Trim() == "Mail")
                    {
                        lst_Mails.Items.Add(dsattach.Tbl_Attach[i - 1].Attach_Name.Trim());
                    }
                    else
                    {
                        lst_Files.Items.Add(dsattach.Tbl_Attach[i - 1].Attach_Name.Trim());
                    }
                }

                try
                {
                    PicSign.Image = global::OCA.WinUI.Properties.Resources.ArenaWarsMonitor;
                    byte[] pic_byte = null;
                    for (int i = 1; i <= dsmail.Tbl_MailBox.Rows.Count; i++)
                    {
                        if (dsmail.Tbl_MailBox[i - 1].Mail_Num.ToString().Trim() == DataGridView.SelectedRows[0].Cells["Mail_Num"].Value.ToString().Trim())
                        {
                            pic_byte = dsmail.Tbl_MailBox[i - 1].Mail_Sign;
                        }
                    }

                    MemoryStream mstrm = new MemoryStream(pic_byte);
                    PicSign.Image = Image.FromStream(mstrm);
                }
                catch { }
            }
            catch { }
        }