Beispiel #1
0
        public async Task <ActionResult> conn()
        {
            List <String> con = null;
            String        id  = Request.Form["value"];
            conn          c   = new conn();

            if (id != null)
            {
                var x = c.Fetch_Data(id);
                con = await x;
            }
            if (con != null)
            {
                ViewBag.newData  = con;
                ViewBag.score    = con[0] + "%";
                ViewBag.sad      = con[1] + "%";
                ViewBag.joy      = con[2] + "%";
                ViewBag.fear     = con[3] + "%";
                ViewBag.disgust  = con[4] + "%";
                ViewBag.anger    = con[5] + "%";
                ViewBag.positive = con[6];
                ViewBag.negative = con[7];
                ViewBag.neutral  = con[8];
            }

            return(View());
        }
        private void btnEdit_Click(object sender, System.EventArgs e)
        {
            if (txtcid.Text == "")
            {
                MessageBox.Show("Ensure all fieds are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtcid.Focus();
            }
            else if (txtname.Text == "")
            {
                MessageBox.Show("Ensure all fieds are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);

                txtname.Focus();
            }
            else if (cbolname.Text == "")
            {
                MessageBox.Show("Ensure all fieds are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);

                cbolname.Focus();
            }
            else if (cboyear.Text == "")
            {
                MessageBox.Show("Ensure all fieds are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);

                cboyear.Focus();
            }
            else if (cbosem.Text == "")
            {
                MessageBox.Show("Ensure all fieds are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);

                cbosem.Focus();
            }
            else if (cbopid.Text == "")
            {
                MessageBox.Show("Ensure all fieds are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);

                cbosem.Focus();
            }
            else
            {
                conn cn = new conn();

                string query1 = "";
                query1 = "UPDATE course SET course_ID='" + txtcid.Text + "',course_Name='" + txtname.Text + "',lecturer_name='" + cbolname.Text + "',year='" + cboyear.Text + "',sem='" + cbosem.Text + "',programme_ID='" + cbopid.Text + "' WHERE course_ID='" + txtSearch.Text + "'";
                if (cn.openConnection() == true)
                {
                    MySqlCommand cmd = new MySqlCommand(query1, cn.connect);
                    cmd.ExecuteNonQuery();

                    txtcid.Text    = "";
                    txtname.Text   = "";
                    cbolname.Text  = "";
                    cboyear.Text   = "";
                    cbosem.Text    = "";
                    cbopid.Text    = "";
                    txtSearch.Text = "";
                    MessageBox.Show("Record updated!", "KUMMMS Dialog Box", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
        private void button1_Click(object sender, System.EventArgs e)
        {
            if (txtcid.Text == "")
            {
                MessageBox.Show("Ensure all fieds are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtcid.Focus();
            }
            else if (txtname.Text == "")
            {
                MessageBox.Show("Ensure all fieds are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);

                txtname.Focus();
            }
            else if (cbolname.Text == "")
            {
                MessageBox.Show("Ensure all fieds are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);

                cbolname.Focus();
            }
            else if (cboyear.Text == "")
            {
                MessageBox.Show("Ensure all fieds are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);

                cboyear.Focus();
            }
            else if (cbosem.Text == "")
            {
                MessageBox.Show("Ensure all fieds are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);

                cbosem.Focus();
            }
            else if (cbopid.Text == "")
            {
                MessageBox.Show("Ensure all fieds are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);

                cbosem.Focus();
            }
            else
            {
                conn   cn     = new conn();
                string query1 = "";
                query1 = "DELETE FROM course WHERE course_ID='" + txtSearch.Text + "'";
                if (cn.openConnection() == true)
                {
                    MySqlCommand cmd = new MySqlCommand(query1, cn.connect);
                    cmd.ExecuteNonQuery();

                    txtcid.Text   = "";
                    txtname.Text  = "";
                    cbolname.Text = "";
                    cboyear.Text  = "";
                    cbosem.Text   = "";
                    cbopid.Text   = "";
                    txtSearch.Focus();
                    MessageBox.Show("Record deleted!", "KUMMMS Dialog Box", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Beispiel #4
0
    public void bind()
    {
        conn    obj = new conn();
        String  sql = "SELECT * FROM staffinfo,power,state where staffinfo.Power=power.Power AND staffinfo.StateID=state.StateID and staffinfo.power>0";
        DataSet ds  = obj.GetDataSet(sql);

        Repeater.DataSource = ds;
        Repeater.DataBind();
    }
Beispiel #5
0
    }//签到绑定

    public void bindonduty()
    {
        conn    onduty = new conn();
        String  sql    = "select staffinfo.WID,Name,Tel,Email,QQ,PowerName from onduty,staffinfo,power where WorkState=21 and staffinfo.WID=onduty.WID and power.Power=staffinfo.Power";
        DataSet ds     = onduty.GetDataSet(sql);

        Repeater1.DataSource = ds;
        Repeater1.DataBind();
    }//工作人员绑定
Beispiel #6
0
    public void bind()
    {
        conn    obj = new conn();
        String  sql = "SELECT salary.SalaID, salary.Month,salary.Year,salary.Money,salary.SendWay,state.StateName,salary.SendTime,salary.GetTime,salary.Remark,SalaryTypeName FROM salary ,staffinfo ,state,salarytype WHERE staffinfo.SID =" + Session["userid"] + " AND salary.WID = staffinfo.WID AND salary.StateID=state.StateID AND salary.SalaryTypeID=salarytype.SalaryTypeID order by Month";
        DataSet ds  = obj.GetDataSet(sql);

        Repeater2.DataSource = ds;
        Repeater2.DataBind();
    }
Beispiel #7
0
    public void bindadvise()
    {
        conn    obj = new conn();
        String  sql = "select * from applyadvise ORDER BY Score DESC";
        DataSet ds  = obj.GetDataSet(sql);

        Repeater1.DataSource = ds;
        Repeater1.DataBind();
    }
Beispiel #8
0
    public void bindall()
    {
        conn    obj = new conn();
        String  sql = "SELECT Name,salary.WID,salary.SalaID, salary.Month,salary.Money,salary.SendWay,state.StateName,salary.SendTime,salary.GetTime,salary.Remark FROM salary ,staffinfo ,state WHERE  salary.WID = staffinfo.WID AND salary.StateID=state.StateID order by WID";
        DataSet ds  = obj.GetDataSet(sql);

        GridView2.DataSource = ds;
        GridView2.DataBind();
    }
Beispiel #9
0
    }//工作人员绑定

    public bool checkwork()
    {
        conn   work = new conn();
        String sql  = "select * from onduty where WorkState=21 and onduty.WID in (SELECT WID from staffinfo where SID=?userid)";

        MySqlParameter[] insertpar =
        {
            new MySqlParameter("?userid", MySqlDbType.VarChar)
        };
        insertpar[0].Value = Session["userid"];
        return(work.ReadSql(sql, insertpar));
    }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtsno.Text == "")
            {
                MessageBox.Show("Ensure all fieds are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtsno.Focus();
            }
            else if (txtreg.Text == "")
            {
                MessageBox.Show("Ensure all fieds are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);

                txtreg.Focus();
            }
            else if (txtcos.Text == "")
            {
                MessageBox.Show("Ensure all fieds are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);

                txtcos.Focus();
            }
            else if (cboyear.Text == "")
            {
                MessageBox.Show("Ensure all fieds are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);

                cboyear.Focus();
            }
            else if (cbosem.Text == "")
            {
                MessageBox.Show("Ensure all fieds are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);

                cbosem.Focus();
            }

            else
            {
                conn cn = new conn();

                string query3 = "";
                query3 = "INSERT INTO application VALUES('" + txtsno.Text + "','" + txtreg.Text + "','" + txtcos.Text + "','" + cbosem.Text + "','" + cboyear.Text + "')";
                if (cn.openConnection() == true)
                {
                    MySqlCommand cmd = new MySqlCommand(query3, cn.connect);
                    cmd.ExecuteNonQuery();

                    txtsno.Text  = "";
                    txtreg.Text  = "";
                    txtcos.Text  = "";
                    cbosem.Text  = "";
                    cboyear.Text = "";
                    txtsno.Focus();
                    MessageBox.Show("Record Saved", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
            internal proxy(string target_host, int target_port, string proxy_host, int proxy_port, ProxyType type)
            {
                Console.WriteLine("Socket allocated.");
                this.proxy_conn = new proxy.conn();
                this.proxy_conn.proxy_config(target_host, target_port, proxy_host, proxy_port, type);
                ProxyClientFactory factory = new ProxyClientFactory();

                this.proxy_conn.Proxy = factory.CreateProxyClient(type, proxy_host, proxy_port);
                this.proxy_conn.Proxy.CreateConnectionAsyncCompleted += new EventHandler <CreateConnectionAsyncCompletedEventArgs>(proxy_connected);

                //this.Proxy.CreateConnectionAsync(obj.target_host, obj.target_port);
            }
Beispiel #12
0
    protected void bind()
    {
        conn   userinfo = new conn();
        String sql      = "SELECT * from staffinfo,power,state WHERE state.StateID=staffinfo.StateID and staffinfo.Power=power.Power and staffinfo.SID =" + Session["userid"];//顺序比较重要 如果把参数放到中间 这句话将不能够执行
        //MySqlParameter[] mysp ={ new MySqlParameter ("?username",MySqlDbType.VarChar)
        //mysp[0].Value = Session["username"];
        DataSet ds = userinfo.GetDataSet(sql);

        Repeater1.DataSource = ds;
        //int num = ds.Tables["staffinfo"].Rows.Count; 可以试着判断是否只有一条满足要求的记录
        //GridView1.DataKeyNames = new string[] { "id" };//主键
        Repeater1.DataBind();
    }
Beispiel #13
0
    public void bind()
    {
        //this.DropDownList1.DataTextField = "";
        conn    time = new conn();
        String  sql  = "select * from time where TIMEDIFF(CURRENT_TIME(),Time)>0 ORDER BY TimeID DESC LIMIT 0,2";
        DataSet ds   = time.GetDataSet(sql);

        DropDownList1.DataSource          = ds;
        this.DropDownList1.SelectedIndex  = 0;
        this.DropDownList1.DataTextField  = "Time";   //dropdownlist的Text的字段
        this.DropDownList1.DataValueField = "TimeID"; //dropdownlist的Value的字段
        //DropDownList1.Items.Add(new ListItem("-=请选择=-", "0"));
        this.DropDownList1.DataBind();
    }//签到绑定
Beispiel #14
0
    public void bind()
    {
        conn   obj = new conn();
        String sql = "SELECT salary.SalaID, salary.Month,salary.Money,salary.SendWay,state.StateName,salary.SendTime,salary.GetTime,salary.Remark FROM salary ,staffinfo ,state WHERE staffinfo.SID =" + Session["userid"] + " AND salary.WID = staffinfo.WID AND salary.StateID=state.StateID order by Month";
        //MySqlParameter[] mysp ={ new MySqlParameter ("?username",MySqlDbType.VarChar)
        //                         };
        //mysp[0].Value = Session["username"];
        DataSet ds = obj.GetDataSet(sql);

        GridView1.DataSource = ds;
        //GridView1.DataKeyNames = new string[] { "id" };//主键
        GridView1.DataBind();
        //sqlcon.Close();
    }
Beispiel #15
0
    public void bindapply()
    {
        conn    obj = new conn();
        String  sql = "SELECT * FROM apply";
        DataSet ds  = obj.GetDataSet(sql);

        Repeater2.DataSource = ds;
        Repeater2.DataBind();
        String  sql3 = "select * from applyadvise ORDER BY Score DESC";
        DataSet ds3  = obj.GetDataSet(sql3);

        Repeater3.DataSource = ds3;
        Repeater3.DataBind();
    }
Beispiel #16
0
 protected void ProbarConexion(string nombre, string usuario, string contraseña)
 {
     try
     {
         //Probar si se puede conectar con usuario y contraseña ingresadas
         conn conexiontest = new conn("localhost", usuario, contraseña);
         conexiontest.TestConnection();
     }
     catch (Exception ex)
     {
         Response.StatusCode = 500;
         Response.Write(ex.Message);
         Response.End();
     }
 }
Beispiel #17
0
    public bool check()
    {
        string tel      = Request["q12"];
        conn   telcheck = new conn();

        MySqlParameter[] mysp =
        {
            new MySqlParameter("?tel", MySqlDbType.VarChar)
        };
        mysp[0].Value = tel;

        string sql    = "select * from apply where  Tel=?tel";
        bool   result = telcheck.ReadSql(sql, mysp);

        return(result);
    }
Beispiel #18
0
        private void btnEdit_Click(object sender, System.EventArgs e)
        {
            if (txtDpartmentID.Text == "")
            {
                MessageBox.Show("Ensure all fieds are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtDpartmentID.Focus();
            }
            else if (txtDepartmentName.Text == "")
            {
                MessageBox.Show("Ensure all fieds are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);

                txtDepartmentName.Focus();
            }
            else if (txtDescription.Text == "")
            {
                MessageBox.Show("Ensure all fieds are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);

                txtDescription.Focus();
            }
            else if (txtDpartmentID.Text == "")
            {
                MessageBox.Show("Ensure all fieds are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);

                txtDpartmentID.Focus();
            }


            else
            {
                conn   cn     = new conn();
                string query1 = "";
                query1 = "UPDATE department SET department_ID='" + txtDpartmentID.Text + "',department_Name='" + txtDepartmentName.Text + "',office='" + txtDescription.Text + "',faculty_ID='" + cboSchoolID.Text + "' WHERE department_ID='" + txtSearch.Text + "'";
                if (cn.openConnection() == true)
                {
                    MySqlCommand cmd = new MySqlCommand(query1, cn.connect);
                    cmd.ExecuteNonQuery();

                    txtDpartmentID.Text    = "";
                    txtDepartmentName.Text = "";
                    txtDescription.Text    = "";
                    cboSchoolID.Text       = "";
                    txtDpartmentID.Focus();
                    MessageBox.Show("Record updated!", "KUMMMS Dialog Box", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
        private void frmcourse_Load(object sender, EventArgs e)
        {
            conn   cn    = new conn();
            string query = "";

            query = "SELECT * FROM lecturer ORDER BY lecturer_Name ASC";
            if (cn.openConnection() == true)
            {
                MySqlCommand    cmd        = new MySqlCommand(query, cn.connect);
                MySqlDataReader dataReader = cmd.ExecuteReader();
                this.cbolname.Items.Clear();
                while (dataReader.Read())
                {
                    this.cbolname.Items.Add(dataReader["lecturer_Name"].ToString());
                }
            }
            cn.CloseConnection();
        }
        private void groupBox1_Enter(object sender, EventArgs e)
        {
            conn   cn     = new conn();
            string query6 = "";

            query6 = "SELECT * FROM programme ORDER BY programme_ID ASC";
            if (cn.openConnection() == true)
            {
                MySqlCommand    cmd        = new MySqlCommand(query6, cn.connect);
                MySqlDataReader dataReader = cmd.ExecuteReader();
                this.cbopid.Items.Clear();
                while (dataReader.Read())
                {
                    this.cbopid.Items.Add(dataReader["programme_ID"].ToString());
                }
            }
            cn.CloseConnection();
        }
        private void frmprogramme_Load(object sender, System.EventArgs e)
        {
            conn   cn    = new conn();
            string query = "";

            query = "SELECT * FROM department ORDER BY department_ID ASC";
            if (cn.openConnection() == true)
            {
                MySqlCommand    cmd        = new MySqlCommand(query, cn.connect);
                MySqlDataReader dataReader = cmd.ExecuteReader();
                this.cbodpt.Items.Clear();
                while (dataReader.Read())
                {
                    this.cbodpt.Items.Add(dataReader["department_ID"].ToString());
                }
            }
            cn.CloseConnection();
        }
Beispiel #22
0
        private void btnSave_Click(object sender, System.EventArgs e)
        {
            if (txtDpartmentID.Text == "")
            {
                MessageBox.Show("Ensure all fieds are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtDpartmentID.Focus();
            }
            else if (txtDepartmentName.Text == "")
            {
                MessageBox.Show("Ensure all fieds are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);

                txtDepartmentName.Focus();
            }
            else if (txtDescription.Text == "")
            {
                MessageBox.Show("Ensure all fieds are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);

                txtDescription.Focus();
            }
            else if (cboSchoolID.Text == "")
            {
                MessageBox.Show("Ensure all fieds are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);

                cboSchoolID.Focus();
            }

            else
            {
                conn   cn     = new conn();
                string query3 = "";
                query3 = "INSERT INTO department VALUES('" + txtDpartmentID.Text + "','" + txtDepartmentName.Text + "','" + txtDescription.Text + "','" + cboSchoolID.Text + "')";
                if (cn.openConnection() == true)
                {
                    MySqlCommand cmd = new MySqlCommand(query3, cn.connect);
                    cmd.ExecuteNonQuery();

                    txtDescription.Text    = "";
                    txtDepartmentName.Text = "";
                    txtDescription.Text    = "";
                    txtDpartmentID.Focus();
                    MessageBox.Show("Record Saved", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Beispiel #23
0
    protected void Button3_Click1(object sender, EventArgs e)//注册
    {
        conn reg = new conn();

        MySqlParameter[] mysp = { new MySqlParameter("?username", MySqlDbType.VarChar),
                                  new MySqlParameter("?sid",      MySqlDbType.VarChar) };
        mysp[0].Value = regname.Text;
        mysp[1].Value = regstuid.Text;
        string sql    = "select * from staffinfo where  Name=?username or SID=?sid";
        bool   result = reg.ReadSql(sql, mysp);

        if (result == false)
        {
            string           insert    = "insert into staffinfo (SID,Name,Tel,Email,PWD,RegestTime)values(?regsid,?regusername,?tel,?email,?pwd,?regtime)";
            MySqlParameter[] insertpar =
            {
                new MySqlParameter("?regsid",      MySqlDbType.VarChar),
                new MySqlParameter("?regusername", MySqlDbType.VarChar),
                new MySqlParameter("?tel",         MySqlDbType.VarChar),
                new MySqlParameter("?email",       MySqlDbType.VarChar),
                new MySqlParameter("?pwd",         MySqlDbType.VarChar),
                new MySqlParameter("?regtime",     MySqlDbType.VarChar)
            };
            insertpar[0].Value = regstuid.Text;
            insertpar[1].Value = regname.Text;
            insertpar[2].Value = regphone.Text;
            insertpar[3].Value = regemail.Text;
            insertpar[4].Value = regpassword.Text;
            insertpar[5].Value = DateTime.Now;
            int no = reg.ExecuteSql(insert, insertpar);
            if (no == 1)
            {
                Response.Write("<script language='javascript'>alert('注册成功!现在可以登录了!');</script>");
            }
            else if (no == 0)
            {
                Response.Write("<script language='javascript'>alert('注册写入时出现了一些意外!');</script>");
            }
        }
        else
        {
            Response.Write("<script language='javascript'>alert('该用户名或学号已经存在请重新注册!');</script>");
        }
    }
Beispiel #24
0
        private void frmdepartment_Load(object sender, EventArgs e)
        {
            //COMBOBOX POPULATING DATA FROM DATABASE
            conn   cn    = new conn();
            string query = "";

            query = "SELECT * FROM faculty ORDER BY faculty_ID ASC";
            if (cn.openConnection() == true)
            {
                MySqlCommand cmd = new MySqlCommand(query, cn.connect);
                cmd.ExecuteNonQuery();
                this.cboSchoolID.Items.Clear();

                /* while (dataReader.Read())
                 * {
                 *   this.cboSchoolID.Items.Add(dataReader["faculty_ID"].ToString());
                 * }*/
            }
            cn.CloseConnection();
        }
Beispiel #25
0
    protected void Updatename(RepeaterCommandEventArgs e)
    {
        conn   updatename = new conn();
        string Nickname   = ((TextBox)this.Repeater1.Items[0].FindControl("Nickname")).Text.Trim();
        string Name       = ((TextBox)this.Repeater1.Items[0].FindControl("Name")).Text.Trim();
        string Sign       = ((TextBox)this.Repeater1.Items[0].FindControl("Sign")).Text.Trim();
        string upsql      = "update  staffinfo set Name=?name,Nickname=?nickname,Sign=?sign,LastModify=?lastmodify,Gender=?gender WHERE SID =?session";
        string gender     = ((DropDownList)this.Repeater1.Items[0].FindControl("Gender")).SelectedValue.Trim();

        MySqlParameter[] insertpar =
        {
            new MySqlParameter("?name",       MySqlDbType.VarChar),
            new MySqlParameter("?nickname",   MySqlDbType.VarChar),
            new MySqlParameter("?sign",       MySqlDbType.VarChar),
            new MySqlParameter("?lastmodify", MySqlDbType.VarChar),
            new MySqlParameter("?session",    MySqlDbType.VarChar),
            new MySqlParameter("?gender",     MySqlDbType.VarChar)
        };
        insertpar[0].Value = Name;
        insertpar[1].Value = Nickname;
        insertpar[2].Value = Sign;
        insertpar[3].Value = DateTime.Now;
        insertpar[4].Value = Session["userid"];
        insertpar[5].Value = gender;
        int num = updatename.ExecuteSql(upsql, insertpar);

        if (num == 1)
        {
            //bind();
            //Response.Write("<script language='javascript'>alert('更新成功!');</script>");
            ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "", "alert('更新成功')", true);
            //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "age1", "alert('更新成功')", true);
        }
        else
        {
            Response.Write("<script language='javascript'>alert('更新失败!');</script>");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        conn myconnobj = new conn();

        myconnobj.conOpen();
        btnprint.PostBackUrl = "";
        Button1.PostBackUrl  = "";


        if (myconnobj.checkSession() == 0)
        {
            Response.Redirect("login.aspx");
            Response.End();
        }
        else
        {
            lblwelcome.Text = Session["userName"].ToString();
        }

        lbldept.Text = "";

        if (!IsPostBack)
        {
            SqlDataReader deptreader;

            deptreader                 = myconnobj.getUserDepts(Session["userName"].ToString());
            departments.DataSource     = deptreader;
            departments.DataTextField  = "DeptName";
            departments.DataValueField = "DeptID";
            departments.DataBind();
            myconnobj.conClose();
            employees.Items.Insert(0, new ListItem("Select Employee", "0"));
            departments.Items.Insert(0, new ListItem("Select Department", "0"));
            lbldept.Text     = "";
            txtdatefrom.Text = "";
            txtremarks.Text  = "";
        }
    }
Beispiel #27
0
    protected void Updatecontact(RepeaterCommandEventArgs e)
    {
        conn   updatename  = new conn();
        string email       = ((TextBox)this.Repeater1.Items[0].FindControl("email")).Text.Trim();
        string tel         = ((TextBox)this.Repeater1.Items[0].FindControl("tel")).Text.Trim();
        string qq          = ((TextBox)this.Repeater1.Items[0].FindControl("qq")).Text.Trim();
        string address     = ((TextBox)this.Repeater1.Items[0].FindControl("address")).Text.Trim();
        string homeaddress = ((TextBox)this.Repeater1.Items[0].FindControl("homeaddress")).Text.Trim();
        string upsql       = "update  staffinfo set Email=?email,Tel=?tel,QQ=?qq,LastModify=?lastmodify,Address=?address,HomeAddress=?homeaddress WHERE SID =?session";

        MySqlParameter[] insertpar =
        {
            new MySqlParameter("?email",       MySqlDbType.VarChar),
            new MySqlParameter("?tel",         MySqlDbType.VarChar),
            new MySqlParameter("?qq",          MySqlDbType.VarChar),
            new MySqlParameter("?lastmodify",  MySqlDbType.VarChar),
            new MySqlParameter("?address",     MySqlDbType.VarChar),
            new MySqlParameter("?homeaddress", MySqlDbType.VarChar),
            new MySqlParameter("?session",     MySqlDbType.VarChar)
        };
        insertpar[0].Value = email;
        insertpar[1].Value = tel;
        insertpar[2].Value = qq;
        insertpar[3].Value = DateTime.Now;
        insertpar[4].Value = address;
        insertpar[5].Value = homeaddress;
        insertpar[6].Value = Session["userid"];
        int num = updatename.ExecuteSql(upsql, insertpar);

        if (num == 1)
        {
            Response.Write("<script language='javascript'>alert('更新成功!');location.replace(document.referrer);</script>");
        }
        else
        {
            Response.Write("<script language='javascript'>alert('更新失败!');</script>");
        }
    }
    protected void Dept_Changed(object sender, EventArgs e)
    {
        employees.Enabled = false;
        employees.Items.Clear();
        employees.Items.Insert(0, new ListItem("Select Employee", "0"));
        int deptId;

        deptId = Convert.ToInt32(departments.SelectedValue.ToString());

        if (deptId > 0)
        {
            conn myconn = new conn();
            myconn.conOpen();
            SqlDataReader empreader;
            empreader = myconn.getEmployees(deptId);
            employees.DataTextField  = "FullName";
            employees.DataValueField = "ID";
            employees.DataSource     = empreader;
            employees.DataBind();
            employees.Enabled = true;
            myconn.conClose();
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        try {
            conn myconn = new conn();
            myconn.conOpen();
            int    empid;
            string remarks, date, ip;
            empid   = Convert.ToInt32(employees.SelectedValue.ToString());
            remarks = txtremarks.Text.ToString();
            date    = txtdatefrom.Text.ToString();
            ip      = Request.ServerVariables["REMOTE_ADDR"];
            myconn.markAttendance(empid, date, remarks, ip, Convert.ToInt32(Session["userID"].ToString()));
            myconn.conClose();
            lbldept.Text = "Attendance Marked Successfully";

            txtdatefrom.Text = "";
            txtremarks.Text  = "";
        }
        catch (Exception ex)
        {
            lbldept.Text = ex.Message.ToString();
        }
    }
 private void txtSearch_TextChanged(object sender, System.EventArgs e)
 {
     if (txtSearch.Text == "")
     {
         MessageBox.Show("Ensure all fields are filled", "KUMMMS message", MessageBoxButtons.OK, MessageBoxIcon.Error);
         txtSearch.Focus();
     }
     else
     {
         conn   cn     = new conn();
         string query5 = "";
         query5 = "SELECT *FROM course WHERE course_ID='" + txtSearch.Text + "'";
         if (cn.openConnection() == true)
         {
             MySqlCommand    cmd        = new MySqlCommand(query5, cn.connect);
             MySqlDataReader dataReader = cmd.ExecuteReader();
             if (dataReader.Read())
             {
                 txtcid.Text   = dataReader["course_ID"].ToString();
                 txtname.Text  = dataReader["course_Name"].ToString();
                 cbolname.Text = dataReader["lecturer_name"].ToString();
                 cboyear.Text  = dataReader["year"].ToString();
                 cbosem.Text   = dataReader["sem"].ToString();
                 cbopid.Text   = dataReader["programme_ID"].ToString();
             }
             else
             {
                 txtcid.Text   = "";
                 txtname.Text  = "";
                 cbolname.Text = "";
                 cboyear.Text  = "";
                 cbosem.Text   = "";
                 txtSearch.Focus();
             }
         }
     }
 }
Beispiel #31
0
				procQPMD = new advanQPMD( conn, procInfo.getSchema(),