Ejemplo n.º 1
0
        public void FilllUserInfo(string _UserID)
        {
            btnADCreate.Visible = false;
            btnADSave.Visible = false;

            string filterString = "UserID=" + _UserID;

            DataRow[] staff = m_StaffTbl.Select(filterString);

            txbLastName.Text = staff[0]["LastName"].ToString();
            txbName.Text = staff[0]["Name"].ToString();
            txbSecondName.Text = staff[0]["SecondName"].ToString();

            txtbWorkRoom.Text = staff[0]["WorkRoom"].ToString();

            dtpBirthDay.Text = staff[0]["Birthday"].ToString();

            DataTable dt = m_ITOSQLCommand.ExecuteSQLCommand("Select dbo.GetUserFIOfromStaff(dep.ChiefID),dep.ShortName,dep.Name, pos.Name,dbo.GetBuildingName(stf.WorkPlace),dbo.GetStaffState(stf.State), stf.Login, stf.PayDoxLogin, dbo.GetEmailByID(stf.emailID), GKLogin, UserID, TbNo, dbo.GetUserPos(dep.ChiefID) from stfOrgStructure dep, stfPositions pos ,  Staff stf" +
                " where dep.DepartmentID = stf.DepartmentID and pos.PositionID = stf.PositionID and stf.UserID=" + _UserID);

            if (dt.Rows.Count > 0)
            {
                //TODO вставить проверку есть ли записи
                lblChief.Text = dt.Rows[0][0].ToString();

                ITO_StringConverter fullname = new ITO_StringConverter(dt.Rows[0][0].ToString());

                m_ChiefFIO = fullname.GetFIOBrief();

                cbPosition.Text = dt.Rows[0][3].ToString();
                cbDepartment.Text = dt.Rows[0][1].ToString() + " " + dt.Rows[0][2].ToString();

                cbWorkPlace.Text = dt.Rows[0][4].ToString();

                lblState.Text = dt.Rows[0][5].ToString();

                tbLogin.Text = dt.Rows[0][6].ToString();

                if (dt.Rows[0][7].ToString() != "")
                    lblPayDoxLogin.Text = dt.Rows[0][7].ToString();
                else
                    lblPayDoxLogin.Text = dt.Rows[0][6].ToString();

                lblMainEmail.Text = dt.Rows[0][8].ToString();

                txbGKLogin.Text = dt.Rows[0][9].ToString();

                lblUserID.Text = dt.Rows[0][10].ToString();

                txbTabNo.Text = dt.Rows[0][11].ToString();

                m_ChiefPosition = dt.Rows[0][12].ToString();

                //Заполняем список телефонов

                FillPhones(_UserID);

                //Заполняем список EMAIL

                FillEmails(_UserID);

                //Заполняем список паролей
                FillPasswords(_UserID);     //TODO Уточнить нужно ли это здесь

                //Обнуляем флаги изменения
                m_NameChanged = false;
                m_LastNameChanged = false;
                m_SecondNameChanged = false;
                m_BirthdayChanged = false;
                m_DepartmentChanged = false;
                m_PositionChanged = false;
                m_PlaceChanged = false;
                m_RoomChanged = false;
                m_GKLoginChanged = false;
                btnSave.Visible = false;
            }
        }
Ejemplo n.º 2
0
        public void PrepareData(string _FullName, string _Department, string _BirthDay, string _login, string _Phone, string _WorkPlace, string _Position)
        {
            ITO_StringConverter fullname = new ITO_StringConverter(_FullName);

            txbName.Text = fullname.GetFirstName();
            txbSecondName.Text = fullname.GetSecondName();
            txbLastName.Text = fullname.GetLastName();
            dtpBirthday.Text= _BirthDay;
            txbLogin.Text = _login;
            txbPhone.Text = fullname.FormatPhone(_Phone);

            DataTable dt = m_ITOSQLCommand.ExecuteSQLCommand("Select ShortName,Name from stfOrgStructure where ShortName like '" +_Department+"%'");

            if (dt.Rows.Count > 0)
                cbDepartment.Text = dt.Rows[0][0].ToString() + " " + dt.Rows[0][1].ToString();

            dt = m_ITOSQLCommand.ExecuteSQLCommand("Select Name from stfPositions where Name='" + _Position+"'");

            if (dt.Rows.Count > 0)
                cbPosition.Text = dt.Rows[0][0].ToString();

            CheckDataUnique();

            if (m_ADcon.IsUserExisiting(txbLogin.Text))
            {
                chbAddAD.Enabled = false;
            }
            else
            {
                chbAddAD.Enabled = true;
            }
        }