Exemple #1
0
        public static Kaoguan GetKaoguanByID(int id)
        {
            String    sql = "select kaoguan.*,department.departname from kaoguan,department where kaoguan.depart=department.id and kaoguan.kgstate=1 and kaoguan.id=" + id;
            DataTable dt  = MySqlDBHelper.GetDataSet(sql);

            if (dt.Rows.Count < 1)
            {
                return(null);
            }

            Kaoguan kg   = new Kaoguan();
            bool    falg = false;

            foreach (DataRow dr in dt.Rows)
            {
                kg.Id           = (int)dr["id"];
                kg.WorkID       = dr["workid"].ToString();
                kg.Name         = dr["name"].ToString();
                kg.DepID        = Convert.ToInt32(dr["depart"].ToString());
                kg.PositionName = dr["position"].ToString();
                kg.Company      = dr["company"].ToString();
                kg.Pwd          = dr["password"].ToString();

                kg.DepName = dr["departname"].ToString();
                falg       = true;
                break;
            }
            if (falg)
            {
                return(kg);
            }
            return(null);
        }
Exemple #2
0
        //save
        protected void Add_btnClick(object sender, EventArgs e)
        {
            Kaoguan kg = new Kaoguan();

            kg.WorkID       = work_id.Value;
            kg.Name         = name.Value;
            kg.DepID        = Convert.ToInt32(department.SelectedValue);
            kg.PositionName = Duty.Value;
            kg.Pwd          = Pwsd.Text;

            kg.Company = "北京铁路局丰台机务段";

//             if (Convert.ToInt32(department.SelectedValue)==-1)
//             {
//                 Response.Write("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>");
//                 Response.Write("<script language=javascript>alert('请选择部门!')</script>");
//             }
//             else
            {
                if (msgid != -1)
                {
                    kg.Id = msgid;
                    FTInterviewBLL.KaoguanManage.UpdateKaoguan(kg);
                    Response.Write("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>");
                    Response.Write("<script language=javascript>alert('更新成功!')</script>");
                }
                else
                {
                    FTInterviewBLL.KaoguanManage.Add(kg);
                    Response.Write("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>");
                    Response.Write("<script language=javascript>alert('添加成功!')</script>");
                }
            }
            BindData();
        }
Exemple #3
0
        public static List <Kaoguan> GetAllKaoguan()
        {
            String sql = "select kaoguan.*,department.departname from kaoguan,department" +
                         " where kaoguan.depart=department.id and kaoguan.kgstate=1" +
                         " and department.bmstate=1 " + " order by department.id asc";
            DataTable      dt   = MySqlDBHelper.GetDataSet(sql);
            List <Kaoguan> list = new List <Kaoguan>();

            if (dt.Rows.Count < 1)
            {
                return(list);
            }
            foreach (DataRow dr in dt.Rows)
            {
                Kaoguan kg = new Kaoguan();
                kg.Id           = (int)dr["id"];
                kg.WorkID       = dr["workid"].ToString();
                kg.Name         = dr["name"].ToString();
                kg.DepID        = Convert.ToInt32(dr["depart"].ToString());
                kg.PositionName = dr["position"].ToString();
                kg.Company      = dr["company"].ToString();
                kg.Pwd          = dr["password"].ToString();

                kg.DepName = dr["departname"].ToString();
                list.Add(kg);
            }
            return(list);
        }
Exemple #4
0
 protected void BindData()
 {
     DataProcess.DepartmentBind(department);
     if (msgid != -1)
     {
         Kaoguan kg = FTInterviewBLL.KaoguanManage.GetKaoguanByID(msgid);
         work_id.Value            = kg.WorkID;
         name.Value               = kg.Name;
         department.SelectedValue = kg.DepID + "";
         Duty.Value               = kg.PositionName;
     }
 }
Exemple #5
0
        public static int UpdateKaoguan(Kaoguan kg)
        {
            String sql = "update kaoguan set workid=@workid,name=@name,depart=@depart,position=@position,company=@company,password=@password where id=@id";
            List <MySqlParameter> para_list = new List <MySqlParameter>();

            para_list.Add(new MySqlParameter("@workid", kg.WorkID));
            para_list.Add(new MySqlParameter("@name", kg.Name));
            para_list.Add(new MySqlParameter("@depart", kg.DepID));
            para_list.Add(new MySqlParameter("@position", kg.PositionName));
            para_list.Add(new MySqlParameter("@company", kg.Company));
            para_list.Add(new MySqlParameter("@password", kg.Pwd));

            para_list.Add(new MySqlParameter("@id", kg.Id));

            return(MySqlDBHelper.ExecuteCommand(sql, para_list.ToArray()));
        }
Exemple #6
0
        public static int Add(Kaoguan kaoguan)
        {
            String sql = "insert into kaoguan(workid,name,depart,position,company,password,kgstate) values(@workid,@name,@depart,@position,@company,@password,@kgstate)";
            List <MySqlParameter> para_list = new List <MySqlParameter>();

            para_list.Add(new MySqlParameter("@workid", kaoguan.WorkID));
            para_list.Add(new MySqlParameter("@name", kaoguan.Name));
            para_list.Add(new MySqlParameter("@depart", kaoguan.DepID));
            para_list.Add(new MySqlParameter("@position", kaoguan.PositionName));
            para_list.Add(new MySqlParameter("@company", kaoguan.Company));
            para_list.Add(new MySqlParameter("@password", kaoguan.Pwd));

            para_list.Add(new MySqlParameter("@kgstate", 1));

            return(MySqlDBHelper.ExecuteCommand(sql, para_list.ToArray()));
        }
        protected void Button_Click(object sender, EventArgs e)
        {
            if (UserName.SelectedItem.Text != "请选择")
            {
                if (UserName.SelectedItem.Text == "管理员")
                {
                    if (FTInterviewBLL.UserInfoManage.FindUser(UserName.SelectedItem.Text, txtPwd.Value))
                    {
                        HttpCookie cookie = new HttpCookie("ftcook"); //初使化并设置Cookie的名称
                        cookie.Expires = DateTime.Now.AddDays(1);     //设置过期时间
                        cookie.Values.Add("name", Server.UrlEncode("管理员"));

                        cookie.Values.Add("paswd", txtPwd.Value);
                        cookie.Values.Add("isExpired", "0");
                        Response.AppendCookie(cookie);

                        Response.Redirect("Index/Manager.aspx");
                    }
                }
                else if (UserName.SelectedItem.Text == "电脑操作员")
                {
                    HttpCookie cookie = new HttpCookie("ftcook"); //初使化并设置Cookie的名称

                    cookie.Expires = DateTime.Now.AddDays(1);     //设置过期时间
                    cookie.Values.Add("paswd", txtPwd.Value);
                    cookie.Values.Add("isExpired", "0");
                    Response.AppendCookie(cookie);
                    Response.Redirect("msSystem/index0.aspx");
                }
                else
                {
                    Kaoguan kg = FTInterviewBLL.KaoguanManage.FindKaoGuan(UserName.SelectedItem.Text, txtPwd.Value);
                    if (kg != null)
                    {
                        HttpCookie cookie = new HttpCookie("ftcook");//初使化并设置Cookie的名称
                        cookie.Expires = DateTime.Now.AddDays(1);
                        cookie.Values.Add("kgid", "" + kg.Id);
                        cookie.Values.Add("kgname", Server.UrlEncode(kg.Name));
                        cookie.Values.Add("paswd", txtPwd.Value);
                        cookie.Values.Add("isExpired", "0");
                        Response.AppendCookie(cookie);

                        Response.Redirect("Index/msg.aspx");
                    }
                }
            }
        }
Exemple #8
0
 protected void BindData()
 {
     DataProcess.DepartmentBind(department);
     if (msgid != -1)
     {
         Kaoguan kg = FTInterviewBLL.KaoguanManage.GetKaoguanByID(msgid);
         work_id.Value            = kg.WorkID;
         name.Value               = kg.Name;
         department.SelectedValue = kg.DepID + "";
         Duty.Value               = kg.PositionName;
         Pwsd.Attributes.Add("value", kg.Pwd);//重点
     }
     else
     {
         Pwsd.Attributes.Add("value", "123456");
     }
 }
Exemple #9
0
        public static List <Kaoguan> GetKaoguanByParameters(int depid = -1, string kgname = "")
        {
            String sql = "select kaoguan.*,department.departname from kaoguan,department " +
                         " where kaoguan.depart=department.id and kaoguan.kgstate=1 " +
                         " and department.bmstate=1 ";

            List <string> condi = new List <string>();

            if (depid != -1)
            {
                sql += " and department.id=" + depid;
            }
            if (kgname != "")
            {
                sql += " and kaoguan.name like '%" + kgname + "%' ";
            }

            sql += " order by department.id asc";
            DataTable      dt   = MySqlDBHelper.GetDataSet(sql);
            List <Kaoguan> list = new List <Kaoguan>();

            if (dt.Rows.Count < 1)
            {
                return(list);
            }

            foreach (DataRow dr in dt.Rows)
            {
                Kaoguan kg = new Kaoguan();
                kg.Id           = (int)dr["id"];
                kg.WorkID       = dr["workid"].ToString();
                kg.Name         = dr["name"].ToString();
                kg.DepID        = Convert.ToInt32(dr["depart"].ToString());
                kg.PositionName = dr["position"].ToString();
                kg.Company      = dr["company"].ToString();
                kg.Pwd          = dr["password"].ToString();

                kg.DepName = dr["departname"].ToString();
                list.Add(kg);
            }
            return(list);
        }
Exemple #10
0
 public static int UpdateKaoguan(Kaoguan kg)
 {
     return(FTInterviewDAL.KaoguanService.UpdateKaoguan(kg));
 }
Exemple #11
0
 public static int Add(Kaoguan kg)
 {
     return(FTInterviewDAL.KaoguanService.Add(kg));
 }