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

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

            sqlString  = "INSERT INTO " + this._dataDictionary[DeptMasterInfoEnum.TableName.ToString()] + "(" + this._newLineSybm;
            sqlString += this._dataDictionary[DeptMasterInfoEnum.DpmCDeptNumber.ToString()] + "," + this._newLineSybm;
            sqlString += this._dataDictionary[DeptMasterInfoEnum.DpmCDeptName.ToString()] + "," + this._newLineSybm;
            sqlString += this._dataDictionary[DeptMasterInfoEnum.Remark.ToString()] + "," + this._newLineSybm;
            sqlString += this._dataDictionary[DeptMasterInfoEnum.Add.ToString()] + "," + this._newLineSybm;
            sqlString += this._dataDictionary[DeptMasterInfoEnum.AddDate.ToString()] + "," + this._newLineSybm;
            sqlString += this._dataDictionary[DeptMasterInfoEnum.Last.ToString()] + "," + this._newLineSybm;
            sqlString += this._dataDictionary[DeptMasterInfoEnum.LastDate.ToString()] + ")" + this._newLineSybm;
            sqlString += "VALUES(" + this._newLineSybm;
            sqlString += "'" + infoObject.DpmCDeptNumber.Trim().Replace("'", "''") + "'," + this._newLineSybm;
            sqlString += "'" + infoObject.DpmCDeptName.Trim().Replace("'", "''") + "'," + this._newLineSybm;
            sqlString += "'" + infoObject.Remark.Trim().Replace("'", "''") + "'," + this._newLineSybm;
            sqlString += "'" + infoObject.Add.Trim().Replace("'", "''") + "'," + this._newLineSybm;
            if (infoObject.AddDate == null)
            {
                sqlString += "NULL," + this._newLineSybm;
            }
            else
            {
                sqlString += "'" + infoObject.AddDate.Value.ToString("yyyy-MM-dd hh:mm:ss") + "'," + this._newLineSybm;
            }
            sqlString += "'" + infoObject.Last.Trim().Replace("'", "''") + "'," + this._newLineSybm;
            if (infoObject.LastDate == null)
            {
                sqlString += "NULL)" + this._newLineSybm;
            }
            else
            {
                sqlString += "'" + infoObject.LastDate.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(Model.Master.DeptMasterInfo infoObject)
        {
            string sqlString = string.Empty;
            bool   isSuccess = false;

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

            sqlString  = "UPDATE " + this._dataDictionary[DeptMasterInfoEnum.TableName.ToString()] + " SET " + this._newLineSybm;
            sqlString += this._dataDictionary[DeptMasterInfoEnum.DpmCDeptName.ToString()] + "='" + infoObject.DpmCDeptName.Trim().Replace("'", "''") + "'," + this._newLineSybm;
            sqlString += this._dataDictionary[DeptMasterInfoEnum.Remark.ToString()] + "='" + infoObject.Remark.ToString() + "'," + this._newLineSybm;
            sqlString += this._dataDictionary[DeptMasterInfoEnum.Last.ToString()] + "='" + infoObject.Last.Trim().Replace("'", "''") + "'," + this._newLineSybm;
            if (infoObject.LastDate == null)
            {
                sqlString += this._dataDictionary[DeptMasterInfoEnum.LastDate.ToString()] + "=NULL" + this._newLineSybm;
            }
            else
            {
                sqlString += this._dataDictionary[DeptMasterInfoEnum.LastDate.ToString()] + "='" + infoObject.LastDate.Value.ToString("yyyy-MM-dd hh:mm:ss") + "'" + this._newLineSybm;
            }
            sqlString += " WHERE " + this._dataDictionary[DeptMasterInfoEnum.RecordID.ToString()] + "=" + infoObject.RecordID.ToString();

            DataAccessLayer dal = new DataAccessLayer();

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

            return(isSuccess);
        }
Ejemplo n.º 3
0
        public Model.Master.DeptMasterInfo GetTableFieldLenght()
        {
            DeptMasterInfo deptMasterInfo = new DeptMasterInfo();

            deptMasterInfo.DeptName_Lenght = 20;
            deptMasterInfo.DeptNumber_Lenght = 20;
            deptMasterInfo.Remark_Lenght = 50;

            return deptMasterInfo;
        }
Ejemplo n.º 4
0
        private void ValidateValue(DeptMasterInfo deptInfo, ReturnValueInfo returnValue)
        {
            string messageText = string.Empty;

            returnValue.boolValue = true;

            if (deptInfo.DpmCDeptNumber.Trim() == string.Empty)
            {
                returnValue.boolValue = false;
                returnValue.messageText = "\"部门编号\"" + DefineConstantValue.SystemMessageText.strMessageText_W_CannotEmpty;
            }
        }
Ejemplo n.º 5
0
        public ReturnValueInfo UpdateRecord(DeptMasterInfo deptInfo)
        {
            if (deptInfo == null)
            {
                return null;
            }

            ReturnValueInfo returnValue = new ReturnValueInfo();

            bool isSuccess = false;
            try
            {
                isSuccess = this._deptMasterDA.UpdateRecord(deptInfo);
            }
            catch (Exception Ex)
            {
                throw Ex;
            }

            if (isSuccess)
            {
                returnValue.boolValue = true;
                returnValue.messageText = DefineConstantValue.SystemMessageText.strMessageText_I_UpdateSuccess;
            }
            else
            {
                returnValue.boolValue = false;
                returnValue.messageText = DefineConstantValue.SystemMessageText.strMessageText_I_UpdateFail;
            }

            return returnValue;
        }
Ejemplo n.º 6
0
        public ReturnValueInfo InsertRecord(DeptMasterInfo deptInfo)
        {
            if (deptInfo == null)
            {
                return null;
            }

            ReturnValueInfo returnValue = new ReturnValueInfo();
            ValidateValue(deptInfo, returnValue);
            if (!returnValue.boolValue)
            {
                return returnValue;
            }

            bool isExistRecord = false;
            try
            {
                isExistRecord = this._deptMasterDA.IsExistRecord(deptInfo.DpmCDeptNumber);
            }
            catch (Exception Ex)
            {
                throw Ex;
            }

            if (isExistRecord)
            {
                returnValue.boolValue = false;
                returnValue.messageText = DefineConstantValue.SystemMessageText.strMessageText_I_RecordIsExist;

                return returnValue;
            }

            bool isSuccess = false;

            try
            {
                isSuccess = this._deptMasterDA.InsertRecord(deptInfo);
            }
            catch (Exception Ex)
            {
                throw Ex;
            }

            if (isSuccess)
            {
                returnValue.boolValue = true;
                returnValue.messageText = DefineConstantValue.SystemMessageText.strMessageText_I_AddSuccess;
            }
            else
            {
                returnValue.boolValue = false;
                returnValue.messageText = DefineConstantValue.SystemMessageText.strMessageText_I_AddFail;
            }

            return returnValue;
        }