Ejemplo n.º 1
0
        public bool InsertRecord(CodeMasterInfo infoObject)
        {
            string sqlString = string.Empty;
            bool isSuccess = false;

            if (infoObject == null)
            {
                return isSuccess;
            }

            sqlString = "INSERT INTO " + this._dataBaseDic[CodeMasterInfoEnum.TableName.ToString()] + "(" + this._newLineSybm;
            sqlString += this._dataBaseDic[CodeMasterInfoEnum.CmtCKey1.ToString()] + "," + this._newLineSybm;
            sqlString += this._dataBaseDic[CodeMasterInfoEnum.CmtCKey2.ToString()] + "," + this._newLineSybm;
            sqlString += this._dataBaseDic[CodeMasterInfoEnum.CmtCValue.ToString()] + "," + this._newLineSybm;
            sqlString += this._dataBaseDic[CodeMasterInfoEnum.CmtFNumber.ToString()] + "," + this._newLineSybm;
            sqlString += this._dataBaseDic[CodeMasterInfoEnum.CmtCRemark.ToString()] + "," + this._newLineSybm;
            sqlString += this._dataBaseDic[CodeMasterInfoEnum.CmtCRemark2.ToString()] + "," + this._newLineSybm;
            sqlString += this._dataBaseDic[CodeMasterInfoEnum.CmtCAdd.ToString()] + "," + this._newLineSybm;
            sqlString += this._dataBaseDic[CodeMasterInfoEnum.CmtDAddDate.ToString()] + "," + this._newLineSybm;
            sqlString += this._dataBaseDic[CodeMasterInfoEnum.CmtCLast.ToString()] + "," + this._newLineSybm;
            sqlString += this._dataBaseDic[CodeMasterInfoEnum.CmtDLastDate.ToString()] + ")" + this._newLineSybm;
            sqlString += "VALUES(" + this._newLineSybm;
            sqlString += "'" + infoObject.CmtCKey1.Trim().Replace("'", "''") + "'," + this._newLineSybm;
            sqlString += "'" + infoObject.CmtCKey2.Trim().Replace("'", "''") + "'," + this._newLineSybm;
            sqlString += "'" + infoObject.CmtCValue.Trim().Replace("'", "''") + "'," + this._newLineSybm;
            sqlString += infoObject.CmtFNumber.ToString() + "," + this._newLineSybm;
            sqlString += "'" + infoObject.CmtCRemark.Trim().Replace("'", "''") + "'," + this._newLineSybm;
            sqlString += "'" + infoObject.CmtCRemark2.Trim().Replace("'", "''") + "'," + this._newLineSybm;
            sqlString += "'" + infoObject.CmtCAdd.Trim().Replace("'", "''") + "'," + this._newLineSybm;
            if (infoObject.CmtDAddDate == null)
            {
                sqlString += "NULL," + this._newLineSybm;
            }
            else
            {
                sqlString += "'" + infoObject.CmtDAddDate.Value.ToString("yyyy-MM-dd hh:mm:ss") + "'," + this._newLineSybm;
            }
            sqlString += "'" + infoObject.CmtCLast.Trim().Replace("'", "''") + "'," + this._newLineSybm;
            if (infoObject.CmtDLastDate == null)
            {
                sqlString += "NULL)" + this._newLineSybm;
            }
            else
            {
                sqlString += "'" + infoObject.CmtDLastDate.Value.ToString("yyyy-MM-dd hh:mm:ss") + "')" + this._newLineSybm;
            }

            DataAccessLayer dal = new DataAccessLayer();
            try
            {
                isSuccess = dal.ExecNonQuery(sqlString);
            }
            catch (Exception Ex)
            {
                throw Ex;
            }

            return isSuccess;
        }
Ejemplo n.º 2
0
        public bool UpdateRecord(CodeMasterInfo infoObject)
        {
            string sqlString = string.Empty;
            bool isSuccess = false;

            if (infoObject == null)
            {
                return isSuccess;
            }

            sqlString = "UPDATE " + this._dataBaseDic[CodeMasterInfoEnum.TableName.ToString()] + " SET " + this._newLineSybm;
            sqlString += this._dataBaseDic[CodeMasterInfoEnum.CmtCValue.ToString()] + "='" + infoObject.CmtCValue.Trim().Replace("'", "''") + "'," + this._newLineSybm;
            sqlString += this._dataBaseDic[CodeMasterInfoEnum.CmtFNumber.ToString()] + "=" + infoObject.CmtFNumber.ToString() + "," + this._newLineSybm;
            sqlString += this._dataBaseDic[CodeMasterInfoEnum.CmtCRemark.ToString()] + "='" + infoObject.CmtCRemark.Trim().Replace("'", "''") + "'," + this._newLineSybm;
            sqlString += this._dataBaseDic[CodeMasterInfoEnum.CmtCRemark2.ToString()] + "='" + infoObject.CmtCRemark2.Trim().Replace("'", "''") + "'," + this._newLineSybm;
            sqlString += this._dataBaseDic[CodeMasterInfoEnum.CmtCLast.ToString()] + "='" + infoObject.CmtCLast.Trim().Replace("'", "''") + "'," + this._newLineSybm;
            if (infoObject.CmtDLastDate == null)
            {
                sqlString += this._dataBaseDic[CodeMasterInfoEnum.CmtDLastDate.ToString()] + "=NULL" + this._newLineSybm;
            }
            else
            {
                sqlString += this._dataBaseDic[CodeMasterInfoEnum.CmtDLastDate.ToString()] + "='" + infoObject.CmtDLastDate.Value.ToString("yyyy-MM-dd hh:mm:ss") + "'" + this._newLineSybm;
            }
            sqlString += " WHERE " + this._dataBaseDic[CodeMasterInfoEnum.CmtIRecID.ToString()] + "=" + infoObject.CmtIRecID.ToString();

            DataAccessLayer dal = new DataAccessLayer();
            try
            {
                isSuccess = dal.ExecNonQuery(sqlString);
            }
            catch (Exception Ex)
            {
                throw Ex;
            }

            return isSuccess;
        }
Ejemplo n.º 3
0
        public CodeMasterInfo GetTableFieldLenght()
        {
            CodeMasterInfo codeMasterInfo = null;

            codeMasterInfo = new CodeMasterInfo();

            codeMasterInfo.CmtCKey1_Lenght = 30;
            codeMasterInfo.CmtCKey2_Lenght = 30;
            codeMasterInfo.CmtCValue_Lenght = 30;
            codeMasterInfo.CmtCRemark_Lenght = 200;
            codeMasterInfo.CmtCRemark2_Lenght = 200;
            codeMasterInfo.CmtCAdd_Lenght = 20;
            codeMasterInfo.CmtCLast_Lenght = 20;

            #region MyRegion

            //Dictionary<string, int> dic = null;

            //DataBaseCommand<CodeMasterInfo> dbc = new DataBaseCommand<CodeMasterInfo>();

            //try
            //{
            //    dic = dbc.GetTableFieldLenght(this._dataBaseDic[CodeMasterInfoEnum.TableName.ToString()]);
            //}
            //catch (Exception Ex)
            //{
            //    throw Ex;
            //}

            //if (dic != null)
            //{
            //    codeMasterInfo = new CodeMasterInfo();

            //    codeMasterInfo.CmtCKey1_Lenght = dic[this._dataBaseDic[CodeMasterInfoEnum.CmtCKey1.ToString()]];
            //    codeMasterInfo.CmtCKey2_Lenght = dic[this._dataBaseDic[CodeMasterInfoEnum.CmtCKey2.ToString()]];
            //    codeMasterInfo.CmtCValue_Lenght = dic[this._dataBaseDic[CodeMasterInfoEnum.CmtCValue.ToString()]];
            //    codeMasterInfo.CmtCRemark_Lenght = dic[this._dataBaseDic[CodeMasterInfoEnum.CmtCRemark.ToString()]];
            //    codeMasterInfo.CmtCRemark2_Lenght = dic[this._dataBaseDic[CodeMasterInfoEnum.CmtCKey2.ToString()]];
            //    codeMasterInfo.CmtCAdd_Lenght = dic[this._dataBaseDic[CodeMasterInfoEnum.CmtCAdd.ToString()]];
            //    codeMasterInfo.CmtCLast_Lenght = dic[this._dataBaseDic[CodeMasterInfoEnum.CmtCLast.ToString()]];

            //}

            #endregion

            return codeMasterInfo;
        }