protected void Butto2_Click(object sender, EventArgs e)
        {
            try
            {
                List <int> selectedRows = new List <int>();

                foreach (GridViewRow gvr in GridView1.Rows)
                {
                    if ((gvr.FindControl("CheckBox2") as CheckBox).Checked == true)
                    {
                        selectedRows.Add(gvr.Cells[0].Text.ToInt());
                    }
                }

                if (selectedRows.Count > 0)
                {
                    VPNsRepository vpnir = new VPNsRepository();
                    vpnir.DeleteVPN(selectedRows);
                    LoadvpnData();
                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgDeleteSuccessfull, Color.Green);
                }
            }
            catch
            {
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errDeleteFailed, Color.Red);
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            FacultiesRepositpry faculty = new FacultiesRepositpry();

            if (faculty.FindBytitle(TextBox1.Text) != null)
            {
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errDuplicateUsername, Color.Red);
                return;
            }

            bool successfullCreateAccount = true;

            try
            {
                Faculty newFaculty = new Faculty();
                newFaculty.FacultyTitle = TextBox1.Text.Trim();

                FacultiesRepositpry fir = new FacultiesRepositpry();
                fir.SaveFaculty(newFaculty);


                ClearForm();
            }
            catch (System.Exception err)
            {
                successfullCreateAccount = false;
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errAddFailed, Color.Red);
            }
            if (successfullCreateAccount)
            {
                // ClearForm();
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgAddSuccessfull, Color.Green);
            }
        }
Beispiel #3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            VPNsRepository vpn = new VPNsRepository();

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

            bool successfullCreateAccount = true;

            try
            {
                VPN newvpn = new VPN();
                newvpn.DepartmentID   = ddldepartment.SelectedValue.ToInt();
                newvpn.UserTypeID     = DropDownList1.SelectedValue.ToInt();
                newvpn.UserID         = ddluserid.SelectedValue.ToInt();
                newvpn.Username       = txtusername.Text;
                newvpn.Password       = txtpass.Text;
                newvpn.VPNDescription = txtdes.Text;
                VPNsRepository vpnir = new VPNsRepository();
                vpnir.Savevpn(newvpn);
            }
            catch (System.Exception err)
            {
                successfullCreateAccount = false;
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errAddFailed, Color.Red);
            }
            if (successfullCreateAccount)
            {
                // ClearForm();
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgAddSuccessfull, Color.Green);
            }
        }
        protected void Button1_Click1(object sender, EventArgs e)
        {
            if (lbllevelid.Text.Length > 0)
            {
                try
                {
                    EduLevelsRepository elir = new EduLevelsRepository();

                    if (elir.FindBytitle(TextBox1.Text) != null)
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errRepeatTitle, Color.Red);

                        return;
                    }
                    EduLevel editlevel = new EduLevel();
                    if ((TextBox1.Text.Length > 0) && (TextBox1.Text != lbltitle.Text))
                    {
                        editlevel.LevelTitle = TextBox1.Text;
                    }

                    editlevel.LevelID = lbllevelid.Text.ToInt();
                    elir.SaveEduLevel(editlevel);

                    ClearForm();


                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgUpdateSuccessfull, Color.Green);
                }
                catch
                {
                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errUpdateFailed, Color.Red);
                }
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            EmailTypesRepository emailtype = new EmailTypesRepository();

            if (emailtype.FindBytitle(TextBox1.Text) != null)
            {
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errDuplicateUsername, Color.Red);
                return;
            }


            bool successfullCreateAccount = true;


            try
            {
                EmailType newEmailType = new EmailType();
                newEmailType.EmailTypeTitle = TextBox1.Text.Trim();


                EmailTypesRepository etir = new EmailTypesRepository();
                etir.SaveEmailType(newEmailType);
                ClearForm();
            }
            catch (System.Exception err)
            {
                successfullCreateAccount = false;
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errAddFailed, Color.Red);
            }
            if (successfullCreateAccount)
            {
                // ClearForm();
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgAddSuccessfull, Color.Green);
            }
        }
Beispiel #6
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            try
            {
                List <int> selectedRows = new List <int>();

                foreach (GridViewRow gvr in GridView1.Rows)
                {
                    if ((gvr.FindControl("CheckBox2") as CheckBox).Checked == true)
                    {
                        selectedRows.Add(gvr.Cells[0].Text.ToInt());
                    }
                }

                if (selectedRows.Count > 0)
                {
                    EmailContactsRepository dir = new EmailContactsRepository();
                    dir.DeleteEmailContact(selectedRows);
                    LoadEmailContactData(Session["UserID"].ToString(), Session["UserTypeID"].ToString());


                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgDeleteSuccessfull, Color.Green);
                }
            }
            catch
            {
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errDeleteFailed, Color.Red);
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (lbllecid.Text.Length > 0)
                {
                    VLecturersRepository vLecirr = new VLecturersRepository();

                    if ((txtusername.Text.Length > 0) && (txtusername.Text != lblusername.Text))
                    {
                        if (vLecirr.FindByuserName(txtusername.Text) != null)
                        {
                            PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errRepeatuserTitle, Color.Red);

                            return;
                        }
                    }



                    PersonsAdmin person = new PersonsAdmin();
                    person.AdminID = lbllecid.Text.ToInt();

                    person.FirstName = txtname.Text;
                    person.LastName  = txtlastname.Text;

                    if ((txtusername.Text.Length > 0) && (txtusername.Text != lblusername.Text))
                    {
                        person.Username = txtusername.Text;
                    }
                    else
                    {
                        person.Username = lblusername.Text;
                    }
                    //person.Password = (txtpass.Text.Length > 0 ? FormsAuthentication.HashPasswordForStoringInConfigFile(txtpass.Text, "MD5") : person.Password);
                    if (txtpass.Text.Length > 0)
                    {
                        person.Password = FormsAuthentication.HashPasswordForStoringInConfigFile(txtpass.Text, "MD5");
                    }
                    else
                    {
                        person.Password = Session["pass"].ToString();
                    }
                    person.Status = (chkActiveAccount.Checked == true ? 0 : 1);

                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgUpdateSuccessfull, Color.Green);
                }
            }
            catch
            {
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errUpdateFailed, Color.Red);
            }
        }
Beispiel #8
0
        protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
        {
            lblmessage.Text = "";
            if (txtsearch.Text.Length > 0)
            {
                if (DropDownList1.SelectedValue == "3")
                {
                    try
                    {
                        EmailContactsRepository dir = new EmailContactsRepository();

                        Session["ecetid"]    = dir.SearchpersonEmailTypeid(txtsearch.Text.ToInt(), Session["UserTypeID"].ToString().ToInt(), Session["UserID"].ToString().ToInt());
                        GridView1.DataSource = Session["ecetid"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", dir.EmailContactCount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["ecetid"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount);
                    }
                    catch
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red);
                        lblrecordcount.Text       = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount);
                    }
                }
                if (DropDownList1.SelectedValue == "4")
                {
                    try
                    {
                        EmailContactsRepository dir = new EmailContactsRepository();

                        Session["eceaid"]    = dir.SearchpersonEmailAddrress(txtsearch.Text.ToString(), Session["UserTypeID"].ToString().ToInt(), Session["UserID"].ToString().ToInt());
                        GridView1.DataSource = Session["eceaid"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", dir.EmailContactCount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["eceaid"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount);
                    }
                    catch
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red);
                        lblrecordcount.Text       = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount);
                    }
                }
            }
            else
            {
                LoadEmailContactData(Session["UserID"].ToString(), Session["UserTypeID"].ToString());
            }
        }
Beispiel #9
0
        protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
        {
            lblmessage.Text = "";
            if (txtsearch.Text.Length > 0)
            {
                if (DropDownList1.SelectedValue == "0")
                {
                    try
                    {
                        RolesRepository rrir = new RolesRepository();

                        Session["Roledatafindid"] = rrir.Searchid(txtsearch.Text.ToInt());
                        GridView1.DataSource      = Session["Roledatafindid"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", rrir.Rolescount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["Roledatafindid"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount);
                    }
                    catch
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red);
                        lblrecordcount.Text       = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount);
                    }
                }
                if (DropDownList1.SelectedValue == "1")
                {
                    try
                    {
                        RolesRepository rrir = new RolesRepository();

                        Session["Roledatafindtitle"] = rrir.SearchTitle(txtsearch.Text.ToString());
                        GridView1.DataSource         = Session["Roledatafindtitle"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", rrir.Rolescount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["Roledatafindtitle"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount);
                    }
                    catch
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red);
                        lblrecordcount.Text       = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount);
                    }
                }
            }
            else
            {
                LoadRoleData();
            }
        }
        protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
        {
            lblmessage.Text = "";
            if (txtsearch.Text.Length > 0)
            {
                if (DropDownList1.SelectedValue == "0")
                {
                    try
                    {
                        WebServiceAccountsRepository pair = new WebServiceAccountsRepository();

                        Session["stddatafindid"] = pair.Searchid(txtsearch.Text.ToInt());
                        GridView1.DataSource     = Session["stddatafindid"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", pair.webacountcount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["stddatafindid"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount);
                    }
                    catch
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red);
                        lblrecordcount.Text       = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount);
                    }
                }
                if (DropDownList1.SelectedValue == "1")
                {
                    try
                    {
                        PersonsAdminsRepository pair = new PersonsAdminsRepository();
                        Session["stddatafindcode"] = pair.SearchFirstName(txtsearch.Text);
                        GridView1.DataSource       = Session["stddatafindcode"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", pair.PersonAdmincount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["stddatafindcode"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount);
                    }
                    catch
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red);
                        lblrecordcount.Text       = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount);
                    }
                }

                else
                {
                    LoadStdData();
                }
            }
        }
Beispiel #11
0
        protected void btnSubmitCaptcha_Click(object sender, EventArgs e)
        {
            bool success = false;

            if (Session["Captcha"] != null)
            {
                //Match captcha text entered by user and the one stored in session
                if (Convert.ToString(Session["Captcha"]) == txtCaptchaText.Text.Trim())
                {
                    success = true;
                }
            }

            lblStatus.Visible = true;
            if (success)
            {
                lblStatus.Text = "Success";
                PersonsAdminsRepository perir       = new PersonsAdminsRepository();
                PersonsAdmin            currentuser = perir.FindByUserName(tbxusername.Text);

                if (currentuser == null)
                {
                    PersonTools.ShowMessage(lblStatus, Resources.DashboardText.errInvalidUserPass, Color.Red);

                    return;
                }

                if (tbxpass.Text != currentuser.Password)
                {
                    PersonTools.ShowMessage(lblStatus, Resources.DashboardText.errInvalidUserPass, Color.Red);
                    return;
                }

                if (currentuser.Status.Value == 1)
                {
                    PersonTools.ShowMessage(lblStatus, Resources.DashboardText.errAccountIsLocked, Color.Red);
                    return;
                }


                Session["CurrentUser"] = currentuser;

                Redirector.Goto(Redirector.PageName.DepartmentsManager);
            }
            else
            {
                PersonTools.ShowMessage(lblStatus, Resources.DashboardText.errInvalidUserPass, Color.Red);
            }
        }
Beispiel #12
0
        protected void Button1_Click1(object sender, EventArgs e)
        {
            if (lblid.Text.Length > 0)
            {
                try
                {
                    EmailContactsRepository ecrir = new EmailContactsRepository();
                    if ((TextBox2.Text.Length > 0) && (TextBox2.Text != lblemailaddrress.Text))
                    {
                        if (ecrir.FindByEmailAddrress(TextBox2.Text) != null)
                        {
                            PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errRepeatemailTitle, Color.Red);

                            return;
                        }
                    }



                    //  EmailContactsRepository ecrir = new EmailContactsRepository();
                    EmailContact email = new EmailContact();
                    email.UserTypeID = Session["UserTypeID"].ToString().ToInt();
                    // email.UserID=ddluserid.SelectedValue.ToInt();
                    //  email.EmailTypeID = ddlemailtype.SelectedValue.ToInt();
                    email.UserID      = Session["UserID"].ToString().ToInt();
                    email.EmailTypeID = Session["newemailtype"].ToString().ToInt();

                    email.ID = lblid.Text.ToInt();
                    ecrir.SaveEmailContact(email);

                    if ((TextBox2.Text.Length > 0) && (TextBox2.Text != lblemailaddrress.Text))
                    {
                        email.EmailAddrress = TextBox2.Text.Trim();
                    }


                    clearform();


                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgUpdateSuccessfull, Color.Green);
                }
                catch
                {
                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errUpdateFailed, Color.Red);
                }
            }
        }
Beispiel #13
0
        protected void Button1_Click1(object sender, EventArgs e)
        {
            if (lblid.Text.Length > 0)
            {
                try
                {
                    TelContactsRepository telir = new TelContactsRepository();
                    if ((TextBox2.Text.Length > 0) && (TextBox2.Text != lbltelnumber.Text))
                    {
                        if (telir.FindBytelnumber(TextBox2.Text) != null)
                        {
                            PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errRepeatetelTitle, Color.Red);

                            return;
                        }
                    }


                    TelContactsRepository ecrir = new TelContactsRepository();
                    TelContact            tel   = new TelContact();
                    tel.UserTypeID = DropDownList1.SelectedItem.Value.ToInt();
                    // tel.UserID = ddluserid.SelectedValue.ToInt();
                    tel.UserID    = Session["newuserid"].ToString().ToInt();
                    tel.TelTypeID = Session["newteltype"].ToString().ToInt();
                    //   tel.TelTypeID = ddlTeltype.SelectedValue.ToInt();

                    tel.ID = lblid.Text.ToInt();
                    if ((TextBox2.Text.Length > 0) && (TextBox2.Text != lbltelnumber.Text))
                    {
                        tel.TelNumber = TextBox2.Text.Trim();
                    }
                    ecrir.SavetelContact(tel);



                    clearform();


                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgUpdateSuccessfull, Color.Green);
                }
                catch
                {
                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errUpdateFailed, Color.Red);
                }
            }
        }
Beispiel #14
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            EmailContactsRepository email = new EmailContactsRepository();

            if (email.FindByEmailAddrress(TextBox1.Text) != null)
            {
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errDuplicateUsername, Color.Red);
                return;
            }



            bool successfullCreateAccount = true;


            try
            {
                EmailContact newcontact = new EmailContact();
                newcontact.UserTypeID = lblusertypeid.Text.ToInt();

                newcontact.UserID        = lbluserid.Text.ToInt();
                newcontact.EmailTypeID   = ddlemailtype.SelectedValue.ToInt();
                newcontact.EmailAddrress = TextBox1.Text.Trim();

                EmailContactsRepository ecrir = new EmailContactsRepository();
                ecrir.SaveEmailContact(newcontact);



                ClearForm();
            }
            catch (System.Exception err)
            {
                successfullCreateAccount = false;
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errAddFailed, Color.Red);
            }
            if (successfullCreateAccount)
            {
                // ClearForm();
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgAddSuccessfull, Color.Green);
            }
        }
Beispiel #15
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            PersonsAdminsRepository parir = new PersonsAdminsRepository();

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



            bool successfullCreateAccount = true;

            try
            {
                PersonsAdminsRepository pair  = new PersonsAdminsRepository();
                PersonsAdmin            newpa = new PersonsAdmin();
                newpa.FirstName = txtname.Text.Trim();
                newpa.LastName  = txtlastname.Text.Trim();
                newpa.Username  = txtusername.Text.Trim();
                newpa.Password  = FormsAuthentication.HashPasswordForStoringInConfigFile(txtpass.Text, "MD5");
                newpa.Status    = (chkActiveAccount.Checked == true ? 0 : 1);

                pair.SavePerson(newpa);


                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);
            }
        }
Beispiel #16
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            try
            {
                List <int> selectedRows = new List <int>();

                foreach (GridViewRow gvr in GridView1.Rows)
                {
                    if ((gvr.FindControl("CheckBox2") as CheckBox).Checked == true)
                    {
                        selectedRows.Add(gvr.Cells[0].Text.ToInt());
                    }
                }

                if (selectedRows.Count > 0)
                {
                    VLecturersRepository vstdir = new VLecturersRepository();
                    vstdir.Deletelec(selectedRows);
                    //   vstdir.Deletelecturer(selectedRows);
                    LoadStdData();

                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgDeleteSuccessfull, Color.Green);


                    EmailContactsRepository emrir = new EmailContactsRepository();
                    emrir.DeletepersonEmailContact(selectedRows);
                    LoadStdData();

                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgDeleteSuccessfull, Color.Green);

                    TelContactsRepository trir = new TelContactsRepository();
                    trir.DeletepersonTelContact(selectedRows);
                    LoadStdData();
                }
            }
            catch
            {
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errDeleteFailed, Color.Red);
            }
        }
Beispiel #17
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            TelContactsRepository tel = new TelContactsRepository();

            if (tel.FindBytelnumber(TextBox1.Text) != null)
            {
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errDuplicateUsername, Color.Red);
                return;
            }

            bool successfullCreateAccount = true;

            try
            {
                TelContact newcontact = new  TelContact();
                newcontact.UserTypeID = DropDownList1.SelectedValue.ToInt();
                newcontact.UserID     = ddluserid.SelectedValue.ToInt();
                newcontact.TelTypeID  = ddlTeltype.SelectedValue.ToInt();
                newcontact.TelNumber  = TextBox1.Text.Trim();

                TelContactsRepository ecrir = new  TelContactsRepository();


                ecrir.SavetelContact(newcontact);

                ClearForm();
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgAddSuccessfull, Color.Green);
            }
            catch (System.Exception err)
            {
                successfullCreateAccount = false;
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errAddFailed, Color.Red);
            }
            if (successfullCreateAccount)
            {
                // ClearForm();
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgAddSuccessfull, Color.Green);
            }
        }
        protected void Button1_Click1(object sender, EventArgs e)
        {
            if (lblEmailTypeid.Text.Length > 0)
            {
                try
                {
                    TelTypesRepository etir = new TelTypesRepository();


                    if (etir.FindBytitle(TextBox1.Text) != null)
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errRepeatTitle, Color.Red);

                        return;
                    }



                    TelType editteltype = new TelType();
                    if ((TextBox1.Text.Length > 0) && (TextBox1.Text != lbltitle.Text))
                    {
                        editteltype.TelTypeTitle = TextBox1.Text;
                    }

                    editteltype.TelTypeID = lblEmailTypeid.Text.ToInt();

                    etir.SaveTelType(editteltype);
                    ClearForm();


                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgUpdateSuccessfull, Color.Green);
                }
                catch
                {
                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errUpdateFailed, Color.Red);
                }
            }
        }
        protected void Button1_Click1(object sender, EventArgs e)
        {
            if (lblFacultyid.Text.Length > 0)
            {
                try
                {
                    FacultiesRepositpry fir = new FacultiesRepositpry();

                    if (fir.FindBytitle(TextBox1.Text) != null)
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errRepeatGroupTitle, Color.Red);

                        return;
                    }
                    Faculty editFulty = new Faculty();
                    if ((TextBox1.Text.Length > 0) && (TextBox1.Text != lbltitle.Text))
                    {
                        editFulty.FacultyTitle = TextBox1.Text;
                    }

                    editFulty.FacultyID = lblFacultyid.Text.ToInt();


                    fir.SaveFaculty(editFulty);



                    ClearForm();


                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgUpdateSuccessfull, Color.Green);
                }
                catch
                {
                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errUpdateFailed, Color.Red);
                }
            }
        }
        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);
            //}
        }
        protected void Button1_Click1(object sender, EventArgs e)
        {
            if (lblDepartmentid.Text.Length > 0)
            {
                try
                {
                    DepartmentsRepository dir = new DepartmentsRepository();

                    if (dir.FindBytitle(TextBox1.Text) != null)
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errRepeatTitle, Color.Red);

                        return;
                    }
                    Department editdepartment = new Department();

                    editdepartment.DepartmentID = lblDepartmentid.Text.ToInt();
                    if ((TextBox1.Text.Length > 0) && (TextBox1.Text != lbltitle.Text))
                    {
                        editdepartment.DepartmentTitle = TextBox1.Text;
                    }

                    dir.SaveDepartment(editdepartment);



                    ClearForm();


                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgUpdateSuccessfull, Color.Green);
                }
                catch
                {
                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errUpdateFailed, Color.Red);
                }
            }
        }
Beispiel #22
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            DepartmentsRepository dep = new DepartmentsRepository();

            if (dep.FindBytitle(TextBox1.Text) != null)
            {
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errDuplicateUsername, Color.Red);
                return;
            }



            bool successfullCreateAccount = true;


            try
            {
                Department newDepartment = new Department();
                newDepartment.DepartmentTitle = TextBox1.Text.Trim();

                DepartmentsRepository dir = new DepartmentsRepository();
                dir.SaveDepartment(newDepartment);

                ClearForm();
            }

            catch (System.Exception err)
            {
                successfullCreateAccount = false;
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errAddFailed, Color.Red);
            }
            if (successfullCreateAccount)
            {
                // ClearForm();
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgAddSuccessfull, Color.Green);
            }
        }
Beispiel #23
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            VEduTendenciesRepository ten = new VEduTendenciesRepository();

            if (ten.FindByTendencyTitle(TextBox1.Text) != null)
            {
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errDuplicateUsername, Color.Red);
                return;
            }



            bool successfullCreateAccount = true;


            try
            {
                EduTendency newTendency = new EduTendency();

                VEduTendenciesRepository ctrir = new VEduTendenciesRepository();
                newTendency.TendencyTitle = TextBox1.Text.Trim();

                newTendency.FieldID = ddlfield.SelectedValue.ToInt();
                ctrir.SaveTen(newTendency);
                ClearForm();
            }
            catch (System.Exception err)
            {
                successfullCreateAccount = false;
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errAddFailed, Color.Red);
            }
            if (successfullCreateAccount)
            {
                // ClearForm();
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgAddSuccessfull, Color.Green);
            }
        }
Beispiel #24
0
        protected void Button1_Click1(object sender, EventArgs e)
        {
            if (lblid.Text.Length > 0)
            {
                try
                {
                    VPNsRepository vpnir = new VPNsRepository();
                    if ((txtusername.Text.Length > 0) && (txtusername.Text != lblusername.Text))
                    {
                        if (vpnir.FindByUsername(txtusername.Text) != null)
                        {
                            PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errRepeatemailTitle, Color.Red);
                            return;
                        }
                    }
                    VPN vpn = vpnir.FindvpnByid(lblid.Text.ToInt());
                    vpn.UserTypeID   = Session["UserType"].ToString().ToInt();
                    vpn.UserID       = Session["UserID"].ToString().ToInt();
                    vpn.DepartmentID = Session["DepartmentID"].ToString().ToInt();
                    if ((txtusername.Text.Length > 0) && (txtusername.Text != lblusername.Text))
                    {
                        vpn.Username = txtusername.Text;
                    }
                    if ((txtpass.Text != null))
                    {
                        vpn.Password = txtpass.Text;
                    }
                    vpnir.Savevpn(vpn);

                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgUpdateSuccessfull, Color.Green);
                }
                catch
                {
                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errUpdateFailed, Color.Red);
                }
            }
        }
Beispiel #25
0
        protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
        {
            lblmessage.Text = "";
            if (txtsearch.Text.Length > 0)
            {
                if (DropDownList1.SelectedValue == "0")
                {
                    try
                    {
                        VStudentsRepository vstdir = new VStudentsRepository();

                        Session["stddatafindid"] = vstdir.Searchstdid(txtsearch.Text.ToInt());
                        GridView1.DataSource     = Session["stddatafindid"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", vstdir.stdcount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["stddatafindid"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount);
                    }
                    catch
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red);
                        lblrecordcount.Text       = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount);
                    }
                }
                if (DropDownList1.SelectedValue == "1")
                {
                    try
                    {
                        VStudentsRepository vstdir = new VStudentsRepository();
                        Session["stddatafindcode"] = vstdir.Searchstdcode(txtsearch.Text);
                        GridView1.DataSource       = Session["stddatafindcode"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", vstdir.stdcount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["stddatafindcode"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount);
                    }
                    catch
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red);
                        lblrecordcount.Text       = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount);
                    }
                }
                if (DropDownList1.SelectedValue == "2")
                {
                    try
                    {
                        VStudentsRepository vstdir = new VStudentsRepository();
                        Session["stddatafindFirstName"] = vstdir.SearchFirstName(txtsearch.Text);
                        GridView1.DataSource            = Session["stddatafindFirstName"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", vstdir.stdcount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["stddatafindFirstName"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount);
                    }
                    catch
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red);
                        lblrecordcount.Text       = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount);
                    }
                }
                if (DropDownList1.SelectedValue == "3")
                {
                    try
                    {
                        VStudentsRepository vstdir = new VStudentsRepository();
                        Session["stddatafindLasttName"] = vstdir.SearchLastName(txtsearch.Text);
                        GridView1.DataSource            = Session["stddatafindLasttName"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", vstdir.stdcount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["stddatafindLasttName"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount);
                    }
                    catch
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red);
                        lblrecordcount.Text       = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount);
                    }
                }
                if (DropDownList1.SelectedValue == "4")
                {
                    try
                    {
                        VStudentsRepository vstdir = new VStudentsRepository();
                        Session["stddatafindUsername"] = vstdir.SearchUserName(txtsearch.Text);
                        GridView1.DataSource           = Session["stddatafindUsername"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", vstdir.stdcount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["stddatafindUsername"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount);
                    }
                    catch
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red);
                        lblrecordcount.Text       = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount);
                    }
                }
                if (DropDownList1.SelectedValue == "5")
                {
                    try
                    {
                        VStudentsRepository vstdir = new VStudentsRepository();
                        Session["stddatafindFacultyTitle"] = vstdir.SearchFacultyTitle(txtsearch.Text);
                        GridView1.DataSource = Session["stddatafindFacultyTitle"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", vstdir.stdcount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["stddatafindFacultyTitle"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount);
                    }
                    catch
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red);
                        lblrecordcount.Text       = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount);
                    }
                }

                if (DropDownList1.SelectedValue == "6")
                {
                    try
                    {
                        VStudentsRepository vstdir = new VStudentsRepository();
                        Session["stddatafindLevelTitle"] = vstdir.SearchLevelTitle(txtsearch.Text);
                        GridView1.DataSource             = Session["stddatafindLevelTitle"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", vstdir.stdcount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["stddatafindLevelTitle"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount);
                    }
                    catch
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red);
                        lblrecordcount.Text       = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount);
                    }
                }

                if (DropDownList1.SelectedValue == "7")
                {
                    try
                    {
                        VStudentsRepository vstdir = new VStudentsRepository();
                        Session["stddatafindFielsTitle"] = vstdir.SearchFieldTitle(txtsearch.Text);
                        GridView1.DataSource             = Session["stddatafindFielsTitle"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", vstdir.stdcount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["stddatafindFielsTitle"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount);
                    }
                    catch
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red);
                        lblrecordcount.Text       = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount);
                    }
                }

                if (DropDownList1.SelectedValue == "8")
                {
                    try
                    {
                        VStudentsRepository vstdir = new VStudentsRepository();
                        Session["stddatafindTendencyTitle"] = vstdir.SearchTendencyTitle(txtsearch.Text);
                        GridView1.DataSource = Session["stddatafindTendencyTitle"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", vstdir.stdcount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["stddatafindTendencyTitle"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount);
                    }
                    catch
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red);
                        lblrecordcount.Text       = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount);
                    }
                }
            }
            else
            {
                LoadStdData();
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            VLecturersRepository vlec = new VLecturersRepository();

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



            bool successfullCreateAccount = true;

            try
            {
                string serverpath = Server.MapPath(Request.ApplicationPath) + @"\file\" + PersonTools.CurrentPersianDateWithoutSlash() + PersonTools.CurrentTimeWithoutColons() + FileUpload1.FileName;
                string filename   = PersonTools.CurrentPersianDateWithoutSlash() + PersonTools.CurrentTimeWithoutColons() + FileUpload1.FileName;

                VLecturersRepository vstdir = new VLecturersRepository();

                if (vstdir.FindByLinkUrl(filename) != null)
                {
                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errAddFailedFileUploadrepeat, Color.Red);

                    return;
                }
                else
                {
                    if (FileUpload1.FileName.Length > 0)
                    {
                        int filesize = FileUpload1.FileBytes.Length / 1024;
                        if (filesize >= 4000)
                        {
                            PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errAddFailedFileUploadsize, Color.Red);
                            return;
                        }
                        else
                        {
                            FileUpload1.SaveAs(serverpath);
                        }
                    }
                    else
                    {
                        //  PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errAddFailedFileUploadempty, Color.Red);
                        //  return;
                        filename = "";
                    }
                }



                Lecturer newstd = new Lecturer();

                newstd.FirstName    = txtname.Text;
                newstd.LastName     = txtlastname.Text;
                newstd.Gender       = RadioButtonList1.SelectedValue.ToInt();
                newstd.NationalCode = txtnationalcode.Text;
                newstd.FacultyID    = ddlfacultuy.SelectedValue.ToInt();

                newstd.FieldID    = ddlfield.SelectedValue.ToInt();
                newstd.TendencyID = ddltendency.SelectedValue.ToInt();

                newstd.Username = txtusername.Text;
                newstd.Password = FormsAuthentication.HashPasswordForStoringInConfigFile(txtpass.Text, "MD5");

                newstd.ImageFileName = filename;
                newstd.Status        = (chkActiveAccount.Checked == true ? 0 : 1);


                VLecturersRepository vstdirr = new VLecturersRepository();
                vstdirr.Savestd(newstd);


                clearform();
            }
            catch (System.Exception err)
            {
                successfullCreateAccount = false;

                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errAddFailed, Color.Red);
            }
            if (successfullCreateAccount)
            {
                // ClearForm();
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgAddSuccessfull, Color.Green);
            }
        }
Beispiel #27
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (lblstdid.Text.Length > 0)
            {
                try
                {
                    string serverpath = Server.MapPath(Request.ApplicationPath) + @"\file\" + PersonTools.CurrentPersianDateWithoutSlash() + PersonTools.CurrentTimeWithoutColons() + FileUpload1.FileName;
                    string filename   = PersonTools.CurrentPersianDateWithoutSlash() + PersonTools.CurrentTimeWithoutColons() + FileUpload1.FileName;

                    VStudentsRepository vstdir = new VStudentsRepository();

                    if (vstdir.FindByLinkUrl(filename) != null)
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errAddFailedFileUploadrepeat, Color.Red);

                        return;
                    }
                    else
                    {
                        if (FileUpload1.FileName.Length > 0)
                        {
                            int filesize = FileUpload1.FileBytes.Length / 1024;
                            if (filesize >= 4000)
                            {
                                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errAddFailedFileUploadsize, Color.Red);
                                return;
                            }
                            else
                            {
                                FileUpload1.SaveAs(serverpath);
                            }
                        }
                        else
                        {
                            filename = Session["imageurl"].ToString();
                        }
                    }

                    if ((txtusername.Text.Length > 0) && (txtusername.Text != lblusername.Text))
                    {
                        if (vstdir.FindByuserName(txtusername.Text) != null)
                        {
                            PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errRepeatuserTitle, Color.Red);

                            return;
                        }
                    }
                    VStudentsRepository vstdirr = new VStudentsRepository();
                    Student             std     = new Student();
                    std.StudentID    = lblstdid.Text.ToInt();
                    std.StudentCode  = txtstdcode.Text;
                    std.FirstName    = txtname.Text;
                    std.LastName     = txtlastname.Text;
                    std.Gender       = RadioButtonList1.SelectedValue.ToInt();
                    std.NationalCode = txtnationalcode.Text;
                    std.FacultyID    = Session["newfacultyid"].ToString().ToInt();
                    std.LevelID      = Session["newlevelid"].ToString().ToInt();
                    std.FieldID      = Session["newfieldid"].ToString().ToInt();
                    std.TendencyID   = Session["newtenid"].ToString().ToInt();
                    std.EntryTerm    = RadioButtonList2.SelectedValue.ToInt();
                    if ((txtusername.Text.Length > 0) && (txtusername.Text != lblusername.Text))
                    {
                        std.Username = txtusername.Text;
                    }
                    else
                    {
                        std.Username = lblusername.Text;
                    }

                    if (txtpass.Text.Length > 0)
                    {
                        std.Password = FormsAuthentication.HashPasswordForStoringInConfigFile(txtpass.Text, "MD5");
                    }
                    else
                    {
                        std.Password = Session["pass"].ToString();
                    }

                    std.Status        = (chkActiveAccount.Checked == true ? 0 : 1);
                    std.ImageFileName = filename;
                    vstdirr.Savestd(std);
                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgUpdateSuccessfull, Color.Green);
                }
                catch
                {
                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errUpdateFailed, Color.Red);
                }
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (lblempid.Text.Length > 0)
            {
                try
                {
                    string serverpath = Server.MapPath(Request.ApplicationPath) + @"\file\" + PersonTools.CurrentPersianDateWithoutSlash() + PersonTools.CurrentTimeWithoutColons() + FileUpload1.FileName;
                    string filename   = PersonTools.CurrentPersianDateWithoutSlash() + PersonTools.CurrentTimeWithoutColons() + FileUpload1.FileName;


                    VEmployeesRepository vLecir = new VEmployeesRepository();
                    if (vLecir.FindByLinkUrl(filename) != null)
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errAddFailedFileUploadrepeat, Color.Red);

                        return;
                    }
                    else
                    {
                        if (FileUpload1.FileName.Length > 0)
                        {
                            int filesize = FileUpload1.FileBytes.Length / 1024;
                            if (filesize >= 4000)
                            {
                                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errAddFailedFileUploadsize, Color.Red);
                                return;
                            }
                            else
                            {
                                FileUpload1.SaveAs(serverpath);
                            }
                        }
                        else
                        {
                            filename = Session["imageurl"].ToString();
                        }
                    }

                    if ((txtusername.Text.Length > 0) && (txtusername.Text != lblusername.Text))
                    {
                        if (vLecir.FindByuserName(txtusername.Text) != null)
                        {
                            PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errRepeatuserTitle, Color.Red);

                            return;
                        }
                    }

                    VEmployeesRepository vempirr = new VEmployeesRepository();
                    Employee             emp     = new Employee();

                    emp.EmployeeID = lblempid.Text.ToInt();

                    emp.FirstName    = txtname.Text;
                    emp.LastName     = txtlastname.Text;
                    emp.Gender       = RadioButtonList1.SelectedValue.ToInt();
                    emp.NationalCode = txtnationalcode.Text;
                    emp.DepartmentID = Session["newdep"].ToString().ToInt();
                    emp.RoleID       = Session["newrole"].ToString().ToInt();
                    if ((txtusername.Text.Length > 0) && (txtusername.Text != lblusername.Text))
                    {
                        emp.Username = txtusername.Text;
                    }
                    else
                    {
                        emp.Username = lblusername.Text;
                    }

                    //emp.Password = (txtpass.Text.Length > 0 ? FormsAuthentication.HashPasswordForStoringInConfigFile(txtpass.Text, "MD5") : emp.Password);
                    if (txtpass.Text.Length > 0)
                    {
                        emp.Password = FormsAuthentication.HashPasswordForStoringInConfigFile(txtpass.Text, "MD5");
                    }
                    else
                    {
                        emp.Password = Session["pass"].ToString();
                    }
                    emp.Status = (chkActiveAccount.Checked == true ? 0 : 1);

                    emp.ImageFileName = filename;
                    vempirr.Saveemp(emp);

                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgUpdateSuccessfull, Color.Green);
                }
                catch
                {
                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errUpdateFailed, Color.Red);
                }
            }
        }
        protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
        {
            lblmessage.Text = "";
            if (txtsearch.Text.Length > 0)
            {
                if (DropDownList1.SelectedValue == "0")
                {
                    try
                    {
                        VPNsRepository vpnir = new VPNsRepository();
                        Session["ecid"]      = vpnir.Searchusername(txtsearch.Text);
                        GridView1.DataSource = Session["ecid"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", vpnir.VPNCount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["ecid"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount);
                    }
                    catch
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red);
                        lblrecordcount.Text       = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount);
                    }
                }
                if (DropDownList1.SelectedValue == "1")
                {
                    try
                    {
                        VPNsRepository vpnir = new VPNsRepository();
                        Session["ecutid"]    = vpnir.SearchUserTypeid(txtsearch.Text.ToInt());
                        GridView1.DataSource = Session["ecutid"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", vpnir.VPNCount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["ecutid"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount);
                    }
                    catch
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red);
                        lblrecordcount.Text       = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount);
                    }
                }
                if (DropDownList1.SelectedValue == "2")
                {
                    try
                    {
                        VPNsRepository vpnir = new VPNsRepository();
                        Session["ecuid"]     = vpnir.SearchUserid(txtsearch.Text.ToInt());
                        GridView1.DataSource = Session["ecuid"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", vpnir.VPNCount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["ecuid"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount);
                    }
                    catch
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red);
                        lblrecordcount.Text       = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount);
                    }
                }
            }
            else
            {
                LoadvpnData();
            }
        }
Beispiel #30
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            VEmployeesRepository emp = new VEmployeesRepository();

            if (emp.FindByuserName(txtmail.Text) != null)
            {
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errDuplicateUsername, Color.Red);
                return;
            }



            //  bool successfullCreateAccount = true;
            //try
            //{
            string serverpath = Server.MapPath(Request.ApplicationPath) + @"\file\" + PersonTools.CurrentPersianDateWithoutSlash() + PersonTools.CurrentTimeWithoutColons() + FileUpload1.FileName;
            string filename   = PersonTools.CurrentPersianDateWithoutSlash() + PersonTools.CurrentTimeWithoutColons() + FileUpload1.FileName;


            //VEmployeesRepository vstdir = new VEmployeesRepository();
            //if (vstdir.FindByLinkUrl(filename) != null)
            //{
            //    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errAddFailedFileUploadrepeat, Color.Red);

            //    return;
            //}
            //else
            //{

            if (FileUpload1.FileName.Length > 0)
            {
                //int filesize = FileUpload1.FileBytes.Length / 1024;
                //if (filesize >= 4000)
                //{
                //    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errAddFailedFileUploadsize, Color.Red);
                //    return;
                //}
                //else
                //{

                FileUpload1.SaveAs(serverpath);
                //  }
            }
            else
            {
                //  PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errAddFailedFileUploadempty, Color.Red);
                //  return;
                filename = "";
            }
            //   }



            Employee newemp = new Employee();

            newemp.DepartmentID = ddldep.SelectedValue.ToInt();
            newemp.RoleID       = ddlrole.SelectedValue.ToInt();
            newemp.FirstName    = txtname.Text;
            newemp.LastName     = txtlastname.Text;
            newemp.Gender       = RadioButtonList1.SelectedValue.ToInt();
            newemp.NationalCode = txtnationalcode.Text;


            newemp.ImageFileName = filename;
            newemp.FixTel        = txttel.Text;
            newemp.Email         = txtmail.Text;
            newemp.Mobile        = txtmobile.Text;

            VEmployeesRepository vstdirr = new VEmployeesRepository();

            vstdirr.Saveemp(newemp);


            clearform();
            PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgAddSuccessfull, Color.Green);
        }