예제 #1
0
        public static string Insert(DemoModel _demoModel)
        {
            DbCommand command = Catalog_Access.CreateCommand();

            //Have to wite the stored procedure
            command.CommandText = "sp_insert_Demo";

            DbParameter param;

            param = command.CreateParameter();
            param.ParameterName = "@Name";
            param.Value         = _demoModel.Name;
            param.DbType        = DbType.String;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@CreatedBy";
            param.Value         = _demoModel.CreatedBy;
            param.DbType        = DbType.String;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Return";
            param.DbType        = DbType.String;
            param.Size          = 2;
            param.Direction     = ParameterDirection.Output;
            command.Parameters.Add(param);

            Catalog_Access.ExecuteNonQuery(command);

            string Return = command.Parameters["@Return"].Value.ToString();

            return(Return);
        }
예제 #2
0
        public static DataTable Get()
        {
            DbCommand command = Catalog_Access.CreateCommand();

            command.CommandText = "sp_Get_Demo";

            return(Catalog_Access.ExecuteSelectCommand(command));
        }
예제 #3
0
        public static int Delete(int Code)
        {
            DbCommand command = Catalog_Access.CreateCommand();

            command.CommandText = "sp_Delete_Demo_By_Code";

            DbParameter param;

            param = command.CreateParameter();
            param.ParameterName = "@Code";
            param.Value         = Code;
            param.DbType        = DbType.Int32;
            command.Parameters.Add(param);

            return(Catalog_Access.ExecuteNonQuery(command));
        }
예제 #4
0
        public static DataTable Get(int Code)
        {
            DbCommand command = Catalog_Access.CreateCommand();

            command.CommandText = "sp_Get_Demo_By_Code";

            DbParameter param;

            param = command.CreateParameter();
            param.ParameterName = "@Code";
            param.Value         = Code;
            param.DbType        = DbType.Int32;
            command.Parameters.Add(param);

            return(Catalog_Access.ExecuteSelectCommand(command));
        }
예제 #5
0
        public static DataTable Filter_Get(int iDisplayLength, int iDisplayStart, int iSortCol_0, string sSortDir_0, string sSearch)
        {
            DbCommand command = Catalog_Access.CreateCommand();

            command.CommandText = "sp_Filter_Get_Demo";

            DbParameter param;

            param = command.CreateParameter();
            param.ParameterName = "@DisplayLength";
            param.Value         = iDisplayLength;
            param.DbType        = DbType.Int32;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@DisplayStart";
            param.Value         = iDisplayStart;
            param.DbType        = DbType.Int32;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@SortCol";
            param.Value         = iSortCol_0;
            param.DbType        = DbType.Int32;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@SortDir";
            param.Value         = sSortDir_0;
            param.DbType        = DbType.String;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Search";
            param.Value         = sSearch;
            param.DbType        = DbType.String;
            command.Parameters.Add(param);

            return(Catalog_Access.ExecuteSelectCommand(command));
        }
예제 #6
0
        public static string Update(DemoModel _demoModel)
        {
            DbCommand command = Catalog_Access.CreateCommand();

            command.CommandText = "sp_Update_Demo";

            DbParameter param;

            param = command.CreateParameter();
            param.ParameterName = "@Code";
            param.Value         = _demoModel.Code;
            param.DbType        = DbType.Int32;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Name";
            param.Value         = _demoModel.Name;
            param.DbType        = DbType.String;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@UpdatedBy";
            param.Value         = _demoModel.UpdatedBy;
            param.DbType        = DbType.String;
            command.Parameters.Add(param);

            param = command.CreateParameter();
            param.ParameterName = "@Return";
            param.DbType        = DbType.String;
            param.Size          = 2;
            param.Direction     = ParameterDirection.Output;
            command.Parameters.Add(param);
            Catalog_Access.ExecuteNonQuery(command);

            string Return = command.Parameters["@Return"].Value.ToString();

            return(Return);
        }