public DataSet SaveSurrogacyHistory(SurrogacyHistory SurrogacyHistory) { DataSet dataSet = new DataSet(); try { string storedProcedure = "pSRGs_SurrogacyHistoryInfo"; string parameterName = "@aXMLString"; string parameterValue = ObjectHelper.GetXMLFromObject(SurrogacyHistory); sqlCommand = new SqlCommand(storedProcedure, sqlConnection); sqlCommand.Parameters.AddWithValue(parameterName, parameterValue); sqlCommand.CommandType = CommandType.StoredProcedure; sqlConnection.Open(); sqlDataAdapter.SelectCommand = sqlCommand; sqlDataAdapter.Fill(dataSet); dataSet.Tables[0].TableName = "SURROGACYHISTORY"; } catch (Exception) { throw; } finally { sqlConnection.Close(); } return(dataSet); }
private bool ValidateHistoryInfoForm(SurrogacyHistory surrogatePersonalInfo, out string responseMessage) { bool boolResponse = true; responseMessage = "<ul>"; List <FormData> lsSurrogacyHistoryFormData = new List <FormData>(); lsSurrogacyHistoryFormData.Add(new FormData(FormInputType.DropDownListValue, surrogatePersonalInfo.SurrogateBefore, "SURROGATEBEFORE", "Surrogate Before", true)); lsSurrogacyHistoryFormData.Add(new FormData(FormInputType.DropDownListValue, surrogatePersonalInfo.EggDonate, "EGGDONATE", "Egg Donate", true)); boolResponse = FormValidator.validateForm(lsSurrogacyHistoryFormData, out responseMessage); return(boolResponse); }
public ActionResult HistoryInfo() { SurrogateService surrogatehistoryService = new SurrogateService(); SurrogacyHistory surrogacyhistory = new SurrogacyHistory(); try { surrogacyhistory.UserID = ApplicationManager.LoggedInUser.UserID; surrogacyhistory.EntityState = EntityState.View; surrogacyhistory = surrogatehistoryService.SaveSurrogacyHistory(surrogacyhistory); } catch (Exception ex) { WebHelper.SetMessageAlertProperties(this, ResponseType.Error.ToString(), ApplicationManager.GenericErrorMessage, "5000"); LoggerHelper.WriteToLog(ex); } return(View("HistoryInfo", surrogacyhistory)); }
public ActionResult HistoryInfo(SurrogacyHistory surrogacyhistory) { SurrogateService surrogateService = new SurrogateService(); string validationMessage = string.Empty; try { if (ValidateHistoryInfoForm(surrogacyhistory, out validationMessage)) { surrogacyhistory.EntityState = surrogacyhistory.SurrogacyHistoryID != null ? EntityState.Edit : EntityState.Save; surrogacyhistory.ChangeBy = ApplicationManager.LoggedInUser.UserID; surrogacyhistory.UserID = ApplicationManager.LoggedInUser.UserID; surrogacyhistory = surrogateService.SaveSurrogacyHistory(surrogacyhistory); if (surrogacyhistory.responseDetail.responseType == ResponseType.Error) { WebHelper.SetMessageAlertProperties(this, ResponseType.Error.ToString(), surrogacyhistory.responseDetail.ResponseMessage, "5000"); return(View("HistoryInfo", surrogacyhistory)); } else { WebHelper.SetMessageBoxProperties(this, ResponseType.Success); } } else { WebHelper.SetMessageBoxProperties(this, ResponseType.Error, validationMessage); return(View("HistoryInfo", surrogacyhistory)); } } catch (Exception ex) { WebHelper.SetMessageAlertProperties(this, ResponseType.Error.ToString(), ApplicationManager.GenericErrorMessage, "5000"); LoggerHelper.WriteToLog(ex); } return(View("HistoryInfo", surrogacyhistory)); }
public SurrogacyHistory SaveSurrogacyHistory(SurrogacyHistory SurrogacyHistory) { SurrogacyHistory localsurrogacyhistory = new SurrogacyHistory(); SurrogateData surrogacyhistorydata = new SurrogateData(); DataSet dataSet = new DataSet(); try { dataSet = surrogacyhistorydata.SaveSurrogacyHistory(SurrogacyHistory); if (dataSet.Tables["SURROGACYHISTORY"].Rows.Count > 0) { localsurrogacyhistory = new SurrogacyHistory(); localsurrogacyhistory.SurrogacyHistoryID = dataSet.Tables["SurrogacyHistory"].Rows[0]["SURROGACYHISTORYID"].ToString(); localsurrogacyhistory.UserID = dataSet.Tables["SurrogacyHistory"].Rows[0]["USERID"].ToString(); localsurrogacyhistory.SurrogateBefore = dataSet.Tables["SurrogacyHistory"].Rows[0]["SURROGATEBEFORE"].ToString(); localsurrogacyhistory.DetailSurrogate = dataSet.Tables["SurrogacyHistory"].Rows[0]["DETAILSURROGATE"].ToString(); localsurrogacyhistory.EggDonate = dataSet.Tables["SurrogacyHistory"].Rows[0]["EGGDONATE"].ToString(); localsurrogacyhistory.DetailEggDonate = dataSet.Tables["SurrogacyHistory"].Rows[0]["DETAILEGGDONATE"].ToString(); localsurrogacyhistory.IsSubmit = Convert.ToInt32(dataSet.Tables["SurrogacyHistory"].Rows[0]["ISSUBMIT"].ToString()); } } catch (SqlException sqlEx) { localsurrogacyhistory.responseDetail.responseType = ResponseType.Error; localsurrogacyhistory.responseDetail.ResponseMessage = sqlEx.Message; } catch (Exception ex) { localsurrogacyhistory.responseDetail.responseType = ResponseType.Error; localsurrogacyhistory.responseDetail.ResponseMessage = ApplicationManager.GenericErrorMessage; LoggerHelper.WriteToLog(ex); } return(localsurrogacyhistory == null ? new SurrogacyHistory() : localsurrogacyhistory); }