Example #1
0
        public bool funNewBook(string iConnection, string iUserName, string iOfficeSpaceId)
        {
            Connection    = iConnection;
            OfficeSpaceId = iOfficeSpaceId;
            UserName      = iUserName;

            frmBook frm = new frmBook();

            frm.Command = "New";
            if (frm.ShowDialog() == DialogResult.OK)
            {
                if (!frm.IsDisposed)
                {
                    frm.Close();
                    frm.Dispose();
                }
                return(true);
            }
            else
            {
                if (!frm.IsDisposed)
                {
                    frm.Close();
                    frm.Dispose();
                }
                return(false);
            }
        }
Example #2
0
        public bool funEditBook(string iConnection, string iUserName, string iOfficeSpaceId, DataTable dt, int currentIndex)
        {
            Connection    = iConnection;
            OfficeSpaceId = iOfficeSpaceId;
            UserName      = iUserName;
            if (dt.Rows.Count == 0)
            {
                return(false);
            }

            string BookName  = "" + dt.Rows[currentIndex]["BOOKNAME"];
            string BookType  = "" + dt.Rows[currentIndex]["BOOKTYPE"];
            string BookPrice = "" + dt.Rows[currentIndex]["BOOKPRICE"];
            string ID        = "" + dt.Rows[currentIndex]["ID"];

            frmBook frm = new frmBook();

            frm.Text             = "แก้ไขข้อมูลหนังสือ";
            frm.Command          = "Edit";
            frm.ID               = ID;
            frm.txbBookName.Text = BookName;
            frm.txbBookType.Text = BookType;
            frm.txbPrice.Text    = BookPrice;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                if (!frm.IsDisposed)
                {
                    frm.Close();
                    frm.Dispose();
                }
                return(true);
            }
            else
            {
                if (!frm.IsDisposed)
                {
                    frm.Close();
                    frm.Dispose();
                }
                return(false);
            }
            return(false);
        }