コード例 #1
0
        private GK_OA_OutFileRegiesterModel _DataBind(int Code)
        {
            GK_OA_OutFileRegiesterModel model = new GK_OA_OutFileRegiesterModel();
            StringBuilder builder             = new StringBuilder();

            builder.Append("select * from GK_OA_OutFileRegiester ");
            builder.Append(" where Code=@Code");
            this._DataProcess.CommandText = builder.ToString();
            this._DataProcess.ProcessParametersAdd("@Code", SqlDbType.Int, 4, Code);
            SqlDataReader sqlDataReader = null;

            try
            {
                try
                {
                    sqlDataReader = this._DataProcess.GetSqlDataReader();
                    while (sqlDataReader.Read())
                    {
                        this.Initialize(sqlDataReader, model);
                    }
                }
                catch (SqlException exception)
                {
                    throw exception;
                }
            }
            finally
            {
                if (sqlDataReader != null)
                {
                    sqlDataReader.Close();
                }
            }
            return(model);
        }
コード例 #2
0
        public int Update(GK_OA_OutFileRegiesterModel ObjModel)
        {
            int num = 0;

            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                connection.Open();
                SqlTransaction transaction = connection.BeginTransaction();
                try
                {
                    try
                    {
                        num = new GK_OA_OutFileRegiesterBLL().Update(ObjModel, transaction);
                        transaction.Commit();
                    }
                    catch (SqlException exception)
                    {
                        transaction.Rollback();
                        connection.Close();
                        throw exception;
                    }
                    return(num);
                }
                finally
                {
                    connection.Close();
                }
            }
            return(num);
        }
コード例 #3
0
 private void Initialize(SqlDataReader reader, GK_OA_OutFileRegiesterModel obj)
 {
     if (reader.GetValue(0) != DBNull.Value)
     {
         obj.Code = reader.GetInt32(0);
     }
     if (reader.GetValue(1) != DBNull.Value)
     {
         obj.FileCode = reader.GetString(1);
     }
     if (reader.GetValue(2) != DBNull.Value)
     {
         obj.RegiesterDate = reader.GetDateTime(2);
     }
     if (reader.GetValue(3) != DBNull.Value)
     {
         obj.UnitCode = reader.GetString(3);
     }
     if (reader.GetValue(4) != DBNull.Value)
     {
         obj.Detail = reader.GetString(4);
     }
     if (reader.GetValue(5) != DBNull.Value)
     {
         obj.Remark = reader.GetString(5);
     }
     if (reader.GetValue(6) != DBNull.Value)
     {
         obj.FileNumeber = reader.GetString(6);
     }
     if (reader.GetValue(7) != DBNull.Value)
     {
         obj.UserCode = reader.GetString(7);
     }
 }
コード例 #4
0
        private List <GK_OA_OutFileRegiesterModel> _Select(GK_OA_OutFileRegiesterQueryModel qmObj)
        {
            List <GK_OA_OutFileRegiesterModel> list = new List <GK_OA_OutFileRegiesterModel>();
            StringBuilder builder = new StringBuilder();

            builder.Append("select * from GK_OA_OutFileRegiester ");
            builder.Append(qmObj.QueryConditionStr);
            if (qmObj.SortColumns.Length == 0)
            {
                builder.Append(" ORDER BY Code desc");
            }
            else
            {
                builder.Append(" ORDER BY " + qmObj.SortColumns);
            }
            this._DataProcess.CommandText   = builder.ToString();
            this._DataProcess.SqlParameters = qmObj.Parameters;
            SqlDataReader sqlDataReader = null;
            int           num           = 0;

            try
            {
                try
                {
                    sqlDataReader = this._DataProcess.GetSqlDataReader();
                    while (sqlDataReader.Read())
                    {
                        if ((num >= qmObj.StartRecord) && ((list.Count < qmObj.MaxRecords) || (qmObj.MaxRecords == -1)))
                        {
                            GK_OA_OutFileRegiesterModel model = new GK_OA_OutFileRegiesterModel();
                            this.Initialize(sqlDataReader, model);
                            list.Add(model);
                        }
                        num++;
                    }
                }
                catch (SqlException exception)
                {
                    throw exception;
                }
            }
            finally
            {
                if (sqlDataReader != null)
                {
                    sqlDataReader.Close();
                }
            }
            return(list);
        }
コード例 #5
0
        private int _Update(GK_OA_OutFileRegiesterModel mObj)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update GK_OA_OutFileRegiester set ");
            if (mObj.FileCode != null)
            {
                builder.Append("FileCode=@FileCode,");
                this._DataProcess.ProcessParametersAdd("@FileCode", SqlDbType.VarChar, 50, mObj.FileCode);
            }
            if (mObj.RegiesterDate != DateTime.MinValue)
            {
                builder.Append("RegiesterDate=@RegiesterDate,");
                this._DataProcess.ProcessParametersAdd("@RegiesterDate", SqlDbType.DateTime, 8, mObj.RegiesterDate);
            }
            if (mObj.UnitCode != null)
            {
                builder.Append("UnitCode=@UnitCode,");
                this._DataProcess.ProcessParametersAdd("@UnitCode", SqlDbType.VarChar, 50, mObj.UnitCode);
            }
            if (mObj.Detail != null)
            {
                builder.Append("Detail=@Detail,");
                this._DataProcess.ProcessParametersAdd("@Detail", SqlDbType.VarChar, 500, mObj.Detail);
            }
            if (mObj.Remark != null)
            {
                builder.Append("Remark=@Remark,");
                this._DataProcess.ProcessParametersAdd("@Remark", SqlDbType.VarChar, 500, mObj.Remark);
            }
            if (mObj.FileNumeber != null)
            {
                builder.Append("FileNumeber=@FileNumeber,");
                this._DataProcess.ProcessParametersAdd("@FileNumeber", SqlDbType.VarChar, 50, mObj.FileNumeber);
            }
            if (mObj.UserCode != null)
            {
                builder.Append("UserCode=@UserCode,");
                this._DataProcess.ProcessParametersAdd("@UserCode", SqlDbType.VarChar, 50, mObj.UserCode);
            }
            builder.Remove(builder.Length - 1, 1);
            builder.Append(" where Code=@Code");
            this._DataProcess.ProcessParametersAdd("@Code", SqlDbType.Int, 4, mObj.Code);
            this._DataProcess.CommandText = builder.ToString();
            return(this._DataProcess.RunSql());
        }
コード例 #6
0
        public GK_OA_OutFileRegiesterModel GetGK_OA_OutFileRegiester(int Code)
        {
            GK_OA_OutFileRegiesterModel model = new GK_OA_OutFileRegiesterModel();

            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                try
                {
                    connection.Open();
                    model = new GK_OA_OutFileRegiesterBLL().GetModel(Code, connection);
                    connection.Close();
                }
                catch (SqlException exception)
                {
                    throw exception;
                }
            }
            return(model);
        }
コード例 #7
0
        private int _Insert(GK_OA_OutFileRegiesterModel mObj)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into GK_OA_OutFileRegiester(");
            builder.Append("FileCode,RegiesterDate,UnitCode,Detail,Remark,FileNumeber,UserCode)");
            builder.Append(" values (");
            builder.Append("@FileCode,@RegiesterDate,@UnitCode,@Detail,@Remark,@FileNumeber,@UserCode) ");
            builder.Append("SELECT @Code = SCOPE_IDENTITY()");
            this._DataProcess.CommandText = builder.ToString();
            this._DataProcess.ProcessParametersAdd("@FileCode", SqlDbType.VarChar, 50, mObj.FileCode);
            this._DataProcess.ProcessParametersAdd("@RegiesterDate", SqlDbType.DateTime, 8, mObj.RegiesterDate);
            this._DataProcess.ProcessParametersAdd("@UnitCode", SqlDbType.VarChar, 50, mObj.UnitCode);
            this._DataProcess.ProcessParametersAdd("@Detail", SqlDbType.VarChar, 500, mObj.Detail);
            this._DataProcess.ProcessParametersAdd("@Remark", SqlDbType.VarChar, 500, mObj.Remark);
            this._DataProcess.ProcessParametersAdd("@FileNumeber", SqlDbType.VarChar, 50, mObj.FileNumeber);
            this._DataProcess.ProcessParametersAdd("@UserCode", SqlDbType.VarChar, 50, mObj.UserCode);
            SqlParameter parameter = this._DataProcess.ProcessParametersAdd("@Code", SqlDbType.Int, 4, null);

            parameter.Direction = ParameterDirection.Output;
            this._DataProcess.RunSql();
            mObj.Code = (int)parameter.Value;
            return(mObj.Code);
        }
コード例 #8
0
        public int Update(GK_OA_OutFileRegiesterModel ObjModel, SqlTransaction Transaction)
        {
            GK_OA_OutFileRegiesterDAL rdal = new GK_OA_OutFileRegiesterDAL(Transaction);

            return(rdal.Update(ObjModel));
        }
コード例 #9
0
 public int Update(GK_OA_OutFileRegiesterModel mObj)
 {
     return(this._Update(mObj));
 }
コード例 #10
0
 public int Insert(GK_OA_OutFileRegiesterModel mObj)
 {
     return(this._Insert(mObj));
 }
コード例 #11
0
 public int Delete(GK_OA_OutFileRegiesterModel mObj)
 {
     return(this._Delete(mObj.Code));
 }