protected void btnAnularDefuncion_Click(object sender, EventArgs e) { //Hacemos la baja lógica del registro, la información quedara en la base de datos int idPaciente = Convert.ToInt32(Request.QueryString["id"]); SubSonic.Select query = new SubSonic.Select(); query.From(SysDefuncion.Schema); query.Where(SysDefuncion.Columns.IdPaciente).IsEqualTo(idPaciente).And(SysDefuncion.Columns.Activo).IsEqualTo(true); SysDefuncion q = query.ExecuteSingle <SysDefuncion>(); q.Activo = false; q.Save(); //Finalmente debería asignar al campo fallecido FALSE int id = Convert.ToInt32(idPaciente); DalSic.SysPaciente pac = new DalSic.SysPaciente(id); //pac.Fallecido = false; pac.Save(); Response.Redirect("~/Paciente/PacienteList.aspx"); }
private void actualizar() { try { //Hacemos el update SubSonic.Select query = new SubSonic.Select(); query.From(SysDefuncion.Schema); query.Where(SysDefuncion.Columns.IdPaciente).IsEqualTo(Convert.ToInt32(Request.QueryString["id"])); SysDefuncion q = query.ExecuteSingle <SysDefuncion>(); q.IdPaciente = q.IdPaciente; //Esto no debería cambiar ya que está asociado al mismo paciente q.Fecha = txtFechaDefuncion.Text; q.Hora = txtHoraDefuncion.Text; q.CausaMuerte = txtCausaMuerte.Text; q.IdProfesional = hfMedico.Value == "" ? q.IdProfesional : Convert.ToInt32(hfMedico.Value); q.EgresoPersonal = txtEmpresaQueRetira.Text; q.IngresoMorguePersonal = txtPersonalIngresaMorgue.Text; q.Observaciones = txtObservaciones.Text; q.IdSsoUserModificacion = Convert.ToInt32(SSOHelper.CurrentIdentity.Id); q.Activo = true; q.FechaModificacion = DateTime.Now; q.Save(); } catch (Exception ex) { this.error.Visible = true; } }
private void cargarCombo() { SubSonic.Select ef = new SubSonic.Select(); ef.From(SysEfector.Schema); ef.Where(SysEfector.Columns.IdZona).IsEqualTo(9); ef.And(SysEfector.Columns.Complejidad).IsEqualTo(2); ef.OrderAsc("nombre"); ddlEfector.DataSource = ef.ExecuteTypedList <SysEfector>(); ddlEfector.DataBind(); ddlEfector.Items.Insert(0, new ListItem("TODOS", "0")); }
private void LoadHostelRecord() { TblHostelEnrollment hostel = new SubSonic.Select() .From(TblHostelEnrollment.Schema) .Where(TblHostelEnrollment.Columns.MemberID).IsEqualTo(hdnID.Value) .And(TblHostelEnrollment.Columns.MemberType).IsEqualTo(false) .ExecuteSingle <TblHostelEnrollment>(); if (hostel != null) { ddlHostel.SelectedValue = hostel.HostelID.ToString(); txtEnrollDate.SelectedDate = Convert.ToDateTime(hostel.HAdmissionDate); } }
private void LoadEnrollment() { TblCurrentEnrollment currenroll = new SubSonic.Select() .From(TblCurrentEnrollment.Schema) .Where(TblCurrentEnrollment.Columns.StudentID).IsEqualTo(hdnID.Value) .ExecuteSingle <TblCurrentEnrollment>(); if (currenroll != null) { ddlClass.SelectedValue = currenroll.ClassNo.ToString(); LoadGroup(ddlClass.SelectedValue); ddlGroup.SelectedValue = currenroll.GroupID.ToString(); } }
private void UpdateStore() { TblAssestStore store; if (hdnID.Value == "") { Query qry = new Query(TblAssestStore.Schema); qry.AddWhere(TblAssestStore.Columns.ItemID, Comparison.Equals, ddlItems.SelectedValue).AND (TblAssestStore.Columns.BranchID, Comparison.Equals, Session["BranchID"]); DataTable dt = qry.ExecuteDataSet().Tables[0]; if (dt.Rows.Count == 0) { store = new TblAssestStore(); store.IsNew = true; store.ItemID = Convert.ToInt32(ddlItems.SelectedValue); store.Quantity = Convert.ToInt32(txtQuantity.Text); store.BranchID = Convert.ToInt32(Session["BranchID"]); } else { store = new SubSonic.Select() .From(TblAssestStore.Schema) .Where(TblAssestStore.Columns.ItemID).IsEqualTo(ddlItems.SelectedValue) .And(TblAssestStore.Columns.BranchID).IsEqualTo(Session["BranchID"]) .ExecuteSingle <TblAssestStore>(); store.IsNew = false; store.Quantity += Convert.ToInt32(txtQuantity.Text); } } else { store = new SubSonic.Select() .From(TblAssestStore.Schema) .Where(TblAssestStore.Columns.ItemID).IsEqualTo(ddlItems.SelectedValue) .And(TblAssestStore.Columns.BranchID).IsEqualTo(Session["BranchID"]) .ExecuteSingle <TblAssestStore>(); store.IsNew = false; if (Convert.ToInt32(txtQuantity.Text) > Convert.ToInt32(hdnQuantity.Value)) { store.Quantity += Convert.ToInt32(txtQuantity.Text) - Convert.ToInt32(hdnQuantity.Value); } else { store.Quantity -= Convert.ToInt32(hdnQuantity.Value) - Convert.ToInt32(txtQuantity.Text); } } store.Save(); }
/// <summary> /// hàm thực hiện chấp nhập thông tin /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdOK_Click(object sender, EventArgs e) { SqlQuery sqlQuery = new SubSonic.Select().From(SysTrinhky.Schema) .Where(SysTrinhky.Columns.ReportName).IsEqualTo(txtBaoCao.Text); if(sqlQuery.GetRecordCount()>0) { new Update(SysTrinhky.Schema) .Set(SysTrinhky.Columns.TitleReport).EqualTo(txtTieuDe.Text) .Where(SysTrinhky.Columns.ReportName).IsEqualTo(txtBaoCao.Text).Execute(); } else { SysTrinhky.Insert(txtBaoCao.Text, globalVariables.UserName, "Arial", 12, "Chữ đậm", "", txtTieuDe.Text); } this.Close(); }
protected void btnDelete_Click(object sender, EventArgs e) { LinkButton btn = (LinkButton)sender; TblAssestStock stock = new TblAssestStock(btn.CommandArgument); TblAssestStore store = new SubSonic.Select() .From(TblAssestStore.Schema) .Where(TblAssestStore.Columns.ItemID).IsEqualTo(stock.ItemID) .And(TblAssestStore.Columns.BranchID).IsEqualTo(Session["BranchID"]) .ExecuteSingle <TblAssestStore>(); store.Quantity -= stock.Quantity; store.Save(); TblAssestStock.Delete(btn.CommandArgument); LoadStock(); string msg = "Item has been deleted!"; lblmsg.Text = helper.DisplayNotificationMessage(msgDiv, msg, "alert alert-success alert-icon alert-dismissible", icon, "icon mdi mdi-check"); }
private void LoadTransportRecord() { TblTransportHolder transport = new SubSonic.Select() .From(TblTransportHolder.Schema) .Where(TblTransportHolder.Columns.MemberID).IsEqualTo(hdnID.Value) .And(TblTransportHolder.Columns.MemberType).IsEqualTo(false) .ExecuteSingle <TblTransportHolder>(); if (transport != null) { ddlRoute.SelectedValue = transport.RouteID.ToString(); LoadBuses(); ddlBus.SelectedValue = transport.BusID.ToString(); txtDiscount.Text = transport.Discount.ToString(); txtSeatNo.Text = transport.SeatNo.ToString(); txtBusStop.Text = transport.Stop.ToString(); txtTJoinDate.SelectedDate = Convert.ToDateTime(transport.JoiningDate); } }
protected void btnBuscar_Click(object sender, EventArgs e) { SubSonic.Select s = new SubSonic.Select(); s.From(SysPaciente.Schema); //busqueda por documento if (txtDni.Text.Length > 0) { int nrodoc = 0; nrodoc = Convert.ToInt32(txtDni.Text); gvPersonas.DataSource = DalPadron.SPs.ListarObraSocial((Convert.ToInt32(txtDni.Text))).GetDataSet().Tables[0]; gvPersonas.DataBind(); //busqueda en Pd_Paciente gvPadronPaciente.DataSource = DalPadron.SPs.GetPacientes((Convert.ToInt32(txtDni.Text))).GetDataSet().Tables[0]; gvPadronPaciente.DataBind(); //llenado de la grilla gvPacientes.DataSource = SPs.GetPacientesPorDocumento(nrodoc).GetDataSet(); gvPacientes.DataBind(); return; } DateTime fnac; DateTime?fnac2 = null; if (DateTime.TryParse(txtFecNacBusqueda.Text, out fnac)) { fnac2 = fnac; } //Busqueda por Nro Doc de la Madre int docM = 0; if (txtDocMadre.Text != "") { docM = Convert.ToInt32(txtDocMadre.Text); } gvPacientes.DataSource = SPs.GetPacientesPorNombres(fnac2, txtNombreBusqueda.Text.Trim(), txtApellidoBusqueda.Text.Trim(), docM, txtNombreMadreBusqueda.Text.Trim(), txtApellidoMadreBusqueda.Text.Trim()).GetDataSet(); gvPacientes.DataBind(); }
protected void btnSubmit_Click(object sender, EventArgs e) { TblTransportHolder transport; if (hdnID.Value != "") { transport = new SubSonic.Select() .From(TblTransportHolder.Schema) .Where(TblTransportHolder.Columns.MemberID).IsEqualTo(hdnID.Value) .And(TblTransportHolder.Columns.MemberType).IsEqualTo(true) .ExecuteSingle <TblTransportHolder>(); if (transport == null) { transport = new TblTransportHolder(); transport.IsNew = true; } else { transport.IsNew = false; } } else { transport = new TblTransportHolder(); transport.IsNew = true; } transport.RouteID = Convert.ToInt32(ddlRoute.SelectedValue); transport.BusID = Convert.ToInt32(ddlBus.SelectedValue); transport.MemberID = employee.EmployeeID; transport.MemberType = true; transport.Discount = Convert.ToInt32(txtDiscount.Text); transport.SeatNo = Convert.ToInt32(txtSeatNo.Text); transport.Stop = txtBusStop.Text; transport.JoiningDate = txtTJoinDate.SelectedDate; transport.IsActive = true; transport.Save(); hdnID.Value = ""; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int id = Convert.ToInt32(Request.QueryString["id"]); DalSic.SysPaciente pac = new DalSic.SysPaciente(id); DataTable dtd = new DataTable(); if (pac != null) { txtDocumento.Text = pac.NumeroDocumento.ToString(); txtApellidoNombres.Text = pac.Apellido.ToString() + " " + pac.Nombre.ToString();; txtEdad.Text = pac.Edad.ToString(); txtSexo.Text = pac.SysSexo.Nombre.ToString(); txtOS.Text = pac.SysObraSocial.Nombre.ToString(); SubSonic.Select query = new SubSonic.Select(); query.From(DalSic.SysDefuncion.Schema); query.Where(SysDefuncion.Columns.IdPaciente).IsEqualTo(id).And(SysDefuncion.Columns.Activo).IsEqualTo(true); dtd = query.ExecuteDataSet().Tables[0]; if (dtd.Rows.Count > 0) //Se encontró registro de defunción asociado { cargarRegistro(dtd); btnAnularDefuncion.Visible = true; hfupdate.Value = "si"; } else { hfupdate.Value = "no"; } } } }
private KcbDonthuocChitiet[] CreateArrayPresDetail() { this._temp = ActionResult.Success; int index = 0; KcbDonthuocChitiet[] chitietArray = new KcbDonthuocChitiet[this.m_dtDonthuocChitiet.DefaultView.Count]; try { foreach (DataRowView view in this.m_dtDonthuocChitiet.DefaultView) { long num2 = Utility.Int64Dbnull(view[KcbDonthuocChitiet.Columns.IdThuockho], -1); int num3 = CommonLoadDuoc.SoLuongTonTrongKho(-1L, Utility.Int32Dbnull(view[KcbDonthuocChitiet.Columns.IdKho], -1), Utility.Int16Dbnull(view[KcbDonthuocChitiet.Columns.IdThuoc], -1), Utility.Int64Dbnull(view[KcbDonthuocChitiet.Columns.IdThuockho], -1), new int?(Utility.Int32Dbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("KIEMTRATHUOC_CHOXACNHAN", "1", false), 1)), (byte)0); if (this.m_enAct == action.Update) { int soLuong = 0; KcbDonthuocChitiet chitiet = new SubSonic.Select(new TableSchema.TableColumn[] { KcbDonthuocChitiet.SoLuongColumn }).From(KcbDonthuocChitiet.Schema).Where(KcbDonthuocChitiet.IdChitietdonthuocColumn).IsEqualTo(Utility.Int32Dbnull(view[KcbDonthuocChitiet.Columns.IdChitietdonthuoc], -1)).ExecuteSingle<KcbDonthuocChitiet>(); if (chitiet != null) { soLuong = chitiet.SoLuong; } num3 += soLuong; } if (Utility.Int32Dbnull(view[KcbDonthuocChitiet.Columns.SoLuong], 0) > num3) { Utility.ShowMsg(string.Format("Số lượng thuốc {0}({1}) vượt quá số lượng tồn trong kho{2}({3}) \nBạn cần chỉnh lại số lượng thuốc!", new object[] { Utility.sDbnull(view[DmucThuoc.Columns.TenThuoc], "").ToString(), Utility.Int32Dbnull(view[KcbDonthuocChitiet.Columns.SoLuong], 0).ToString(), Utility.sDbnull(view[TDmucKho.Columns.TenKho], "").ToString(), num3.ToString() })); this._temp = ActionResult.NotEnoughDrugInStock; return null; } chitietArray[index] = new KcbDonthuocChitiet(); chitietArray[index].IdDonthuoc = this.IdDonthuoc; chitietArray[index].IdChitietdonthuoc = Utility.Int32Dbnull(view[KcbDonthuocChitiet.Columns.IdChitietdonthuoc], -1); chitietArray[index].IdBenhnhan = -1; chitietArray[index].MaLuotkham = ""; chitietArray[index].IdKho = new int?(Utility.Int32Dbnull(view[KcbDonthuocChitiet.Columns.IdKho], -1)); chitietArray[index].IdThuoc = Utility.Int16Dbnull(view[KcbDonthuocChitiet.Columns.IdThuoc], -1); chitietArray[index].TrangthaiThanhtoan = Utility.ByteDbnull(view[KcbDonthuocChitiet.Columns.TrangthaiThanhtoan], 0); chitietArray[index].SttIn = new short?(Utility.Int16Dbnull(view[KcbDonthuocChitiet.Columns.SttIn], 1)); chitietArray[index].TrangthaiHuy = 0; chitietArray[index].IdThuockho = new long?(num2); chitietArray[index].GiaNhap = new decimal?(Utility.DecimaltoDbnull(view[KcbDonthuocChitiet.Columns.GiaNhap], -1)); chitietArray[index].GiaBan = new decimal?(Utility.DecimaltoDbnull(view[KcbDonthuocChitiet.Columns.GiaBan], -1)); chitietArray[index].Vat = new decimal?(Utility.DecimaltoDbnull(view[KcbDonthuocChitiet.Columns.Vat], -1)); chitietArray[index].SoLo = Utility.sDbnull(view[KcbDonthuocChitiet.Columns.SoLo], -1); chitietArray[index].MaNhacungcap = Utility.sDbnull(view[KcbDonthuocChitiet.Columns.MaNhacungcap], -1); chitietArray[index].NgayHethan = Utility.ConvertDate(view["sNgayhethan"].ToString()).Date; chitietArray[index].SoluongHuy = 0; chitietArray[index].TuTuc = 0; chitietArray[index].SoLuong = Utility.Int32Dbnull(view[KcbDonthuocChitiet.Columns.SoLuong], 0); chitietArray[index].DonGia = Utility.DecimaltoDbnull(view[KcbDonthuocChitiet.Columns.DonGia], 0); chitietArray[index].PhuThu = new decimal?(Utility.Int16Dbnull(view[KcbDonthuocChitiet.Columns.PhuThu], 0)); chitietArray[index].MotaThem = Utility.sDbnull(view[KcbDonthuocChitiet.Columns.MotaThem], ""); chitietArray[index].ChidanThem = Utility.sDbnull(view[KcbDonthuocChitiet.Columns.ChidanThem], ""); chitietArray[index].CachDung = Utility.sDbnull(view[KcbDonthuocChitiet.Columns.CachDung], ""); chitietArray[index].DonviTinh = Utility.sDbnull(view[KcbDonthuocChitiet.Columns.DonviTinh], ""); chitietArray[index].SolanDung = Utility.sDbnull(view[KcbDonthuocChitiet.Columns.SolanDung], null); chitietArray[index].SoluongDung = Utility.sDbnull(view[KcbDonthuocChitiet.Columns.SoluongDung], null); chitietArray[index].SluongSua = 0; chitietArray[index].SluongLinh = 0; chitietArray[index].TrangThai = 0; chitietArray[index].TrangthaiBhyt = 1; chitietArray[index].IdThanhtoan = -1; chitietArray[index].NgayTao = new DateTime?(globalVariables.SysDate); chitietArray[index].NguoiTao = globalVariables.UserName; chitietArray[index].MaDoituongKcb = Utility.sDbnull("DV"); chitietArray[index].BhytChitra = 0; chitietArray[index].BnhanChitra = new decimal?(Utility.DecimaltoDbnull(view[KcbDonthuocChitiet.Columns.DonGia], 0)); chitietArray[index].PtramBhyt = 0; index++; } } catch (Exception) { } return chitietArray; }
private List<KcbDonthuocChitiet> GetChangedData() { List<KcbDonthuocChitiet> list = new List<KcbDonthuocChitiet>(); this._temp = ActionResult.Success; KcbDonthuocChitiet[] chitietArray = new KcbDonthuocChitiet[this.m_dtDonthuocChitiet.DefaultView.Count]; try { foreach (DataRow row in this.m_dtDonthuocChitiet.Rows) { long key = Utility.Int64Dbnull(row[KcbDonthuocChitiet.Columns.IdThuockho], -1); //if (this.lstChangeData.ContainsKey(key)) //{ //string str = this.lstChangeData[key].ToString(); //if (this.isChanged(str)) //{ int num3 = CommonLoadDuoc.SoLuongTonTrongKho(-1L, Utility.Int32Dbnull(row[KcbDonthuocChitiet.Columns.IdKho], -1), Utility.Int16Dbnull(row[KcbDonthuocChitiet.Columns.IdThuoc], -1), key, new int?(Utility.Int32Dbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("KIEMTRATHUOC_CHOXACNHAN", "1", false), 1)), (byte)0); if (this.m_enAct == action.Update) { int soLuong = 0; KcbDonthuocChitiet chitiet = new SubSonic.Select(new TableSchema.TableColumn[] { KcbDonthuocChitiet.SoLuongColumn }).From(KcbDonthuocChitiet.Schema).Where(KcbDonthuocChitiet.IdChitietdonthuocColumn).IsEqualTo(Utility.Int32Dbnull(row[KcbDonthuocChitiet.Columns.IdChitietdonthuoc], -1)).ExecuteSingle<KcbDonthuocChitiet>(); if (chitiet != null) { soLuong = chitiet.SoLuong; } num3 += soLuong; } if (Utility.Int32Dbnull(row[KcbDonthuocChitiet.Columns.SoLuong], 0) > num3) { Utility.ShowMsg(string.Format("Số lượng thuốc {0}({1}) vượt quá số lượng tồn trong kho{2}({3}) \nBạn cần chỉnh lại số lượng thuốc!", new object[] { Utility.sDbnull(row[DmucThuoc.Columns.TenThuoc], "").ToString(), Utility.Int32Dbnull(row[KcbDonthuocChitiet.Columns.SoLuong], 0).ToString(), Utility.sDbnull(row[TDmucKho.Columns.TenKho], "").ToString(), num3.ToString() })); this._temp = ActionResult.NotEnoughDrugInStock; return null; } this.hasChanged = true; list.Add(this.getNewItem(row)); //} //} } return list; } catch (Exception exception) { Utility.ShowMsg("Lỗi khi lấy dữ liệu cập nhật đơn thuốc:\n" + exception.Message); return null; } }
/// <summary> /// return next available ordernumber based on officeid /// </summary> /// <param name="officeid"></param> /// <returns></returns> public static int next_order_number(int officeid) { int _nextorderno = 0; int _maxorderno = 0; switch (officeid) { case 1: //uk office { _maxorderno = new SubSonic.Select(Aggregate.Max(OrderNumberTable.OrderNumberColumn)). From(DAL.Logistics.Tables.OrderNumberTable).ExecuteScalar<int>(); break; } case 2: //hong kong office { _maxorderno = new SubSonic.Select(Aggregate.Max(Hkont.OrderNumberColumn)). From(DAL.Logistics.Tables.Hkont).ExecuteScalar<int>(); break; } case 3: //singapore office { _maxorderno = new SubSonic.Select(Aggregate.Max(Sgont.OrderNumberColumn)). From(DAL.Logistics.Tables.Sgont).ExecuteScalar<int>(); break; } case 4: //australia order { _maxorderno = new SubSonic.Select(Aggregate.Max(Aont.OrderNumberColumn)). From(DAL.Logistics.Tables.Aont).ExecuteScalar<int>(); break; } case 5: //italy order { _maxorderno = new SubSonic.Select(Aggregate.Max(Itont.OrderNumberColumn)). From(DAL.Logistics.Tables.Itont).ExecuteScalar<int>(); break; } case 6: //us order { _maxorderno = new SubSonic.Select(Aggregate.Max(Usont.OrderNumberColumn)). From(DAL.Logistics.Tables.Usont).ExecuteScalar<int>(); break; } case 7: //netherlands order { _maxorderno = new SubSonic.Select(Aggregate.Max(Nlont.OrderNumberColumn)). From(DAL.Logistics.Tables.Nlont).ExecuteScalar<int>(); break; } case 9: //germany order { _maxorderno = new SubSonic.Select(Aggregate.Max(Deont.OrderNumberColumn)). From(DAL.Logistics.Tables.Deont).ExecuteScalar<int>(); break; } case 10: //thailand order { _maxorderno = new SubSonic.Select(Aggregate.Max(Thont.OrderNumberColumn)). From(DAL.Logistics.Tables.Thont).ExecuteScalar<int>(); break; } case 13: //brazil order { _maxorderno = new SubSonic.Select(Aggregate.Max(Bront.OrderNumberColumn)). From(DAL.Logistics.Tables.Bront).ExecuteScalar<int>(); break; } default: { _maxorderno = -1; break; } }//end switch _nextorderno = _maxorderno + 1; //get next available number or return 0 if not found return _nextorderno; }
private void MostrarPaciente() { ///muestra solo el primer paciente con ese numero de documento. int i = 0; if (!String.IsNullOrEmpty(txtDni.Text)) { try { int dni = Int32.Parse(txtDni.Text); ///////////////////////////////////////////////////// ///modificacacion para dar prioridad al paciente validado ///////////////////////////////////////////////////// SysPacienteCollection lst = new SubSonic.Select() .From(Schemas.SysPaciente) .Where(SysPaciente.Columns.NumeroDocumento).IsEqualTo(dni) .And(SysPaciente.Columns.IdEstado).IsEqualTo(3)///primero busca el paciente validado .And(SysPaciente.Columns.Activo).IsEqualTo(1) .ExecuteAsCollection <SysPacienteCollection>(); foreach (SysPaciente oPaciente in lst) { if (i == 0) { lblEstado.Text = "VALIDADO"; lblEstado.ForeColor = Color.Red; lblidPaciente.Text = oPaciente.IdPaciente.ToString(); lblDU.Text = oPaciente.NumeroDocumento.ToString(); lblApellido.Text = oPaciente.Apellido; lblNombre.Text = oPaciente.Nombre; lblFechaNacimiento.Text = oPaciente.FechaNacimiento.ToShortDateString(); switch (oPaciente.IdSexo) { case 1: lblSexo.Text = "Sin definir"; break; case 2: lblSexo.Text = "Femenino"; break; case 3: lblSexo.Text = "Masculino"; break; } pnlPaciente.Visible = true; pnlSinDatosPaciente.Visible = false; } i += 1; } ///////////////////////////////////////////////////// // si no encontró un paciente validado busca a un identificado ///////////////////////////////////////////////////// // if (lst.Count == 0) if (i == 0) { SysPacienteCollection lst2 = new SubSonic.Select() .From(Schemas.SysPaciente) .Where(SysPaciente.Columns.NumeroDocumento).IsEqualTo(dni) .And(SysPaciente.Columns.IdEstado).IsEqualTo(1)/// busca el paciente IDENTIFICADO .And(SysPaciente.Columns.Activo).IsEqualTo(1) .ExecuteAsCollection <SysPacienteCollection>(); foreach (SysPaciente oPaciente in lst2) { if (i == 0) { lblEstado.Text = "IDENTIFICADO"; lblEstado.ForeColor = Color.Green; lblidPaciente.Text = oPaciente.IdPaciente.ToString(); lblDU.Text = oPaciente.NumeroDocumento.ToString(); lblApellido.Text = oPaciente.Apellido; lblNombre.Text = oPaciente.Nombre; lblFechaNacimiento.Text = oPaciente.FechaNacimiento.ToShortDateString(); switch (oPaciente.IdSexo) { case 1: lblSexo.Text = "Sin definir"; break; case 2: lblSexo.Text = "Femenino"; break; case 3: lblSexo.Text = "Masculino"; break; } pnlPaciente.Visible = true; pnlSinDatosPaciente.Visible = false; } i += 1; } } if (i == 0) { pnlPaciente.Visible = false; pnlSinDatosPaciente.Visible = true; } } catch (Exception e) { string popupScript = "<script language='JavaScript'> alert('Los datos ingresados no son válidos')</script>"; Page.RegisterClientScriptBlock("PopupScript", popupScript); } } }
protected void btnSave_Click(object sender, EventArgs e) { if (helper.ExecutePlainQuery("select * from TblStudents where RegistrationNo='" + txtRegNo.Text + "' and BranchID=" + Session["BranchID"]).Rows.Count > 0 && String.IsNullOrEmpty(hdnID.Value)) { lblmsg.Text = helper.DisplayNotificationMessage(msgDiv, txtRegNo.Text + " already exists!", "alert alert-danger alert-icon alert-dismissible", icon, "icon mdi mdi-check"); } else { string msg = "student has been added!"; if (hdnID.Value == "") { student = new TblStudent(); student.IsNew = true; student.CreateBy = Convert.ToString(Session["BranchUserID"]); } else { student = new TblStudent(hdnID.Value); student.IsNew = false; msg = "student has been updated!"; student.UpdatedBy = Convert.ToString(Session["BranchUserID"]); } student.BranchID = Convert.ToInt32(Session["BranchID"]); student.StudentName = txtStudentName.Text; student.FatherName = txtFatherName.Text; student.IsActive = true; student.RegistrationNo = txtRegNo.Text; student.LevelID = Convert.ToInt32(ddlLevel.SelectedValue); if (DDProgName.SelectedValue != "-1") { if (DDProgName.SelectedValue == "PreEng") { student.Program = "FSC"; } else if (DDProgName.SelectedValue == "PreMed") { student.Program = "FSC"; } else { student.Program = DDProgName.SelectedValue; } } if (radioSpring.Checked) { student.Session = "Spring"; } else { student.Session = "Autumn"; } student.DateofAdmission = txtDOA.SelectedDate; if (radioMale.Checked) { student.Gender = "Male"; } else { student.Gender = "Female"; } if (txtPic.HasFile) { if (String.IsNullOrEmpty(lblimgName.Text)) { postedFile = txtPic.FileName; } else { postedFile = lblimgName.Text; } txtPic.SaveAs(Server.MapPath("~/Admin/assets/CustomImages/" + txtPic.FileName)); student.Pic = postedFile; } student.Nationality = txtNationality.Text; student.Domicile = txtDomicile.Text; student.Religion = ddlReligion.SelectedValue; student.Cnic = txtCNIC.Text; student.Dob = txtDOB.SelectedDate; student.PlaceofBirth = txtPlaceOfBirth.Text; student.SEmail = txtStdEmail.Text; student.SCellNo = txtStdCell.Text; student.SHomePhone = txtPhoneNo.Text; student.SAddress = txtHomeAddress.Text; if (chkTransport.Checked) { student.IsTrannsport = true; } else { student.IsTrannsport = false; } if (chkHostel.Checked) { student.IsHostel = true; } else { student.IsHostel = false; } student.GName = txtGardianName.Text; student.GRelationship = txtRelationship.Text; student.GAddress = txtOfficeAddress.Text; student.GEmail = txtGEmail.Text; student.GOccupation = txtGOccupation.Text; student.GMonthlyIncome = Convert.ToDecimal(txtMonthlyIncome.Text); student.GCellNo = txtGCell.Text; student.ClassNo = Convert.ToInt32(ddlClass.SelectedValue); if (!String.IsNullOrEmpty(ddlGroup.SelectedValue)) { student.GroupID = Convert.ToInt32(ddlGroup.SelectedValue); } student.Save(); if (ddlLevel.SelectedValue == "2") { student.Program = DDProgName.SelectedValue; Query qry = new Query(TblStudentAcademicRecord.Schema); qry.AddWhere(TblStudentAcademicRecord.Columns.StudentID, Comparison.Equals, student.StudentID); DataTable dt = qry.ExecuteDataSet().Tables[0]; TblStudentAcademicRecord academic; if (dt.Rows.Count == 0) { academic = new TblStudentAcademicRecord(); academic.IsNew = true; } else { academic = new TblStudentAcademicRecord(dt.Rows[0]["ARecordID"]); academic.IsNew = false; } academic.StudentID = student.StudentID; academic.Degree = DropDownMatric.SelectedValue; academic.Board = txtSCCInstitue.Text; academic.Year = txtSSCYear.Text; academic.RollNo = txtSSCRNo.Text; academic.TotalMarks = Convert.ToInt32(txtSSCTMarks.Text); academic.ObtainedMarks = Convert.ToInt32(txtSSCOMarks.Text); academic.Grade = txtSSCGrade.Text; academic.MajorSubject = txtSSCDestinction.Text; academic.Save(); if (DropDownInter.SelectedValue != "-1") { TblStudentAcademicRecord interacademic; if (dt.Rows.Count == 0) { interacademic = new TblStudentAcademicRecord(); interacademic.IsNew = true; } else { interacademic = new TblStudentAcademicRecord(dt.Rows[1]["ARecordID"]); interacademic.IsNew = false; } interacademic.StudentID = student.StudentID; interacademic.Degree = DropDownInter.SelectedValue; interacademic.Board = txtInterInstitue.Text; interacademic.Year = txtInterYear.Text; interacademic.RollNo = txtInterRNo.Text; interacademic.TotalMarks = Convert.ToInt32(txtInterTMarks.Text); interacademic.ObtainedMarks = Convert.ToInt32(txtInterOMarks.Text); interacademic.Grade = txtInterGrade.Text; interacademic.MajorSubject = txtInterDestinction.Text; interacademic.Save(); } } if (chkTransport.Checked) { TblTransportHolder transport; if (hdnID.Value != "") { transport = new SubSonic.Select() .From(TblTransportHolder.Schema) .Where(TblTransportHolder.Columns.MemberID).IsEqualTo(hdnID.Value) .And(TblTransportHolder.Columns.MemberType).IsEqualTo(false) .ExecuteSingle <TblTransportHolder>(); if (transport == null) { transport = new TblTransportHolder(); transport.IsNew = true; } else { transport.IsNew = false; } } else { transport = new TblTransportHolder(); transport.IsNew = true; } transport.RouteID = Convert.ToInt32(ddlRoute.SelectedValue); transport.BusID = Convert.ToInt32(ddlBus.SelectedValue); transport.MemberID = student.StudentID; transport.MemberType = false; transport.Discount = Convert.ToInt32(txtDiscount.Text); transport.SeatNo = Convert.ToInt32(txtSeatNo.Text); transport.Stop = txtBusStop.Text; transport.JoiningDate = txtTJoinDate.SelectedDate; transport.IsActive = true; transport.Save(); } if (chkHostel.Checked) { TblHostelEnrollment hostel; if (hdnID.Value != "") { hostel = new SubSonic.Select() .From(TblHostelEnrollment.Schema) .Where(TblHostelEnrollment.Columns.MemberID).IsEqualTo(hdnID.Value) .And(TblHostelEnrollment.Columns.MemberType).IsEqualTo(false) .ExecuteSingle <TblHostelEnrollment>(); if (hostel == null) { hostel = new TblHostelEnrollment(); hostel.IsNew = true; } else { hostel.IsNew = false; } } else { hostel = new TblHostelEnrollment(); hostel.IsNew = true; } hostel.MemberID = student.StudentID; hostel.MemberType = false; hostel.HostelID = Convert.ToInt32(ddlHostel.SelectedValue); hostel.HAdmissionDate = txtEnrollDate.SelectedDate; hostel.Save(); } //TblCurrentEnrollment Currenroll; //if (hdnID.Value != "") //{ // Currenroll = new SubSonic.Select() // .From(TblCurrentEnrollment.Schema) // .Where(TblCurrentEnrollment.Columns.StudentID).IsEqualTo(hdnID.Value) // .ExecuteSingle<TblCurrentEnrollment>(); // if (Currenroll == null) // { // Currenroll = new TblCurrentEnrollment(); // Currenroll.IsNew = true; // Currenroll.CreateBy = Convert.ToString(Session["BranchUserID"]); // } // else // { // Currenroll.IsNew = false; // Currenroll.UpdatedBy = Convert.ToString(Session["BranchUserID"]); // } //} //else //{ // Currenroll = new TblCurrentEnrollment(); // Currenroll.IsNew = true; // Currenroll.CreateBy = Convert.ToString(Session["BranchUserID"]); //} //Currenroll.StudentID = student.StudentID; //Currenroll.ClassNo = Convert.ToInt32(ddlClass.SelectedValue); //Currenroll.BranchID = Convert.ToInt32(Session["BranchID"]); //Currenroll.EnrollmentDate = DateTime.Now; //Currenroll.GroupID = Convert.ToInt32(ddlGroup.SelectedValue); //Currenroll.Save(); //TblEnrollmentHistory EnrollHistory; //if (hdnID.Value != "") //{ // EnrollHistory = new SubSonic.Select() // .From(TblEnrollmentHistory.Schema) // .Where(TblEnrollmentHistory.Columns.StudentID).IsEqualTo(hdnID.Value) // .And(TblEnrollmentHistory.Columns.ClassNo).IsEqualTo(ddlClass.SelectedValue) // .ExecuteSingle<TblEnrollmentHistory>(); // if (EnrollHistory == null) // { // EnrollHistory = new TblEnrollmentHistory(); // EnrollHistory.IsNew = true; // EnrollHistory.CreateBy = Convert.ToString(Session["BranchUserID"]); // } // else // { // EnrollHistory.IsNew = false; // EnrollHistory.UpdatedBy = Convert.ToString(Session["BranchUserID"]); // } //} //else //{ // EnrollHistory = new TblEnrollmentHistory(); // EnrollHistory.IsNew = true; // EnrollHistory.CreateBy = Convert.ToString(Session["BranchUserID"]); //} //EnrollHistory.StudentID = student.StudentID; //EnrollHistory.ClassNo = Convert.ToInt32(ddlClass.SelectedValue); //EnrollHistory.BranchID = Convert.ToInt32(Session["BranchID"]); //EnrollHistory.EnrollmentDate = DateTime.Now; //EnrollHistory.GroupID = Convert.ToInt32(ddlGroup.SelectedValue); //EnrollHistory.Save(); lblmsg.Text = helper.DisplayNotificationMessage(msgDiv, msg, "alert alert-success alert-icon alert-dismissible", icon, "icon mdi mdi-check"); helper.ClearInputs(this.Controls); txtDOB.SelectedDate = null; txtDOA.SelectedDate = null; // LoadTransportRecord(); // LoadHostelRecord(); lblimgName.Text = string.Empty; hdnID.Value = ""; reqFpic.Enabled = true; chkHostel.Checked = false; chkTransport.Checked = false; lblimgName.Visible = false; } }
private KcbDonthuocChitiet[] CreateArrayPresDetail() { this._temp = ActionResult.Success; int index = 0; KcbDonthuocChitiet[] chitietArray = new KcbDonthuocChitiet[this.m_dtDonthuocChitiet.DefaultView.Count]; try { foreach (DataRowView view in this.m_dtDonthuocChitiet.DefaultView) { long num2 = Utility.Int64Dbnull(view[KcbDonthuocChitiet.Columns.IdThuockho], -1); int num3 = CommonLoadDuoc.SoLuongTonTrongKho(-1L, Utility.Int32Dbnull(view[KcbDonthuocChitiet.Columns.IdKho], -1), Utility.Int16Dbnull(view[KcbDonthuocChitiet.Columns.IdThuoc], -1), Utility.Int64Dbnull(view[KcbDonthuocChitiet.Columns.IdThuockho], -1), new int?(Utility.Int32Dbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("KIEMTRATHUOC_CHOXACNHAN", "1", false), 1)), Utility.ByteDbnull(objLuotkham.Noitru, 0)); if (this.em_Action == action.Update) { int soLuong = 0; KcbDonthuocChitiet chitiet = new SubSonic.Select(new TableSchema.TableColumn[] { KcbDonthuocChitiet.SoLuongColumn }).From(KcbDonthuocChitiet.Schema).Where(KcbDonthuocChitiet.IdChitietdonthuocColumn).IsEqualTo(Utility.Int32Dbnull(view[KcbDonthuocChitiet.Columns.IdChitietdonthuoc], -1)).ExecuteSingle<KcbDonthuocChitiet>(); if (chitiet != null) { soLuong = chitiet.SoLuong; } num3 += soLuong; } if (Utility.Int32Dbnull(view[KcbDonthuocChitiet.Columns.SoLuong], 0) > num3) { Utility.ShowMsg(string.Format("Số lượng "+(KIEU_THUOC_VT == "THUOC" ?"thuốc":"vật tư")+" {0}({1}) vượt quá số lượng tồn trong kho{2}({3}) \nBạn cần chỉnh lại số lượng "+(KIEU_THUOC_VT == "THUOC" ?"thuốc":"vật tư")+"!", new object[] { Utility.sDbnull(view[DmucThuoc.Columns.TenThuoc], "").ToString(), Utility.Int32Dbnull(view[KcbDonthuocChitiet.Columns.SoLuong], 0).ToString(), Utility.sDbnull(view[TDmucKho.Columns.TenKho], "").ToString(), num3.ToString() })); this._temp = ActionResult.NotEnoughDrugInStock; return null; } chitietArray[index] = new KcbDonthuocChitiet(); chitietArray[index].IdDonthuoc = this.IdDonthuoc; chitietArray[index].IdChitietdonthuoc = Utility.Int32Dbnull(view[KcbDonthuocChitiet.Columns.IdChitietdonthuoc], -1); chitietArray[index].IdBenhnhan = new long?(this.objLuotkham.IdBenhnhan); chitietArray[index].MaLuotkham = this.objLuotkham.MaLuotkham; chitietArray[index].IdKho = new int?(Utility.Int32Dbnull(view[KcbDonthuocChitiet.Columns.IdKho], -1)); chitietArray[index].IdThuoc = Utility.Int16Dbnull(view[KcbDonthuocChitiet.Columns.IdThuoc], -1); chitietArray[index].TrangthaiThanhtoan = Utility.ByteDbnull(view[KcbDonthuocChitiet.Columns.TrangthaiThanhtoan], 0); chitietArray[index].SttIn = new short?(Utility.Int16Dbnull(view[KcbDonthuocChitiet.Columns.SttIn], 1)); chitietArray[index].TrangthaiHuy = 0; chitietArray[index].IdThuockho = new long?(num2); chitietArray[index].GiaNhap = new decimal?(Utility.DecimaltoDbnull(view[KcbDonthuocChitiet.Columns.GiaNhap], -1)); chitietArray[index].GiaBan = new decimal?(Utility.DecimaltoDbnull(view[KcbDonthuocChitiet.Columns.GiaBan], -1)); chitietArray[index].Vat = new decimal?(Utility.DecimaltoDbnull(view[KcbDonthuocChitiet.Columns.Vat], -1)); chitietArray[index].SoLo = Utility.sDbnull(view[KcbDonthuocChitiet.Columns.SoLo], -1); chitietArray[index].MaNhacungcap = Utility.sDbnull(view[KcbDonthuocChitiet.Columns.MaNhacungcap], -1); chitietArray[index].NgayHethan = Utility.ConvertDate(view["sNgayhethan"].ToString()).Date; chitietArray[index].SoluongHuy = 0; chitietArray[index].TuTuc = new byte?(Utility.ByteDbnull(view[KcbDonthuocChitiet.Columns.TuTuc], 0)); chitietArray[index].SoLuong = Utility.Int32Dbnull(view[KcbDonthuocChitiet.Columns.SoLuong], 0); chitietArray[index].DonGia = Utility.DecimaltoDbnull(view[KcbDonthuocChitiet.Columns.DonGia], 0); chitietArray[index].PhuThu = new decimal?(Utility.Int16Dbnull(view[KcbDonthuocChitiet.Columns.PhuThu], 0)); chitietArray[index].MotaThem = Utility.sDbnull(view[KcbDonthuocChitiet.Columns.MotaThem], ""); chitietArray[index].ChidanThem = Utility.sDbnull(view[KcbDonthuocChitiet.Columns.ChidanThem], ""); chitietArray[index].CachDung = Utility.sDbnull(view[KcbDonthuocChitiet.Columns.CachDung], ""); chitietArray[index].DonviTinh = Utility.sDbnull(view[KcbDonthuocChitiet.Columns.DonviTinh], ""); chitietArray[index].SolanDung = Utility.sDbnull(view[KcbDonthuocChitiet.Columns.SolanDung], null); chitietArray[index].SoluongDung = Utility.sDbnull(view[KcbDonthuocChitiet.Columns.SoluongDung], null); chitietArray[index].SluongSua = 0; chitietArray[index].SluongLinh = 0; chitietArray[index].TrangThai = 0; chitietArray[index].TrangthaiBhyt = 1; chitietArray[index].IdThanhtoan = -1; chitietArray[index].IdGoi = id_goidv; chitietArray[index].TrongGoi = trong_goi; chitietArray[index].NgayTao = new DateTime?(globalVariables.SysDate); chitietArray[index].NguoiTao = globalVariables.UserName; chitietArray[index].MaDoituongKcb = Utility.sDbnull(this.MaDoiTuong); chitietArray[index].PtramBhyt = objLuotkham.TrangthaiNoitru <= 0 ? this.objLuotkham.PtramBhyt : objLuotkham.PtramBhytGoc; chitietArray[index].PtramBhytGoc = this.objLuotkham.PtramBhytGoc; if (Utility.Int32Dbnull(view[KcbDonthuocChitiet.Columns.TuTuc], 0) == 0) { decimal BHCT = 0m; if (objLuotkham.DungTuyen == 1) { BHCT = Utility.DecimaltoDbnull(view[KcbDonthuocChitiet.Columns.DonGia], 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) / 100); } else { if (objLuotkham.TrangthaiNoitru <= 0) BHCT = Utility.DecimaltoDbnull(view[KcbDonthuocChitiet.Columns.DonGia], 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) / 100); else//Nội trú cần tính=đơn giá * % đầu thẻ * % tuyến BHCT = Utility.DecimaltoDbnull(view[KcbDonthuocChitiet.Columns.DonGia], 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhytGoc, 0) / 100) * (BHYT_PTRAM_TRAITUYENNOITRU / 100); } //decimal num5 = (Utility.DecimaltoDbnull(view[KcbDonthuocChitiet.Columns.DonGia], 0) * Utility.DecimaltoDbnull(this.objLuotkham.PtramBhyt, 0)) / 100M; decimal num6 = Utility.DecimaltoDbnull(view[KcbDonthuocChitiet.Columns.DonGia], 0) - BHCT; chitietArray[index].BhytChitra = new decimal?(BHCT); chitietArray[index].BnhanChitra = new decimal?(num6); } else//BHYT Tự túc { chitietArray[index].BhytChitra = 0; chitietArray[index].BnhanChitra = new decimal?(Utility.DecimaltoDbnull(view[KcbDonthuocChitiet.Columns.DonGia], 0)); chitietArray[index].PtramBhyt = 0; } if (this.objLuotkham.MaDoituongKcb == "BHYT") { } index++; } } catch (Exception) { } return chitietArray; }
/// <summary> /// return next available ordernumber based on officeid /// </summary> /// <param name="officeid"></param> /// <returns></returns> public static int next_order_number(int officeid) { int _nextorderno = 0; int _maxorderno = 0; switch (officeid) { case 1: //uk office { _maxorderno = new SubSonic.Select(Aggregate.Max(OrderNumberTable.OrderNumberColumn)). From(DAL.Logistics.Tables.OrderNumberTable).ExecuteScalar <int>(); break; } case 2: //hong kong office { _maxorderno = new SubSonic.Select(Aggregate.Max(Hkont.OrderNumberColumn)). From(DAL.Logistics.Tables.Hkont).ExecuteScalar <int>(); break; } case 3: //singapore office { _maxorderno = new SubSonic.Select(Aggregate.Max(Sgont.OrderNumberColumn)). From(DAL.Logistics.Tables.Sgont).ExecuteScalar <int>(); break; } case 4: //australia order { _maxorderno = new SubSonic.Select(Aggregate.Max(Aont.OrderNumberColumn)). From(DAL.Logistics.Tables.Aont).ExecuteScalar <int>(); break; } case 5: //italy order { _maxorderno = new SubSonic.Select(Aggregate.Max(Itont.OrderNumberColumn)). From(DAL.Logistics.Tables.Itont).ExecuteScalar <int>(); break; } case 6: //us order { _maxorderno = new SubSonic.Select(Aggregate.Max(Usont.OrderNumberColumn)). From(DAL.Logistics.Tables.Usont).ExecuteScalar <int>(); break; } case 7: //netherlands order { _maxorderno = new SubSonic.Select(Aggregate.Max(Nlont.OrderNumberColumn)). From(DAL.Logistics.Tables.Nlont).ExecuteScalar <int>(); break; } case 9: //germany order { _maxorderno = new SubSonic.Select(Aggregate.Max(Deont.OrderNumberColumn)). From(DAL.Logistics.Tables.Deont).ExecuteScalar <int>(); break; } case 10: //thailand order { _maxorderno = new SubSonic.Select(Aggregate.Max(Thont.OrderNumberColumn)). From(DAL.Logistics.Tables.Thont).ExecuteScalar <int>(); break; } case 13: //brazil order { _maxorderno = new SubSonic.Select(Aggregate.Max(Bront.OrderNumberColumn)). From(DAL.Logistics.Tables.Bront).ExecuteScalar <int>(); break; } default: { _maxorderno = -1; break; } }//end switch _nextorderno = _maxorderno + 1; //get next available number or return 0 if not found return(_nextorderno); }