string getAllDepartment() { HcDoctorDepartmentsEntity obj = new HcDoctorDepartmentsEntity(); string DepartmentData = ""; string noImage = "/Docx/no_image.png"; obj.Isactive = "Active"; DataTable dt = (DataTable)ExecuteDB(HCareTaks.AG_GetAllHcDoctorDepartmentsRecord, obj); foreach (DataRow dr in dt.Rows) { string deptimg = string.IsNullOrEmpty(dr["dept_image"].ToString()) ? noImage : dr["dept_image"].ToString(); DepartmentData += @"<div class='card border-bottom-theme-color-2px maxwidth400' >" + "<img class='img-fullwidth boxImg img-fluid' alt='' src='" + deptimg + "'>" + "<div class='team-overlay'></div>" + "<div class='card-body'>" + "<h4 class='card-title'>" + dr["Name"] + "</h4>" + "<p class='card-text'>" + dr["About"] + "</p>" + "<a href = '/Home/Department/" + dr["ID"] + "' class='btn btn-sm btn-outline-success btn-block'>Find Consultant</a>" + "</div></div>"; } return(DepartmentData); }
public JsonResult DoctorsDepartmentSaveUpdate(HcDoctorDepartmentsEntity obj) { bool Success = false; if (string.IsNullOrEmpty(obj.Isactive)) { obj.Isactive = "Active"; } if (string.IsNullOrEmpty(obj.Id)) { obj.Createdby = Session["UserId"].ToString(); obj.Createdtime = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"); obj.Id = (string)ExecuteDB(HCareTaks.AG_SaveHcDoctorDepartmentsInfo, obj); if (!string.IsNullOrEmpty(obj.Id)) { Success = true; } } else { obj.Updatedby = Session["UserId"].ToString(); obj.Updatedtime = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"); Success = (bool)ExecuteDB(HCareTaks.AG_UpdateHcDoctorDepartmentsInfo, obj); } string Message = Success ? "Process has been done successfully" : "Sorry something went wrong!"; return(Json(new { Success = Success, Message = Message, Id = obj.Id })); }
string getminmalDepartment() { HcDoctorDepartmentsEntity obj = new HcDoctorDepartmentsEntity(); string DepartmentData = ""; string noImage = "/Docx/no_image.png"; obj.Isactive = "Active"; DataTable dt = (DataTable)ExecuteDB(HCareTaks.AG_GetAllHcDoctorDepartmentsRecord, obj); foreach (DataRow dr in dt.Rows) { string deptimg = string.IsNullOrEmpty(dr["dept_image"].ToString()) ? noImage : dr["dept_image"].ToString(); DepartmentData += @"<div class='card' > <a href='/Home/Department/" + dr["ID"] + " '>" + "<img class='img-fluid' alt='' src='" + deptimg + "'>" + "<div class='team-overlay'></div>" + "<div class='card-body'>" + "<h6 class='card-title'>" + dr["Name"] + "</h6>" + "<p class='card-text text-mute'> <small>" + dr["About"] + " </small></p>" + "</div> </a></div>"; } return(DepartmentData); }
public DataTable GetAllHcDoctorDepartmentsRecord(object param) { Database db = DatabaseFactory.CreateDatabase(); string sql = @"SELECT ID, Name, About, dept_image, COALESCE(full_desc,null,'Nothing found') as full_desc, IsActive, CreatedBy, CreatedTime, UpdatedBy, UpdatedTime FROM HC_Doctor_Departments Where 1=1"; HcDoctorDepartmentsEntity obj = new HcDoctorDepartmentsEntity(); if (param != null) { obj = (HcDoctorDepartmentsEntity)param; } if (!string.IsNullOrEmpty(obj.Isactive)) { sql += " And IsActive = '" + obj.Isactive + "'"; } if (!string.IsNullOrEmpty(obj.Id)) { sql += " And ID = '" + obj.Id + "'"; } DbCommand dbCommand = db.GetSqlStringCommand(sql); DataSet ds = db.ExecuteDataSet(dbCommand); return(ds.Tables[0]); }
public object UpdateHcDoctorDepartmentsInfo(object param) { Database db = DatabaseFactory.CreateDatabase(); object retObj = null; using (DbConnection connection = db.CreateConnection()) { connection.Open(); DbTransaction transaction = connection.BeginTransaction(); try { HcDoctorDepartmentsEntity hcDoctorDepartmentsEntity = (HcDoctorDepartmentsEntity)param; HcDoctorDepartmentsDAL hcDoctorDepartmentsDAL = new HcDoctorDepartmentsDAL(); retObj = (object)hcDoctorDepartmentsDAL.UpdateHcDoctorDepartmentsInfo(hcDoctorDepartmentsEntity, db, transaction); transaction.Commit(); } catch { transaction.Rollback(); throw; } finally { connection.Close(); } } return(retObj); }
public HcDoctorDepartmentsEntity GetSingleHcDoctorDepartmentsRecordById(object param) { Database db = DatabaseFactory.CreateDatabase(); string sql = "SELECT ID, Name, About, IsActive, CreatedBy, CreatedTime, UpdatedBy, UpdatedTime FROM HC_Doctor_Departments WHERE Id=@Id"; DbCommand dbCommand = db.GetSqlStringCommand(sql); db.AddInParameter(dbCommand, "Id", DbType.String, param); HcDoctorDepartmentsEntity hcDoctorDepartmentsEntity = null; using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { if (dataReader.Read()) { hcDoctorDepartmentsEntity = new HcDoctorDepartmentsEntity(); if (dataReader["ID"] != DBNull.Value) { hcDoctorDepartmentsEntity.Id = dataReader["ID"].ToString(); } if (dataReader["Name"] != DBNull.Value) { hcDoctorDepartmentsEntity.Name = dataReader["Name"].ToString(); } if (dataReader["About"] != DBNull.Value) { hcDoctorDepartmentsEntity.About = dataReader["About"].ToString(); } if (dataReader["IsActive"] != DBNull.Value) { hcDoctorDepartmentsEntity.Isactive = dataReader["IsActive"].ToString(); } if (dataReader["CreatedBy"] != DBNull.Value) { hcDoctorDepartmentsEntity.Createdby = dataReader["CreatedBy"].ToString(); } if (dataReader["CreatedTime"] != DBNull.Value) { hcDoctorDepartmentsEntity.Createdtime = dataReader["CreatedTime"].ToString(); } if (dataReader["UpdatedBy"] != DBNull.Value) { hcDoctorDepartmentsEntity.Updatedby = dataReader["UpdatedBy"].ToString(); } if (dataReader["UpdatedTime"] != DBNull.Value) { hcDoctorDepartmentsEntity.Updatedtime = dataReader["UpdatedTime"].ToString(); } } } return(hcDoctorDepartmentsEntity); }
public bool UpdateHcDoctorDepartmentsInfo(HcDoctorDepartmentsEntity hcDoctorDepartmentsEntity, Database db, DbTransaction transaction) { string sql = "UPDATE HC_Doctor_Departments SET Name= @Name, About= @About, IsActive= @Isactive, UpdatedBy= @Updatedby, UpdatedTime= @Updatedtime WHERE Id=@Id"; DbCommand dbCommand = db.GetSqlStringCommand(sql); db.AddInParameter(dbCommand, "Id", DbType.String, hcDoctorDepartmentsEntity.Id); db.AddInParameter(dbCommand, "Name", DbType.String, hcDoctorDepartmentsEntity.Name); db.AddInParameter(dbCommand, "About", DbType.String, hcDoctorDepartmentsEntity.About); db.AddInParameter(dbCommand, "Isactive", DbType.String, hcDoctorDepartmentsEntity.Isactive); db.AddInParameter(dbCommand, "Updatedby", DbType.String, hcDoctorDepartmentsEntity.Updatedby); db.AddInParameter(dbCommand, "Updatedtime", DbType.String, hcDoctorDepartmentsEntity.Updatedtime); db.ExecuteNonQuery(dbCommand, transaction); return(true); }
public object SaveHcDoctorDepartmentsInfo(HcDoctorDepartmentsEntity hcDoctorDepartmentsEntity, Database db, DbTransaction transaction) { string sql = "INSERT INTO HC_Doctor_Departments ( Name, About, IsActive, CreatedBy, CreatedTime ) output inserted.ID VALUES ( @Name, @About, @Isactive, @Createdby, @Createdtime )"; DbCommand dbCommand = db.GetSqlStringCommand(sql); db.AddInParameter(dbCommand, "Name", DbType.String, hcDoctorDepartmentsEntity.Name); db.AddInParameter(dbCommand, "About", DbType.String, hcDoctorDepartmentsEntity.About); db.AddInParameter(dbCommand, "Isactive", DbType.String, hcDoctorDepartmentsEntity.Isactive); db.AddInParameter(dbCommand, "Createdby", DbType.String, hcDoctorDepartmentsEntity.Createdby); db.AddInParameter(dbCommand, "Createdtime", DbType.String, hcDoctorDepartmentsEntity.Createdtime); var id = db.ExecuteScalar(dbCommand, transaction).ToString(); return(id); }
public JsonResult DoctorsDepartmentDeleteById(string Id) { bool Success = false; HcDoctorDepartmentsEntity obj = (HcDoctorDepartmentsEntity)ExecuteDB(HCareTaks.AG_GetSingleHcDoctorDepartmentsRecordById, Id); if (obj != null) { obj.Updatedby = Session["UserId"].ToString(); obj.Updatedtime = DateTime.Now.ToString("dd/MM/yyyy"); obj.Isactive = "Inactive"; Success = (bool)ExecuteDB(HCareTaks.AG_UpdateHcDoctorDepartmentsInfo, obj); } string Message = Success ? "Delete Success" : "Sorry something went wrong!"; return(Json(new { Success = Success, Message = Message })); }
public List <SelectListItem> List_Department() { List <SelectListItem> Items = new List <SelectListItem>(); HcDoctorDepartmentsEntity obj = new HcDoctorDepartmentsEntity(); obj.Isactive = "Active"; DataTable dt = (DataTable)ExecuteDB(HCareTaks.AG_GetAllHcDoctorDepartmentsRecord, obj); foreach (DataRow dr in dt.Rows) { Items.Add(new SelectListItem { Text = dr["Name"].ToString(), Value = dr["ID"].ToString() }); } return(Items); }
public ActionResult DoctorsDepartmentCreate(string Id) { string eMsg = SiteMainMenuList("Doctors Department Details", "Settings", "DoctorsDepartmentList"); if (!string.IsNullOrEmpty(eMsg)) { return(RedirectToOut(eMsg)); } //else if (!SiteUserAccess("", "V")) return RedirectToOut(); HcDoctorDepartmentsEntity obj = new HcDoctorDepartmentsEntity(); if (!string.IsNullOrEmpty(Id)) { obj = (HcDoctorDepartmentsEntity)ExecuteDB(HCareTaks.AG_GetSingleHcDoctorDepartmentsRecordById, Id); } return(View(obj)); }
string getSingleDept(string id) { string singleDeptData = ""; HcDoctorDepartmentsEntity obj = new HcDoctorDepartmentsEntity(); obj.Isactive = "Active"; obj.Id = id; DataTable dt = (DataTable)ExecuteDB(HCareTaks.AG_GetAllHcDoctorDepartmentsRecord, obj); foreach (DataRow dr in dt.Rows) { singleDeptData += @"<h6 class='card-title'>" + dr["Name"] + "</h6>" + "<p class='card-text text-mute'> <small>" + dr["About"] + " </small></p>" + "<p class='card-text text-mute'> <small>" + dr["full_desc"] + " </small></p>"; } return(singleDeptData); }
string DoctorsDepartmentListTableData() { string TableData = ""; HcDoctorDepartmentsEntity obj = new HcDoctorDepartmentsEntity(); DataTable dt = (DataTable)ExecuteDB(HCareTaks.AG_GetAllHcDoctorDepartmentsRecord, obj); int Count = 1; foreach (DataRow dr in dt.Rows) { string Action = "<i class='mdi mdi-table-edit iAction' title='Edit This' onclick=\"EditDetails('" + dr["Id"].ToString() + "')\" style='color:orange'></i>"; Action += "<i class='mdi mdi-close-box iAction' title='Inactive This' onclick=\"DeleteDetails('" + dr["Id"].ToString() + "', this)\" style='color:red'></i>"; TableData += "<tr>" + "<td>" + Count + "</td>" + "<td>" + dr["Name"] + "</td>" + "<td>" + dr["About"] + "</td>" + "<td class='IsActive'>" + dr["IsActive"] + "</td>" + "<td>" + Action + "</td>" + "</tr>"; Count += 1; } string CreateBtn = "<button class='btn btn-primary' type='button' onclick='CreateDetails()' style='margin-bottom:10px;'> New</button>"; string tHead = "<tr>" + "<th>Sort</th>" + "<th>Name</th>" + "<th>About</th>" + "<th>IsActive</th>" + "<th>Action</th>" + "</tr>"; TableData = CreateBtn + "<div class='table-responsive'><table id='zero_config' class='table table-striped table-bordered'>" + "<thead>" + tHead + "</thead><tbody>" + TableData + "</tbody></table></div>"; return(TableData); }