Example #1
0
        private bool pmHasUsedChild1Corp(cDBMSAgent inSQLHelper, string inRowID, ref string ioErrorMsg)
        {
            bool   bllResult   = false;
            string strErrorMsg = "";
            string strRefMsg   = "";

            inSQLHelper.SetPara(new object[] { inRowID });
            if (inSQLHelper.SQLExec(ref this.dtsDataEnv, "QChk", MapTable.Table.RefProd, "select GLRef.fcSkid, GLRef.fcCode, GLRef.fcRefNo from RefProd left join GLREF on GLREF.FCSKID = REFPROD.FCGLREF where RefProd.fcProd = ?", ref strErrorMsg))
            {
                string strCorpStr = "ºÃÔÉÑ· (" + this.mdtrCurrCorp["fcCode"].ToString().TrimEnd() + ") " + this.mdtrCurrCorp["fcName"].ToString().TrimEnd();
                foreach (DataRow dtrChildTab in this.dtsDataEnv.Tables["QChk"].Rows)
                {
                    //strRefMsg += "\r\n     (" + dtrChildTab["fcCode"].ToString().TrimEnd() + ") " + dtrChildTab["fcName"].ToString().TrimEnd();
                    strRefMsg += "\r\n     (" + dtrChildTab["fcRefNo"].ToString().TrimEnd() + ") ";
                }
                ioErrorMsg = strCorpStr + "\r\nàÍ¡ÊÒÃ" + strRefMsg + "\r\n";
                return(true);
            }
            if (inSQLHelper.SQLExec(ref this.dtsDataEnv, "QChk", MapTable.Table.OrderI, "select OrderH.fcSkid, OrderH.fcCode, OrderH.fcRefNo from OrderI left join ORDERH on OrderH.FCSKID = OrderI.fcOrderH where OrderI.fcProd = ?", ref strErrorMsg))
            {
                string strCorpStr = "ºÃÔÉÑ· (" + this.mdtrCurrCorp["fcCode"].ToString().TrimEnd() + ") " + this.mdtrCurrCorp["fcName"].ToString().TrimEnd();
                foreach (DataRow dtrChildTab in this.dtsDataEnv.Tables["QChk"].Rows)
                {
                    //strRefMsg += "\r\n     (" + dtrChildTab["fcCode"].ToString().TrimEnd() + ") " + dtrChildTab["fcName"].ToString().TrimEnd();
                    strRefMsg += "\r\n     (" + dtrChildTab["fcRefNo"].ToString().TrimEnd() + ") ";
                }
                ioErrorMsg = strCorpStr + "\r\nàÍ¡ÊÒÃ" + strRefMsg + "\r\n";
                return(true);
            }
            return(bllResult);
        }
Example #2
0
        private bool pmHasUsedChildTable(cDBMSAgent inSQLHelper, string inMasterCode, ref string ioErrorMsg)
        {
            bool   bllResult      = false;
            bool   bllChkResult   = false;
            string strRefErrorMsg = "";
            string strErrorMsg    = "";

            cDBMSAgent objSQLHelper = inSQLHelper;

            if (objSQLHelper.SQLExec(ref this.dtsDataEnv, "QCorp", MapTable.Table.Corp, "select fcSkid, fcCode, fcName from " + MapTable.Table.Corp, ref strErrorMsg))
            {
                foreach (DataRow dtrCorp in this.dtsDataEnv.Tables["QCorp"].Rows)
                {
                    this.mdtrCurrCorp = dtrCorp;
                    objSQLHelper.SetPara(new object[] { dtrCorp["fcSkid"].ToString(), inMasterCode.TrimEnd() });
                    if (objSQLHelper.SQLExec(ref this.dtsDataEnv, "QRefChild", this.mstrRefChildTable, "select fcSkid, fcCode, fcName from " + this.mstrRefChildTable + " where " + this.mstrSQLPrefix2, ref strErrorMsg))
                    {
                        DataRow dtrChildTab = this.dtsDataEnv.Tables["QRefChild"].Rows[0];
                        bllChkResult = this.pmHasUsedChild1Corp(objSQLHelper, dtrChildTab["fcSkid"].ToString(), ref ioErrorMsg);
                        if (bllChkResult)
                        {
                            strRefErrorMsg += "\r\n" + ioErrorMsg;
                        }

                        bllResult = (bllResult || bllChkResult);
                    }
                }
            }
            ioErrorMsg = strRefErrorMsg;
            return(bllResult);
        }
Example #3
0
        private bool pmHasUsedChild1Corp(cDBMSAgent inSQLHelper, string inRowID, ref string ioErrorMsg)
        {
            bool   bllResult   = false;
            string strErrorMsg = "";
            string strRefMsg   = "";

            inSQLHelper.SetPara(new object[] { inRowID });
            if (inSQLHelper.SQLExec(ref this.dtsDataEnv, "QChk", MapTable.Table.Department, "select fcSkid, fcCode, fcRefNo from " + MapTable.Table.GLRef + " where fcCoor = ?", ref strErrorMsg))
            {
                string strCorpStr = "ºÃÔÉÑ· (" + this.mdtrCurrCorp["fcCode"].ToString().TrimEnd() + ") " + this.mdtrCurrCorp["fcName"].ToString().TrimEnd();
                foreach (DataRow dtrChildTab in this.dtsDataEnv.Tables["QChk"].Rows)
                {
                    //strRefMsg += "\r\n     (" + dtrChildTab["fcCode"].ToString().TrimEnd() + ") " + dtrChildTab["fcName"].ToString().TrimEnd();
                    strRefMsg += "\r\n     (" + dtrChildTab["fcRefNo"].ToString().TrimEnd() + ") ";
                }
                ioErrorMsg = strCorpStr + "\r\nàÍ¡ÊÒÃ" + strRefMsg + "\r\n";
                return(true);
            }
            inSQLHelper.SetPara(new object[] { inRowID });
            if (inSQLHelper.SQLExec(ref this.dtsDataEnv, "QChk", MapTable.Table.OrderH, "select fcSkid, fcCode, fcRefNo from " + MapTable.Table.OrderH + " where fcCoor = ?", ref strErrorMsg))
            {
                string strCorpStr = "ºÃÔÉÑ· (" + this.mdtrCurrCorp["fcCode"].ToString().TrimEnd() + ") " + this.mdtrCurrCorp["fcName"].ToString().TrimEnd();
                foreach (DataRow dtrChildTab in this.dtsDataEnv.Tables["QChk"].Rows)
                {
                    //strRefMsg += "\r\n     (" + dtrChildTab["fcCode"].ToString().TrimEnd() + ") " + dtrChildTab["fcName"].ToString().TrimEnd();
                    strRefMsg += "\r\n     (" + dtrChildTab["fcRefNo"].ToString().TrimEnd() + ") ";
                }
                ioErrorMsg = strCorpStr + "\r\nàÍ¡ÊÒÃ" + strRefMsg + "\r\n";
                return(true);
            }
            return(bllResult);
        }
Example #4
0
        private void pmLoadBook()
        {
            string     strErrorMsg  = "";
            cDBMSAgent objSQLHelper = new cDBMSAgent(App.ERPConnectionString, App.DatabaseReside);

            objSQLHelper.SetPara(new object[] { this.txtQcBook.Tag });
            if (objSQLHelper.SQLExec(ref this.dtsDataEnv, "QBook", "BOOK", "select fcSkid, fcCode, fcName from BOOK where fcSkid = ?", ref strErrorMsg))
            {
                this.txtQcBook.Tag  = this.dtsDataEnv.Tables["QBook"].Rows[0]["fcSkid"].ToString();
                this.txtQcBook.Text = this.dtsDataEnv.Tables["QBook"].Rows[0]["fcCode"].ToString().TrimEnd();
                this.txtQnBook.Text = this.dtsDataEnv.Tables["QBook"].Rows[0]["fcName"].ToString().TrimEnd();
            }
        }
Example #5
0
        private DataTable pmSearchData(object[] inPrefixPara, string inKey, string inAlias)
        {
            string strAppUserFldList = "cRowID, cCode, cName, cName2";

            string strErrorMsg      = "";
            string strBrowViewAlias = inAlias;
            string strSQLStr        = "";

            strSQLStr = "select " + strAppUserFldList + " from " + MapTable.Table.MasterDept + " where " + this.mstrSQLPrefix
                        + " " + (inKey == "CCODE" ? "CCODE" : "CNAME") + " like ?";

            cDBMSAgent objSQLHelper = new cDBMSAgent(this.mstrConnectionString, this.mDataBaseReside);

            objSQLHelper.SetPara(inPrefixPara);
            objSQLHelper.SQLExec(ref this.dtsDataEnv, strBrowViewAlias, MapTable.Table.MasterDept, strSQLStr, ref strErrorMsg);
            return(this.dtsDataEnv.Tables[strBrowViewAlias].Copy());
        }
Example #6
0
        public static void AppDBChkUpdate()
        {
            if (System.IO.File.Exists(Application.StartupPath + @"\UPDATE.CHK"))
            {
                cDBMSAgent objSQLHelper = new cDBMSAgent(App.ConnectionString, App.DatabaseReside);

                BeSmartMRP.Data.DBChkUpdate mDBChkUpdate = new BeSmartMRP.Data.DBChkUpdate(App.ConnectionString, App.DatabaseReside);

                if (mDBChkUpdate.CheckUpdate())
                {
                    System.IO.File.Delete(Application.StartupPath + @"\UPDATE.CHK");
                    MessageBox.Show("Update Database Structure Complete !", "Application Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Update Database Structure Fail !", "Application Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Example #7
0
 public bool HasUsedChildTable(cDBMSAgent inSQLHelper, string inMasterCode, ref string ioErrorMsg)
 {
     return(this.pmHasUsedChildTable(inSQLHelper, inMasterCode, ref ioErrorMsg));
 }
Example #8
0
        public static bool pmAppChkVersion(ref string ioMsg)
        {
            bool bllIsOK = true;

            string strMsg = "";

            System.Data.DataSet dtsAppVer = new System.Data.DataSet();
            string     strErrorMsg        = "";
            cDBMSAgent objSQLHelper       = new cDBMSAgent(App.ConnectionString, App.DatabaseReside);

            if (!objSQLHelper.SQLExec(ref dtsAppVer, "QAppConfig", "APPCONFIG", "select * from SMAPPCONFIG ", ref strErrorMsg))
            {
                objSQLHelper.SetPara(new object[] { "$$$$0001", App.AppID, "N/A", App.AppVersion, App.AppDBVersion });
                objSQLHelper.SQLExec("insert into SMAPPCONFIG (cRowID , cRegMod , cLicNo , cAppVersion , cDBVersion ) values (?,?,?,?,?)", ref strErrorMsg);
            }

            if (objSQLHelper.SQLExec(ref dtsAppVer, "QAppConfig", "APPCONFIG", "select * from SMAPPCONFIG ", ref strErrorMsg))
            {
                string   strAppVersion = dtsAppVer.Tables["QAppConfig"].Rows[0]["cAppVersion"].ToString().Trim();
                string[] aDate         = strAppVersion.Split('/');
                try
                {
                    string strDateMsg = "";
                    strDateMsg += "\r\n Version â»Ãá¡ÃÁ             : " + App.AppVersion;
                    strDateMsg += "\r\n Version â»Ãá¡ÃÁã¹Ãкº : " + strAppVersion;

                    int intYear = Convert.ToInt32(aDate[2]);
                    //if (DateTime.Now.ToString("gg") == "¾.È.")
                    //{
                    //    intYear = intYear - 543;
                    //}

                    DateTime dttServerAppVersion = new DateTime(intYear, Convert.ToInt32(aDate[1]), Convert.ToInt32(aDate[0]));
                    int      intCmp = dttServerAppVersion.CompareTo(App.dAppVersion);
                    switch (intCmp)
                    {
                    case -1:
                        strMsg += " µéͧ¡ÒÃà»ÅÕè¹ Version â»Ãá¡ÃÁã¹Ãкº ãËéµÃ§¡Ñº Version â»Ãá¡ÃÁÅèÒÊØ´ËÃ×ÍäÁè ?";
                        strMsg += " \r\n";
                        strMsg += " \r\n à¹×èͧ¨Ò¡ Version â»Ãá¡ÃÁ ¹Õé ãËÁè¡ÇèÒ Version â»Ãá¡ÃÁã¹Ãкº";
                        strMsg += strDateMsg;

                        if (MessageBox.Show(strMsg, "Application confirm message", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            objSQLHelper.SetPara(new object[] { App.AppVersion, App.AppDBVersion });
                            objSQLHelper.SQLExec("update SMAPPCONFIG set cAppVersion = ? , cDBVersion = ? ", ref strErrorMsg);
                            MessageBox.Show("Update Version â»Ãá¡ÃÁ à»ç¹Çѹ·Õè " + App.AppVersion + " àÊÃç¨ÊÁºÙóì", "Application confirm message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("äÁè Update Version â»Ãá¡ÃÁã¹Ãкº ", "Application confirm message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            bllIsOK = false;
                        }

                        break;

                    case 0:
                        strMsg = "";
                        break;

                    case 1:
                        strMsg  = " äÁèÊÒÁÒöà¢éÒ·Ó§Ò¹ä´é ! ";
                        strMsg += " \r\n";
                        strMsg += " \r\n à¹×èͧ¨Ò¡Version â»Ãá¡ÃÁ ¹Õé à¡èÒ¡ÇèÒ Version â»Ãá¡ÃÁã¹Ãкº ";
                        strMsg += strDateMsg;
                        bllIsOK = false;
                        break;
                    }
                }
                catch
                {
                    bllIsOK = false;
                    strMsg  = "Consistency Error ! ";
                }
            }

            ioMsg = strMsg;
            return(bllIsOK);
        }