Exemplo n.º 1
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)
                {
                    TelTypesRepository etir = new TelTypesRepository();
                    etir.DeleteTelType(selectedRows);
                    LoadTelTypeData();

                    PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgDeleteSuccessfull, Color.Green);
                }
            }
            catch
            {
                PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errDeleteFailed, Color.Red);
            }
        }
Exemplo n.º 2
0
        public void loadform()
        {
            TelTypesRepository etr = new  TelTypesRepository();
            DataTable          dt  = etr.GetAllTelType();

            ddlTeltype.Items.Clear();

            foreach (DataRow dr in dt.Rows)
            {
                ddlTeltype.Items.Add(new ListItem(dr["TelTypeTitle"].ToString(), dr["TelTypeID"].ToString()));
            }
        }
Exemplo n.º 3
0
        protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
        {
            lblmessage.Text = "";
            if (txtsearch.Text.Length > 0)
            {
                if (DropDownList1.SelectedValue == "0")
                {
                    try
                    {
                        TelTypesRepository etir = new TelTypesRepository();
                        Session["TelTypedatafindid"] = etir.Searchid(txtsearch.Text.ToInt());

                        GridView1.DataSource = Session["TelTypedatafindid"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", etir.TelTypeCount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["TelTypedatafindid"] 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
                    {
                        TelTypesRepository ttir = new TelTypesRepository();
                        Session["TelTypedatafindtitle"] = ttir.SearchTitle(txtsearch.Text.ToString());
                        GridView1.DataSource            = Session["TelTypedatafindtitle"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", ttir.TelTypeCount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["TelTypedatafindtitle"] 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
            {
                LoadTelTypeData();
            }
        }
Exemplo n.º 4
0
        public void LoadTelTypeData()
        {
            TelTypesRepository ttir = new TelTypesRepository();

            Session["TelTypeData"] = ttir.GetAllTelType();
            GridView1.DataSource   = Session["TelTypeData"];


            GridView1.DataBind();

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

            lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["TelTypeData"] as DataTable).Rows.Count.ToString().ToFarsiNumber(), Resources.DashboardText.SelectRecordCount);
        }
Exemplo n.º 5
0
        public void loadform()
        {
            try
            {
                lbluserid.Text     = Session["UserID"].ToString();
                lblusertypeid.Text = Session["UserTypeID"].ToString();
                TelTypesRepository etr = new TelTypesRepository();
                DataTable          dt  = etr.GetAllTelType();

                ddlteltype.Items.Clear();
                foreach (DataRow dr in dt.Rows)
                {
                    ddlteltype.Items.Add(new ListItem(dr["TelTypeTitle"].ToString(), dr["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;
                }
            }
            catch
            {
                Redirector.Goto(Redirector.PageName.errorpage);
            }
        }
Exemplo n.º 6
0
        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);
                }
            }
        }
Exemplo n.º 7
0
        public TelType FindTelTypeID(string username, string password, int id)
        {
            WebServiceAccountsRepository webir       = new WebServiceAccountsRepository();
            WebServiceAccount            currentuser = webir.FindByUserName(username);

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

            else
            {
                return(null);
            }
        }
Exemplo n.º 8
0
        public DataTable GetTeltype(string username, string password)
        {
            WebServiceAccountsRepository webir       = new WebServiceAccountsRepository();
            WebServiceAccount            currentuser = webir.FindByUserName(username);

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

            else
            {
                return(null);
            }
        }
Exemplo n.º 9
0
        public void LoadTelTypeData(string Telid)
        {
            try
            {
                TelTypesRepository etir    = new TelTypesRepository();
                TelType            Teltype = etir.FindByid(Telid.ToInt());


                if (Teltype != null)
                {
                    lbltitle.Text       = Teltype.TelTypeTitle;
                    lblEmailTypeid.Text = Teltype.TelTypeID.ToString();
                    TextBox1.Text       = Teltype.TelTypeTitle;
                }
                else
                {
                    Redirector.Goto(Redirector.PageName.errorpage);
                }
            }
            catch
            {
                Redirector.Goto(Redirector.PageName.errorpage);
            }
        }
Exemplo n.º 10
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);
            }
        }