Beispiel #1
0
        public static bool Save(DayCarePL.AdditionalNotesProperties objNotes)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clAbsentReason, "Save", "Execute Save Method", DayCarePL.Common.GUID_DEFAULT);
            clConnection.DoConnection();
            bool result           = false;
            DayCareDataContext db = new DayCareDataContext();
            AdditionalNote     DBAdditionalNote = null;

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.clAbsentReason, "Save", "Debug Save Method", DayCarePL.Common.GUID_DEFAULT);
                if (objNotes.Id.ToString().Equals(DayCarePL.Common.GUID_DEFAULT))
                {
                    DBAdditionalNote                 = new AdditionalNote();
                    DBAdditionalNote.Id              = System.Guid.NewGuid();
                    DBAdditionalNote.CreatedById     = objNotes.CreatedById;
                    DBAdditionalNote.CreatedDateTime = DateTime.Now;
                }
                else
                {
                    DBAdditionalNote = db.AdditionalNotes.SingleOrDefault(A => A.Id.Equals(objNotes.Id));
                }
                DBAdditionalNote.ChildSchoolYearId    = objNotes.ChildSchoolYearId;
                DBAdditionalNote.CommentDate          = objNotes.CommentDate;
                DBAdditionalNote.Comments             = objNotes.Comments;
                DBAdditionalNote.LastModifiedById     = objNotes.LastModifiedById;
                DBAdditionalNote.LastMidifiedDateTime = DateTime.Now;
                if (objNotes.Id.ToString().Equals(DayCarePL.Common.GUID_DEFAULT))
                {
                    db.AdditionalNotes.InsertOnSubmit(DBAdditionalNote);
                }
                db.SubmitChanges();
                result = true;
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.clAbsentReason, "Save", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                result = false;
            }
            return(result);
        }
Beispiel #2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.AdditionalNote, "btnSave_Click", "Submit btnSave_Click called", DayCarePL.Common.GUID_DEFAULT);
     try
     {
         bool result = false;
         DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.AdditionalNote, "btnSave_Click", "Debug btnSave_Click ", DayCarePL.Common.GUID_DEFAULT);
         DayCareBAL.AdditionalNotesService   proxyAdditionalNoteService = new DayCareBAL.AdditionalNotesService();
         DayCarePL.AdditionalNotesProperties objNote = new DayCarePL.AdditionalNotesProperties();
         ChildDataId = new Guid(ViewState["ChildDataId"].ToString());
         Guid ChildSchoolYearId = Common.GetChildSchoolYearId(ChildDataId, new Guid(Session["CurrentSchoolYearId"].ToString()));
         objNote.ChildSchoolYearId = ChildSchoolYearId;
         objNote.CommentDate       = Convert.ToDateTime(radCommentDate.SelectedDate.ToString());
         objNote.Comments          = txtComment.Text.ToString().Trim();
         if (ViewState["Id"] != null)
         {
             objNote.Id = new Guid(ViewState["Id"].ToString());
         }
         if (Session["StaffId"] != null)
         {
             objNote.LastModifiedById = new Guid(Session["StaffId"].ToString());
             objNote.CreatedById      = new Guid(Session["StaffId"].ToString());
         }
         result = proxyAdditionalNoteService.Save(objNote);
         if (result)
         {
             radCommentDate.SelectedDate = DateTime.Now;
             txtComment.Text             = "";
             rgAdditionalNotes.MasterTableView.Rebind();
             ViewState["Id"] = null;
         }
         else
         {
         }
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #3
0
 public bool Save(DayCarePL.AdditionalNotesProperties objNotes)
 {
     return(DayCareDAL.clAdditionalNotes.Save(objNotes));
 }