public bool SAVE(MedicalVoucherType obj) { Connect(); SqlCommand cmd = new SqlCommand("IUMedicalVoucherType", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@HospitalID", HospitalID); cmd.Parameters.AddWithValue("@LocationID", LocationID); if (obj.VoucherTypeID == 0) { cmd.Parameters.AddWithValue("@VoucherTypeID", 0); cmd.Parameters.AddWithValue("@Mode", "Add"); } else { cmd.Parameters.AddWithValue("@VoucherTypeID", obj.VoucherTypeID); cmd.Parameters.AddWithValue("@Mode", "Edit"); } cmd.Parameters.AddWithValue("@VoucherTypeName", obj.voucherTypeName); cmd.Parameters.AddWithValue("@ReferenceCode", 0); cmd.Parameters.AddWithValue("@AccountsID", obj.MasterAcID); cmd.Parameters.AddWithValue("@Narration", obj.narration); if (obj.debitMasterAccount == null) { cmd.Parameters.AddWithValue("@DebitMasterAccount", 0); } else { cmd.Parameters.AddWithValue("@DebitMasterAccount", obj.debitMasterAccount); } if (obj.editMasterAccount == null) { cmd.Parameters.AddWithValue("@EditMasterAccount", 0); } else { cmd.Parameters.AddWithValue("@EditMasterAccount", obj.editMasterAccount); } cmd.Parameters.AddWithValue("@CodeBlock", obj.codeblock); cmd.Parameters.AddWithValue("@CreationID", UserID); con.Open(); int i = cmd.ExecuteNonQuery(); con.Close(); if (i > 0) { return(true); } else { return(false); } }
public int DeleteVoucher(int VoucherTypeID) { Connect(); int delete = 0; MedicalVoucherType voucher = new MedicalVoucherType(); SqlCommand cmd = new SqlCommand("DeleteMedicalVoucherType", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@HospitalID", HospitalID); cmd.Parameters.AddWithValue("@LocationID", LocationID); cmd.Parameters.AddWithValue("@VoucherTypeID", VoucherTypeID); con.Open(); delete = cmd.ExecuteNonQuery(); return(delete); }
public JsonResult GetAccountID(string prefix) { KeystoneProject.Buisness_Logic.PharmacyMaster.BL_MedicalVoucherType Bl_obj = new BL_MedicalVoucherType(); KeystoneProject.Models.PharmacyMaster.MedicalVoucherType AddServiceMod = new MedicalVoucherType(); DataSet ds = Bl_obj.GetAccountID(prefix, "%"); List <MedicalVoucherType> SearchList = new List <MedicalVoucherType>(); foreach (DataRow dr in ds.Tables[0].Rows) { SearchList.Add(new MedicalVoucherType { masterAccount = dr["AccountName"].ToString(), MasterAcID = Convert.ToInt32(dr["AccountsID"]), }); } return(new JsonResult { Data = SearchList, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public ActionResult MedicalVoucherType(MedicalVoucherType obj) { try { if (obj.debitMasterAccount == "true") { obj.debitMasterAccount = Convert.ToString(true); } else if (obj.debitMasterAccount == "null") { obj.debitMasterAccount = Convert.ToString(false); } else { obj.debitMasterAccount = Convert.ToString(false); } if (obj.editMasterAccount == "true") { obj.editMasterAccount = Convert.ToString(true); } else if (obj.editMasterAccount == null) { obj.editMasterAccount = Convert.ToString(false); } else { obj.editMasterAccount = Convert.ToString(false); } if (Med_vouchertype.CheckVoucher(obj.VoucherTypeID, obj.voucherTypeName)) { if (Med_vouchertype.SAVE(obj)) { if (obj.VoucherTypeID > 0) { ModelState.Clear(); TempData["msg"] = "Medical Voucher Type Updated Successfully"; } else { ModelState.Clear(); TempData["msg"] = "Medical Voucher Type Saved Successfully"; } } else { TempData["msg"] = "Medical Voucher Type Not Saved"; } } else { ViewData["flag"] = "Error"; TempData["Msg"] = "Medical Voucher Type Already Exist "; } return(RedirectToAction("MedicalVoucherType", "MedicalVoucherType")); } catch (Exception ex) { return(RedirectToAction("MedicalVoucherType", "MedicalVoucherType")); } }