Ejemplo n.º 1
0
        protected void btnThem_Click(object sender, EventArgs e)
        {
            dmdto         = new DanhMucThietHaiDTO();
            dmdto.MaClaim = mathamchieu;
            int mahangmuc = int.Parse(drHangMucTaiSan.SelectedItem.Value.ToString());

            if (mahangmuc != 0)
            {
                dmdto.MaHangMuc = mahangmuc;

                string trangthai = txtTrangThai.Text;
                if (trangthai == "")
                {
                    trangthai = "";
                }

                if (ckTinhTrang.Checked == true)
                {
                    dmdto.TinhTrang        = "Yes";
                    dmdto.ThietHaiHoanToan = trangthai;
                    dmdto.TrangThai        = "";
                }
                else
                {
                    dmdto.TinhTrang        = "No";
                    dmdto.ThietHaiHoanToan = "";
                    dmdto.TrangThai        = trangthai;
                }
                string ykien = txtYKienGDV.Text;
                if (ykien != "")
                {
                    dmdto.YKienGDV = ykien;
                }
                else
                {
                    dmdto.YKienGDV = "";
                }
                bool kq = dmdao.ThemDanhMucThietHai(dmdto);
                if (kq == true)
                {
                    //Response.Write("<script> alert ('Update succeed!');</script>");
                    loadDanhSach(mathamchieu);
                    txtTrangThai.Text   = "";
                    txtYKienGDV.Text    = "";
                    ckTinhTrang.Checked = false;
                }

                else
                {
                    Response.Write("<script> alert ('Fail!');</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('Chưa chọn hạng mục tài sản !');</script>");
            }
        }
Ejemplo n.º 2
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                lblMessage.Text = "";

                DanhMucThietHaiDAO dao = new DanhMucThietHaiDAO();

                DanhMucThietHaiDTO thietHai  = new DanhMucThietHaiDTO();
                string             thamchieu = Session["ThamChieu"].ToString();
                thietHai.MaClaim          = thamchieu;
                thietHai.MaHangMuc        = int.Parse(drDamaged.SelectedValue);
                thietHai.ThietHaiHoanToan = txtTotally.Text;
                thietHai.TrangThai        = txtPartial.Text;
                if (checkTinhTrang.Checked)
                {
                    thietHai.TinhTrang = "Yes";
                }
                else
                {
                    thietHai.TinhTrang = "No";
                }
                thietHai.YKienGDV  = txtYKienGDV.Text;
                thietHai.MoTaChung = txtMoTaChung.Text;
                dao.ThemDanhMucThietHai(thietHai);

                Response.Write("<script>parent.reloaData();</script>");
                panelGrid.Visible    = true;
                panelAddEdit.Visible = false;
                int    maGDV   = int.Parse(Request.Cookies["MaGDV"].Value);
                string noidung = gdv.LayTenTheoMa(maGDV) + " created a summary of loss of case SR01" + thamchieu + " .";
                SaveLogTracking(maGDV, noidung, thamchieu);
                loadDanhMucThietHai();
            }catch (Exception ex) {
                lblMessage.Text = ex.Message;
            }
        }