Beispiel #1
0
        // tìm sách theo ID
        void getBookByID()
        {
            try
            {
                SqlConnection con = new SqlConnection(strcon);
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                }
                SqlCommand cmd = new SqlCommand("SELECT * from book_master_tbl WHERE book_id='" + TextBox7.Text.Trim() + "';", con);

                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                if (dt.Rows.Count >= 1)
                {
                    TextBox8.Text = dt.Rows[0]["book_name"].ToString();
                    TextBox4.Text = dt.Rows[0]["publisher_date"].ToString();
                    TextBox3.Text = dt.Rows[0]["edition"].ToString();
                    TextBox6.Text = dt.Rows[0]["cost"].ToString().Trim();
                    TextBox9.Text = dt.Rows[0]["pages"].ToString().Trim();
                    TextBox1.Text = dt.Rows[0]["actual_stock"].ToString().Trim();
                    TextBox2.Text = dt.Rows[0]["current_stock"].ToString().Trim();

                    TextBox5.Text = "" + (Convert.ToInt32(dt.Rows[0]["actual_stock"].ToString()) - Convert.ToInt32(dt.Rows[0]["current_stock"].ToString()));

                    TextBox10.Text = dt.Rows[0]["book_description"].ToString();

                    DropDownList1.SelectedValue = dt.Rows[0]["language"].ToString().Trim();
                    DropDownList2.SelectedValue = dt.Rows[0]["publisher_name"].ToString().Trim();
                    DropDownList3.SelectedValue = dt.Rows[0]["author_name"].ToString().Trim();

                    ListBox1.ClearSelection();
                    string[] genre = dt.Rows[0]["genre"].ToString().Trim().Split(',');
                    for (int i = 0; i < genre.Length; i++)
                    {
                        for (int j = 0; j < ListBox1.Items.Count; j++)
                        {
                            if (ListBox1.Items[j].ToString() == genre[i])
                            {
                                ListBox1.Items[j].Selected = true;
                            }
                        }
                    }

                    global_actual_stock  = Convert.ToInt32(dt.Rows[0]["actual_stock"].ToString().Trim());
                    global_current_stock = Convert.ToInt32(dt.Rows[0]["current_stock"].ToString().Trim());
                    global_issued_books  = global_actual_stock - global_current_stock;
                    global_filepath      = dt.Rows[0]["book_img_link"].ToString();
                }
                else
                {
                    Response.Write("<script>alert('Mã sách không tồn tại!');</script>");
                }
            }
            catch (Exception ex)
            {
                Response.Write("<script>alert('" + ex.Message + "');</script>");
            }
        }
Beispiel #2
0
    protected void LoadScheduleBList()
    {
        string sqlTxt = "";

        FreightEasy.DataManager.FreightEasyData feData = new FreightEasy.DataManager.FreightEasyData();

        if (hOrgID.Value == "" || hOrgID.Value == "0")
        {
            sqlTxt = "SELECT auto_uid AS sb_id,[description] FROM scheduleB WHERE elt_account_number="
                     + elt_account_number + " ORDER BY [description]";
        }
        else
        {
            sqlTxt = "IF EXISTS (SELECT * FROM ig_schedule_b WHERE elt_account_number="
                     + elt_account_number + " AND org_account_number=" + hOrgID.Value + ")\n"
                     + "SELECT sb_id,[description],org_account_number FROM ig_schedule_b WHERE elt_account_number="
                     + elt_account_number + " AND org_account_number=" + hOrgID.Value + " ORDER BY [description]\n"
                     + "ELSE\n"
                     + "SELECT auto_uid AS sb_id,[description] FROM scheduleB WHERE elt_account_number=" + elt_account_number + " ORDER BY [description]";
        }

        feData.AddToDataSet("ScheduleB", sqlTxt);
        ListBox1.DataSource     = feData.Tables["ScheduleB"];
        ListBox1.DataTextField  = "description";
        ListBox1.DataValueField = "sb_id";
        ListBox1.DataBind();
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                if (Session["Usuario"] != null)
                {
                    //List<Prestamo> prestamos = ((Administradora)Session["Administradora"]).prestamosxclientes(((UsuarioWeb)Session["Usuario"]).Cliente.CodigoSocio);
                    List <Reserva> reservas = ((Administradora)Session["Administradora"]).Reservaxclientes(((UsuarioWeb)Session["Usuario"]).Cliente.CodigoSocio);

                    //ListBox1.DataSource = null;
                    ListBox1.DataSource = ((Administradora)Session["Administradora"]).prestamosxclientes(((UsuarioWeb)Session["Usuario"]).Cliente.CodigoSocio);
                    ListBox1.DataBind();

                    //ListBox2.DataSource = null;
                    ListBox2.DataSource = ((Administradora)Session["Administradora"]).Reservaxclientes(((UsuarioWeb)Session["Usuario"]).Cliente.CodigoSocio);
                    ListBox2.DataBind();

                    Label1.Visible = false;
                }
                else
                {
                    TextBox1.Text = "Hola";
                }
            }
        }
Beispiel #4
0
        protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
        {
            string jgdm = TreeView1.SelectedValue;
            string sql  = $@"select RYMC from [RYXX] where JGDM = '{jgdm}'";

            string          path       = Server.MapPath("/App_Data/JGDB.accdb");
            string          ConnString = $@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source = {path};Persist Security Info=False;";
            OleDbConnection Conn       = new OleDbConnection(ConnString);

            Conn.Open();
            OleDbDataAdapter adapter = new OleDbDataAdapter();
            OleDbCommand     command = new OleDbCommand(sql, Conn);

            adapter.SelectCommand = command;
            DataTable Dt = new DataTable();

            adapter.Fill(Dt);
            Conn.Close();

            DataView view = new DataView(Dt);

            ListBox1.DataSource     = Dt;
            ListBox1.DataTextField  = "RYMC";
            ListBox1.DataValueField = "RYMC";
            ListBox1.DataBind();
        }
Beispiel #5
0
        public void makeListThing(string tbl, string column)
        {
            //DataTable things = new DataTable();

            MySqlConnection contable = new MySqlConnection("server=localhost;user id=root;persistsecurityinfo=True;database=chartofaccounts;password=andy");

            contable.Open();

            //MySqlCommand cmdtable = new MySqlCommand("select `" + column + "` from chartofaccounts." + tbl, contable);
            MySqlCommand cmdtable = new MySqlCommand("select * from chartofaccounts." + tbl, contable);

            MySqlDataAdapter adp = new MySqlDataAdapter(cmdtable);

            DataTable dt = new DataTable();

            adp.Fill(dt);

            ListBox1.DataSource = dt;
            ListBox1.DataBind();
            ListBox1.DataTextField  = column;
            ListBox1.DataValueField = column;

            //ListBox1.DataBind();

            cmdtable.Dispose();
            contable.Close();
        }
Beispiel #6
0
    public void cargadatos()
    {
        Datos conectar = new Datos();

        try
        {
            usuariolog = Convert.ToString(Session["u"]);
        }
        catch (Exception) {
            Response.Redirect("Default.aspx");
        }
        DataSet datos = new DataSet();

        if (ddlUsuario.SelectedValue != "0")
        {
            datos = conectar.cargaPermisos(usuariolog);
            ListBox1.DataSource = datos;
            ListBox1.DataBind();

            datos = conectar.cargaUPermisos(ddlUsuario.SelectedValue, usuariolog);
            ListBox2.DataSource = datos;
            ListBox2.DataBind();
        }
        else
        {
            ListBox1.Items.Clear();
            ListBox2.Items.Clear();
        }
    }
Beispiel #7
0
        /************************* ปุ่มเช็คชื่อ ******************************/
        private void button1_Click(object sender, EventArgs e)
        {
            if (comboBox1.SelectedItem != null && (ListBox1.GetItemCheckState(0) == CheckState.Checked ||
                                                   ListBox1.GetItemCheckState(1) == CheckState.Checked || ListBox1.GetItemCheckState(2) == CheckState.Checked ||
                                                   ListBox1.GetItemCheckState(3) == CheckState.Checked || ListBox1.GetItemCheckState(4) == CheckState.Checked ||
                                                   ListBox1.GetItemCheckState(5) == CheckState.Checked || ListBox1.GetItemCheckState(6) == CheckState.Checked ||
                                                   ListBox1.GetItemCheckState(7) == CheckState.Checked || ListBox1.GetItemCheckState(8) == CheckState.Checked ||
                                                   ListBox1.GetItemCheckState(9) == CheckState.Checked || ListBox1.GetItemCheckState(10) == CheckState.Checked))
            {
                /* val_date และ val_date_check เป็นตัวแปรแบบโกลบอลเพื่อนำไปใช้ในฟอมอื่น
                 * val_date คือ วัน_เดือน_ปี
                 * val_date_check คือ วัน/เดือน/ปี ชัวโมงนาที-ชั่วโมงนาที */
                val_date = dateTimePicker1.Value.Day.ToString() + "_" + dateTimePicker1.Value.Month.ToString()
                           + "_" + dateTimePicker1.Value.Year.ToString();

                val_date_check = dateTimePicker1.Value.Day.ToString()
                                 + "/" + dateTimePicker1.Value.Month.ToString() + "/" + dateTimePicker1.Value.Year.ToString()
                                 + " " + period();
                // เรียกใช้ เมธอด period เพราะต้องการให้ตัวแปร time_etc เก็บค่าเวลา เพื่อนำไปใช้ใน form อื่นๆ
                period();
                val_class = comboBox1.Text;
                Form2 form2 = new Form2();
                form2.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("กรุณาเลิอกข้อมูลให้ครบ");
            }
        }
Beispiel #8
0
        private void FadeInEffect(object sender, EventArgs e)
        {
            this.Refresh();
            FadeIn(this, 1);

            ListBox1.Focus();
        }
Beispiel #9
0
        private void ListBox1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
        {
            if (ListBox1.Items.Count > 0)
            {
                e.DrawBackground();

                if ((e.Index % 2) == 1)
                {
                    e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(255, 255, 255)), e.Bounds);
                }
                else
                {
                    e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(245, 245, 245)), e.Bounds);
                }

                if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
                {
                    e.Graphics.FillRectangle(HighlightBrush, e.Bounds);
                }


                using (SolidBrush b = new SolidBrush(e.ForeColor))
                {
                    e.Graphics.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias;
                    e.Graphics.DrawString(ListBox1.GetItemText(ListBox1.Items(e.Index)), e.Font, b, e.Bounds.Left + dpicalc(this, 20), ((e.Bounds.Height - ListBox1.Font.Height) / 2) + e.Bounds.Top);
                }
                e.DrawFocusRectangle();
            }
        }
Beispiel #10
0
    private void InitPage()
    {
        _sqldt = HtnData.Query("SELECT * FROM HTN_SQL");
        ListBox1.DataSource    = _sqldt;
        ListBox1.DataTextField = "SQLKEY";
        ListBox1.DataBind();
        ListBox1.AutoPostBack = true;

        List <ListItem> _source = new List <ListItem>();

        _source.Add(new ListItem()
        {
            Text = "服务", Value = "服务"
        });
        _source.Add(new ListItem()
        {
            Text = "应用", Value = "应用"
        });
        DropDownList1.DataSource = _source;
        DropDownList1.DataBind();

        if (_sqldt != null && _sqldt.Rows.Count > 0)
        {
            SelectItem(_sqldt.Rows[0]);
        }
    }
Beispiel #11
0
    private void MyDataBind()
    {
        using (SqlConnection conn = new DB().GetConnection())
        {
            SqlCommand cmd = conn.CreateCommand();
            cmd.CommandText = "select * from  [ArticleTags] where ID  not in (" + Label3.Text + ") order by ID asc ";
            conn.Open();
            SqlDataReader rd = cmd.ExecuteReader();
            TagsList.DataSource     = rd;
            TagsList.DataTextField  = "TagName";
            TagsList.DataValueField = "ID";
            TagsList.DataBind();
            rd.Close();



            cmd.CommandText = "select * from [Articles_ArticleTags] where ArticleID = @ArticleID";
            cmd.Parameters.AddWithValue("@ArticleID", IDLabel.Text);
            SqlDataReader rd1 = cmd.ExecuteReader();
            ListBox1.DataSource     = rd1;
            ListBox1.DataTextField  = "ArticleTagName";
            ListBox1.DataValueField = "ArticleTagID";
            ListBox1.DataBind();
            rd1.Close();
        }
    }
Beispiel #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                sum = getSum();
                myArray.Add("春天:Spring");
                myArray.Add("夏天:Summer");
                myArray.Add("秋天:Autumn");
                myArray.Add("冬天:Winter");
                DropDownList1.DataSource = myArray;
                DropDownList1.DataBind();
                DataGrid1.DataBind();

                string        constr = "Data Source=192.168.50.4;Initial Catalog=SBSPMS;Persist Security Info=True;User ID=sa;Password=123456";
                string        str    = "select * from BookInfo";
                SqlConnection con    = new SqlConnection(constr);
                con.Open();
                SqlDataAdapter sda = new SqlDataAdapter(str, con);
                DataSet        ds  = new DataSet();
                sda.Fill(ds, "BookInfo");
                ListBox1.DataSource     = ds.Tables["BookInfo"];
                ListBox1.DataTextField  = "Name";
                ListBox1.DataValueField = "ID";
                ListBox1.DataBind();
                con.Close();
            }
            //Page.DataBind();
        }
Beispiel #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        WebUtility.ShowClientConfirm("Message", "Detailfdsafdsafsdafdsaf\nfdsafdsafsdafsdaf\nfdsafdsafdsafsdafsad", "titleOK",
                                     "OK", "cancel", null, "onCancel");
        wf.Width  = 500;
        wf.Height = 700;
        wf.Center = true;
        WebUtility.AdjustWindow(wf);

        String cbReference =
            Page.ClientScript.GetCallbackEventReference(this,
                                                        "arg", "ReceiveServerData", "context");
        String callbackScript;

        callbackScript = "function CallServer(arg, context)" +
                         "{ " + cbReference + ";}";
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(),
                                                    "CallServer", callbackScript, true);

        catalog = new System.Collections.Specialized.ListDictionary();
        catalog.Add("monitor", 12);
        catalog.Add("laptop", 10);
        catalog.Add("keyboard", 23);
        catalog.Add("mouse", 17);

        ListBox1.DataSource    = catalog;
        ListBox1.DataTextField = "key";
        ListBox1.DataBind();
    }
Beispiel #14
0
        private void ButtonUbaci_Click(object sender, RoutedEventArgs e)
        {
            WindowFilmPromena w1 = new WindowFilmPromena();

            w1.Title = "Ubaci podatke o filmu";
            w1.Owner = this;
            if (w1.ShowDialog() == true)
            {
                Film f = w1.Film;

                int id = fDal.UbaciFilm(f);

                if (id != -1)
                {
                    PrikaziFilmove();
                    int indeks = listaFilmova.FindIndex(c1 => c1.FilmId == id);
                    ListBox1.SelectedIndex = indeks;
                    ListBox1.ScrollIntoView(ListBox1.Items[indeks]);
                    MessageBox.Show("Ubacen novi film");
                }
                else
                {
                    MessageBox.Show("Greska pri unosu filma");
                }
            }
        }
Beispiel #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        String cbReference = Page.ClientScript.GetCallbackEventReference
                             (
            this,
            "arg",
            "ReceiveServerData",
            "context"
                             );

        String callbackScript;

        callbackScript = "function CallServer(arg, context)" + "{ " + cbReference + "} ;";
        Page.ClientScript.RegisterClientScriptBlock
        (
            this.GetType(),
            "CallServer",
            callbackScript,
            true
        );

        catalog = new System.Collections.Specialized.ListDictionary();
        catalog.Add("monitor", 12);
        catalog.Add("laptop", 10);
        catalog.Add("keyboard", 23);
        catalog.Add("mouse", 17);

        //ListBox1.Items[].Value

        ListBox1.DataSource    = catalog;
        ListBox1.DataTextField = "key";
        ListBox1.DataBind();
    }
        protected void bottonClickAction(object sender, EventArgs e)
        {
            Button button     = sender as Button;
            string buttonName = button.ID;

            Icommand      command = CommandFactory.CreateCommand(buttonName);
            CommandArg    cmdArg  = new CommandArg();
            CommandResult results = null;

            cmdArg.Value   = txtNameValuePair.Text;
            cmdArg.ListBox = ListBox1;
            if (command != null)
            {
                results = command.Execute(cmdArg);
                if (results.ErrorMessage == "")
                {
                    ListBox1.DataSource = results.NvCollection;
                    ListBox1.DataBind();
                    errorLabel.Text = "";
                }
                else
                {
                    errorLabel.Text      = results.ErrorMessage;
                    errorLabel.ForeColor = System.Drawing.Color.Red;
                    errorLabel.Font.Size = FontUnit.Larger;
                }
            }
        }
Beispiel #17
0
        protected void SeleccionarEquipoTrabajoAcreditador(int codigoProyecto, bool selectTeam = true)
        {
            bool seleccionoAlguien = false;
            var  equipoTrabajo     = Negocio.PlanDeNegocioV2.Utilidad.ProyectoGeneral.GetEquipoTrabajo(codigoProyecto);

            ListBox1.ClearSelection();

            foreach (Int32 integrante in equipoTrabajo)
            {
                var contacto = ListBox1.Items.FindByValue(integrante.ToString());

                if (contacto != null)
                {
                    contacto.Selected = selectTeam;
                    seleccionoAlguien = true;
                }
            }

            if (selectTeam && seleccionoAlguien)
            {
                PlanDeNegocioV2.Formulacion.Utilidad.Utilidades.PresentarMsj("Se seleccionó el emprendedor del proyecto.", this, "Alert");
            }
            else
            {
                PlanDeNegocioV2.Formulacion.Utilidad.Utilidades.PresentarMsj("El proyecto no cuenta con emprendedores activos.", this, "Alert");
            }
        }
Beispiel #18
0
        protected void CheckAndUpdateStatus(object sender, FormViewUpdatedEventArgs e)
        {
            if (e.AffectedRows > 0)
            {
                lblmsg.Text = "Applocation ID number " + Convert.ToInt32(FormView1.DataKey.Value).ToString() + " has been supervised successfully.";
                ListBox1.DataBind();
            }
            Class1 cs = new Class1();
            Int32  intLevelID;

            intLevelID = Convert.ToInt32(cs.getAnyFieldFromView(Session["UserID"].ToString(), "LevelID"));
            //Check the total remaning supervision and check the last supervisor
            if (cs.checkIsLastSupervisor(Convert.ToInt32(FormView1.DataKey.Value)))
            {
                SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings["strConn"].ToString());
                Conn.Open();
                SqlCommand cmd = new SqlCommand("UPDATE Application SET AppLevel = 98, IsSupComplete = 1 where AppID =" + Convert.ToInt32(FormView1.DataKey.Value), Conn);
                cmd.ExecuteNonQuery();
                lblmsg.ForeColor = System.Drawing.Color.Green;
            }

            else
            {
                if (Convert.ToBoolean(cs.checkOneLevelComplete(Convert.ToInt32(FormView1.DataKey.Value), intLevelID)))
                {
                    SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings["strConn"].ToString());
                    Conn.Open();
                    SqlCommand cmd = new SqlCommand("UPDATE Application SET AppLevel = " + intLevelID + " where AppID =" + Convert.ToInt32(FormView1.DataKey.Value), Conn);
                    cmd.ExecuteNonQuery();
                    lblmsg.ForeColor = System.Drawing.Color.Green;
                }
            }
        }
Beispiel #19
0
    /// <summary>
    /// 浏览状态绑定货位1
    /// </summary>
    /// <param name="strWhere">查询条件,用于得到原始单号和仓库号</param>
    private void BindHW1(string PDDH)
    {
        try
        {
            DataSet dsPDD = PDParam.GetList("PDDH = '" + PDDH + "'");
            if (dsPDD == null || dsPDD.Tables[0].Rows.Count < 1)
            {
                this.PrintfError("盘点单号不存在!");
                return;
            }
            string YSDH = dsPDD.Tables[0].Rows[0]["YSDH"].ToString();
            string CK   = dsPDD.Tables[0].Rows[0]["CK"].ToString();

            DataSet dsHW1 = PDParam.getHW1DS(YSDH, CK);

            ListBox1.DataSource     = dsHW1;
            ListBox1.DataTextField  = "HW";
            ListBox1.DataValueField = "HW";

            ListBox1.DataBind();
        }
        catch
        {
            this.PrintfError("绑定未分配货位时出现错误,请重试");
            return;
        }
    }
        protected void Button5_Click(object sender, EventArgs e)
        {
            ListItem itm = ListBox2.SelectedItem;

            Label4.Text = " ";


            KeyValuePair <int, int> r = lst1.SingleOrDefault(x => x.Key == Convert.ToInt32(itm.Value));

            //Label3.Text = r.Key.ToString();
            ProductService.IproductsClient client = new ProductService.IproductsClient();

            ProductService.Product p = client.GetProduct(Convert.ToInt32(itm.Value));
            total      -= r.Value * p.ProductPrice;
            Label5.Text = total.ToString();
            lst1.Remove(r);
            Label4.Text = "";
            foreach (var element in lst1)
            {
                Label4.Text += element;
            }
            ListBox2.Items.Remove(ListBox2.SelectedItem);
            ListBox1.Items.Add(itm);
            ListBox1.ClearSelection();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Button2.Visible = false;
            DateTime dNow = DateTime.Now;


            TextBox1.Text = (dNow.ToString("MM/dd/yyyy"));


            txtReqId.Text   = Request.QueryString["val"];
            txtReqDate.Text = Request.QueryString["val2"];
            txtapprove.Text = Request.QueryString["val5"];

            if (!this.IsPostBack)
            {
                // MySql.Data.MySqlClient.MySqlCommand cmd;
                conn = new MySql.Data.MySqlClient.MySqlConnection(ConnString);
                conn.Open();

                string query = "SELECT item_name,itemid FROM procurement.item where reqid ='" + txtReqId.Text + "' ";
                cmd = new MySql.Data.MySqlClient.MySqlCommand(query, conn);
                ListBox1.DataSource     = cmd.ExecuteReader();
                ListBox1.DataTextField  = "item_name";
                ListBox1.DataValueField = "itemid";
                ListBox1.DataBind();


                conn.Close();
            }
        }
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        string category          = DropDownList1.SelectedValue;
        string connection_string = @"Data Source=(localdb)\mssqllocaldb;Initial Catalog=test;Integrated Security=True;Pooling=False";

        string query = "SELECT name,age from Legends WHERE category='" + category + "'";

        SqlConnection con = new SqlConnection(connection_string);

        SqlCommand cmd = new SqlCommand(query, con);



        try
        {
            con.Open();

            ListBox1.DataSource     = cmd.ExecuteReader();
            ListBox1.DataTextField  = "name";
            ListBox1.DataValueField = "age";
            ListBox1.DataBind();
        }
        catch (Exception err)
        {
        }
        finally
        {
            con.Close();
        }

        ListBox1.SelectedIndex = -1;
    }
Beispiel #23
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        conexao.Open();
        string        comando        = "SELECT codPaciente FROM Consulta WHERE id = '" + idConsulta + "'";
        SqlCommand    comandoUsuario = new SqlCommand(comando, conexao);
        SqlDataReader drUsuario      = comandoUsuario.ExecuteReader();

        drUsuario.Read();
        int user = Convert.ToInt32(drUsuario["codPaciente"]);

        drUsuario.Close();
        comandoUsuario.Dispose();

        string desc = txtDescricao.Text;

        comando = "INSERT INTO exame VALUES (@codPaciente, @desc, NULL)";
        SqlCommand cmd = new SqlCommand(comando, conexao);

        cmd.Parameters.AddWithValue("codPaciente", user);
        cmd.Parameters.AddWithValue("codConsulta", idConsulta);
        cmd.Parameters.AddWithValue("desc", desc);
        cmd.ExecuteNonQuery();
        cmd.Dispose();

        conexao.Close();
        ListBox1.DataBind();
    }
Beispiel #24
0
        private DataSet fillEntities()
        {
            string mgrId = Session["uid"].ToString();

            string        levelId = Session["levelId"].ToString();
            SqlConnection con     = new SqlConnection(m_connectons);

            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }

            SqlCommand cmd = new SqlCommand("USP_GET_EMPDETAILS_ROLEWISE", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@EmployeeCode", mgrId);
            SqlDataAdapter adpt        = new SqlDataAdapter(cmd);
            DataSet        thisDataSet = new DataSet();

            adpt.Fill(thisDataSet);
            ListBox1.DataValueField = "EOD_EMPID";
            ListBox1.DataTextField  = "EmployeeName";
            ListBox1.DataSource     = thisDataSet.Tables[0];
            ListBox1.DataBind();
            return(thisDataSet);
        }
Beispiel #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int numAlumnos    = (int)Application.Get("Alumno");
            int numProfesores = (int)Application.Get("Profesor");

            Label1.Text = "Numero de usuarios conectados- Alumno\\s: " + Convert.ToString(numAlumnos) + " Profe\\s: " + Convert.ToString(numProfesores);
            string    arrProfesor   = "ArrayProfesor";
            string    arrAlumnos    = "ArrayAlumno";
            ArrayList arrayProfesor = (ArrayList)Application.Contents[arrProfesor];

            ListBox1.Items.Clear();
            foreach (string a in arrayProfesor)
            {
                ListBox1.Items.Add(a);
            }
            ListBox1.DataBind();
            ArrayList arrayAlumnos = (ArrayList)Application.Contents[arrAlumnos];

            ListBox2.Items.Clear();
            foreach (string a in arrayAlumnos)
            {
                ListBox2.Items.Add(a);
            }
            ListBox2.DataBind();
        }
Beispiel #26
0
        private void LoadListValues()
        {
            string strSQLtoLoadusers;
            string intValue;
            Class1 objGloble = new Class1();

            intValue = "True";

            if ((intValue == "False"))
            {
                strSQLtoLoadusers = "SELECT UserID, UserName FROM UserManager WHERE     (NOT (UserID = '" + Session["UserID"] + "')) ORDER BY UserName";
            }
            else
            {
                strSQLtoLoadusers = "SELECT UserID, UserName FROM UserManager ORDER BY UserName";
            }
            SqlConnection  Conn           = new SqlConnection(ConfigurationManager.ConnectionStrings["strConn"].ToString());
            SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(strSQLtoLoadusers, Conn);
            DataSet        DSUsers        = new DataSet();

            sqlDataAdapter.Fill(DSUsers, "UserManager");
            ListBox1.DataSource     = DSUsers;
            ListBox1.DataMember     = "UserManager";
            ListBox1.DataTextField  = "UserName";
            ListBox1.DataValueField = "UserID";
            ListBox1.DataBind();
        }
Beispiel #27
0
        private void LoadListValues()
        {
            string strSQLtoLoadusers = null;
            string struserid         = Session["UserID"].ToString();
            string intValue          = null;
            Class1 objGloble         = new Class1();

            intValue = objGloble.CheckUserIDRightsForIT(struserid, "Admin");

            if (intValue == "False")
            {
                strSQLtoLoadusers = "SELECT     '0 - ALL' AS UserID, ' Assign Rights to All' UserName  FROM         UserManager  UNION   SELECT UserID, UserName FROM UserManager WHERE     (NOT (UserID = '" + Session["UserID"] + "')) ORDER BY UserName";
            }
            else
            {
                strSQLtoLoadusers = "SELECT     '0 - ALL' AS UserID, ' Assign Rights to All' UserName  FROM         UserManager  UNION   SELECT UserID, UserName FROM UserManager ORDER BY UserName";
            }

            SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings["strConn"].ToString());


            SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(strSQLtoLoadusers, Conn);
            DataSet        DSUsers        = new DataSet();

            sqlDataAdapter.Fill(DSUsers, "UserManage");
            ListBox1.DataSource     = DSUsers;
            ListBox1.DataMember     = "UserManage";
            ListBox1.DataTextField  = "UserName";
            ListBox1.DataValueField = "UserID";
            ListBox1.DataBind();
        }
 protected void Button2_Click(object sender, EventArgs e)
 {
     try
     {
         ListBox1.DataSource = null;
         baglanti.Open();
         SqlCommand     komut   = new SqlCommand("select TC,tarih from Recete where TC=" + TextBox3.Text, baglanti);
         SqlDataAdapter adaptor = new SqlDataAdapter(komut);
         DataSet        DS      = new DataSet();
         adaptor.Fill(DS);
         baglanti.Close();
         ListBox1.DataSource    = DS.Tables[0];
         ListBox1.DataTextField = "tarih";
         ListBox1.DataBind();
         if (ListBox1.Items.Count > 0)
         {
             Session["HastaTC"] = TextBox3.Text;
         }
         else
         {
             Response.Write("Girdiğiniz TC ye ait hastanın reçetesi bulunmamaktadır !");
         }
     }
     catch (Exception)
     {
         Response.Write("TC 11 haneli olmalıdır !");
     }
 }
Beispiel #29
0
        //user defined function
        //adaugam o noua rezervare

        void addNewRezervation()
        {
            try
            {
                //cream un obiect con , cu parametrul strcon

                SqlConnection con = new SqlConnection(strcon);
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                }

                string Scaun = " ";
                int    count = 0;
                foreach (int i in ListBox1.GetSelectedIndices()) //doar indicii selectati sunt retinuri
                {
                    count = count + 1;
                    Scaun = Scaun + ListBox1.Items[i] + ",";
                }

                Scaun = Scaun.Remove(Scaun.Length - 1); //remove comma from end


                SqlCommand cmd = new SqlCommand("INSERT INTO Rezervare (UserID, Username, NumarRezervare,  NumarBilete) SELECT UserID, @Username,  @NumarRezervare,  @NumarBilete FROM [User]  WHERE Username =  @Username ", con);

                SqlCommand cmd1 = new SqlCommand("INSERT INTO Bilet(FilmID, RezervareID, NumarScaun) VALUES((SELECT FilmID FROM Film  WHERE TitluFilm = '" + TextBox4.Text.Trim() + "') , (SELECT RezervareID FROM Rezervare WHERE NumarRezervare =  '" + TextBox1.Text.Trim() + "'), @NumarScaun)", con);


                cmd.Parameters.AddWithValue("@Username", TextBox3.Text.Trim());
                cmd.Parameters.AddWithValue("@NumarRezervare", TextBox1.Text.Trim());
                cmd.Parameters.AddWithValue("@NumarBilete", count);
                cmd1.Parameters.AddWithValue("@NumarScaun", Scaun);

                cmd.ExecuteNonQuery();  //fire the query
                cmd1.ExecuteNonQuery(); //fire the query
                ;

                if (CheckBox1.Checked)
                {
                    SqlCommand cmd3 = new SqlCommand("INSERT INTO Plata(RezervareID, Platit) VALUES((SELECT RezervareID FROM Rezervare WHERE NumarRezervare =  '" + TextBox1.Text.Trim() + "'), 'DA')", con);
                    cmd3.ExecuteNonQuery();
                }
                else
                {
                    SqlCommand cmd3 = new SqlCommand("INSERT INTO Plata(RezervareID, Platit) VALUES((SELECT RezervareID FROM Rezervare WHERE NumarRezervare =  '" + TextBox1.Text.Trim() + "'), 'NU')", con);
                    cmd3.ExecuteNonQuery();
                }


                con.Close();
                Response.Write("<script>alert('Rezervare adaugata. ');</script>");
                clearForm();
                GridView1.DataBind(); // se da refresh automat la tabel
                //  GridView2.DataBind(); // se da refresh automat la tabel
            }
            catch (Exception ex)
            {
                Response.Write("<script>alert('" + ex.Message + "');</script>");
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection("Data Source= .\\sql19; Initial Catalog = ComputerStore; Persist Security Info = True; User ID = ProjectUser; Password = 123");
            String        sql;

            sql = "SELECT * FROM product where name ='" + TextBox2.Text + "' ";
            SqlCommand comm = new SqlCommand(sql, conn);

            conn.Open();
            SqlDataReader reader = comm.ExecuteReader();


            if (reader.Read())
            {
                TextBox1.Text          = Convert.ToString((int)reader["Id"]);
                TextBox3.Text          = Convert.ToString((int)reader["price"]);
                TextBox4.Text          = Convert.ToString((int)reader["quantity"]);
                RadioButton2.Checked   = (Boolean)reader["NoDiscount"];
                RadioButton1.Checked   = (Boolean)reader["WithDiscount"];
                ListBox1.SelectedValue = (string)reader["category"];
                Label1.Visible         = true;
                Label1.Text            = "Item Selected";
            }
            else
            {
                TextBox1.Text = "";
                TextBox2.Text = "";
                TextBox3.Text = "";
                TextBox4.Text = "";
                ListBox1.ClearSelection();
                Label1.Visible = true;
                Label1.Text    = "This name doesn't exist";
            }
            reader.Close();
        }