/// <summary> /// Saving records into the database /// </summary> public void Save() { try { string Q_DiseaseDetailModel = "insert into diseasedetails(DocId, Age, Gender, AreaId, PatientAddDate, DiseaseId) values({0}, {1}, '{2}', {3}, '{4}', {5})"; Logger.Debug("DiseaseMasterModel", "Save", "Assigning values to query."); string cmdText = string.Format(Q_DiseaseDetailModel, this.DocId, this.Age, ParameterFormater.FormatParameter(this.Gender), this.AreaId, this.PatientAddDate.ToString("yyyy/MM/dd HH:mm:ss.fff"), this.DiseaseId); Logger.Debug("DiseaseMasterModel", "Save", "Formatting the special character"); Database db = new Database(); Logger.Debug("DiseaseMasterModel", "Save", "Database object created."); Logger.Debug("DiseaseMasterModel", "Save", "Before inserting value in database"); db.Insert(cmdText); Logger.Debug("DiseaseMasterModel", "Save", "After value inserted in database"); } catch (Exception ex) { Logger.Error("DiseaseMasterModel", "Save", "Error occured while saving area master detail", ex); throw ex; } finally { Logger.Debug("DiseaseMasterModel", "Save", "Killing sleep connection."); Database.KillConnections(); } }
/// <summary> ///inserting new record in databse /// </summary> public void Save() { try { string Q_SaveAreaMasterDetail = "insert into areamaster(AreaName, ShortAreaName) values({0}','{1}')"; Logger.Debug("AreaMasterModel", "Save", "Assigning values to query."); string cmdText = string.Format(Q_SaveAreaMasterDetail, ParameterFormater.FormatParameter(this.AreaName), ParameterFormater.FormatParameter(this.ShortAreaName)); Logger.Debug("AreaMasterModel", "Save", "Formatting the special character"); Database db = new Database(); Logger.Debug("AreaMasterModel", "Save", "Database object created."); Logger.Debug("AreaMasterModel", "Save", "Before inserting value in database"); db.Insert(cmdText); Logger.Debug("AreaMasterModel", "Save", "After value inserted in database"); } catch (Exception ex) { Logger.Error("AreaMasterModel", "Save", "Error occured while saving area master detail", ex); throw ex; } finally { Logger.Debug("AreaMasterModel", "Save", "Killing sleep connection."); Database.KillConnections(); } }
public void Save() { try { string Q_DoctorDetailModel = "insert into doctordetails(Id, DoctorName, Department, MobileNumber, Address, AreaId, Username, Password, CreatedDate) values({0}, '{1}', '{2}', {3}, '{4}', {5}, '{6}', '{7}', '{8}')"; Logger.Debug("DoctorDetailsModel", "Save", "Assigning values to query."); string cmdText = string.Format(Q_DoctorDetailModel, this.Id, ParameterFormater.FormatParameter(this.DoctorName), ParameterFormater.FormatParameter(this.Department), this.MobileNumber, ParameterFormater.FormatParameter(this.Address), this.AreaId, ParameterFormater.FormatParameter(this.UserName), this.Password, this.CreateDate.ToString("yyyy/MM/dd HH:mm:ss.fff")); Logger.Debug("DoctorDetailsModel", "Save", "Formatting the special character"); Database db = new Database(); Logger.Debug("DoctorDetailsModel", "Save", "Database object created."); Logger.Debug("DoctorDetailsModel", "Save", "Before inserting value in database"); db.Insert(cmdText); Logger.Debug("DoctorDetailsModel", "Save", "After value inserted in database"); } catch (Exception ex) { Logger.Error("DoctorDetailsModel", "Save", "Error occured while saving area master detail", ex); throw ex; } finally { Logger.Debug("DoctorDetailsModel", "Save", "Killing sleep connection."); Database.KillConnections(); } }