Exemple #1
0
        private void btn_Nhap_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Bạn có muốn nhập quyết định này hay không ?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                if (VerifyData())
                {
                    bool bUploadInfoSuccess = false;

                    Business.HDQD.QuyetDinh quyetdinh = new Business.HDQD.QuyetDinh();
                    quyetdinh.Ma_Quyet_Dinh     = thongTinQuyetDinh1.txt_MaQD.Text;
                    quyetdinh.Ten_Quyet_Dinh    = thongTinQuyetDinh1.txt_TenQD.Text;
                    quyetdinh.Loai_QuyetDinh_ID = Convert.ToInt16(thongTinQuyetDinh1.comB_Loai.SelectedValue);
                    quyetdinh.Ngay_Ky           = thongTinQuyetDinh1.dTP_NgayKy.Value;
                    quyetdinh.Ngay_Hieu_Luc     = thongTinQuyetDinh1.dTP_NgayHieuLuc.Value;
                    if (thongTinQuyetDinh1.dTP_NgayHetHan.Checked == true)
                    {
                        quyetdinh.Ngay_Het_Han = thongTinQuyetDinh1.dTP_NgayHetHan.Value;
                    }
                    else
                    {
                        quyetdinh.Ngay_Het_Han = null;
                    }
                    quyetdinh.MoTa = thongTinQuyetDinh1.rTB_MoTa.Text;

                    try
                    {
                        int        count           = dsDonVi_new.Count;
                        string[]   ten_don_vi_moi  = new string[count];
                        string[]   ten_dv_viet_tat = new string[count];
                        int[]      dv_cha_id       = new int[count];
                        DateTime[] tu_ngay         = new DateTime[count];
                        string[]   ghi_chu         = new string[count];

                        for (int i = 0; i < dsDonVi_new.Count; i++)
                        {
                            DonVi dv = new DonVi();
                            dv = dsDonVi_new[i];

                            ten_don_vi_moi[i]  = dv.TenDonVi;
                            ten_dv_viet_tat[i] = dv.TenDVVietTat;
                            if (dv.DVChaID != null)
                            {
                                dv_cha_id[i] = dv.DVChaID.Value;
                            }
                            else
                            {
                                dv_cha_id[i] = 0;
                            }
                            tu_ngay[i] = dv.TuNgay.Value;
                        }

                        quyetdinh.Add_ThanhLapDV(ten_don_vi_moi, ten_dv_viet_tat, dv_cha_id, ghi_chu, tu_ngay);
                        MessageBox.Show("Thành lập đơn vị thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        EnableControls(true);
                        bUploadInfoSuccess = true;

                        if (Paths != null && Paths.Count > 0 && bUploadInfoSuccess)
                        {
                            UploadFile();
                        }
                        else
                        {
                            CleanUIData();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Thành lập đơn vị không thành công.\r\n" + ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("Vui lòng nhập đầy đủ thông tin của quyết định.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Exemple #2
0
        private void btn_Nhap_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Bạn có muốn nhập quyết định này hay không ?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                if (VerifyData())
                {
                    bool bUploadInfoSuccess = false;

                    Business.HDQD.QuyetDinh quyetdinh = new Business.HDQD.QuyetDinh();
                    quyetdinh.Ma_Quyet_Dinh = thongTinQuyetDinh1.txt_MaQD.Text;
                    quyetdinh.Ten_Quyet_Dinh = thongTinQuyetDinh1.txt_TenQD.Text;
                    quyetdinh.Loai_QuyetDinh_ID = Convert.ToInt16(thongTinQuyetDinh1.comB_Loai.SelectedValue);
                    quyetdinh.Ngay_Ky = thongTinQuyetDinh1.dTP_NgayKy.Value;
                    quyetdinh.Ngay_Hieu_Luc = thongTinQuyetDinh1.dTP_NgayHieuLuc.Value;
                    if (thongTinQuyetDinh1.dTP_NgayHetHan.Checked == true)
                        quyetdinh.Ngay_Het_Han = thongTinQuyetDinh1.dTP_NgayHetHan.Value;
                    else
                        quyetdinh.Ngay_Het_Han = null;
                    quyetdinh.MoTa = thongTinQuyetDinh1.rTB_MoTa.Text;

                    try
                    {
                        int count = dsDonVi_new.Count;
                        string[] ten_don_vi_moi = new string[count];
                        string[] ten_dv_viet_tat = new string[count];
                        int[] dv_cha_id = new int[count];
                        DateTime[] tu_ngay = new DateTime[count];
                        string[] ghi_chu = new string[count];

                        for (int i = 0; i < dsDonVi_new.Count; i++)
                        {
                            DonVi dv = new DonVi();
                            dv = dsDonVi_new[i];

                            ten_don_vi_moi[i] = dv.TenDonVi;
                            ten_dv_viet_tat[i] = dv.TenDVVietTat;
                            if (dv.DVChaID != null)
                                dv_cha_id[i] = dv.DVChaID.Value;
                            else
                                dv_cha_id[i] = 0;
                            tu_ngay[i] = dv.TuNgay.Value;
                        }

                        quyetdinh.Add_ThanhLapDV(ten_don_vi_moi, ten_dv_viet_tat, dv_cha_id, ghi_chu, tu_ngay);
                        MessageBox.Show("Thành lập đơn vị thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        EnableControls(true);
                        bUploadInfoSuccess = true;
                        
                        if (Paths != null && Paths.Count > 0 && bUploadInfoSuccess)
                        {
                            UploadFile();
                        }
                        else
                        {
                            CleanUIData();
                        }

                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Thành lập đơn vị không thành công.\r\n" + ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                    MessageBox.Show("Vui lòng nhập đầy đủ thông tin của quyết định.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            
        }