private void Save() { if (!base.ValidateIfCommandAllowed(Request.Url.AbsoluteUri, ENums.PageCommand.Add)) { return; } if (ValidateValues() == false) { return; } bool bActionCompleted = false; AccomContactDTO oAccomodationContactData = MapControlsToObject(); AccomodationContactsMaster oAccomodationContactMaster = new AccomodationContactsMaster(); bActionCompleted = oAccomodationContactMaster.Insert(oAccomodationContactData); if (bActionCompleted == true) { base.DisplayAlert("The record has been inserted successfully"); ClearPageControls(); lblStatus.Text = "Saved"; } else { lblStatus.Text = "Error Occured while insertion: Please refer to the error log."; } oAccomodationContactData = null; oAccomodationContactMaster = null; }
public bool Delete(AccomContactDTO oAccomContactData) { string sProcName; DatabaseManager oDB; try { oDB = new DatabaseManager(); sProcName = "up_Del_AccomodationContact"; oDB.DbCmd = oDB.GetStoredProcCommand(sProcName); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@iContactId", DbType.Int32, oAccomContactData.ContactId); oDB.ExecuteNonQuery(oDB.DbCmd); } catch (Exception exp) { GF.LogError("clsAccomodationContact.Delete", exp.Message.ToString()); oDB = null; return(false); } finally { oDB = null; } return(true); }
private void Delete() { if (!base.ValidateIfCommandAllowed(Request.Url.AbsoluteUri, ENums.PageCommand.Delete)) { return; } if (ValidateValues() == false) { return; } bool bActionCompleted = false; int Id = 0; int.TryParse(hfId.Value, out Id); if (Id == 0) { lblStatus.Text = "Please click on edit button again."; return; } AccomContactDTO oAccomodationContactData = new AccomContactDTO(); oAccomodationContactData.ContactId = Id; AccomodationContactsMaster oAccomodationContactMaster = new AccomodationContactsMaster(); /* * ADDED BY VIJAY * CHECK IF THE AccomodationContact WHICH IS TO BE DELETED HAS ANY ASSOCIATED RECORDS...IF YES, MOVE OUT OF THE FUNCTION ELSE PROCEED * IF THE OUTPUT OF sMessage IS "", THEN RECORD CAN BE DELETED, ELSE NOT * */ string sMessage = ""; GF.HasRecords(Convert.ToString(Id), "tblAccomodationContactsMaster", out sMessage); if (sMessage != "") { base.DisplayAlert(sMessage); btnDelete.Enabled = true; } else { bActionCompleted = oAccomodationContactMaster.Delete(oAccomodationContactData); if (bActionCompleted == true) { base.DisplayAlert("The record has been deleted successfully"); ClearPageControls(); //lblStatus.Text = "Deleted"; RefreshGrid(); } else { base.DisplayAlert("Error Occured while deletion: Please refer to the error log."); } } oAccomodationContactData = null; oAccomodationContactMaster = null; }
private AccomContactDTO MapControlsToObject() { AccomContactDTO oAccomodationContactData = new AccomContactDTO(); oAccomodationContactData.ContactName = txtContactName.Text.ToString(); oAccomodationContactData.ToId = txtToIds.Text; oAccomodationContactData.CCId = txtCCIds.Text; oAccomodationContactData.BCCId = txtBCCIds.Text; oAccomodationContactData.AccomodationId = Convert.ToInt32(ddlAccomodation.SelectedValue); oAccomodationContactData.MailOnBooking = rdBookingYes.Checked; oAccomodationContactData.MailOnBookingUpdate = rdBookingUpdatYes.Checked; oAccomodationContactData.MailOnBookingConfirmation = rdCancellationYes.Checked; oAccomodationContactData.MailOnBookingConfirmationUpdate = rdConfirmationUpdateYes.Checked; oAccomodationContactData.MailOnCancellation = rdConfirmationUpdateYes.Checked; oAccomodationContactData.MailOnDeletion = rdDeletionYes.Checked; return(oAccomodationContactData); }
public bool Update(AccomContactDTO oAccomContactData) { string sProcName; DatabaseManager oDB; try { oDB = new DatabaseManager(); sProcName = "up_Upd_AccomodationContact"; oDB.DbCmd = oDB.GetStoredProcCommand(sProcName); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@ContactId", DbType.Int32, oAccomContactData.ContactId); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@AccomodationId", DbType.Int32, oAccomContactData.AccomodationId); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@ContactName", DbType.String, oAccomContactData.ContactName); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@ToId", DbType.String, oAccomContactData.ToId); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@CCId", DbType.String, oAccomContactData.CCId); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@BCCId", DbType.String, oAccomContactData.BCCId); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@MailOnBooking", DbType.Boolean, oAccomContactData.MailOnBooking); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@MailOnBookingUpdate", DbType.Boolean, oAccomContactData.MailOnBookingUpdate); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@MailOnBookingConfirmation", DbType.Boolean, oAccomContactData.MailOnBookingConfirmation); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@MailOnBookingConfirmationUpdate", DbType.Boolean, oAccomContactData.MailOnBookingConfirmationUpdate); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@MailOnCancellation", DbType.Boolean, oAccomContactData.MailOnCancellation); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@MailOnDeletion", DbType.Boolean, oAccomContactData.MailOnDeletion); oDB.ExecuteNonQuery(oDB.DbCmd); } catch (Exception exp) { GF.LogError("clsAccomodationContactsMaster.Update", exp.Message.ToString()); oDB = null; return(false); } finally { oDB = null; } return(true); }
private void Update() { if (!base.ValidateIfCommandAllowed(Request.Url.AbsoluteUri, ENums.PageCommand.Update)) { return; } if (ValidateValues() == false) { return; } bool bActionCompleted = false; int Id = 0; int.TryParse(hfId.Value, out Id); if (Id == 0) { lblStatus.Text = "Please click on edit button again."; return; } AccomContactDTO oAccomodationContactData = new AccomContactDTO(); oAccomodationContactData.ContactId = Id; oAccomodationContactData.AccomodationId = Convert.ToInt32(ddlAccomodation.SelectedValue); oAccomodationContactData.ContactName = txtContactName.Text.ToString(); oAccomodationContactData.ToId = txtToIds.Text; oAccomodationContactData.CCId = txtCCIds.Text; oAccomodationContactData.BCCId = txtBCCIds.Text; oAccomodationContactData.MailOnBooking = false; if (rdBookingYes.Checked) { oAccomodationContactData.MailOnBooking = true; } oAccomodationContactData.MailOnBookingUpdate = false; if (rdBookingUpdatYes.Checked) { oAccomodationContactData.MailOnBookingUpdate = true; } oAccomodationContactData.MailOnBookingConfirmation = false; if (rdConfirmationYes.Checked) { oAccomodationContactData.MailOnBookingConfirmation = true; } oAccomodationContactData.MailOnBookingConfirmationUpdate = false; if (rdConfirmationUpdateYes.Checked) { oAccomodationContactData.MailOnBookingConfirmationUpdate = true; } oAccomodationContactData.MailOnCancellation = false; if (rdCancellationYes.Checked) { oAccomodationContactData.MailOnCancellation = true; } oAccomodationContactData.MailOnDeletion = false; if (rdDeletionYes.Checked) { oAccomodationContactData.MailOnDeletion = true; } AccomodationContactsMaster oAccomodationContactMaster = new AccomodationContactsMaster(); bActionCompleted = oAccomodationContactMaster.Update(oAccomodationContactData); if (bActionCompleted == true) { base.DisplayAlert("The record has been updated successfully"); txtContactName.Text = ""; lblStatus.Text = "Updated"; } else { lblStatus.Text = "Error Occured while updation: Please refer to the error log."; } oAccomodationContactData = null; oAccomodationContactMaster = null; }
public AccomContactDTO[] GetAccomodationContacts(int AccomodationId, int ContactId) { DataSet ds; AccomContactDTO[] AccomContactData; AccomContactData = null; ds = null; string sProcName; DatabaseManager oDB; try { oDB = new DatabaseManager(); sProcName = "up_Get_AccomodationContact"; oDB.DbCmd = oDB.GetStoredProcCommand(sProcName); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@AccomodationId", DbType.Int32, AccomodationId); oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@ContactId", DbType.Int32, ContactId); ds = oDB.ExecuteDataSet(oDB.DbCmd); if (ds != null && ds.Tables[0].Rows.Count > 0) { AccomContactData = new AccomContactDTO[ds.Tables[0].Rows.Count]; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { AccomContactData[i] = new AccomContactDTO(); if (ds.Tables[0].Rows[i][0] != DBNull.Value) { AccomContactData[i].ContactId = Convert.ToInt32(ds.Tables[0].Rows[i][0].ToString()); } if (ds.Tables[0].Rows[i][1] != DBNull.Value) { AccomContactData[i].AccomodationId = Convert.ToInt32(ds.Tables[0].Rows[i][1].ToString()); } if (ds.Tables[0].Rows[i][2] != DBNull.Value) { AccomContactData[i].ContactName = Convert.ToString(ds.Tables[0].Rows[i][2].ToString()); } if (ds.Tables[0].Rows[i][3] != DBNull.Value) { AccomContactData[i].ToId = Convert.ToString(ds.Tables[0].Rows[i][3].ToString()); } if (ds.Tables[0].Rows[i][4] != DBNull.Value) { AccomContactData[i].CCId = Convert.ToString(ds.Tables[0].Rows[i][4].ToString()); } if (ds.Tables[0].Rows[i][5] != DBNull.Value) { AccomContactData[i].BCCId = Convert.ToString(ds.Tables[0].Rows[i][5].ToString()); } if (ds.Tables[0].Rows[i][6] != DBNull.Value) { AccomContactData[i].MailOnBooking = Convert.ToBoolean(ds.Tables[0].Rows[i][6].ToString()); } if (ds.Tables[0].Rows[i][7] != DBNull.Value) { AccomContactData[i].MailOnBookingUpdate = Convert.ToBoolean(ds.Tables[0].Rows[i][7].ToString()); } if (ds.Tables[0].Rows[i][8] != DBNull.Value) { AccomContactData[i].MailOnBookingConfirmation = Convert.ToBoolean(ds.Tables[0].Rows[i][8].ToString()); } if (ds.Tables[0].Rows[i][9] != DBNull.Value) { AccomContactData[i].MailOnBookingConfirmationUpdate = Convert.ToBoolean(ds.Tables[0].Rows[i][9].ToString()); } if (ds.Tables[0].Rows[i][10] != DBNull.Value) { AccomContactData[i].MailOnCancellation = Convert.ToBoolean(ds.Tables[0].Rows[i][10].ToString()); } if (ds.Tables[0].Rows[i][11] != DBNull.Value) { AccomContactData[i].MailOnDeletion = Convert.ToBoolean(ds.Tables[0].Rows[i][11].ToString()); } } } } catch (Exception exp) { GF.LogError("clsAccomodationContacts.Update", exp.Message.ToString()); oDB = null; return(null); } finally { oDB = null; } // return oCombinedAccomData; return(AccomContactData); }