public object UpdateHcLabTestInfo(object param) { Database db = DatabaseFactory.CreateDatabase(); object retObj = null; using (DbConnection connection = db.CreateConnection()) { connection.Open(); DbTransaction transaction = connection.BeginTransaction(); try { HcLabTestEntity hcLabTestEntity = (HcLabTestEntity)param; HcLabTestDAL hcLabTestDAL = new HcLabTestDAL(); retObj = (object)hcLabTestDAL.UpdateHcLabTestInfo(hcLabTestEntity, db, transaction); transaction.Commit(); } catch { transaction.Rollback(); throw; } finally { connection.Close(); } } return(retObj); }
public ActionResult LabTest() { HcLabTestEntity obj = new HcLabTestEntity(); ViewBag.AllLabTest = getAllLabTest(obj); ViewBag.AllTestCategory = List_Labtest(); return(View()); }
public HcLabTestEntity GetSingleHcLabTestRecordById(object param) { Database db = DatabaseFactory.CreateDatabase(); string sql = "SELECT Id, testId, testName, testAmount, testStatus, testCategory, createBy, created_at, updateBy, updateDate FROM HC_Lab_test WHERE Id=@Id"; DbCommand dbCommand = db.GetSqlStringCommand(sql); db.AddInParameter(dbCommand, "Id", DbType.String, param); HcLabTestEntity hcLabTestEntity = null; using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { if (dataReader.Read()) { hcLabTestEntity = new HcLabTestEntity(); if (dataReader["Id"] != DBNull.Value) { hcLabTestEntity.Id = dataReader["Id"].ToString(); } if (dataReader["testId"] != DBNull.Value) { hcLabTestEntity.Testid = dataReader["testId"].ToString(); } if (dataReader["testName"] != DBNull.Value) { hcLabTestEntity.Testname = dataReader["testName"].ToString(); } if (dataReader["testAmount"] != DBNull.Value) { hcLabTestEntity.Testamount = dataReader["testAmount"].ToString(); } if (dataReader["testStatus"] != DBNull.Value) { hcLabTestEntity.Teststatus = dataReader["testStatus"].ToString(); } if (dataReader["testCategory"] != DBNull.Value) { hcLabTestEntity.Testcategory = dataReader["testCategory"].ToString(); } if (dataReader["createBy"] != DBNull.Value) { hcLabTestEntity.Createby = dataReader["createBy"].ToString(); } if (dataReader["created_at"] != DBNull.Value) { hcLabTestEntity.CreatedAt = dataReader["created_at"].ToString(); } if (dataReader["updateBy"] != DBNull.Value) { hcLabTestEntity.Updateby = dataReader["updateBy"].ToString(); } if (dataReader["updateDate"] != DBNull.Value) { hcLabTestEntity.Updatedate = dataReader["updateDate"].ToString(); } } } return(hcLabTestEntity); }
public ActionResult LabTest(HcLabTestEntity obj) { HcLabTestEntity pobj = new HcLabTestEntity(); pobj.Testcategory = String.Format("{0}", Request.Form["Testcategory"]); pobj.Testname = String.Format("{0}", Request.Form["labsearch"]); ViewBag.AllLabTest = getAllLabTest(pobj); ViewBag.AllTestCategory = List_Labtest(); return(View()); }
public bool UpdateHcLabTestInfo(HcLabTestEntity hcLabTestEntity, Database db, DbTransaction transaction) { string sql = "UPDATE HC_Lab_test SET testId= @Testid, testName= @Testname, testAmount= @Testamount, testStatus= @Teststatus, testCategory= @Testcategory, createBy= @Createby, created_at= @CreatedAt, updateBy= @Updateby, updateDate= @Updatedate WHERE Id=@Id"; DbCommand dbCommand = db.GetSqlStringCommand(sql); db.AddInParameter(dbCommand, "Id", DbType.String, hcLabTestEntity.Id); db.AddInParameter(dbCommand, "Testid", DbType.String, hcLabTestEntity.Testid); db.AddInParameter(dbCommand, "Testname", DbType.String, hcLabTestEntity.Testname); db.AddInParameter(dbCommand, "Testamount", DbType.String, hcLabTestEntity.Testamount); db.AddInParameter(dbCommand, "Teststatus", DbType.String, hcLabTestEntity.Teststatus); db.AddInParameter(dbCommand, "Testcategory", DbType.String, hcLabTestEntity.Testcategory); db.AddInParameter(dbCommand, "Createby", DbType.String, hcLabTestEntity.Createby); db.AddInParameter(dbCommand, "CreatedAt", DbType.String, hcLabTestEntity.CreatedAt); db.AddInParameter(dbCommand, "Updateby", DbType.String, hcLabTestEntity.Updateby); db.AddInParameter(dbCommand, "Updatedate", DbType.String, hcLabTestEntity.Updatedate); db.ExecuteNonQuery(dbCommand, transaction); return(true); }
public bool SaveHcLabTestInfo(HcLabTestEntity hcLabTestEntity, Database db, DbTransaction transaction) { string sql = "INSERT INTO HC_Lab_test ( Id, testId, testName, testAmount, testStatus, testCategory, createBy, created_at, updateBy, updateDate) VALUES ( @Id, @Testid, @Testname, @Testamount, @Teststatus, @Testcategory, @Createby, @CreatedAt, @Updateby, @Updatedate )"; DbCommand dbCommand = db.GetSqlStringCommand(sql); db.AddInParameter(dbCommand, "Id", DbType.String, hcLabTestEntity.Id); db.AddInParameter(dbCommand, "Testid", DbType.String, hcLabTestEntity.Testid); db.AddInParameter(dbCommand, "Testname", DbType.String, hcLabTestEntity.Testname); db.AddInParameter(dbCommand, "Testamount", DbType.String, hcLabTestEntity.Testamount); db.AddInParameter(dbCommand, "Teststatus", DbType.String, hcLabTestEntity.Teststatus); db.AddInParameter(dbCommand, "Testcategory", DbType.String, hcLabTestEntity.Testcategory); db.AddInParameter(dbCommand, "Createby", DbType.String, hcLabTestEntity.Createby); db.AddInParameter(dbCommand, "CreatedAt", DbType.String, hcLabTestEntity.CreatedAt); db.AddInParameter(dbCommand, "Updateby", DbType.String, hcLabTestEntity.Updateby); db.AddInParameter(dbCommand, "Updatedate", DbType.String, hcLabTestEntity.Updatedate); db.ExecuteNonQuery(dbCommand, transaction); return(true); }
string getAllLabTest(HcLabTestEntity obj) { string LabTestData = ""; HcLabTestEntity parms = new HcLabTestEntity(); parms.Testcategory = obj.Testcategory; parms.Testname = obj.Testname; parms.Teststatus = "Active"; DataTable dt = (DataTable)ExecuteDB(HCareTaks.AG_GetAllHcLabTestRecord, parms); if (dt.Rows.Count > 1) { foreach (DataRow dr in dt.Rows) { LabTestData += @"<div class='col-md-4 col-lg-4 mb-30'>" + "<div class='card card-doctor'>" + "<img src='/' alt='' />" + "<div class='card-title'>" + "<h6 class='py-10'>" + dr["testName"] + "</h6>" + "<p class='py-10'> <span class='badge badge-pill badge-danger'>" + dr["catTestName"] + "</span></p>" + "</div>" + "<div class='card-body'>" + "<p class='py-10 text-primary font-1'>" + "Something about the test. maybe a breif " + "</p>" + "</div>" + // addtocart" (66cd831b-066b-40e2-b2db-4b4773954ba3)';' "<button onclick='addtocart(" + dr["Id"] + ");' class='btn btn-success btn-sm btn-block'>ADD " + dr["testAmount"] + " $</button>" + "</div>" + "</div>"; } } else { LabTestData += @"<p class='py-10'> Sorry! No Lab test associate with your search.</p>"; } return(LabTestData); }
public DataTable GetAllHcLabTestRecord(object param) { Database db = DatabaseFactory.CreateDatabase(); //string sql = "SELECT Id, testId, testName, testAmount, testStatus, testCategory, createBy, created_at AS CreatedAt, updateBy, updateDate FROM HC_Lab_test where 1=1"; string sql = @"SELECT A.Id, A.testId, A.testName, A.testAmount, A.testStatus, A.testCategory, B.catTestName, A.createBy, A.created_at, A.updateBy, A.updateDate FROM HC_Lab_test A , HC_Test_category B WHERE A.testCategory = B.Id And A.testStatus='Active' AND 1=1"; HcLabTestEntity obj = new HcLabTestEntity(); if (param != null) { obj = (HcLabTestEntity)param; } if (string.IsNullOrEmpty(obj.Testname)) { if (!string.IsNullOrEmpty(obj.Testcategory)) { sql += " And A.testCategory = '" + obj.Testcategory + "'"; } if (!string.IsNullOrEmpty(obj.Id)) { sql += " And A.ID = '" + obj.Id + "'"; } } else { if (!string.IsNullOrEmpty(obj.Testname)) { sql += " And UPPER(A.testName)like Upper('%" + obj.Testname + "%')"; } } DbCommand dbCommand = db.GetSqlStringCommand(sql); DataSet ds = db.ExecuteDataSet(dbCommand); return(ds.Tables[0]); }