Esempio n. 1
0
 private void gridViewDanhBaCongTy_DoubleClick(object sender, EventArgs e)
 {
     try
     {
         if (gridViewDanhBaCongTy.SelectedRowsCount > 0)
         {
             DanhBaCongTy    objCongTy = (DanhBaCongTy)gridViewDanhBaCongTy.GetFocusedRow();
             frmDanhBaCongTy frm       = new frmDanhBaCongTy(objCongTy, false);
             frm.ShowDialog(this);
             if (frm.IsSuccess)
             {
                 objCongTy = frm.GetDanhBaCongTy();
                 frm.Dispose();
                 if (!objCongTy.Update())
                 {
                     new MessageBox.MessageBoxBA().Show("Lỗi thêm mới danh bạ công ty");
                 }
                 else
                 {
                     LoadListDanhBaCongTy();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogError.WriteLogError("gridViewDanhBaCongTy_DoubleClick: ", ex);
     }
 }
 /// <summary>
 /// Mo form DanhBaCongTy de edit
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void gridDanhBaCongTy_DoubleClick(object sender, EventArgs e)
 {
     gridDMDanhBaCongTy.SelectionMode = Janus.Windows.GridEX.SelectionMode.SingleSelection;
     if (gridDMDanhBaCongTy.SelectedItems.Count > 0)
     {
         GridEXRow       row             = ((GridEXSelectedItem)gridDMDanhBaCongTy.SelectedItems[0]).GetRow();
         DanhBaCongTy    objDanhBaCongTy = (DanhBaCongTy)((GridEXSelectedItem)gridDMDanhBaCongTy.SelectedItems[0]).GetRow().DataRow;
         frmDanhBaCongTy frm             = new frmDanhBaCongTy(objDanhBaCongTy, false);
         if (frm.ShowDialog(this) == DialogResult.OK)
         {
             objDanhBaCongTy = frm.GetDanhBaCongTy();
             frm.Dispose();
             //Insert DataBase
             if (!objDanhBaCongTy.Update())
             {
                 new MessageBox.MessageBoxBA().Show("Lỗi thêm mới danh bạ công ty");
                 return;
             }
             else
             {
                 //Load lai grid
                 LoadListDanhBaCongTy();
             }
         }
         else
         {
             return;
         }
     }
 }
        private void ThemDanhBaCongTy()
        {
            DanhBaCongTy    objDanhBaCongTy = new DanhBaCongTy(string.Empty, string.Empty, string.Empty);
            frmDanhBaCongTy frm             = new frmDanhBaCongTy(objDanhBaCongTy, true);// them moi

            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                objDanhBaCongTy = frm.GetDanhBaCongTy();
                //Insert DataBase
                if (StringTools.TrimSpace(objDanhBaCongTy.Name).Length <= 0)
                {
                    return;
                }

                if (StringTools.TrimSpace(objDanhBaCongTy.Address).Length <= 0)
                {
                    return;
                }

                if (StringTools.TrimSpace(objDanhBaCongTy.PhoneNumber).Length < 8)
                {
                    return;
                }
                if (!objDanhBaCongTy.Insert())
                {
                    new MessageBox.MessageBoxBA().Show("Lỗi thêm mới vào danh bạ công ty");
                    return;
                }
                else
                {
                    //Load lai grid
                    LoadListDanhBaCongTy();
                }
            }
        }
Esempio n. 4
0
        private void SuaDanhBaCongTy()
        {
            try
            {
                if (gridViewDanhBaCongTy.SelectedRowsCount > 0)
                {
                    DanhBaCongTy    objDanhBaCongTy = (DanhBaCongTy)gridViewDanhBaCongTy.GetFocusedRow();
                    frmDanhBaCongTy frm             = new frmDanhBaCongTy(objDanhBaCongTy, false);
                    frm.ShowDialog(this);
                    if (frm.IsSuccess)
                    {
                        objDanhBaCongTy = frm.GetDanhBaCongTy();
                        if (StringTools.TrimSpace(objDanhBaCongTy.Name).Length <= 0)
                        {
                            return;
                        }

                        if (StringTools.TrimSpace(objDanhBaCongTy.Address).Length <= 0)
                        {
                            return;
                        }

                        if (StringTools.TrimSpace(objDanhBaCongTy.PhoneNumber).Length < 8)
                        {
                            return;
                        }

                        if (!objDanhBaCongTy.Update())
                        {
                            new MessageBox.MessageBoxBA().Show("Lỗi sửa danh bạ công ty!");
                        }
                        else
                        {
                            LoadListDanhBaCongTy();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogError.WriteLogError("SuaDanhBaCongTy: ", ex);
            }
        }
Esempio n. 5
0
        private void ThemDanhBaCongTy()
        {
            try
            {
                DanhBaCongTy    objDanhBaCongTy = new DanhBaCongTy(string.Empty, string.Empty, string.Empty);
                frmDanhBaCongTy frm             = new frmDanhBaCongTy(objDanhBaCongTy, true);// them moi
                frm.ShowDialog(this);
                if (frm.IsSuccess)
                {
                    objDanhBaCongTy = frm.GetDanhBaCongTy();

                    if (StringTools.TrimSpace(objDanhBaCongTy.Name).Length <= 0)
                    {
                        return;
                    }

                    if (StringTools.TrimSpace(objDanhBaCongTy.Address).Length <= 0)
                    {
                        return;
                    }

                    if (StringTools.TrimSpace(objDanhBaCongTy.PhoneNumber).Length < 8)
                    {
                        return;
                    }

                    if (!objDanhBaCongTy.Insert())
                    {
                        new MessageBox.MessageBoxBA().Show("Lỗi thêm mới vào danh bạ công ty");
                    }
                    else
                    {
                        LoadListDanhBaCongTy();
                    }
                }
            }
            catch (Exception ex)
            {
                LogError.WriteLogError("ThemDanhBaCongTy: ", ex);
            }
        }
        private void SuaDanhBaCongTy()
        {
            gridDMDanhBaCongTy.SelectionMode = Janus.Windows.GridEX.SelectionMode.SingleSelection;
            if (gridDMDanhBaCongTy.SelectedItems.Count > 0)
            {
                GridEXRow       row             = ((GridEXSelectedItem)gridDMDanhBaCongTy.SelectedItems[0]).GetRow();
                DanhBaCongTy    objDanhBaCongTy = (DanhBaCongTy)((GridEXSelectedItem)gridDMDanhBaCongTy.SelectedItems[0]).GetRow().DataRow;
                frmDanhBaCongTy frm             = new frmDanhBaCongTy(objDanhBaCongTy, false);
                if (frm.ShowDialog(this) == DialogResult.OK)
                {
                    objDanhBaCongTy = frm.GetDanhBaCongTy();
                    if (StringTools.TrimSpace(objDanhBaCongTy.Name).Length <= 0)
                    {
                        return;
                    }

                    if (StringTools.TrimSpace(objDanhBaCongTy.Address).Length <= 0)
                    {
                        return;
                    }

                    if (StringTools.TrimSpace(objDanhBaCongTy.PhoneNumber).Length < 8)
                    {
                        return;
                    }
                    //Insert DataBase
                    if (!objDanhBaCongTy.Update())
                    {
                        new MessageBox.MessageBoxBA().Show("Lỗi thêm mới khách ảo");
                        return;
                    }
                    else
                    {
                        //Load lai grid
                        LoadListDanhBaCongTy();
                    }
                }
            }
        }