private PrescreptionModel MapConsultationPrescription(DataRow row) { if (row != null) { PrescreptionModel psModel = new PrescreptionModel(); psModel.ConsultationId = Convert.ToInt32(row["ConsultationID"]); psModel.PrescreptionText = row["PrescriptionText"] != null?Convert.ToString(row["PrescriptionText"]) : string.Empty; psModel.TenantID = row["TenantID"] != null?Convert.ToInt32(row["TenantID"]) : 0; psModel.Type = row["Type"] != null?Convert.ToInt32(row["Type"]) : 0; psModel.IsDeleted = Convert.ToInt32(row["IsDeleted"]) == 0 ? true : false; psModel.CreatedBy = Convert.ToInt32(row["CreatedBy"]); psModel.CreatedByEntity = Convert.ToInt32(row["CreatedByEntity"]); psModel.CreatedOn = row["CreatedOn"] != null ? new InternalDateTime(Convert.ToInt64(row["CreatedOn"])) : new InternalDateTime(); psModel.ModifiedBy = row["ModifiedBy"] != null?Convert.ToInt32(row["ModifiedBy"]) : 0; psModel.ModifiedByEntity = row["ModifiedByEntity"] != null?Convert.ToInt32(row["ModifiedByEntity"]) : 0; psModel.ModifiedOn = row["ModifiedOn"] != null ? new InternalDateTime(Convert.ToInt64(row["ModifiedOn"])) : new InternalDateTime(); return(psModel); } return(null); }
private List <Parameter> GetPrescreptionParams(PrescreptionModel model) { List <Parameter> param = new List <Parameter>(); param.Add(new Parameter("@PrescriptionText", model.PrescreptionText)); param.Add(new Parameter("@Type", model.Type)); param.Add(new Parameter("@ConsultationID", model.ConsultationId)); param.Add(new Parameter("@TenantID", model.TenantID)); param.Add(new Parameter("@CreatedUserID", model.CreatedBy)); param.Add(new Parameter("@CreatedByEntity", model.CreatedByEntity)); return(param); }
public PrescreptionViewModel MapConsultationPrescription(PrescreptionModel model) { return(new PrescreptionViewModel() { ConsultationId = model.ConsultationId, PrescreptionText = model.PrescreptionText, IsDeleted = model.IsDeleted, TanentId = model.TenantID, CreatedBy = model.CreatedBy, CreatedOn = model.CreatedOn, CreatedByEntity = model.CreatedByEntity, ModifiedBy = model.ModifiedBy, ModifiedOn = model.ModifiedOn, ModifiedEntity = model.ModifiedByEntity }); }
public PrescreptionModel SavePrescreption(PrescreptionModel prescreptionModel) { List <Parameter> param = GetPrescreptionParams(prescreptionModel); Parameter p_IsError = new Parameter("@IsError", DBNull.Value, ParameterDirection.Output, DbType.Int16, 1); Parameter p_ErrorMsg = new Parameter("@ErrorMsg", DBNull.Value, ParameterDirection.Output, DbType.String, 100); param.Add(p_IsError); param.Add(p_ErrorMsg); var r = dataBaseService.ExecuteScalar(StoredProcedures.InsertPrescreptionDetails, DBCommandType.Procedure, param.ToArray()); int Id = Convert.ToInt32(r); if (Id > 0) { prescreptionModel.Success = true; prescreptionModel.Id = Id; } else { prescreptionModel.Success = false; prescreptionModel.ErrorMessage = "Error inserting prescreption"; } return(prescreptionModel); }