Ejemplo n.º 1
0
        private static Tab_UserCertificate ToModel(DataRow row)
        {
            Tab_UserCertificate model = new Tab_UserCertificate();

            model.Idx            = row.IsNull("Idx")?null:(System.Int32?)row["Idx"];
            model.UserIdx_FxIdx  = row.IsNull("UserIdx_FxIdx")?null:(System.Int32?)row["UserIdx_FxIdx"];
            model.CertificateMap = row.IsNull("CertificateMap")?null:(System.String)row["CertificateMap"];
            model.GetTheDate     = row.IsNull("GetTheDate")?null:(System.DateTime?)row["GetTheDate"];
            return(model);
        }
Ejemplo n.º 2
0
        public int AddNew(Tab_UserCertificate model)
        {
            string sql = "insert into Tab_UserCertificate(UserIdx_FxIdx,CertificateMap,GetTheDate)  values(@UserIdx_FxIdx,@CertificateMap,@GetTheDate); select @@identity ;";
            int    Idx = Convert.ToInt32(SqlHelper.ExecuteScalar(CommandType.Text, sql
                                                                 , new SqlParameter("@UserIdx_FxIdx", model.UserIdx_FxIdx)
                                                                 , new SqlParameter("@CertificateMap", model.CertificateMap)
                                                                 , new SqlParameter("@GetTheDate", model.GetTheDate)
                                                                 ));

            return(Idx);
        }
Ejemplo n.º 3
0
        public bool Update(Tab_UserCertificate model)
        {
            string sql  = "update Tab_UserCertificate set UserIdx_FxIdx=@UserIdx_FxIdx,CertificateMap=@CertificateMap,GetTheDate=@GetTheDate where Idx=@Idx";
            int    rows = SqlHelper.ExecuteNonQuery(CommandType.Text, sql
                                                    , new SqlParameter("@UserIdx_FxIdx", model.UserIdx_FxIdx)
                                                    , new SqlParameter("@CertificateMap", model.CertificateMap)
                                                    , new SqlParameter("@GetTheDate", model.GetTheDate)
                                                    , new SqlParameter("Idx", model.Idx)
                                                    );

            return(rows > 0);
        }
Ejemplo n.º 4
0
        public Tab_UserCertificate Get(string Idx)
        {
            DataTable dt = SqlHelper.ExecuteDataset(CommandType.Text, "select * from Tab_UserCertificate  where Idx=@Idx",
                                                    new SqlParameter("Idx", Idx)).Tables[0];

            if (dt.Rows.Count > 1)
            {
                throw new Exception("more than 1 row was found");
            }

            if (dt.Rows.Count <= 0)
            {
                return(null);
            }

            DataRow             row   = dt.Rows[0];
            Tab_UserCertificate model = ToModel(row);

            return(model);
        }