private void ActionUpdate()
 {
     if(grdList.CurrentRow!=null&&grdList.CurrentRow.RowType==RowType.Record)
     {
         if (grdList.CurrentRow == null) return;
         v_ServiceDetail_ID =
             Utility.Int32Dbnull(grdList.GetValue(DmucDichvuclsChitiet.Columns.IdChitietdichvu), -1);
         frm_themmoi_dichvucls_chitiet frm = new frm_themmoi_dichvucls_chitiet();
         frm.txtID.Text = Utility.sDbnull(v_ServiceDetail_ID);
         frm.m_enAction = action.Update;
         frm.dsServiceDetail = m_dtDataDetailService;
         if (grdList.CurrentRow != null)
             frm.drServiceDetail = Utility.FetchOnebyCondition(m_dtDataDetailService, DmucDichvuclsChitiet.Columns.IdChitietdichvu+ "=" + v_ServiceDetail_ID);
         frm.ShowDialog();
     }
     ModifyCommand();
     ModifyCommand1();
 }
 /// <summary>
 /// HAM THUC HIEN TAO MOI CHI TIET DICH VU
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmdNew_Click(object sender, EventArgs e)
 {
     frm_themmoi_dichvucls_chitiet frm=new frm_themmoi_dichvucls_chitiet();
     frm.txtID.Text = "-1";
     frm.m_enAction = action.Insert;
     frm.grdlist = grdServiceDetail;
     frm.dtDataServiceDetail = dsTable;
     frm.Service_ID = Utility.Int32Dbnull(txtLoaiDichvu.MyID, -1);
     frm.ShowDialog();
     grdServiceDetail_SelectionChanged(grdServiceDetail, e);
     ModifyCommand();
 }
 /// <summary>
 /// HAM THUC HIEN SUA THONG TIN CHI TIET
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmdEdit_Click(object sender, EventArgs e)
 {
     if (_currentGRd != null && _currentGRd.Name == grdServiceDetail.Name)
     {
         if (Utility.isValidGrid(grdServiceDetail))
         {
             frm_themmoi_dichvucls_chitiet frm = new frm_themmoi_dichvucls_chitiet();
             frm.txtID.Text = grdServiceDetail.GetValue(DmucDichvuclsChitiet.Columns.IdChitietdichvu).ToString();
             frm.m_enAction = action.Update;
             frm.grdlist = grdServiceDetail;
             frm.dtDataServiceDetail = dsTable;
             if (grdServiceDetail.CurrentRow != null)
                 frm.drServiceDetail = Utility.FetchOnebyCondition(dsTable, DmucDichvuclsChitiet.Columns.IdChitietdichvu + "=" + v_ServiceDetail_Id);
             frm.ShowDialog();
             grdServiceDetail_SelectionChanged(grdServiceDetail, e);
         }
     }
     else
     {
         if (Utility.isValidGrid( grdChitiet))
         {
             frm_themmoi_dichvucls_chitiet frm = new frm_themmoi_dichvucls_chitiet();
             frm.txtID.Text = grdChitiet.GetValue(DmucDichvuclsChitiet.Columns.IdChitietdichvu).ToString();
             frm.m_enAction = action.Update;
             frm.grdlist = grdChitiet;
             frm.dtDataServiceDetail = dsTable;
             if (grdChitiet.CurrentRow != null)
                 frm.drServiceDetail = Utility.FetchOnebyCondition(dsTable, DmucDichvuclsChitiet.Columns.IdChitietdichvu + "=" + v_ServiceDetail_Id);
             frm.ShowDialog();
             grdServiceDetail_SelectionChanged(grdServiceDetail, e);
         }
     }
     ModifyCommand();
 }
 private void cmdThemMoi_Click(object sender, EventArgs e)
 {
     if (grdList.CurrentRow != null && grdList.CurrentRow.RowType == RowType.Record)
     {
         if (grdList.CurrentRow == null) return;
         frm_themmoi_dichvucls_chitiet frm = new frm_themmoi_dichvucls_chitiet();
         frm.grdlist = grdList;
         frm.txtID.Text = "-1";
         frm.m_enAction = action.Insert;
         frm.dsServiceDetail = m_dtDataDetailService;
         if (grdList.CurrentRow != null)
             frm.drServiceDetail = Utility.FetchOnebyCondition(m_dtDataDetailService, DmucDichvuclsChitiet.Columns.IdChitietdichvu+ "=" + v_ServiceDetail_ID);
         frm.ShowDialog();
     }
     ModifyCommand();
     ModifyCommand1();
 }
 /// <summary>
 /// HAM THUC HIEN SUA THONG TIN CHI TIET
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmdEdit_Click(object sender, EventArgs e)
 {
     if (this.ActiveControl != null && this.ActiveControl.Name == grdServiceDetail.Name)
     {
         if (grdServiceDetail.CurrentRow != null && grdServiceDetail.CurrentRow.RowType == RowType.Record)
         {
             frm_themmoi_dichvucls_chitiet frm = new frm_themmoi_dichvucls_chitiet();
             frm.txtID.Text = grdServiceDetail.GetValue(DmucDichvuclsChitiet.Columns.IdChitietdichvu).ToString();
             frm.m_enAction = action.Update;
             frm.grdlist = grdServiceDetail;
             frm.dsServiceDetail = dsTable;
             if (grdServiceDetail.CurrentRow != null)
                 frm.drServiceDetail = Utility.FetchOnebyCondition(dsTable, DmucDichvuclsChitiet.Columns.IdChitietdichvu + "=" + v_ServiceDetail_Id);
             frm.ShowDialog();
             grdServiceDetail_SelectionChanged(grdServiceDetail, e);
         }
     }
     else if (this.ActiveControl != null && this.ActiveControl.Name == grdChitiet.Name)
     {
         if (grdChitiet.CurrentRow != null && grdChitiet.CurrentRow.RowType == RowType.Record)
         {
             frm_themmoi_dichvucls_chitiet frm = new frm_themmoi_dichvucls_chitiet();
             frm.txtID.Text = grdChitiet.GetValue(DmucDichvuclsChitiet.Columns.IdChitietdichvu).ToString();
             frm.m_enAction = action.Update;
             frm.grdlist = grdChitiet;
             frm.dsServiceDetail = dsTable;
             if (grdChitiet.CurrentRow != null)
                 frm.drServiceDetail = Utility.FetchOnebyCondition(dsTable, DmucDichvuclsChitiet.Columns.IdChitietdichvu + "=" + v_ServiceDetail_Id);
             frm.ShowDialog();
             grdServiceDetail_SelectionChanged(grdServiceDetail, e);
         }
     }
     ModifyCommand();
 }