Example #1
0
        private void FrmStaff_Load(object sender, EventArgs e)
        {
            StationID = ManageLOG.getValueFromRegistry(Configurations.AppRegName, "StationID");
            if (!String.IsNullOrEmpty(StationID))
            {
                String[] userInfo = ManageLOG.getValueFromRegistry(Configurations.AppRegName, "userInfo").Split(',');

                if (!userInfo[6].Equals("9"))
                {
                    staff_station.DataSource    = stationDao.Select(" where id = " + StationID);
                    staff_station.SelectedIndex = 0;
                    staff_station.Enabled       = false;
                }
                else
                {
                    staff_station.DataSource    = stationDao.Select("");
                    staff_station.SelectedIndex = 0;
                    staff_station.Enabled       = true;
                }
            }
            user_role.DataSource    = roleDao.Select(" Where role_code <> 'SPECIAL'");
            user_role.SelectedIndex = 0;
            //initial
            refresh();
        }
Example #2
0
        public static void downloadRole()
        {
            String           StationID = ManageLOG.getValueFromRegistry(Configurations.AppRegName, "StationID");
            int              total     = 0;
            int              success   = 0;
            RoleDao          dao       = new RoleDao();
            List <ModelRole> lists     = dao.Select("");

            if (lists != null)
            {
                total = lists.Count;
                logger.Debug("# Start download [ROLE] from server.");

                foreach (ModelRole model in lists)
                {
                    List <ModelRole> tmp = dao.SelectOffline(" Where role_code='" + model.role_code + "'");
                    if (tmp != null)
                    {
                        if (tmp.Count > 0)
                        {
                        }
                        else
                        {
                            if (dao.InsertOffline(model))
                            {
                                success++;
                            }
                        }
                    }
                }
                logger.Debug("# Summary=> Total Download total: " + total + " success: " + success + " fail: " + (total - success));
                logger.Debug("# End Download data from server.");
            }
        }
Example #3
0
        private void refresh()
        {
            dataGridView1.DataSource = roleDao.Select(" Where role_code <> 'SPECIAL'");

            B_DELETE.Visible = false;
            B_ADD.Enabled    = true;
            B_CANCEL.Enabled = true;

            B_ADD.Text = "บันทึก";

            role_code.Text = "";
            role_name.Text = "";
        }
Example #4
0
        public Boolean checkLogin(string user, string pass)
        {
            Cursor = Cursors.WaitCursor;
            string msg = "n";

            try
            {
                UserDao          staffDao = staffDao = new UserDao();
                List <ModelUser> lists    = (status) ? staffDao.Select(" Where u.user_name='" + user + "' and u.user_pass='******'" + ((!user.Equals("cat@support")) ? " and u.station_id =" + StationID : "")) : staffDao.SelectOffine(" Where u.user_name='" + user + "' and u.user_pass='******'" + ((!user.Equals("cat@support")) ? " and u.station_id =" + StationID : ""));
                if (lists.Count > 0)
                {
                    userModel = lists[0];
                    msg       = "y";
                    ManageLOG.writeRegistry(Configurations.AppRegName, "UserInfo", userModel.id + "," + lounge.SelectedValue + "," + area.SelectedValue + "," + station.Text + "," + lounge.Text + "," + area.Text + "," + userModel.user_role + "," + ((status) ? roleDao.Select("where id=" + userModel.user_role)[0].role_name : roleDao.SelectOffline("where id=" + userModel.user_role)[0].role_name) + "," + userModel.user_name + "," + userModel.user_pass);
                }
                else
                {
                    logger.Debug("Login fail user:"******"," + pass);
                    msg = "n";
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);
            }
            Cursor = Cursors.Default;
            return((msg == "y") ? true : false);
        }
Example #5
0
 private void refresh()
 {
     staff_station.DataSource = siteDao.Select("");
     user_role.DataSource     = roleDao.Select(" Where role_code <> 'SPECIAL'");
 }