예제 #1
0
        private static Tab_Y_SiteMail ToModel(DataRow row)
        {
            Tab_Y_SiteMail model = new Tab_Y_SiteMail();

            model.Idx             = row.IsNull("Idx")?null:(System.Int32?)row["Idx"];
            model.Sender          = row.IsNull("Sender")?null:(System.String)row["Sender"];
            model.SenderIdx       = row.IsNull("SenderIdx")?null:(System.Int32?)row["SenderIdx"];
            model.RecverIdx       = row.IsNull("RecverIdx")?null:(System.Int32?)row["RecverIdx"];
            model.RecverLoginName = row.IsNull("RecverLoginName")?null:(System.String)row["RecverLoginName"];
            model.IsSysMail       = row.IsNull("IsSysMail")?null:(System.Boolean?)row["IsSysMail"];
            model.MailSubject     = row.IsNull("MailSubject")?null:(System.String)row["MailSubject"];
            model.MailContent     = row.IsNull("MailContent")?null:(System.String)row["MailContent"];
            model.IsOpened        = row.IsNull("IsOpened")?null:(System.Boolean?)row["IsOpened"];
            model.CreateDate      = row.IsNull("CreateDate")?null:(System.DateTime?)row["CreateDate"];
            model.FirstReadData   = row.IsNull("FirstReadData")?null:(System.DateTime?)row["FirstReadData"];
            return(model);
        }
예제 #2
0
        public int AddNew(Tab_Y_SiteMail model)
        {
            string sql = "insert into Tab_Y_SiteMail(Sender,SenderIdx,RecverIdx,RecverLoginName,IsSysMail,MailSubject,MailContent,IsOpened,CreateDate,FirstReadData)  values(@Sender,@SenderIdx,@RecverIdx,@RecverLoginName,@IsSysMail,@MailSubject,@MailContent,@IsOpened,@CreateDate,@FirstReadData); select @@identity ;";
            int    Idx = Convert.ToInt32(SqlHelper.ExecuteScalar(CommandType.Text, sql
                                                                 , new SqlParameter("@Sender", model.Sender)
                                                                 , new SqlParameter("@SenderIdx", model.SenderIdx)
                                                                 , new SqlParameter("@RecverIdx", model.RecverIdx)
                                                                 , new SqlParameter("@RecverLoginName", model.RecverLoginName)
                                                                 , new SqlParameter("@IsSysMail", model.IsSysMail)
                                                                 , new SqlParameter("@MailSubject", model.MailSubject)
                                                                 , new SqlParameter("@MailContent", model.MailContent)
                                                                 , new SqlParameter("@IsOpened", model.IsOpened)
                                                                 , new SqlParameter("@CreateDate", model.CreateDate)
                                                                 , new SqlParameter("@FirstReadData", model.FirstReadData)
                                                                 ));

            return(Idx);
        }
예제 #3
0
        public bool Update(Tab_Y_SiteMail model)
        {
            string sql  = "update Tab_Y_SiteMail set Sender=@Sender,SenderIdx=@SenderIdx,RecverIdx=@RecverIdx,RecverLoginName=@RecverLoginName,IsSysMail=@IsSysMail,MailSubject=@MailSubject,MailContent=@MailContent,IsOpened=@IsOpened,CreateDate=@CreateDate,FirstReadData=@FirstReadData where Idx=@Idx";
            int    rows = SqlHelper.ExecuteNonQuery(CommandType.Text, sql
                                                    , new SqlParameter("@Sender", model.Sender)
                                                    , new SqlParameter("@SenderIdx", model.SenderIdx)
                                                    , new SqlParameter("@RecverIdx", model.RecverIdx)
                                                    , new SqlParameter("@RecverLoginName", model.RecverLoginName)
                                                    , new SqlParameter("@IsSysMail", model.IsSysMail)
                                                    , new SqlParameter("@MailSubject", model.MailSubject)
                                                    , new SqlParameter("@MailContent", model.MailContent)
                                                    , new SqlParameter("@IsOpened", model.IsOpened)
                                                    , new SqlParameter("@CreateDate", model.CreateDate)
                                                    , new SqlParameter("@FirstReadData", model.FirstReadData)
                                                    , new SqlParameter("Idx", model.Idx)
                                                    );

            return(rows > 0);
        }
예제 #4
0
        public Tab_Y_SiteMail Get(string Idx)
        {
            DataTable dt = SqlHelper.ExecuteDataset(CommandType.Text, "select * from Tab_Y_SiteMail  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_Y_SiteMail model = ToModel(row);

            return(model);
        }