protected void lkbSave_Click(object sender, EventArgs e) { try { if (txtClassName.Text.Trim() == "") { uc_sucess1.VisibleError = true; uc_sucess1.ErrorMessage = "Class name cannot be left empty!"; return; } MST_CLASS obj = new MST_CLASS(); obj.ClassName = txtClassName.Text.Trim(); obj.Org_Id = cls_Common.UserProfile.ORG_ID; obj.UserId = cls_Common.UserProfile.Id; obj.Status = (byte)EnumConstants.Status.Active; obj.CreatedBy = cls_Common.UserProfile.Id; obj.CreatedDate = DateTime.Now; _ClassDTO.Save(obj); uc_sucess1.Visible = true; uc_sucess1.SuccessMessage = "Data Saved Successfully."; BindClass(); txtClassName.Text = ""; } catch (Exception ex) { uc_sucess1.VisibleError = true; uc_sucess1.ErrorMessage = "Error Occured!"; } }
public bool Save(MST_CLASS data) { try { unitOfWork.ClassRepository.Create(data); unitOfWork.Save(); return(true); } catch (Exception ex) { return(false); } }
protected void lvClass_ItemUpdating(object sender, ListViewUpdateEventArgs e) { String ClassName = e.NewValues["ClassName"].ToString(); int classId = (int)e.Keys["ClassId"]; MST_CLASS classItem = new MST_CLASS(); classItem.ClassName = ClassName; classItem.ClassId = classId; classItem.UpdatedBy = cls_Common.UserProfile.Id; var isUpdate = _ClassDTO.Update(classItem); if (isUpdate) { _ClassDTO = new cls_ClassDTO(); lvClass.EditIndex = -1; BindClass(); } }
public bool Update(MST_CLASS data) { try { var item = unitOfWork.ClassRepository.Find(f => f.ClassId == data.ClassId); if (item != null) { item.ClassName = data.ClassName; item.UpdatedBy = data.UpdatedBy; item.UpdatedDate = DateTime.Now; unitOfWork.ClassRepository.Update(item); } unitOfWork.Save(); return(true); } catch (Exception ex) { return(false); } }