/// <summary> /// Insert application info /// </summary> /// <param name="oApplicationInfoViewModel"></param> /// <returns>Response</returns> public Response oInsertApplicationInfo(ApplicationInfoViewModel oApplicationInfoViewModel) { #region ": Insert :" Response oResponse = new Response(); try { if (oApplicationInfoViewModel != null) { var lstMemberInfo = (from c in this.ApplicationInfoDBSet where c.APPLICATION_ID == oApplicationInfoViewModel.APPLICATION_ID orderby c.ID descending select new { ID = c.ID, APPLICATION_ID = c.APPLICATION_ID, MEMBER_INFO_TITLE = c.TITLE, DESCRIPTION = c.DESCRIPTION }); if (lstMemberInfo.Count() >= 5) { oResponse.OperationResult = enumOperationResult.RelatedRecordFaild; return(oResponse); } APPLICATION_INFO oAPPLICATION_INFO = new APPLICATION_INFO() { APPLICATION_ID = oApplicationInfoViewModel.APPLICATION_ID, TITLE = oApplicationInfoViewModel.TITLE, DESCRIPTION = oApplicationInfoViewModel.DESCRIPTION, CREATED_BY = oApplicationInfoViewModel.CREATED_BY, CREATED_DATE = DateTime.Now }; this.oTakamulConnection.APPLICATION_INFO.Add(oAPPLICATION_INFO); if (this.intCommit() > 0) { oResponse.OperationResult = enumOperationResult.Success; } else { oResponse.OperationResult = enumOperationResult.Faild; } } } catch (Exception Ex) { oResponse.OperationResult = enumOperationResult.Faild; //TODO : Log Error Message oResponse.OperationResultMessage = Ex.Message.ToString(); } return(oResponse); #endregion }
/// <summary> /// Update member info /// </summary> /// <param name="oApplicationInfoViewModel"></param> /// <returns>Response</returns> public Response oUpdateApplicationInfo(ApplicationInfoViewModel oApplicationInfoViewModel) { Response oResponse = new Response(); #region Try Block try { // Start try #region Check oEventViewModel Value APPLICATION_INFO oAPPLICATION_INFO = new APPLICATION_INFO(); oAPPLICATION_INFO = this.oTakamulConnection.APPLICATION_INFO.Find(oApplicationInfoViewModel.ID); if (oAPPLICATION_INFO == null) { throw new ArgumentNullException("oAPPLICATION_INFO Entity Is Null"); } #endregion #region Update Default APPLICATION_INFO oAPPLICATION_INFO.APPLICATION_ID = oApplicationInfoViewModel.APPLICATION_ID; oAPPLICATION_INFO.TITLE = oApplicationInfoViewModel.TITLE; oAPPLICATION_INFO.DESCRIPTION = oApplicationInfoViewModel.DESCRIPTION; oAPPLICATION_INFO.MODIFIED_BY = oApplicationInfoViewModel.CREATED_BY; oAPPLICATION_INFO.MODIFIED_DATE = DateTime.Now; this.ApplicationInfoDBSet.Attach(oAPPLICATION_INFO); this.oTakamulConnection.Entry(oAPPLICATION_INFO).State = EntityState.Modified; if (this.intCommit() > 0) { oResponse.OperationResult = enumOperationResult.Success; } else { oResponse.OperationResult = enumOperationResult.Faild; } #endregion }// End try #endregion #region Catch Block catch (Exception Ex) {// Start Catch oResponse.OperationResult = enumOperationResult.Faild; //TODO : Log Error Message oResponse.OperationResultMessage = Ex.Message.ToString(); }//End Catch #endregion return(oResponse); }