Beispiel #1
0
 public bool Save(MST_SECTION data)
 {
     try
     {
         unitOfWork.SectionRepository.Create(data);
         unitOfWork.Save();
         return(true);
     }
     catch (Exception ex)
     { return(false); }
 }
Beispiel #2
0
        protected void lvSection_ItemUpdating(object sender, ListViewUpdateEventArgs e)
        {
            String      SectionName = e.NewValues["SectionName"].ToString();
            int         SectionId   = (int)e.Keys["SectionId"];
            MST_SECTION item        = new MST_SECTION();

            item.SectionName = SectionName;
            item.SectionId   = SectionId;
            item.UpdatedBy   = cls_Common.UserProfile.Id;
            var isUpdate = _SectionDTO.Update(item);

            if (isUpdate)
            {
                _SectionDTO         = new cls_SectionDTO();
                lvSection.EditIndex = -1;
                BindSection();
            }
        }
Beispiel #3
0
 public bool Update(MST_SECTION data)
 {
     try
     {
         var item = unitOfWork.SectionRepository.Find(f => f.SectionId == data.SectionId);
         if (item != null)
         {
             item.SectionName = data.SectionName;
             item.UpdatedBy   = data.UpdatedBy;
             item.UpdatedDate = DateTime.Now;
             unitOfWork.SectionRepository.Update(item);
         }
         unitOfWork.Save();
         return(true);
     }
     catch (Exception ex)
     { return(false); }
 }
Beispiel #4
0
 protected void lkbSaveSection_Click(object sender, EventArgs e)
 {
     try
     {
         if (ddlClassName.SelectedIndex < 1)
         {
             uc_sucess.VisibleError = true;
             uc_sucess.ErrorMessage = "Please Select Class Name First";
             return;
         }
         if (txtSectionName.Text.Trim() == "")
         {
             uc_sucess.VisibleError = true;
             uc_sucess.ErrorMessage = "Section name cannot be left empty!";
             return;
         }
         MST_SECTION obj = new MST_SECTION();
         obj.SectionName = txtSectionName.Text.Trim();
         obj.ClassId     = Convert.ToInt32(ddlClassName.SelectedValue.ToString());
         obj.Status      = (byte)EnumConstants.Status.Active;
         obj.CreatedBy   = cls_Common.UserProfile.Id;
         obj.CreatedDate = DateTime.Now;
         _SectionDTO.Save(obj);
         uc_sucess.Visible        = true;
         uc_sucess.SuccessMessage = "Data Saved Successfully.";
         RefreshClasses();
         BindSection();
         BindDDLSection();
         txtSectionName.Text        = "";
         ddlClassName.SelectedIndex = -1;
     }
     catch (Exception ex)
     {
         uc_sucess.VisibleError = true;
         uc_sucess.ErrorMessage = "Error Occured!";
     }
 }