Example #1
0
        public frmLogin()
        {
            InitializeComponent();
            this.btnExit.Image = FWImageDic.EXIT_IMAGE16;
            this.btnConfig.Image = FWImageDic.CONFIG_IMAGE16;
            this.btnLogin.Image = FWImageDic.LOGIN_IMAGE16;
            this.Icon = FrameworkParams.ApplicationIcon;
            components = new System.ComponentModel.Container();
            user = new User();
            user.loadCookies();
            txtUsername.EditValue = user.username;
            txtPassword.EditValue = user.password;
            if (user.savePass == "Y") chkRememberPwd.Checked = true;
            if (user.isAutoLogin == "Y") chkAutoLogin.Checked = true;
            if (chkAutoLogin.Checked) FrameworkParams.isSkipLogin = true;
            // init skin
            FrameworkParams.currentSkin = new PLSkin(this.components);
            FrameworkParams.option = new Option();
            FrameworkParams.option.load();

            Application.CurrentCulture = ApplyFormatAction.GetCultureInfo();

            FrameworkParams.currentSkin.SelectSkin(HelpNumber.ParseInt32(FrameworkParams.option.Skin));
            this.Shown += new EventHandler(frmLogin_Shown);
        }
Example #2
0
        public frmUserChild(Form formUserMan, string actionName, object selectedUserId)
        {
            InitializeComponent();
            //this.btnClose.Image = FWImageDic.CLOSE_IMAGE16;
            //this.btnSave.Image = FWImageDic.SAVE_IMAGE16;
            this.btnSelect.Image = FWImageDic.CHOICE_IMAGE16;

            this.formUserMan = formUserMan;
            this.actionName = actionName;
            this.selectedUser = new User();
            if (selectedUserId != null)
            {
                selectedUser.id = HelpNumber.ParseInt64(selectedUserId.ToString());
                selectedUser.loadByUserId();
                employee_id = selectedUser.employee_id;
                txtUsername.Enabled = false;
                btnSelect.Enabled = false;
            }
            initData();

            //HUNG
            //string select = "select employee.id , employee.name as employee_name, employee.department_id, department.name as department_name, user_cat.userid, user_cat.username " +
            //                "from employee left join user_cat on  employee.id = user_cat.employee_id " +
            //                "join department on department.id=employee.department_id where user_cat.userid is null and 1=1";
            string select = "select DM_NHAN_VIEN.id , DM_NHAN_VIEN.name as employee_name, DM_NHAN_VIEN.department_id, department.name as department_name, user_cat.userid, user_cat.username " +
                            "from DM_NHAN_VIEN left join user_cat on  DM_NHAN_VIEN.id = user_cat.employee_id " +
                            "join department on department.id=DM_NHAN_VIEN.department_id where user_cat.userid is null and 1=1";
            DataSet dsGrid = DABase.getDatabase().LoadDataSet(new QueryBuilder(select), "DETAIL");
            if (plChonUser == null)
                plChonUser = new PLChonNhanVien();
            plChonUser.Init("DEPARTMENT", "ID", "PARENT_ID", new string[] { "NAME" }, new string[] {"Tên phòng ban" }, dsGrid, new string[] { "Nhân viên ID", "Họ tên nhân viên", "Phòng ban ID", "Tên phòng ban", "Người dùng ID", "Tên truy cập" }, "DEPARTMENT_ID", "USERNAME", HelpGen.G_FW_ID);
            plChonUser.SetShowChonNhanVien(btnSelect);
            plChonUser.mDlgGetSelectDataset = new PLChonNhanVien.DlgGetSelectDataset(_getSelectedDataSet);
            plChonUser.mDlgGetUnSelectDataset = new PLChonNhanVien.DlgGetUnSelectDataset(_getUnSelectedDataSet);
            plChonUser.m_IsMultiselect = true;
            plChonUser.mVisibleGridColumn(new string[] { "id", "department_id", "department_name", "userid" });
            //--------------------------
        }
Example #3
0
 public ApplyPermissionAction(string formName)
 {
     this.user = FrameworkParams.currentUser;
 }
Example #4
0
 public void initData()
 {
     user = new User();
     user.loadCookies();
     user.loadByUserName();
 }
Example #5
0
 private void barButtonItemDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (xtraTabControlLeft.SelectedTabPage.Name.Equals("xtraTabPageGroup"))
     {
         if (gridViewGroup.FocusedRowHandle < 0) return;
         DataRow row = gridViewGroup.GetDataRow(gridViewGroup.FocusedRowHandle);
         DialogResult reply = FWMsgBox.questionGroupDelete(row["GROUPNAME"].ToString());
         if (reply == DialogResult.Yes)
         {
             Group group = new Group();
             group.id = HelpNumber.ParseInt64(row["GROUPID"].ToString());
             if (!group.delete())
             {
                 FWMsgBox.showDeleteUsing();
                 return;
             }
             else
             {
                 gridViewGroup.DeleteRow(gridViewGroup.FocusedRowHandle);
                 editEnabledButtonDeleteAndEdit();
             }
         }
     }
     else
     {
         if (gridViewUser.FocusedRowHandle < 0) return;
         DataRow row = gridViewUser.GetDataRow(gridViewUser.FocusedRowHandle);
         if (row["USERNAME"].ToString() == "admin")
         {
             HelpMsgBox.ShowNotificationMessage("Bạn không thể xóa người dùng 'admin'");
             return;
         }
         DialogResult reply = FWMsgBox.questionUserDelete(row["USERNAME"].ToString());
         if (reply == DialogResult.Yes)
         {
             User user = new User();
             user.id = HelpNumber.ParseInt64(row["USERID"].ToString());
             if (!user.delete())
             {
                 FWMsgBox.showDeleteUsing();
                 return;
             }
             else
             {
                 this.gridViewUser.DeleteRow(gridViewUser.FocusedRowHandle);
                 editEnabledButtonDeleteAndEdit();
             }
         }
     }
     //HUNG
     reLoadGroupUserThanhPhan();
 }
Example #6
0
 //PHUOC TEST
 public User findByUserName(String username)
 {
     DatabaseFB db = DABase.getDatabase();
     DbCommand dbSelect = db.GetSQLStringCommand("SELECT * FROM USER_CAT WHERE USERNAME=@username");
     db.AddInParameter(dbSelect, "@username", DbType.String, username);
     IDataReader reader = db.ExecuteReader(dbSelect);
     if (reader.Read())
     {
         User user = new User();
         user.id = HelpNumber.ParseInt64(reader["USERID"].ToString());
         //user.password = reader["PWD"].ToString();
         user.password = "******";
         user.username = reader["USERNAME"].ToString();
         user.isChangePass = (reader["ISCHANGEPWD_BIT"].ToString().Equals("Y") ? true : false);
         user.isActive = (reader["ISACTIVE_BIT"].ToString().Equals("Y") ? true : false);
         if (!reader["LASTACCESS"].ToString().Equals(""))
             user.lastAccess = DateTime.Parse(reader["LASTACCESS"].ToString());
         user.employee_id = (reader["EMPLOYEE_ID"] == null? -1: HelpNumber.ParseInt64(reader["EMPLOYEE_ID"].ToString()));
         reader.Close();
         user.fullname = GetFullName(user.id);
         return user;
     }
     return null;
 }
Example #7
0
        public static User loadUser()
        {
            User user = new User();
            DataSet ds = new DataSet();
            try
            {
                if (ConfigFile.ReadXML(FAUser.COOKIES, ds) == false)
                {
                    saveUser("admin", "admin", "Y", "N");
                    ConfigFile.ReadXML(FAUser.COOKIES, ds);
                }

                DataTable myDataTable = ds.Tables["SYS_USER"];
                if (myDataTable.Rows.Count > 0)
                {
                    DataRow row = myDataTable.Rows[0];
                    user.username = (string)row["username"];
                    user.password = (string)row["password"];
                    user.savePass = (string)row["savepassword"];
                    user.isAutoLogin = (string)row["isautologin"];
                }
            }
            catch
            {
                user.username = "";
                user.password = "";
                user.savePass = "";
                user.isAutoLogin = "";
            }
            return user;
        }
Example #8
0
 //PHUOC TEST
 public User findById(long userId)
 {
     DatabaseFB db = DABase.getDatabase();
     //DbCommand dbSelect = db.GetSQLStringCommand("SELECT user_cat.*, employee.name as fullname FROM user_cat inner join employee on employee.id=user_cat.employee_id WHERE USERID=@userId");
     DbCommand dbSelect = db.GetSQLStringCommand("SELECT user_cat.*, DM_NHAN_VIEN.name as fullname FROM user_cat left join DM_NHAN_VIEN on DM_NHAN_VIEN.id=user_cat.employee_id WHERE user_cat.USERID=@userId");
     db.AddInParameter(dbSelect, "@userId", DbType.Int64, userId);
     IDataReader reader = db.ExecuteReader(dbSelect);
     if (reader.Read())
     {
         User user = new User();
         user.id = HelpNumber.ParseInt64(reader["USERID"].ToString());
         user.fullname = (reader["fullname"]==null? "" : reader["fullname"].ToString());
         user.password = "******";
         user.username = reader["USERNAME"].ToString();
         user.isChangePass = (reader["ISCHANGEPWD_BIT"].ToString().Equals("Y") ? true : false);
         user.isActive = (reader["ISACTIVE_BIT"].ToString().Equals("Y") ? true : false);
         if (!reader["LASTACCESS"].ToString().Equals(""))
             user.lastAccess = DateTime.Parse(reader["LASTACCESS"].ToString());
         user.employee_id = (reader["EMPLOYEE_ID"] == null? -1 : HelpNumber.ParseInt64(reader["EMPLOYEE_ID"]));
         reader.Close();
         return user;
     }
     return null;
 }
Example #9
0
        //PHUOC
        public List<User> findAll()
        {
            List<User> users = new List<User>();
            DatabaseFB db = DABase.getDatabase();
            DbCommand dbSelect = db.GetSQLStringCommand("SELECT * FROM USER_CAT ORDER BY lower(USERNAME)");
            IDataReader reader = db.ExecuteReader(dbSelect);
            while (reader.Read())
            {
                User user = new User();
                user.id = HelpNumber.ParseInt64(reader["USERID"].ToString());
                user.username = reader["USERNAME"].ToString();
                //user.password = reader["PWD"].ToString();
                user.password = "******";

                user.isChangePass = (reader["ISCHANGEPWD_BIT"].ToString().Equals("Y") ? true : false);
                user.isActive = (reader["ISACTIVE_BIT"].ToString().Equals("Y") ? true : false);

                if (!reader["LASTACCESS"].ToString().Equals(""))
                    user.lastAccess = DateTime.Parse(reader["LASTACCESS"].ToString());

                users.Add(user);
            }
            reader.Close();
            return users;
        }
Example #10
0
 //PHUOC OK
 public List<User> getListUserByIdGroup(long groupId)
 {
     List<User> users = new List<User>();
     DatabaseFB db = DABase.getDatabase();
     DbCommand select = db.GetSQLStringCommand("SELECT * FROM USER_CAT u,GROUP_USER_REL ug WHERE" +
             " u.USERID=ug.USERID AND ug.GROUPID=@groupId ORDER BY lower(USERNAME) ASC");
     db.AddInParameter(select, "@groupId", DbType.Int64, groupId);
     IDataReader reader = db.ExecuteReader(select);
     while (reader.Read())
     {
         User user = new User();
         user.id = HelpNumber.ParseInt64(reader["USERID"]);
         user.username = reader["USERNAME"].ToString();
         user.fullname = "Chưa kết với Employee";
         user.isActive = (reader["ISACTIVE_BIT"].ToString() == "Y" ? true : false);
         user.isChangePass = (reader["ISCHANGEPWD_BIT"].ToString() == "Y" ? true : false);
         users.Add(user);
     }
     reader.Close();
     return users;
 }
Example #11
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            SplashScreen.SetCommentaryString("..Đang nạp giao diện.");
            this.btnExit.Image = FWImageDic.EXIT_IMAGE16;
            this.btnConfig.Image = FWImageDic.CONFIG_IMAGE16;
            this.btnLogin.Image = FWImageDic.LOGIN_IMAGE16;
            this.Icon = FrameworkParams.ApplicationIcon;
            components = new System.ComponentModel.Container();
            user = new User();
            user.loadCookies();
            txtUsername.EditValue = user.username;
            txtPassword.EditValue = user.password;
            if (user.savePass == "Y") chkRememberPwd.Checked = true;
            if (user.isAutoLogin == "Y") chkAutoLogin.Checked = true;
            if (frmLoginInstance == null)
            {
                if (chkAutoLogin.Checked) FrameworkParams.isSkipLogin = true;
                frmLoginInstance = this;
            }
            // init skin
            if(FrameworkParams.UsingSkin == true)
                FrameworkParams.currentSkin = new DevExpressSkin(this.components);
            FrameworkParams.option = new Option();
            FrameworkParams.option.load();

            Application.CurrentCulture = ApplyFormatAction.GetCultureInfo();
            if(FrameworkParams.currentSkin!=null)
                FrameworkParams.currentSkin.SelectSkin(HelpNumber.ParseInt32(FrameworkParams.option.Skin));

            if (FrameworkParams.isSkipLogin==true)
            {
                SplashScreen.SetCommentaryString("..Đang xử lý đăng nhập tự động.");

                this.isDirect = true;
                this.LoginAction();
            }
        }
Example #12
0
 private void lbUser_DoubleClick(object sender, System.EventArgs e)
 {
     if (lbUser.SelectedIndex <= 0) return;
     User u = new User();
     u.username = lbUser.SelectedItem.ToString();
     u.loadByUserName();
     frmUserChild form = new frmUserChild(null, "EDIT", u.id.ToString());
     ProtocolForm.ShowModalDialog(this, form);
 }