Esempio n. 1
0
        public void SetEmpStatusByUsername(string username, string password, string Username, bool isactive)
        {
            WebServiceAccountsRepository webir       = new WebServiceAccountsRepository();
            WebServiceAccount            currentuser = webir.FindByUserName(username);

            if (currentuser != null)
            {
                if (currentuser.Password == password)
                {
                    VEmployeesRepository vempir = new VEmployeesRepository();
                    Employee             emp    = vempir.FindByuserName2(Username);
                    if (isactive == true)

                    {
                        emp.Status = "0".ToInt();
                    }
                    else
                    {
                        emp.Status = "1".ToInt();
                    }
                    vempir.Saveemp(emp);
                }
                else
                {
                }
            }

            else
            {
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            //try
            //{

            if (lbllecid.Text.Length > 0)
            {
                WebServiceAccountsRepository webir = new WebServiceAccountsRepository();
                if ((txtusername.Text.Length > 0) && (txtusername.Text != lblusername.Text))
                {
                    if (webir.FindByUserName(txtusername.Text) != null)
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errRepeatuserTitle, Color.Red);

                        return;
                    }
                }

                WebServiceAccountsRepository webirr  = new WebServiceAccountsRepository();
                WebServiceAccount            account = new WebServiceAccount();

                if ((txtusername.Text.Length > 0) && (txtusername.Text != lblusername.Text))
                {
                    account.Username = txtusername.Text;
                }

                account.AccountID = lbllecid.Text.ToInt();
                account.Password  = (txtpass.Text.Length > 0 ? FormsAuthentication.HashPasswordForStoringInConfigFile(txtpass.Text, "MD5") : account.Password);
                account.Status    = (chkActiveAccount.Checked == true ? 0 : 1);
                webirr.Saveaccount(account);
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgUpdateSuccessfull, Color.Green);
            }
            //}
            //catch
            //{
            //    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errUpdateFailed, Color.Red);
            //}
        }
Esempio n. 3
0
        public void SetstdPasswordByID(string username, string password, int studentID, string NewPassword)
        {
            WebServiceAccountsRepository webir       = new WebServiceAccountsRepository();
            WebServiceAccount            currentuser = webir.FindByUserName(username);

            if (currentuser != null)
            {
                if (currentuser.Password == password)
                {
                    VStudentsRepository vempir = new VStudentsRepository();
                    Student             emp    = vempir.FindByid2(studentID);
                    emp.Password = NewPassword;
                    vempir.Savestd(emp);
                }
                else
                {
                }
            }

            else
            {
            }
        }
Esempio n. 4
0
        public VStudent FindByStdNationalCode(string username, string password, string stdcode)
        {
            WebServiceAccountsRepository webir       = new WebServiceAccountsRepository();
            WebServiceAccount            currentuser = webir.FindByUserName(username);

            if (currentuser != null)
            {
                if (currentuser.Password == password)
                {
                    VStudentsRepository depir = new VStudentsRepository();
                    return(depir.FindBynationatcode(stdcode));
                }
                else
                {
                    return(null);
                }
            }

            else
            {
                return(null);
            }
        }
Esempio n. 5
0
        public VStudent FindByStudentID(string username, string password, int id)
        {
            WebServiceAccountsRepository webir       = new WebServiceAccountsRepository();
            WebServiceAccount            currentuser = webir.FindByUserName(username);

            if (currentuser != null)
            {
                if (currentuser.Password == password)
                {
                    VStudentsRepository depir = new VStudentsRepository();
                    return(depir.FindByid(id));
                }
                else
                {
                    return(null);
                }
            }

            else
            {
                return(null);
            }
        }
Esempio n. 6
0
        public DataTable GetStudent(string username, string password)
        {
            WebServiceAccountsRepository webir       = new WebServiceAccountsRepository();
            WebServiceAccount            currentuser = webir.FindByUserName(username);

            if (currentuser != null)
            {
                if (currentuser.Password == password)
                {
                    VStudentsRepository depir = new VStudentsRepository();
                    return(depir.GetAllstd());
                }
                else
                {
                    return(null);
                }
            }

            else
            {
                return(null);
            }
        }
Esempio n. 7
0
        public VLecturer FindByLecNationalCode(string username, string password, string lecnationalcode)
        {
            WebServiceAccountsRepository webir       = new WebServiceAccountsRepository();
            WebServiceAccount            currentuser = webir.FindByUserName(username);

            if (currentuser != null)
            {
                if (currentuser.Password == password)
                {
                    VLecturersRepository depir = new VLecturersRepository();
                    return(depir.FindBynationalcode(lecnationalcode));
                }
                else
                {
                    return(null);
                }
            }

            else
            {
                return(null);
            }
        }
Esempio n. 8
0
        public void UpdateEmployeeByID(string username, string password, int EmpID, Employee emp)
        {
            WebServiceAccountsRepository webir       = new WebServiceAccountsRepository();
            WebServiceAccount            currentuser = webir.FindByUserName(username);

            if (currentuser != null)
            {
                if (currentuser.Password == password)
                {
                    VEmployeesRepository vempir   = new VEmployeesRepository();
                    Employee             employee = vempir.FindByid2(EmpID);

                    vempir.Saveemp(emp);
                }
                else
                {
                }
            }

            else
            {
            }
        }
Esempio n. 9
0
        public VEmployee FindByEmpNationalCode(string username, string password, string empcode)
        {
            WebServiceAccountsRepository webir       = new WebServiceAccountsRepository();
            WebServiceAccount            currentuser = webir.FindByUserName(username);

            if (currentuser != null)
            {
                if (currentuser.Password == password)
                {
                    VEmployeesRepository depir = new VEmployeesRepository();
                    return(depir.FindBynationalcode(empcode));
                }
                else
                {
                    return(null);
                }
            }

            else
            {
                return(null);
            }
        }
Esempio n. 10
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            WebServiceAccountsRepository parir = new WebServiceAccountsRepository();

            if (parir.FindByUserName(txtusername.Text) != null)
            {
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errDuplicateUsername, Color.Red);
                return;
            }

            bool successfullCreateAccount = true;

            try
            {
                WebServiceAccount webaccount = new WebServiceAccount();
                webaccount.Username = txtusername.Text.Trim();
                webaccount.Password = FormsAuthentication.HashPasswordForStoringInConfigFile(txtpass.Text, "MD5");
                webaccount.Status   = (chkActiveAccount.Checked == true ? 0 : 1);

                parir.Saveaccount(webaccount);


                clearform();
            }
            catch (System.Exception err)
            {
                //OnlineTools.ShowMessage(lblMessage, err.Message, Color.Red);
                successfullCreateAccount = false;
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errAddFailed, Color.Red);
            }
            if (successfullCreateAccount)
            {
                // ClearForm();
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgAddSuccessfull, Color.Green);
            }
        }