private void in_hop_dong_process()
{
int[] v_selected_row = m_grv.GetSelectedRows();
if(v_selected_row.Length == 0)
{
string v_str_error = "Bạn chưa chọn dòng dữ liệu nào để in";
XtraMessageBox.Show(v_str_error, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
else
{
m_output_path = "";
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.Filter = "docx files (*.docx)|*.docx|All files (*.*)|*.*";
saveFileDialog1.RestoreDirectory = true;
saveFileDialog1.FileName = "HD";
if(saveFileDialog1.ShowDialog() == DialogResult.OK)
{
m_output_path = Path.Combine(Path.GetDirectoryName(saveFileDialog1.FileName), Path.GetFileNameWithoutExtension(saveFileDialog1.FileName));
SplashScreenManager.ShowForm(this, typeof(SplashScreen1), true, true, false);
try
{
for(int i = 0; i < m_grv.GetSelectedRows().Length; i++)
{
var v_dr = m_grv.GetDataRow(m_grv.GetSelectedRows()[i]);
string v_output_path = m_output_path + " " + v_dr["MA_NV"];
print_hop_dong(v_dr, v_output_path);
SplashScreenManager.Default.SendCommand(SplashScreen1.SplashScreenCommand.SetProgress, (int)((decimal)i / (decimal)m_grv.GetSelectedRows().Length * 100));
}
XtraMessageBox.Show("In thành công!", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch(Exception v_e)
{
throw;
}
finally
{
SplashScreenManager.CloseForm(false);
}
}
}
}