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;
            }
        }
示例#2
0
 private void loadDanhMucThietHai(String claimID)
 {
     DanhMucThietHaiDAO danhMucThietHaiDAO = new DanhMucThietHaiDAO();
     DataTable dataSource = danhMucThietHaiDAO.DanhSachDanhMucThietHaiTheoClaim(claimID);
     int dem = dataSource.Rows.Count;
     bool kt = false;
     for (int i = 0; i < dem; i++)
     {
         DataRow dr = dataSource.Rows[i];
         string text = dr["YKienGDV"].ToString();
         if (text != "" && text!=null)
             kt = true;
     }
     if (kt == true)
     {
         gvYKienYCo.DataSource = dataSource;
         gvYKienYCo.DataBind();
     }
     gvDanhMucThietHai.DataSource = dataSource;
     gvDanhMucThietHai.DataBind();
 }
 void loaddanhmucthiethai(string idclaim)
 {
     DanhMucThietHaiDAO dm = new DanhMucThietHaiDAO();
     gvDanhSachHangMucThietHai.DataSource = dm.DanhSachDanhMucThietHaiTheoClaim(idclaim);
     gvDanhSachHangMucThietHai.DataBind();
 }
        private void loadDanhMucThietHai()
        {
            DanhMucThietHaiDAO danhMucThietHaiDAO = new DanhMucThietHaiDAO();
            DataTable dataSource = danhMucThietHaiDAO.DanhSachDanhMucThietHaiTheoClaim(claimID);

            grDanhMucThietHaiILA.DataSource = dataSource;
            grDanhMucThietHaiILA.DataBind();

            grDanhMucThietHaiSR01.DataSource = dataSource;
            grDanhMucThietHaiSR01.DataBind();
        }
        protected void grDanhMucThietHaiSR01_RowEditing(object sender, GridViewEditEventArgs e)
        {
            GridViewRow grRow = grDanhMucThietHaiSR01.Rows[e.NewEditIndex];
            string id = ((HiddenField)grRow.FindControl("hiddenID")).Value;
            e.Cancel = true;

            DanhMucThietHaiDAO dao = new DanhMucThietHaiDAO();
            DataRow dtRow = dao.GetDanhMucThietHai(id);

            panelGrid.Visible = false;
            panelAddEdit.Visible = true;
            btnAdd.Visible = false;
            btnUpdate.Visible = true;

            hiddenDanhMucID.Value = id;
            drDamaged.SelectedValue = dtRow["ID_HangMuc"].ToString();
            txtMoTaChung.Text = dtRow["TinhTrangChung"].ToString();
            txtTotally.Text = dtRow["ThietHaiHoanToan"].ToString();
            txtPartial.Text = dtRow["TrangThai"].ToString();
            txtYKienGDV.Text = dtRow["YKienGDV"].ToString();

            if(dtRow["TinhTrang"].ToString().ToLower() == "yes")
                checkTinhTrang.Checked = true;
            else
                checkTinhTrang.Checked = false;
        }
 protected void grDanhMucThietHaiSR01_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     GridViewRow grRow = grDanhMucThietHaiSR01.Rows[e.RowIndex];
     string id = ((HiddenField)grRow.FindControl("hiddenID")).Value;
     string thamchieu = Session["ThamChieu"].ToString();
     DanhMucThietHaiDAO dao = new DanhMucThietHaiDAO();
     bool kq=dao.XoaDanhMucThietHai(int.Parse(id));
     if (kq == true)
     {
         loadDanhMucThietHai();
         int maGDV = int.Parse(Request.Cookies["MaGDV"].Value);
         string noidung = gdv.LayTenTheoMa(maGDV) + " delete summary of loss SR01 of case " + thamchieu + " .";
     }
     Response.Write("<script>parent.reloaData();</script>");
 }