public List<PD_PROJECT_KAOPING_Model> DataTableToList(DataTable dt)
 {
     List<PD_PROJECT_KAOPING_Model> list = new List<PD_PROJECT_KAOPING_Model>();
     int count = dt.Rows.Count;
     if (count > 0)
     {
         for (int i = 0; i < count; i++)
         {
             PD_PROJECT_KAOPING_Model item = new PD_PROJECT_KAOPING_Model();
             if (dt.Rows[i]["AUTO_ID"].ToString() != "")
             {
                 item.AUTO_ID = new int?(int.Parse(dt.Rows[i]["AUTO_ID"].ToString()));
             }
             if (dt.Rows[i]["KP_TYPEID"].ToString() != "")
             {
                 item.KP_TYPEID = new int?(int.Parse(dt.Rows[i]["KP_TYPEID"].ToString()));
             }
             if (dt.Rows[i]["KP_DETAILID"].ToString() != "")
             {
                 item.KP_DETAILID = new int?(int.Parse(dt.Rows[i]["KP_DETAILID"].ToString()));
             }
             item.KP_YEAR = dt.Rows[i]["KP_YEAR"].ToString();
             item.KP_COMPANYPK = dt.Rows[i]["KP_COMPANYPK"].ToString();
             item.KH_TYPE = dt.Rows[i]["KH_TYPE"].ToString();
             if (dt.Rows[i]["KP_SCORE"].ToString() != "")
             {
                 item.KP_SCORE = new int?(int.Parse(dt.Rows[i]["KP_SCORE"].ToString()));
             }
             list.Add(item);
         }
     }
     return list;
 }
 public PD_PROJECT_KAOPING_Model GetModel(int AUTO_ID)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("select AUTO_ID,KP_TYPEID,KP_DETAILID,KP_YEAR,KP_COMPANYPK,KH_TYPE,KP_SCORE from PD_PROJECT_KAOPING ");
     builder.Append(" where AUTO_ID=:AUTO_ID ");
     OracleParameter[] cmdParms = new OracleParameter[] { new OracleParameter(":AUTO_ID", OracleType.Number, 4) };
     cmdParms[0].Value = AUTO_ID;
     PD_PROJECT_KAOPING_Model model = new PD_PROJECT_KAOPING_Model();
     DataSet set = DbHelperOra.Query(builder.ToString(), cmdParms);
     if (set.Tables[0].Rows.Count <= 0)
     {
         return null;
     }
     if (set.Tables[0].Rows[0]["AUTO_ID"].ToString() != "")
     {
         model.AUTO_ID = new int?(int.Parse(set.Tables[0].Rows[0]["AUTO_ID"].ToString()));
     }
     if (set.Tables[0].Rows[0]["KP_TYPEID"].ToString() != "")
     {
         model.KP_TYPEID = new int?(int.Parse(set.Tables[0].Rows[0]["KP_TYPEID"].ToString()));
     }
     if (set.Tables[0].Rows[0]["KP_DETAILID"].ToString() != "")
     {
         model.KP_DETAILID = new int?(int.Parse(set.Tables[0].Rows[0]["KP_DETAILID"].ToString()));
     }
     model.KP_YEAR = set.Tables[0].Rows[0]["KP_YEAR"].ToString();
     model.KP_COMPANYPK = set.Tables[0].Rows[0]["KP_COMPANYPK"].ToString();
     model.KH_TYPE = set.Tables[0].Rows[0]["KH_TYPE"].ToString();
     if (set.Tables[0].Rows[0]["KP_SCORE"].ToString() != "")
     {
         model.KP_SCORE = new int?(int.Parse(set.Tables[0].Rows[0]["KP_SCORE"].ToString()));
     }
     return model;
 }
 public void Add(PD_PROJECT_KAOPING_Model model)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("insert into PD_PROJECT_KAOPING(");
     builder.Append("AUTO_ID,KP_TYPEID,KP_DETAILID,KP_YEAR,KP_COMPANYPK,KH_TYPE,KP_SCORE)");
     builder.Append(" values (");
     builder.Append(":AUTO_ID,:KP_TYPEID,:KP_DETAILID,:KP_YEAR,:KP_COMPANYPK,:KH_TYPE,:KP_SCORE)");
     OracleParameter[] cmdParms = new OracleParameter[] { new OracleParameter(":AUTO_ID", OracleType.Number, 4), new OracleParameter(":KP_TYPEID", OracleType.Number, 4), new OracleParameter(":KP_DETAILID", OracleType.Number, 4), new OracleParameter(":KP_YEAR", OracleType.NVarChar), new OracleParameter(":KP_COMPANYPK", OracleType.NVarChar), new OracleParameter(":KH_TYPE", OracleType.NVarChar), new OracleParameter(":KP_SCORE", OracleType.Number, 4) };
     cmdParms[0].Value = model.AUTO_ID;
     cmdParms[1].Value = model.KP_TYPEID;
     cmdParms[2].Value = model.KP_DETAILID;
     cmdParms[3].Value = model.KP_YEAR;
     cmdParms[4].Value = model.KP_COMPANYPK;
     cmdParms[5].Value = model.KH_TYPE;
     cmdParms[6].Value = model.KP_SCORE;
     DbHelperOra.ExecuteSql(builder.ToString(), cmdParms);
 }
 public bool Update(PD_PROJECT_KAOPING_Model model)
 {
     return this.dal.Update(model);
 }
 public void Add(PD_PROJECT_KAOPING_Model model)
 {
     this.dal.Add(model);
 }
 public bool Update(PD_PROJECT_KAOPING_Model model)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("update PD_PROJECT_KAOPING set ");
     builder.Append("AUTO_ID=:AUTO_ID,");
     builder.Append("KP_TYPEID=:KP_TYPEID,");
     builder.Append("KP_DETAILID=:KP_DETAILID,");
     builder.Append("KP_YEAR=:KP_YEAR,");
     builder.Append("KP_COMPANYPK=:KP_COMPANYPK,");
     builder.Append("KH_TYPE=:KH_TYPE,");
     builder.Append("KP_SCORE=:KP_SCORE");
     builder.Append(" where AUTO_ID=:AUTO_ID ");
     OracleParameter[] cmdParms = new OracleParameter[] { new OracleParameter(":AUTO_ID", OracleType.Number, 4), new OracleParameter(":KP_TYPEID", OracleType.Number, 4), new OracleParameter(":KP_DETAILID", OracleType.Number, 4), new OracleParameter(":KP_YEAR", OracleType.NVarChar), new OracleParameter(":KP_COMPANYPK", OracleType.NVarChar), new OracleParameter(":KH_TYPE", OracleType.NVarChar), new OracleParameter(":KP_SCORE", OracleType.Number, 4) };
     cmdParms[0].Value = model.AUTO_ID;
     cmdParms[1].Value = model.KP_TYPEID;
     cmdParms[2].Value = model.KP_DETAILID;
     cmdParms[3].Value = model.KP_YEAR;
     cmdParms[4].Value = model.KP_COMPANYPK;
     cmdParms[5].Value = model.KH_TYPE;
     cmdParms[6].Value = model.KP_SCORE;
     return (DbHelperOra.ExecuteSql(builder.ToString(), cmdParms) > 0);
 }