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."); } }
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); }