public static BG_PrjJonSub AddBG_PrjJonSub(BG_PrjJonSub bG_PrjJonSub)
        {
            string sql =
                "INSERT BG_PrjJonSub (PPID, PIID)" +
                "VALUES (@PPID, @PIID)";

            sql += " ; SELECT @@IDENTITY";

            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@PPID", bG_PrjJonSub.PPID),
                    new SqlParameter("@PIID", bG_PrjJonSub.PIID)
                };

                string IdStr = DBUnity.ExecuteScalar(CommandType.Text, sql, para);
                int newId = Convert.ToInt32(IdStr);
                return GetBG_PrjJonSubByPSID(newId);

            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
        public static BG_PrjJonSub GetBG_PrjJonSubByPSID(int pSID)
        {
            string sql = "SELECT * FROM BG_PrjJonSub WHERE PSID = @PSID";

            try
            {
                SqlParameter para = new SqlParameter("@PSID", pSID);
                DataTable dt = DBUnity.AdapterToTab(sql, para);

                if(dt.Rows.Count > 0)
                {
                    BG_PrjJonSub bG_PrjJonSub = new BG_PrjJonSub();

                    bG_PrjJonSub.PSID = dt.Rows[0]["PSID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PSID"];
                    bG_PrjJonSub.PPID = dt.Rows[0]["PPID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PPID"];
                    bG_PrjJonSub.PIID = dt.Rows[0]["PIID"] == DBNull.Value ? 0 : (int)dt.Rows[0]["PIID"];

                    return bG_PrjJonSub;
                }
                else
                {
                    return null;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
 public static bool DeleteBG_PrjJonSub(BG_PrjJonSub bG_PrjJonSub)
 {
     return DeleteBG_PrjJonSubByPSID( bG_PrjJonSub.PSID );
 }
        public static bool ModifyBG_PrjJonSub(BG_PrjJonSub bG_PrjJonSub)
        {
            string sql =
                "UPDATE BG_PrjJonSub " +
                "SET " +
                    "PPID = @PPID, " +
                    "PIID = @PIID " +
                "WHERE PSID = @PSID";

            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@PSID", bG_PrjJonSub.PSID),
                    new SqlParameter("@PPID", bG_PrjJonSub.PPID),
                    new SqlParameter("@PIID", bG_PrjJonSub.PIID)
                };

                int t = DBUnity.ExecuteNonQuery(CommandType.Text, sql, para);
                if(t>0)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
 public static bool ModifyBG_PrjJonSub(BG_PrjJonSub bG_PrjJonSub)
 {
     return BG_PrjJonSubService.ModifyBG_PrjJonSub(bG_PrjJonSub);
 }
 public static bool DeleteBG_PrjJonSub(BG_PrjJonSub bG_PrjJonSub)
 {
     return BG_PrjJonSubService.DeleteBG_PrjJonSub(bG_PrjJonSub);
 }
 public static BG_PrjJonSub AddBG_PrjJonSub(BG_PrjJonSub bG_PrjJonSub)
 {
     return BG_PrjJonSubService.AddBG_PrjJonSub(bG_PrjJonSub);
 }