コード例 #1
0
ファイル: MainForm.cs プロジェクト: VinhNT/MedicineCenter
        }        //MnuItemAddDiagnosisDetailsClick

        void MnuItemCatogeryListClick(object sender, EventArgs e)
        {
            frmCatogeryList frmTmp = new frmCatogeryList();

            frmTmp.Show();
            frmTmp.setConnectionReferenceNLoadData(this.myConn);
            frmTmp.MdiParent = this;
            frmTmp           = null;
        }        //MnuItemCatogeryListClick
コード例 #2
0
        }        //BtnResetClick

        void BtnCloseClick(object sender, System.EventArgs e)
        {
            if (iWorkMode == ENUM_MODE_ADDNEW_OUTSIDE || iWorkMode == ENUM_MODE_EDIT)
            {
                frmCatogeryList frmTmp = new frmCatogeryList();
                frmTmp.setConnectionReferenceNLoadData(this.refCon);
                frmTmp.MdiParent = this.MdiParent;
                frmTmp.Show();
                frmTmp = null;
            }
            this.Close();
        }        //BtnCloseClick
コード例 #3
0
        }        //BtnCloseClick

        void BtnOKClick(object sender, System.EventArgs e)
        {
            OleDbCommand myCom;
            string       strSQL;

            if (this.txtCatogeryName.Text.Length <= 0)
            {
                MessageBox.Show(ERR_CATEGORY_NAME_EMPTY, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtCatogeryName.Focus();
                return;
            }
            myCom            = new OleDbCommand();
            myCom.Connection = this.refCon;

            if (iWorkMode == ENUM_MODE_EDIT)
            {            //edit an existing item
                frmCatogeryList frmTmp;
                strSQL            = "UPDATE tblMasterInfor SET M_Name= '" + txtCatogeryName.Text.ToString() + "', M_Description ='" + txtCatogeryDescription.Text.ToString() + "'  WHERE M_ID= " + strRefID + ";";
                myCom.CommandText = strSQL;
                myCom.Connection  = refCon;
                myCom.ExecuteNonQuery();
                this.Close();
                frmTmp = new frmCatogeryList();
                frmTmp.setConnectionReferenceNLoadData(this.refCon);
                frmTmp.MdiParent = this.MdiParent;
                frmTmp.Show();
                frmTmp = null;
            }            //Add new mode
            else
            {
                strSQL = "INSERT INTO tblMasterInfor(M_Name, M_Type, M_Description) VALUES('" + txtCatogeryName.Text.ToString() + "', " + cboCatogeryType.SelectedIndex.ToString() + ", ";
                if (txtCatogeryDescription.Text.Length <= 0)
                {
                    strSQL += "NULL );";
                }
                else
                {
                    strSQL += "'" + txtCatogeryDescription.Text.ToString() + "');";
                }
                myCom.CommandText = strSQL;
                myCom.Connection  = refCon;
                myCom.ExecuteNonQuery();
                txtCatogeryName.Text          = string.Empty;
                txtCatogeryDescription.Text   = string.Empty;
                cboCatogeryType.SelectedIndex = this.iMode;
            }    //if - else
        }        //BtnOKClick
コード例 #4
0
        void BtnOKClick(object sender, System.EventArgs e)
        {
            OleDbCommand myCom ;
            string strSQL;
            if (this.txtCatogeryName.Text.Length<=0)
            {
                MessageBox.Show(ERR_CATEGORY_NAME_EMPTY, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtCatogeryName.Focus();
                return;
            }
            myCom = new OleDbCommand();
            myCom.Connection = this.refCon;

            if (iWorkMode == ENUM_MODE_EDIT)
            {//edit an existing item
                frmCatogeryList frmTmp;
                strSQL ="UPDATE tblMasterInfor SET M_Name= '"+ txtCatogeryName.Text.ToString() + "', M_Description ='" + txtCatogeryDescription.Text.ToString() + "'  WHERE M_ID= " + strRefID + ";";
                myCom.CommandText = strSQL;
                myCom.Connection = refCon;
                myCom.ExecuteNonQuery();
                this.Close();
                frmTmp = new frmCatogeryList();
                frmTmp.setConnectionReferenceNLoadData(this.refCon);
                frmTmp.MdiParent =this.MdiParent;
                frmTmp.Show();
                frmTmp = null;
            }//Add new mode
            else
            {
                strSQL ="INSERT INTO tblMasterInfor(M_Name, M_Type, M_Description) VALUES('" + txtCatogeryName.Text.ToString() + "', " + cboCatogeryType.SelectedIndex.ToString() + ", ";
                if (txtCatogeryDescription.Text.Length<=0)
                {
                    strSQL += "NULL );";
                }else strSQL+= "'" + txtCatogeryDescription.Text.ToString() + "');";
                myCom.CommandText = strSQL;
                myCom.Connection = refCon;
                myCom.ExecuteNonQuery();
                txtCatogeryName.Text = string.Empty;
                txtCatogeryDescription.Text = string.Empty;
                cboCatogeryType.SelectedIndex =  this.iMode;
            }//if - else
        }
コード例 #5
0
 void BtnCloseClick(object sender, System.EventArgs e)
 {
     if (iWorkMode==ENUM_MODE_ADDNEW_OUTSIDE || iWorkMode==ENUM_MODE_EDIT)
     {
         frmCatogeryList frmTmp = new frmCatogeryList();
         frmTmp.setConnectionReferenceNLoadData(this.refCon);
         frmTmp.MdiParent =this.MdiParent;
         frmTmp.Show();
         frmTmp = null;
     }
     this.Close();
 }
コード例 #6
0
ファイル: MainForm.cs プロジェクト: VinhNT/MedicineCenter
 void MnuItemCatogeryListClick(object sender, EventArgs e)
 {
     frmCatogeryList frmTmp = new frmCatogeryList();
     frmTmp.Show();
     frmTmp.setConnectionReferenceNLoadData(this.myConn);
     frmTmp.MdiParent =this;
     frmTmp = null;
 }