Int64 ICMNEventDataAccess.Delete(CMNEventEntity cMNEventEntity, String filterExpression, DatabaseOperationType option, TransactionRequired reqTran) { try { long retValues = -99; switch (reqTran) { case TransactionRequired.No: { retValues = Delete(cMNEventEntity, filterExpression, option); break; } case TransactionRequired.Yes: { retValues = DeleteTran(cMNEventEntity, filterExpression, option); break; } default: { retValues = -99; break; } } return(retValues); } catch (Exception ex) { throw ex; } }
Int64 ICMNEventDataAccess.Add(CMNEventEntity cMNEventEntity, DatabaseOperationType option, TransactionRequired reqTran) { try { long retValues = -99; switch (reqTran) { case TransactionRequired.No: { retValues = Add(cMNEventEntity, option); break; } case TransactionRequired.Yes: { retValues = AddTran(cMNEventEntity, option); break; } default: { retValues = -99; break; } } return(retValues); } catch (Exception ex) { throw ex; } }
private void SaveCMNEventEntity() { if (IsValid) { try { CMNEventEntity cMNEventEntity = BuildCMNEventEntity(); Int64 result = -1; if (cMNEventEntity.IsNew) { result = FCCCMNEvent.GetFacadeCreate().Add(cMNEventEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CMNEventEntity.FLD_NAME_EventID, cMNEventEntity.EventID.ToString(), SQLMatchType.Equal); result = FCCCMNEvent.GetFacadeCreate().Update(cMNEventEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } if (result > 0) { _EventID = 0; _CMNEventEntity = new CMNEventEntity(); PrepareInitialView(); BindCMNEventList(); if (cMNEventEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Event Information has been added successfully.", false); String NavigationUrl = UrlHelper.BuildSecureUrl("~/Common/CMNEventInvitationInformation.aspx", string.Empty, UrlConstants.OVERVIEW_EVENT_ID, result.ToString()).ToString(); Response.Redirect(NavigationUrl); } else { MiscUtil.ShowMessage(lblMessage, "Event Information has been updated successfully.", false); String NavigationUrl = UrlHelper.BuildSecureUrl("~/Common/CMNEventInvitationInformation.aspx", string.Empty, UrlConstants.OVERVIEW_EVENT_ID, result.ToString()).ToString(); Response.Redirect(NavigationUrl); } } else { if (cMNEventEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Event Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Event Information.", false); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }
private void SaveCMNEventEntity() { if (IsValid) { try { CMNEventEntity cMNEventEntity = BuildCMNEventEntity(); Int64 result = -1; if (cMNEventEntity.IsNew) { result = FCCCMNEvent.GetFacadeCreate().Add(cMNEventEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CMNEventEntity.FLD_NAME_EventID, cMNEventEntity.EventID.ToString(), SQLMatchType.Equal); result = FCCCMNEvent.GetFacadeCreate().Update(cMNEventEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } if (result > 0) { PrepareEditView(); if (cMNEventEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Event Information has been added successfully.", false); } else { MiscUtil.ShowMessage(lblMessage, "Event Information has been updated successfully.", false); } } else { if (cMNEventEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Event Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Event Information.", false); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }
private Int64 DeleteTran(CMNEventEntity cMNEventEntity, String filterExpression, DatabaseOperationType option) { long returnCode = -99; const string SP = "dbo.CMNEvent_SET"; Database db = DatabaseFactory.CreateDatabase(); using (DbCommand cmd = db.GetStoredProcCommand(SP)) { AddOptionParameter(cmd, option); AddOutputParameter(cmd, db); AddFilterExpressionParameter(cmd, filterExpression, db); DbConnection connection = db.CreateConnection(); connection.Open(); DbTransaction transaction = connection.BeginTransaction(); try { using (IDataReader reader = db.ExecuteReader(cmd, transaction)) { returnCode = GetReturnCodeFromParameter(cmd); } if (returnCode >= 0) { transaction.Commit(); } else { throw new ArgumentException("Error Code." + returnCode.ToString()); } } catch (Exception ex) { transaction.Rollback(); throw ex; } finally { transaction.Dispose(); connection.Close(); connection = null; } } return(returnCode); }
protected void lvCMNEvent_ItemCommand(object sender, ListViewCommandEventArgs e) { Int64 EventID; Int64.TryParse(e.CommandArgument.ToString(), out EventID); if (EventID > 0) { if (string.Equals(e.CommandName, "EditItem")) { _EventID = EventID; PrepareEditView(); } else if (string.Equals(e.CommandName, "DeleteItem")) { try { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(CMNEventEntity.FLD_NAME_EventID, EventID.ToString(), SQLMatchType.Equal); CMNEventEntity cMNEventEntity = new CMNEventEntity(); result = FCCCMNEvent.GetFacadeCreate().Delete(cMNEventEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _EventID = 0; _CMNEventEntity = new CMNEventEntity(); PrepareInitialView(); BindCMNEventList(); MiscUtil.ShowMessage(lblMessage, "Event has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete Event.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } } }
private Int64 Delete(CMNEventEntity cMNEventEntity, String filterExpression, DatabaseOperationType option) { long returnCode = -99; const string SP = "dbo.CMNEvent_SET"; using (DbCommand cmd = Database.GetStoredProcCommand(SP)) { AddOptionParameter(cmd, option); AddOutputParameter(cmd); AddFilterExpressionParameter(cmd, filterExpression); using (IDataReader reader = Database.ExecuteReader(cmd)) { returnCode = GetReturnCodeFromParameter(cmd); switch (returnCode) { case SqlConstants.DB_STATUS_CODE_DATAALREADYEXIST: { throw new ArgumentException("CMNEventEntity already exists. Please specify another CMNEventEntity."); } case SqlConstants.DB_STATUS_CODE_DATAUPDATEDFROMOTHERSESSION: { throw new ArgumentException("CMNEventEntity data already updated from different session."); } case SqlConstants.DB_STATUS_CODE_FAIL_OPERATION: { throw new ArgumentException("CMNEventEntity already exists. Please specify another CMNEventEntity."); } } } } return(returnCode); }
Int64 ICMNEventFacade.Delete(CMNEventEntity cMNEventEntity, String filterExpression, DatabaseOperationType option, TransactionRequired reqTran) { return(DataAccessFactory.CreateCMNEventDataAccess().Delete(cMNEventEntity, filterExpression, option, reqTran)); }
Int64 ICMNEventFacade.Add(CMNEventEntity cMNEventEntity, DatabaseOperationType option, TransactionRequired reqTran) { return(DataAccessFactory.CreateCMNEventDataAccess().Add(cMNEventEntity, option, reqTran)); }
protected void btnAddNew_Click(object sender, EventArgs e) { _EventID = 0; _CMNEventEntity = new CMNEventEntity(); PrepareInitialView(); }
private CMNEventEntity BuildCMNEventEntity() { CMNEventEntity cMNEventEntity = CurrentCMNEventEntity; cMNEventEntity.EventIdentityCategoryID = OverviewEventIdentityCategoryID; if (ddlEventCategoryID.Items.Count > 0) { if (ddlEventCategoryID.SelectedValue == "0") { } else { cMNEventEntity.EventCategoryID = Int64.Parse(ddlEventCategoryID.SelectedValue); } } cMNEventEntity.ParentEventID = null; cMNEventEntity.ReferenceEventID = null; cMNEventEntity.EventReferenceNo = txtEventReferenceNo.Text.Trim(); cMNEventEntity.Title = txtTitle.Text.Trim(); cMNEventEntity.Details = txtDetails.Text.Trim(); cMNEventEntity.Location = txtLocation.Text.Trim(); if (ddlEventLocationCategoryID.Items.Count > 0) { if (ddlEventLocationCategoryID.SelectedValue == "0") { } else { cMNEventEntity.EventLocationCategoryID = Int64.Parse(ddlEventLocationCategoryID.SelectedValue); } } if (ddlGalleriaLocationID.Items.Count > 0) { if (ddlGalleriaLocationID.SelectedValue == "0") { } else { cMNEventEntity.LocationReferenceID = Int64.Parse(ddlGalleriaLocationID.SelectedValue); } } cMNEventEntity.WebsiteURL = txtWebsiteURL.Text.Trim(); cMNEventEntity.TicketSellerURL = txtTicketSellerURL.Text.Trim(); cMNEventEntity.YoutubeURL = txtYoutubeURL.Text.Trim(); cMNEventEntity.TransitAndParkingInformation = txtTransitAndParkingInformation.Text.Trim(); if (ddlEventOptionID.Items.Count > 0) { if (ddlEventOptionID.SelectedValue == "0") { } else { cMNEventEntity.EventOptionID = Int64.Parse(ddlEventOptionID.SelectedValue); } } cMNEventEntity.CompletionPercentage = 0; cMNEventEntity.EventStatusID = MasterDataConstants.CMNMDEventStatus.UP_COMING; if (ddlRepeatCategoryID.Items.Count > 0) { if (ddlRepeatCategoryID.SelectedValue == "0") { } else { cMNEventEntity.RepeatCategoryID = Int64.Parse(ddlRepeatCategoryID.SelectedValue); } } cMNEventEntity.CreatedByMemberID = CurrentMember.MemberID; cMNEventEntity.OwnerMemberID = CurrentMember.MemberID; cMNEventEntity.CreateDate = System.DateTime.Now; cMNEventEntity.Duration = 0; if (txtExpectedStartDate.Text.Trim().IsNotNullOrEmpty()) { cMNEventEntity.ExpectedStartDate = MiscUtil.ParseToDateTimeJQueryUI(txtExpectedStartDate.Text); } if (txtExpectedEndDate.Text.Trim().IsNotNullOrEmpty()) { cMNEventEntity.ExpectedEndDate = MiscUtil.ParseToDateTimeJQueryUI(txtExpectedEndDate.Text); } else { cMNEventEntity.ExpectedEndDate = null; } if (txtActualStartDate.Text.Trim().IsNotNullOrEmpty()) { cMNEventEntity.ActualStartDate = MiscUtil.ParseToDateTimeJQueryUI(txtActualStartDate.Text); } else { cMNEventEntity.ActualStartDate = null; } if (txtActualEndDate.Text.Trim().IsNotNullOrEmpty()) { cMNEventEntity.ActualEndDate = MiscUtil.ParseToDateTimeJQueryUI(txtActualEndDate.Text); } else { cMNEventEntity.ActualEndDate = null; } cMNEventEntity.IsAllDay = chkIsAllDay.Checked; if (!txtNotifyBeforeMin.Text.Trim().IsNullOrEmpty()) { cMNEventEntity.NotifyBeforeMin = Int32.Parse(txtNotifyBeforeMin.Text.Trim()); } else { cMNEventEntity.NotifyBeforeMin = null; } cMNEventEntity.IsNotifyCompleted = false; cMNEventEntity.Remarks = txtRemarks.Text.Trim(); if (ddlSharedSettingID.Items.Count > 0) { if (ddlSharedSettingID.SelectedValue == "0") { } else { cMNEventEntity.SharedSettingID = Int64.Parse(ddlSharedSettingID.SelectedValue); } } cMNEventEntity.ModifiedDateTime = System.DateTime.Now; cMNEventEntity.IP = MiscUtil.GetLocalIP(); cMNEventEntity.IsOwnerGoing = false; cMNEventEntity.IsRemoved = false; return(cMNEventEntity); }
private void PrepareEditView() { CMNEventEntity cMNEventEntity = CurrentCMNEventEntity; if (!cMNEventEntity.IsNew) { if (ddlEventCategoryID.Items.Count > 0 && cMNEventEntity.EventCategoryID != null) { ddlEventCategoryID.SelectedValue = cMNEventEntity.EventCategoryID.ToString(); } txtEventReferenceNo.Text = cMNEventEntity.EventReferenceNo.ToString(); txtTitle.Text = cMNEventEntity.Title.ToString(); txtDetails.Text = cMNEventEntity.Details.ToString(); txtLocation.Text = cMNEventEntity.Location.ToString(); if (ddlEventLocationCategoryID.Items.Count > 0 && cMNEventEntity.EventLocationCategoryID != null) { ddlEventLocationCategoryID.SelectedValue = cMNEventEntity.EventLocationCategoryID.ToString(); } //Location will come here txtWebsiteURL.Text = cMNEventEntity.WebsiteURL.ToString(); txtTicketSellerURL.Text = cMNEventEntity.TicketSellerURL.ToString(); txtYoutubeURL.Text = cMNEventEntity.YoutubeURL.ToString(); txtTransitAndParkingInformation.Text = cMNEventEntity.TransitAndParkingInformation.ToString(); if (ddlEventOptionID.Items.Count > 0 && cMNEventEntity.EventOptionID != null) { ddlEventOptionID.SelectedValue = cMNEventEntity.EventOptionID.ToString(); } if (ddlRepeatCategoryID.Items.Count > 0 && cMNEventEntity.RepeatCategoryID != null) { ddlRepeatCategoryID.SelectedValue = cMNEventEntity.RepeatCategoryID.ToString(); } txtDuration.Text = cMNEventEntity.Duration.ToString(); txtExpectedStartDate.Text = MiscUtil.ConvertDateTSQLStringJQueryUI(DateTime.Parse(cMNEventEntity.ExpectedStartDate.ToString())); if (cMNEventEntity.ExpectedEndDate != null) { txtExpectedEndDate.Text = MiscUtil.ConvertDateTSQLStringJQueryUI(DateTime.Parse(cMNEventEntity.ExpectedEndDate.ToString())); } else { txtExpectedEndDate.Text = String.Empty; } if (cMNEventEntity.ActualStartDate != null) { txtActualStartDate.Text = MiscUtil.ConvertDateTSQLStringJQueryUI(DateTime.Parse(cMNEventEntity.ActualStartDate.ToString())); } else { txtActualStartDate.Text = String.Empty; } if (cMNEventEntity.ActualEndDate != null) { txtActualEndDate.Text = MiscUtil.ConvertDateTSQLStringJQueryUI(DateTime.Parse(cMNEventEntity.ActualEndDate.ToString())); } else { txtActualEndDate.Text = String.Empty; } chkIsAllDay.Checked = cMNEventEntity.IsAllDay; txtNotifyBeforeMin.Text = cMNEventEntity.NotifyBeforeMin.ToString(); txtRemarks.Text = cMNEventEntity.Remarks.ToString(); if (ddlSharedSettingID.Items.Count > 0 && cMNEventEntity.SharedSettingID != null) { ddlSharedSettingID.SelectedValue = cMNEventEntity.SharedSettingID.ToString(); } btnSubmit.Text = "Update"; btnAddNew.Visible = true; } }
protected void btnSendMailToGuest_Click(object sender, EventArgs e) { //Mail will implement here. #region Guest Invitation Mail CMNEventEntity cMNEventEntity = FCCCMNEvent.GetFacadeCreate().GetByID(OverviewEventID); String MailBody = String.Empty; String Subject = String.Empty; StringBuilder sb = new StringBuilder(); sb.Append("Dear Sir,"); sb.Append("<br/>"); sb.Append("This is a auto generated mail from the ERP."); sb.Append("<br/>"); sb.Append("An Event has created."); sb.Append("<br/>"); sb.Append("Dated : " + cMNEventEntity.ExpectedStartDate.ToString(UIConstants.SHORT_DATE_FORMAT)); sb.Append("<br/>"); sb.Append("-"); sb.Append("<br/>"); sb.Append("Thanks"); sb.Append("<br/>"); sb.Append("ERP System"); MailBody = sb.ToString(); Subject = "ERP, Event"; String fe1 = SqlExpressionBuilder.PrepareFilterExpression(CMNEventInvitationInformationEntity.FLD_NAME_EventID, OverviewEventID.ToString(), SQLMatchType.Equal); String fe2 = SqlExpressionBuilder.PrepareFilterExpression(CMNEventInvitationInformationEntity.FLD_NAME_EventInvitatedPersonTypeID, MasterDataConstants.EventInvitationPersonType.GUEST.ToString(), SQLMatchType.Equal); String fe = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2); IList <CMNEventInvitationInformationEntity> lstEventInvitationInformationEntity = FCCCMNEventInvitationInformation.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression); if (lstEventInvitationInformationEntity != null && lstEventInvitationInformationEntity.Count > 0) { String[] sendToMail = new String[10]; // Should change here. Int64 i = 0; foreach (CMNEventInvitationInformationEntity ent in lstEventInvitationInformationEntity) { HRMemberEntity hRMemberEntity = FCCHRMember.GetFacadeCreate().GetByID(ent.InitationGivenToMemberID); if (hRMemberEntity != null && hRMemberEntity.MemberID > 0) { switch (hRMemberEntity.MemberTypeID) { case MasterDataConstants.MemberType.HR_MEMBER: String fe_member = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeEntity.FLD_NAME_MemberID, ent.InitationGivenToMemberID.ToString(), SQLMatchType.Equal); IList <HREmployeeEntity> lsthREmployeeEntity = FCCHREmployee.GetFacadeCreate().GetIL(null, null, String.Empty, fe_member, DatabaseOperationType.LoadWithFilterExpression); if (lsthREmployeeEntity != null && lsthREmployeeEntity.Count > 0) { sendToMail[i++] = lsthREmployeeEntity[0].PrimaryEmail; } break; //Will Implement Later on... case MasterDataConstants.MemberType.CONSULATANT: break; //case MasterDataConstants.MemberType.CONSULATANT: // break; } } } MiscUtil.SendMail(sendToMail, Subject, MailBody); } #endregion }
private Int64 Add(CMNEventEntity cMNEventEntity, DatabaseOperationType option) { long returnCode = -99; const string SP = "dbo.CMNEvent_SET"; using (DbCommand cmd = Database.GetStoredProcCommand(SP)) { AddOptionParameter(cmd, option); AddOutputParameter(cmd); AddNullPrimaryKeyParameter(cmd, "EventID"); Database.AddInParameter(cmd, "@EventIdentityCategoryID", DbType.Int64, cMNEventEntity.EventIdentityCategoryID); Database.AddInParameter(cmd, "@EventCategoryID", DbType.Int64, cMNEventEntity.EventCategoryID); Database.AddInParameter(cmd, "@ParentEventID", DbType.Int64, cMNEventEntity.ParentEventID); Database.AddInParameter(cmd, "@ReferenceEventID", DbType.Int64, cMNEventEntity.ReferenceEventID); Database.AddInParameter(cmd, "@EventReferenceNo", DbType.String, cMNEventEntity.EventReferenceNo); Database.AddInParameter(cmd, "@Title", DbType.String, cMNEventEntity.Title); Database.AddInParameter(cmd, "@Details", DbType.String, cMNEventEntity.Details); Database.AddInParameter(cmd, "@Location", DbType.String, cMNEventEntity.Location); Database.AddInParameter(cmd, "@EventLocationCategoryID", DbType.Int64, cMNEventEntity.EventLocationCategoryID); Database.AddInParameter(cmd, "@LocationReferenceID", DbType.Int64, cMNEventEntity.LocationReferenceID); Database.AddInParameter(cmd, "@WebsiteURL", DbType.String, cMNEventEntity.WebsiteURL); Database.AddInParameter(cmd, "@TicketSellerURL", DbType.String, cMNEventEntity.TicketSellerURL); Database.AddInParameter(cmd, "@YoutubeURL", DbType.String, cMNEventEntity.YoutubeURL); Database.AddInParameter(cmd, "@TransitAndParkingInformation", DbType.String, cMNEventEntity.TransitAndParkingInformation); Database.AddInParameter(cmd, "@EventOptionID", DbType.Int64, cMNEventEntity.EventOptionID); Database.AddInParameter(cmd, "@CompletionPercentage", DbType.Decimal, cMNEventEntity.CompletionPercentage); Database.AddInParameter(cmd, "@EventStatusID", DbType.Int64, cMNEventEntity.EventStatusID); Database.AddInParameter(cmd, "@RepeatCategoryID", DbType.Int64, cMNEventEntity.RepeatCategoryID); Database.AddInParameter(cmd, "@CreatedByMemberID", DbType.Int64, cMNEventEntity.CreatedByMemberID); Database.AddInParameter(cmd, "@OwnerMemberID", DbType.Int64, cMNEventEntity.OwnerMemberID); Database.AddInParameter(cmd, "@CreateDate", DbType.DateTime, cMNEventEntity.CreateDate); Database.AddInParameter(cmd, "@Duration", DbType.Decimal, cMNEventEntity.Duration); Database.AddInParameter(cmd, "@ExpectedStartDate", DbType.DateTime, cMNEventEntity.ExpectedStartDate); Database.AddInParameter(cmd, "@ExpectedEndDate", DbType.DateTime, cMNEventEntity.ExpectedEndDate); Database.AddInParameter(cmd, "@ActualStartDate", DbType.DateTime, cMNEventEntity.ActualStartDate); Database.AddInParameter(cmd, "@ActualEndDate", DbType.DateTime, cMNEventEntity.ActualEndDate); Database.AddInParameter(cmd, "@IsAllDay", DbType.Boolean, cMNEventEntity.IsAllDay); Database.AddInParameter(cmd, "@NotifyBeforeMin", DbType.Int32, cMNEventEntity.NotifyBeforeMin); Database.AddInParameter(cmd, "@IsNotifyCompleted", DbType.Boolean, cMNEventEntity.IsNotifyCompleted); Database.AddInParameter(cmd, "@Remarks", DbType.String, cMNEventEntity.Remarks); Database.AddInParameter(cmd, "@SharedSettingID", DbType.Int64, cMNEventEntity.SharedSettingID); Database.AddInParameter(cmd, "@ModifiedDateTime", DbType.DateTime, cMNEventEntity.ModifiedDateTime); Database.AddInParameter(cmd, "@IP", DbType.String, cMNEventEntity.IP); Database.AddInParameter(cmd, "@IsOwnerGoing", DbType.Boolean, cMNEventEntity.IsOwnerGoing); Database.AddInParameter(cmd, "@IsRemoved", DbType.Boolean, cMNEventEntity.IsRemoved); using (IDataReader reader = Database.ExecuteReader(cmd)) { returnCode = GetReturnCodeFromParameter(cmd); switch (returnCode) { case SqlConstants.DB_STATUS_CODE_DATAALREADYEXIST: { throw new ArgumentException("CMNEventEntity already exists. Please specify another CMNEventEntity."); } case SqlConstants.DB_STATUS_CODE_DATAUPDATEDFROMOTHERSESSION: { throw new ArgumentException("CMNEventEntity data already updated from different session."); } case SqlConstants.DB_STATUS_CODE_FAIL_OPERATION: { throw new ArgumentException("CMNEventEntity already exists. Please specify another CMNEventEntity."); } } } } return(returnCode); }
private Int64 UpdateTran(CMNEventEntity cMNEventEntity, String filterExpression, DatabaseOperationType option) { long returnCode = -99; const string SP = "dbo.CMNEvent_SET"; Database db = DatabaseFactory.CreateDatabase(); using (DbCommand cmd = db.GetStoredProcCommand(SP)) { AddOptionParameter(cmd, option, db); AddOutputParameter(cmd, db); AddFilterExpressionParameter(cmd, filterExpression, db); db.AddInParameter(cmd, "@EventID", DbType.Int64, cMNEventEntity.EventID); db.AddInParameter(cmd, "@EventIdentityCategoryID", DbType.Int64, cMNEventEntity.EventIdentityCategoryID); db.AddInParameter(cmd, "@EventCategoryID", DbType.Int64, cMNEventEntity.EventCategoryID); db.AddInParameter(cmd, "@ParentEventID", DbType.Int64, cMNEventEntity.ParentEventID); db.AddInParameter(cmd, "@ReferenceEventID", DbType.Int64, cMNEventEntity.ReferenceEventID); db.AddInParameter(cmd, "@EventReferenceNo", DbType.String, cMNEventEntity.EventReferenceNo); db.AddInParameter(cmd, "@Title", DbType.String, cMNEventEntity.Title); db.AddInParameter(cmd, "@Details", DbType.String, cMNEventEntity.Details); db.AddInParameter(cmd, "@Location", DbType.String, cMNEventEntity.Location); db.AddInParameter(cmd, "@EventLocationCategoryID", DbType.Int64, cMNEventEntity.EventLocationCategoryID); db.AddInParameter(cmd, "@LocationReferenceID", DbType.Int64, cMNEventEntity.LocationReferenceID); db.AddInParameter(cmd, "@WebsiteURL", DbType.String, cMNEventEntity.WebsiteURL); db.AddInParameter(cmd, "@TicketSellerURL", DbType.String, cMNEventEntity.TicketSellerURL); db.AddInParameter(cmd, "@YoutubeURL", DbType.String, cMNEventEntity.YoutubeURL); db.AddInParameter(cmd, "@TransitAndParkingInformation", DbType.String, cMNEventEntity.TransitAndParkingInformation); db.AddInParameter(cmd, "@EventOptionID", DbType.Int64, cMNEventEntity.EventOptionID); db.AddInParameter(cmd, "@CompletionPercentage", DbType.Decimal, cMNEventEntity.CompletionPercentage); db.AddInParameter(cmd, "@EventStatusID", DbType.Int64, cMNEventEntity.EventStatusID); db.AddInParameter(cmd, "@RepeatCategoryID", DbType.Int64, cMNEventEntity.RepeatCategoryID); db.AddInParameter(cmd, "@CreatedByMemberID", DbType.Int64, cMNEventEntity.CreatedByMemberID); db.AddInParameter(cmd, "@OwnerMemberID", DbType.Int64, cMNEventEntity.OwnerMemberID); db.AddInParameter(cmd, "@CreateDate", DbType.DateTime, cMNEventEntity.CreateDate); db.AddInParameter(cmd, "@Duration", DbType.Decimal, cMNEventEntity.Duration); db.AddInParameter(cmd, "@ExpectedStartDate", DbType.DateTime, cMNEventEntity.ExpectedStartDate); db.AddInParameter(cmd, "@ExpectedEndDate", DbType.DateTime, cMNEventEntity.ExpectedEndDate); db.AddInParameter(cmd, "@ActualStartDate", DbType.DateTime, cMNEventEntity.ActualStartDate); db.AddInParameter(cmd, "@ActualEndDate", DbType.DateTime, cMNEventEntity.ActualEndDate); db.AddInParameter(cmd, "@IsAllDay", DbType.Boolean, cMNEventEntity.IsAllDay); db.AddInParameter(cmd, "@NotifyBeforeMin", DbType.Int32, cMNEventEntity.NotifyBeforeMin); db.AddInParameter(cmd, "@IsNotifyCompleted", DbType.Boolean, cMNEventEntity.IsNotifyCompleted); db.AddInParameter(cmd, "@Remarks", DbType.String, cMNEventEntity.Remarks); db.AddInParameter(cmd, "@SharedSettingID", DbType.Int64, cMNEventEntity.SharedSettingID); db.AddInParameter(cmd, "@ModifiedDateTime", DbType.DateTime, cMNEventEntity.ModifiedDateTime); db.AddInParameter(cmd, "@IP", DbType.String, cMNEventEntity.IP); db.AddInParameter(cmd, "@IsOwnerGoing", DbType.Boolean, cMNEventEntity.IsOwnerGoing); db.AddInParameter(cmd, "@IsRemoved", DbType.Boolean, cMNEventEntity.IsRemoved); DbConnection connection = db.CreateConnection(); connection.Open(); DbTransaction transaction = connection.BeginTransaction(); try { using (IDataReader reader = db.ExecuteReader(cmd, transaction)) { returnCode = GetReturnCodeFromParameter(cmd); } if (returnCode > 0) { transaction.Commit(); } else { throw new ArgumentException("Error Code." + returnCode.ToString()); } } catch (Exception ex) { transaction.Rollback(); throw ex; } finally { transaction.Dispose(); connection.Close(); connection = null; } } return(returnCode); }