Esempio n. 1
0
        /// <summary>
        /// 获取出库列表
        /// </summary>
        public void GetOutDeviceList()
        {
            DataSet ds = OperaterBase.GetData("select * from V_Out_Stock");

            Repeater1.DataSource = ds;
            Repeater1.DataBind();
        }
Esempio n. 2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string username      = TextBox1.Text;
            string password      = TextBox2.Text;
            string adminLoginSql = "select * from Staff_Table where worker_mobile='" + username +
                                   "' and worker_password='******'";
            DataSet ds = OperaterBase.GetData(adminLoginSql);

            if (ds.Tables[0].Rows.Count == 0)
            {
                Label1.Text = "信息有误,请检查";
                return;
            }


            // 存入session,判断session是否为空
            Session["login_user"] = ds.Tables[0].Rows[0]["worker_mobile"];
            if (string.IsNullOrEmpty(Session["login_user"].ToString()))
            {
                Label1.Text = "服务器错误,请联系管理员";
                return;
            }


            // 必须是管理员
            if (ds.Tables[0].Rows[0]["worker_num"].ToString() == "admin")
            {
                Response.Redirect("manage_staff.aspx?staffId=1");
            }
            else
            {
                Response.Redirect("order_list.aspx?staffId=" + ds.Tables[0].Rows[0]["Id"]);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 获取学生列表
        /// </summary>
        private void getStudentList(string sql)
        {
            DataSet ds = OperaterBase.GetData(sql);

            Repeater1.DataSource = ds;
            Repeater1.DataBind();
        }
Esempio n. 4
0
        /// <summary>
        /// 库存数量比对,重新设置库存数量
        /// </summary>
        /// <param name="device_number">设备型号</param>
        /// <param name="device_count">下单数量</param>
        /// <returns></returns>
        public int GetIinventoryCount(string device_number, string device_count)
        {
            // 应该重新设置的库存数量
            int     count = -1;
            DataSet ds    =
                OperaterBase.GetData("select * from Device_List where device_number = '" + device_number + "'");

            // 说明查出来数据了
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (Convert.ToInt32(device_count) > Convert.ToInt32(ds.Tables[0].Rows[0]["device_count"]))
                {
                    Label1.Text = "下单数量大于库存数量,库存数量为" + Convert.ToInt32(ds.Tables[0].Rows[0]["device_count"]);
                }
                else
                {
                    // 数量正常,可以正常减去
                    count = Convert.ToInt32(ds.Tables[0].Rows[0]["device_count"]) - Convert.ToInt32(device_count);
                    OperaterBase.CommandBySql("update Device_List set device_count=" + count +
                                              " where device_number='" + device_number + "'");
                }
            }
            else
            {
                Label1.Text = "设备号有异常,请检查";
            }

            return(count);
        }
Esempio n. 5
0
        /// <summary>
        /// 根据指定条件获取员工数据
        /// </summary>
        private void GetStaffData(string sql)
        {
            DataSet ds =
                OperaterBase.GetData(sql);

            Repeater1.DataSource = ds;
            Repeater1.DataBind();
        }
Esempio n. 6
0
        /// <summary>
        /// 更新用户
        /// 给文本框获取数据库原值
        /// </summary>
        private void UpdateUser()
        {
            int     deviceId = Convert.ToInt32(Request["deviceId"]);
            string  sql      = "select * from Device_List where id=" + deviceId;
            DataSet ds       = OperaterBase.GetData(sql);

            TextBox1.Text = ds.Tables[0].Rows[0]["device_number"].ToString();
            TextBox2.Text = ds.Tables[0].Rows[0]["device_count"].ToString();
        }
Esempio n. 7
0
        private void DropList1()
        {
            string  sql = "select sp.ProvinceName,sp.ProvinceID from S_Province sp";
            DataSet ds  = OperaterBase.GetData(sql);

            DropDownList1.DataSource     = ds;
            DropDownList1.DataTextField  = "ProvinceName";
            DropDownList1.DataValueField = "ProvinceID";
            DropDownList1.DataBind();
        }
Esempio n. 8
0
        private void GetClassList()
        {
            string  sql = "select * from ClassInfo";
            DataSet ds  = OperaterBase.GetData(sql);

            DropDownList1.DataSource     = ds;
            DropDownList1.DataValueField = "ID";
            DropDownList1.DataTextField  = "className";
            DropDownList1.DataBind();
        }
Esempio n. 9
0
        private void DropList2()
        {
            int     value = Convert.ToInt32(DropDownList1.SelectedValue);
            string  sql   = "SELECT * FROM S_City WHERE ProvinceID = " + value;
            DataSet ds    = OperaterBase.GetData(sql);

            DropDownList2.DataSource     = ds;
            DropDownList2.DataTextField  = "CityName";
            DropDownList2.DataValueField = "CityID";
            DropDownList2.DataBind();
        }
Esempio n. 10
0
        /// <summary>
        /// 判断手机号是否唯一
        /// </summary>
        /// <param name="mobile"></param>
        /// <returns>true or false</returns>
        private Boolean IsMobile(string studentNum, string mobile)
        {
            string  sql = "select mobile , studentNum from studentInfo where  studentNum = '" + studentNum + "' or  mobile = '" + mobile + "'";
            DataSet ds  = OperaterBase.GetData(sql);

            if (ds.Tables[0].Rows.Count <= 0)
            {
                return(true);
            }
            return(false);
        }
Esempio n. 11
0
        /// <summary>
        /// 获取设备型号
        /// </summary>
        private void GetDeviceList()
        {
            DataSet ds = OperaterBase.GetData("select * from Device_List where is_delete=0 order by device_number");

            DropDownList1.DataSource     = ds;
            DropDownList1.DataTextField  = "device_number";
            DropDownList1.DataValueField = "id";
            DropDownList1.DataBind();
            // 插入到第一个位置,内容和value值
            DropDownList1.Items.Insert(0, new ListItem("请选择设备编号", "0"));
        }
Esempio n. 12
0
        private void DropList3()
        {
            int     value = Convert.ToInt32(DropDownList2.SelectedValue);
            string  sql   = "SELECT * FROM S_District WHERE CityID = " + value;
            DataSet ds    = OperaterBase.GetData(sql);

            DropDownList3.DataSource     = ds;
            DropDownList3.DataTextField  = "DistrictName";
            DropDownList3.DataValueField = "DistrictID";
            DropDownList3.DataBind();
        }
        /// <summary>
        /// 获取订单列表
        /// </summary>
        public void GetOrderList()
        {
            string staffId = Request["staffId"];

            // 判断是否为空
            if (!string.IsNullOrEmpty(staffId))
            {
                DataSet ds = OperaterBase.GetData("select * from V_Order_Sta_Dev where order_staff= " + staffId);
                Repeater1.DataSource = ds;
                Repeater1.DataBind();
            }
        }
Esempio n. 14
0
        /// <summary>
        /// 获取所有省份
        /// </summary>
        private void GetAllProvince()
        {
            string  sql = "select * from S_Province";
            DataSet ds  = OperaterBase.GetData(sql);

            // 给下拉框绑定
            DropDownList1.DataSource = ds;
            // 绑定下拉框文字
            DropDownList1.DataTextField = "ProvinceName";
            //绑定下拉框value值
            DropDownList1.DataValueField = "ProvinceID";
            DropDownList1.DataBind();
            DropDownList1.Items.Insert(0, new ListItem("请选择省份", "0"));
        }
Esempio n. 15
0
        private Boolean isMobile(string mobile, string password)
        {
            if (mobile != "")
            {
                string sql = "select mobile from studentInfo where mobile = '" + mobile + "'";
                if (OperaterBase.GetData(sql) != null)
                {
                    ResetPassword(mobile, password);
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 16
0
        /// <summary>
        /// 获取选定城市的区县
        /// </summary>
        private void GetSelectedDistrict()
        {
            string  CityID = DropDownList2.SelectedValue;
            string  sql    = "select * from S_District where CityID=" + CityID + "";
            DataSet ds     = OperaterBase.GetData(sql);

            // 给下拉框绑定
            DropDownList3.DataSource = ds;
            // 绑定下拉框文字
            DropDownList3.DataTextField = "DistrictName";
            //绑定下拉框value值
            DropDownList3.DataValueField = "DistrictID";
            DropDownList3.DataBind();
            DropDownList3.Items.Insert(0, new ListItem("请选择地区", "0"));
        }
Esempio n. 17
0
        /// <summary>
        /// 把数据 填入框里面
        /// </summary>
        /// <param name="StudentID"></param>
        private void FillData(int StudentID)
        {
            string  Bysql = "select * from studentInfo where ID = " + StudentID;
            DataSet ds    = OperaterBase.GetData(Bysql);

            TextBox1.Text  = ds.Tables[0].Rows[0]["studentNum"].ToString();
            TextBox2.Text  = ds.Tables[0].Rows[0]["studentSex"].ToString();
            TextBox3.Text  = ds.Tables[0].Rows[0]["mobile"].ToString();
            TextBox4.Text  = ds.Tables[0].Rows[0]["password"].ToString();
            TextBox5.Text  = ds.Tables[0].Rows[0]["birthday"].ToString();
            TextBox6.Text  = ds.Tables[0].Rows[0]["province"].ToString();
            TextBox7.Text  = ds.Tables[0].Rows[0]["city"].ToString();
            TextBox8.Text  = ds.Tables[0].Rows[0]["district"].ToString();
            TextBox10.Text = ds.Tables[0].Rows[0]["classId"].ToString();
            TextBox9.Text  = ds.Tables[0].Rows[0]["studentName"].ToString();
        }
Esempio n. 18
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string user = TextBox1.Text.Trim();
            string pwd  = TextBox2.Text.Trim();
            string sql  = "SELECT studentNum,password FROM studentInfo WHERE studentNum = " + user + " AND password = "******"登录成功";
            }
            else
            {
                Button1.Text = "登录失败";
            }
            Response.Redirect("studentInfo.aspx");
        }
Esempio n. 19
0
        /// <summary>
        /// 修改员工信息
        /// </summary>
        private void UpdateStaff()
        {
            var     ID  = Convert.ToInt32(Request["staffID"]);
            string  sql = "select * from Staff_Table where Id=" + ID + "";
            DataSet ds  = OperaterBase.GetData(sql);

            TextBox1.Text               = ds.Tables[0].Rows[0]["worker_num"].ToString();
            TextBox2.Text               = ds.Tables[0].Rows[0]["worker_name"].ToString();
            Image1.ImageUrl             = ds.Tables[0].Rows[0]["worker_avatar"].ToString();
            Sex_Tb.SelectedValue        = ds.Tables[0].Rows[0]["worker_sex"].ToString();
            TextBox4.Text               = ds.Tables[0].Rows[0]["worker_age"].ToString();
            TextBox5.Text               = ds.Tables[0].Rows[0]["worker_mobile"].ToString();
            TextBox6.Text               = ds.Tables[0].Rows[0]["worker_password"].ToString();
            DropDownList1.SelectedValue = ds.Tables[0].Rows[0]["s_province"].ToString();
            DropDownList2.SelectedValue = ds.Tables[0].Rows[0]["s_city"].ToString();
            DropDownList3.SelectedValue = ds.Tables[0].Rows[0]["s_district"].ToString();
        }
Esempio n. 20
0
        /// <summary>
        /// 获取选定省份的城市
        /// </summary>
        private void GetSelectedCity()
        {
            string  ProvinceID = DropDownList1.SelectedValue;
            string  sql        = "select * from S_City where ProvinceID=" + ProvinceID + "";
            DataSet ds         = OperaterBase.GetData(sql);

            // 给下拉框绑定
            DropDownList2.DataSource = ds;
            // 绑定下拉框文字
            DropDownList2.DataTextField = "CityName";
            //绑定下拉框value值
            DropDownList2.DataValueField = "CityID";
            DropDownList2.DataBind();
            DropDownList2.Items.Insert(0, new ListItem("请选择城市", "0"));
            // 改变省份清除区县
            DropDownList3.Items.Clear();
            DropDownList3.Items.Insert(0, new ListItem("请选择地区", "0"));
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            string worker_mobile = TextBox1.Text;
            // string worker_password = TextBox2.Text;
            string  worker_password = TextBox2.Text;
            DataSet ds =
                OperaterBase.GetData("select * from Staff_Table where worker_mobile='" + worker_mobile +
                                     "' and worker_password='******'");

            if (ds.Tables[0].Rows.Count > 0)
            {
                bool CheckBoxResult = CheckBox1.Checked;
                if (CheckBoxResult)
                {
                    CookieHelper.SetCookie("worker_mobile", ds.Tables[0].Rows[0]["worker_mobile"].ToString(),
                                           DateTime.Now.AddMinutes(10));
                    CookieHelper.SetCookie("worker_password", ds.Tables[0].Rows[0]["worker_password"].ToString(),
                                           DateTime.Now.AddMinutes(10));
                    CookieHelper.SetCookie("remember_password", CheckBox2.Checked.ToString(),
                                           DateTime.Now.AddMinutes(10));
                    CookieHelper.SetCookie("auto_login", CheckBox2.Checked.ToString(),
                                           DateTime.Now.AddMinutes(10));
                    CookieHelper.SetCookie("Id", ds.Tables[0].Rows[0]["Id"].ToString(),
                                           DateTime.Now.AddMinutes(10));
                }
                else
                {
                    Session["worker_mobile"]   = ds.Tables[0].Rows[0]["worker_mobile"];
                    Session["worker_password"] = ds.Tables[0].Rows[0]["worker_password"];
                }

                // 必须是管理员
                if (ds.Tables[0].Rows[0]["worker_num"].ToString() == "admin")
                {
                    Response.Redirect("manage_staff.aspx?staffId=1");
                }
                else
                {
                    Response.Redirect("order_list.aspx?staffId=" + ds.Tables[0].Rows[0]["Id"]);
                }
            }
        }
Esempio n. 22
0
        /// <summary>
        /// 锁定员工姓名
        /// </summary>
        private void GetStaffDetail()
        {
            // 获取传递过来的员工id
            string staffId = Request["staffId"];

            if (!string.IsNullOrEmpty(staffId))
            {
                DataSet ds = OperaterBase.GetData("select * from Staff_Table where is_delete=0 and Id=" + staffId);
                // 如果查询到数据,给员工姓名textBox赋值,并向隐藏控件赋值id
                if (ds.Tables[0].Rows.Count > 0)
                {
                    TextBox4.Text      = ds.Tables[0].Rows[0]["worker_name"].ToString();
                    HiddenField1.Value = ds.Tables[0].Rows[0]["Id"].ToString();
                }
                // 查不到跳转到登录页面
                else
                {
                    Response.Redirect("manage_staff_login.aspx");
                }
            }
        }
        /// <summary>
        /// 根据指定条件获取员工数据
        /// </summary>
        private void GetStaffData(string sql)
        {
            DataSet ds =
                OperaterBase.GetData(sql);
            List <DeviceModel> deviceList = new List <DeviceModel>();

            foreach (DataRow dataRow in ds.Tables[0].Rows)
            {
                DeviceModel deviceModel = new DeviceModel();
                foreach (DataColumn dataColumn in ds.Tables[0].Columns)
                {
                    switch (dataColumn.ColumnName)
                    {
                    case "worker_num":
                        deviceModel.worker_num = dataRow["worker_name"].ToString();
                        break;

                    case "worker_name":
                        deviceModel.worker_name = dataRow["worker_name"].ToString();
                        break;

                    case "worker_avatar":
                        deviceModel.worker_avatar = dataRow["worker_avatar"].ToString();
                        break;

                    case "worker_sex":
                        deviceModel.worker_sex = dataRow["worker_sex"].ToString();
                        break;

                    case "worker_age":
                        deviceModel.worker_age = dataRow["worker_age"].ToString();
                        break;

                    case "worker_mobile":
                        deviceModel.worker_mobile = dataRow["worker_mobile"].ToString();
                        break;

                    case "worker_password":
                        deviceModel.worker_password = dataRow["worker_password"].ToString();
                        break;

                    case "s_province":
                        deviceModel.s_province = dataRow["s_province"].ToString();
                        break;

                    case "s_city":
                        deviceModel.s_city = dataRow["s_city"].ToString();
                        break;

                    case "s_district":
                        deviceModel.s_district = dataRow["s_district"].ToString();
                        break;

                    case "Id":
                        deviceModel.Id = dataRow["Id"].ToString();
                        break;
                    }
                }

                deviceList.Add(deviceModel);
            }

            Repeater1.DataSource = deviceList;
            Repeater1.DataBind();
        }