예제 #1
0
        protected void Button3_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)
                {
                    TelContactsRepository dir = new TelContactsRepository();
                    dir.DeleteTelContact(selectedRows);
                    LoadTelContactData(Session["UserID"].ToString(), Session["UserTypeID"].ToString());


                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgDeleteSuccessfull, Color.Green);
                }
            }
            catch
            {
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errDeleteFailed, Color.Red);
            }
        }
예제 #2
0
        protected void Button3_Click2(object sender, EventArgs e)
        {
            TelContactsRepository vstdir = new TelContactsRepository();

            if (vstdir.Getexeldata() != null)
            {
                DumpExcel(vstdir.Getexeldata(), "TelContacts");
            }
        }
예제 #3
0
        protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
        {
            lblmessage.Text = "";
            if (txtsearch.Text.Length > 0)
            {
                if (DropDownList1.SelectedValue == "3")
                {
                    try
                    {
                        TelContactsRepository dir = new  TelContactsRepository();

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

                        lblrecordcount.Text       = string.Format("{0} : {1}", dir.TelContactCount().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
                    {
                        TelContactsRepository dir = new  TelContactsRepository();

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

                        lblrecordcount.Text       = string.Format("{0} : {1}", dir.TelContactCount().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
            {
                LoadTelContactData(Session["UserID"].ToString(), Session["UserTypeID"].ToString());
            }
        }
예제 #4
0
        public void LoadTelContactData(string userid, string usertypeid)
        {
            //try
            //{

            TelContactsRepository dir = new  TelContactsRepository();

            Session["TelPersonContactData"] = dir.GetTelpersonContactList(userid.ToInt(), usertypeid.ToInt());

            GridView1.DataSource = Session["TelPersonContactData"];


            GridView1.DataBind();

            lblrecordcount.Text = string.Format("{0} : {1}", dir.TelContactCount().ToString().ToFarsiNumber(), Resources.DashboardText.RecordCount);

            lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["TelPersonContactData"] as DataTable).Rows.Count.ToString().ToFarsiNumber(), Resources.DashboardText.SelectRecordCount);

            switch (Session["UserTypeID"].ToString())
            {
            case "1":
            {
                VStudentsRepository vstdir = new VStudentsRepository();
                VStudent            std    = vstdir.FindByid(Session["UserID"].ToString().ToInt());
                Label9.Text = "دانشجو" + ":" + std.FirstName + " " + std.LastName;
            }
            break;

            case "2":
            {
                VLecturersRepository vlec = new VLecturersRepository();
                VLecturer            lec  = vlec.FindByid(Session["UserID"].ToString().ToInt());
                Label9.Text = "استاد" + ":" + lec.FirstName + " " + lec.LastName;
            }
            break;

            case "3":
            {
                VEmployeesRepository vlec = new VEmployeesRepository();
                VEmployee            emp  = vlec.FindByid(Session["UserID"].ToString().ToInt());
                Label9.Text = "کارمند" + ":" + emp.FirstName + " " + emp.LastName;
            }
            break;
            }
            // }
            // catch
            // {
            ////    Redirector.Goto(Redirector.PageName.errorpage);
            // }
        }
예제 #5
0
        public void LoadTelContactData()
        {
            TelContactsRepository dir = new  TelContactsRepository();

            Session["TelContactData"] = dir.GetAllTelContacts();

            GridView1.DataSource = Session["TelContactData"];


            GridView1.DataBind();

            lblrecordcount.Text = string.Format("{0} : {1}", dir.TelContactCount().ToString().ToFarsiNumber(), Resources.DashboardText.RecordCount);

            lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["TelContactData"] as DataTable).Rows.Count.ToString().ToFarsiNumber(), Resources.DashboardText.SelectRecordCount);
        }
예제 #6
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);
                }
            }
        }
예제 #7
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);
            }
        }
예제 #8
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 = lblusertypeid.Text.ToInt();

                newcontact.UserID    = lbluserid.Text.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);
            }
        }
예제 #9
0
        public TelContact FindByTelContactID(string username, string password, int id)
        {
            WebServiceAccountsRepository webir       = new WebServiceAccountsRepository();
            WebServiceAccount            currentuser = webir.FindByUserName(username);

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

            else
            {
                return(null);
            }
        }
예제 #10
0
        public DataTable GetTelContact(string username, string password)
        {
            WebServiceAccountsRepository webir       = new WebServiceAccountsRepository();
            WebServiceAccount            currentuser = webir.FindByUserName(username);

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

            else
            {
                return(null);
            }
        }
예제 #11
0
        public void loadform()
        {
            try
            {
                TelContactsRepository ecrir = new TelContactsRepository();
                TelContact            Tel   = ecrir.FindByid(Session["ID"].ToString().ToInt());
                lblid.Text         = Tel.ID.ToString();
                lbluserid.Text     = Session["UserID"].ToString();
                lblusertypeid.Text = Session["UserTypeID"].ToString();
                Session["TelType"] = Tel.TelTypeID.ToString();

                lbltelnumber.Text = Tel.TelNumber.ToString();

                Session["newTeltype"] = Tel.TelTypeID.ToString();


                switch (Session["UserTypeID"].ToString())
                {
                case "1":
                {
                    VStudentsRepository vstdir = new VStudentsRepository();
                    VStudent            std    = vstdir.FindByid(Session["UserID"].ToString().ToInt());
                    Label9.Text = "دانشجو" + ":" + std.FirstName + " " + std.LastName;
                }
                break;

                case "2":
                {
                    VLecturersRepository vlec = new VLecturersRepository();
                    VLecturer            lec  = vlec.FindByid(Session["UserID"].ToString().ToInt());
                    Label9.Text = "استاد" + ":" + lec.FirstName + " " + lec.LastName;
                }
                break;

                case "3":
                {
                    VEmployeesRepository vlec = new VEmployeesRepository();
                    VEmployee            emp  = vlec.FindByid(Session["UserID"].ToString().ToInt());
                    Label9.Text = "کارمند" + ":" + emp.FirstName + " " + emp.LastName;
                }
                break;
                }



                TelTypesRepository etir    = new TelTypesRepository();
                TelType            Teltype = etir.FindByid(Session["TelType"].ToString().ToInt());
                if (Teltype != null)
                {
                    lblTeltype.Text = Teltype.TelTypeTitle.ToString();
                    // Label7.Text = std.FirstName.ToString() + " " + std.LastName.ToString();
                }
                else
                {
                    Redirector.Goto(Redirector.PageName.errorpage);
                }


                TelTypesRepository etr = new TelTypesRepository();
                DataTable          dt2 = etr.GetAllTelType();
                ddlteltype.Items.Clear();

                foreach (DataRow dr in dt2.Rows)
                {
                    ddlteltype.Items.Add(new ListItem(dr["TelTypeTitle"].ToString(), dr["TelTypeID"].ToString()));
                }
            }
            catch
            {
                Redirector.Goto(Redirector.PageName.errorpage);
            }
        }
예제 #12
0
        public void LoadData(string id)
        {
            try
            {
                TelContactsRepository ecrir = new TelContactsRepository();
                TelContact            Tel   = ecrir.FindByid(id.ToInt());
                lblid.Text           = Tel.ID.ToString();
                Session["UserID"]    = Tel.UserID.ToString();
                Session["TelTypeID"] = Tel.TelTypeID.ToString();
                Session["UserType"]  = Tel.UserTypeID.ToString();
                lbltelnumber.Text    = Tel.TelNumber;

                Session["newuserid"]  = Tel.UserID.ToString();
                Session["newteltype"] = Tel.TelTypeID.ToString();



                VStudentsRepository vstdir = new VStudentsRepository();
                VStudent            std    = vstdir.FindByid(Session["UserID"].ToString().ToInt());
                if (std != null)
                {
                    Label7.Text = std.FirstName.ToString() + " " + std.LastName.ToString();
                }
                else
                {
                    Redirector.Goto(Redirector.PageName.errorpage);
                }



                TelTypesRepository etir    = new TelTypesRepository();
                TelType            Teltype = etir.FindByid(Session["TelTypeID"].ToString().ToInt());
                if (Teltype != null)
                {
                    lblTeltype.Text = Teltype.TelTypeTitle.ToString();

                    // Label7.Text = std.FirstName.ToString() + " " + std.LastName.ToString();
                }
                else
                {
                    Redirector.Goto(Redirector.PageName.errorpage);
                }


                TelTypesRepository etr = new TelTypesRepository();
                DataTable          dt2 = etr.GetAllTelType();
                ddlTeltype.Items.Clear();

                foreach (DataRow dr in dt2.Rows)
                {
                    ddlTeltype.Items.Add(new ListItem(dr["TelTypeTitle"].ToString(), dr["TelTypeID"].ToString()));
                }



                switch ((Session["UserType"].ToString()))
                {
                case "1":
                {
                    DropDownList1.SelectedValue = "1";
                    VStudentsRepository vstd  = new VStudentsRepository();
                    DataTable           dtstd = vstd.GetAllstd();

                    ddluserid.Items.Clear();
                    foreach (DataRow dr in dtstd.Rows)
                    {
                        ddluserid.Items.Add(new ListItem(dr["FirstName"].ToString() + " " + dr["LastName"].ToString(), dr["StudentID"].ToString()));
                    }
                }
                break;

                case "2":
                {
                    DropDownList1.SelectedValue = "2";

                    VLecturersRepository vlrir = new VLecturersRepository();
                    DataTable            dtlec = vlrir.GetAllLec();
                    ddluserid.Items.Clear();
                    foreach (DataRow dr in dtlec.Rows)
                    {
                        ddluserid.Items.Add(new ListItem(dr["FirstName"].ToString() + " " + dr["LastName"].ToString(), dr["LecturerID"].ToString()));
                    }
                }
                break;

                case "3":
                {
                    DropDownList1.SelectedValue = "3";
                    VEmployeesRepository verir = new VEmployeesRepository();
                    DataTable            dtemp = verir.GetAllEmp();
                    ddluserid.Items.Clear();
                    foreach (DataRow dr in dtemp.Rows)
                    {
                        ddluserid.Items.Add(new ListItem(dr["FirstName"].ToString() + " " + dr["LastName"].ToString(), dr["EmployeeID"].ToString()));
                    }
                }
                break;
                }
            }
            catch
            {
                Redirector.Goto(Redirector.PageName.errorpage);
            }
        }