示例#1
0
        public int Insert(SealNotesEntity entity)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into dbo.SealNotes(");
            strSql.Append("Title,SealRequestsID,Description,UserID,CreateOn)");

            strSql.Append(" values (");
            strSql.Append("@Title,@SealRequestsID,@Description,@UserID,@CreateOn)");
            strSql.Append(";select ISNULL( SCOPE_IDENTITY(),0);");
            Database db = DatabaseFactory.CreateDatabase();

            using (DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString()))
            {
                db.AddInParameter(dbCommand, "Title", DbType.String, entity.Title);
                db.AddInParameter(dbCommand, "Description", DbType.String, entity.Description);
                db.AddInParameter(dbCommand, "SealRequestsID", DbType.Int32, entity.SealRequestsID);
                db.AddInParameter(dbCommand, "UserID", DbType.Int32, entity.UserID);
                db.AddInParameter(dbCommand, "CreateOn", DbType.DateTime, entity.CreateOn);

                int    result;
                object obj = db.ExecuteScalar(dbCommand);
                if (!int.TryParse(obj.ToString(), out result))
                {
                    return(0);
                }
                return(result);
            }
        }
示例#2
0
        public string AddNote(HttpRequest Request, int sealRequestID)
        {
            SealNotesEntity entity = new SealNotesEntity();

            entity.Title          = Request.Form["ctl00$ContentPlaceHolder1$txtNoteTitle"];
            entity.Description    = Request.Form["ctl00$ContentPlaceHolder1$txtNoteDescription"].Replace("\r\n", "<br>");
            entity.SealRequestsID = sealRequestID;
            entity.CreateOn       = DateTime.Now;
            entity.UserID         = UserID;
            int count = new App.SealsApplication().InsertSealNotes(entity);

            if (count > 0)
            {
                return("1");
            }
            else
            {
                return("0");
            }
        }
示例#3
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (QS("ID", 0) > 0)
     {
         SealNotesEntity entity = new SealNotesEntity();
         entity.Title          = txtTitle.Text;
         entity.Description    = txtDescription.Text.Replace("\r\n", "<br>");
         entity.SealRequestsID = QS("ID", 0);
         entity.CreateOn       = DateTime.Now;
         entity.UserID         = UserInfo.UserID;
         if (new App.SealsApplication().InsertSealNotes(entity) > 0)
         {
             Redirect(EmptyPopPageUrl, false, true);
         }
         else
         {
             Redirect("error.", "AddSealNote.aspx?ID" + QS("ID"));
         }
     }
     else
     {
         ShowFailMessageToClient("unauthorized access.");
     }
 }
示例#4
0
 public bool Update(SealNotesEntity entity)
 {
     throw new NotImplementedException();
 }
示例#5
0
 public int InsertSealNotes(SealNotesEntity entity)
 {
     return(mgr.InsertSealNotes(entity));
 }
示例#6
0
 public int InsertSealNotes(SealNotesEntity entity)
 {
     return(notesRepository.Insert(entity));
 }