private bool isLeafNode(string nodeID)
    {
        AccessDataSource1.SelectCommand = string.Format("SELECT [EmployeeID] FROM [Employees] WHERE ([ReportsTo] = {0})", nodeID);
        DataView dv = (DataView)AccessDataSource1.Select(DataSourceSelectArguments.Empty);

        return(dv.Count == 0);
    }
Exemplo n.º 2
0
    // hakkımızda
    protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        Label IdLabel = e.Item.FindControl("IdLabel") as Label;
        int   id      = Convert.ToInt32(IdLabel.Text);

        if (e.CommandName == "sil")
        {
            kurumsalSayfa ur = kurumsalSayfa.Select(id);
            if (ur == null)
            {
                Labelbilgi.Text = "<p class='msg error'><b>KAYIT BULUNAMADI !</b></p>";
                return;
            }

            Result <int> sonuc = ur.Delete();

            if (sonuc.HasError)
            {
                Labelbilgi.Text = "<p class='msg error'><b>Hata :" + sonuc.CustomErrorMessage + "</b></p>";
                return;
            }
            else
            {
                Labelbilgi.Text = "<p class='msg done'><b>BAŞARIYLA SİLİNDİ...</b></p>";
                AccessDataSource1.Select(DataSourceSelectArguments.Empty);
                ListView1.DataBind();
            }
        }
        else if (e.CommandName == "duzenle")
        {
            Response.Redirect("kurumsal-duzenle.aspx?Id=" + id.ToString());
        }
    }
Exemplo n.º 3
0
    protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        int id = Convert.ToInt32(ListView1.DataKeys[e.Item.DataItemIndex].Value);

        if (e.CommandName == "sil")
        {
            ik ur = ik.Select(id);
            if (ur == null)
            {
                Labelbilgi.Text = "<p class='msg error'><b>KAYIT BULUNAMADI !</b></p>";
                return;
            }

            //ur.Aktif = false;
            //Result<int> sonuc = ur.Update();
            Result <int> sonuc = ur.Delete();

            if (sonuc.HasError)
            {
                Labelbilgi.Text = "<p class='msg error'><b>Hata :" + sonuc.CustomErrorMessage + "</b></p>";
                return;
            }
            else
            {
                Labelbilgi.Text = "<p class='msg done'><b>BAŞARIYLA SİLİNDİ...</b></p>";
                AccessDataSource1.Select(DataSourceSelectArguments.Empty);
                ListView1.DataBind();
            }
        }
    }
Exemplo n.º 4
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        DataView dv = (DataView)AccessDataSource1.Select(DataSourceSelectArguments.Empty);

        if (dv.Count == 0)
        {
            Label1.Text = "Username and Password not match!";
            return;
        }

        Session["Username"] = dv[0].Row["Username"].ToString();
        Session["UserType"] = dv[0].Row["UserType"].ToString();
        Session["Password"] = dv[0].Row["Password"].ToString();

        if (Session["PID"] != null)
        {
            Response.Redirect("~/Products.aspx");
        }
        if (Session["UserType"].ToString().Equals("admin"))
        {
            Response.Redirect("~/Admin/Default.aspx");
        }
        if (Session["UserType"].ToString().Equals("user"))
        {
            Response.Redirect("~/Member/Default.aspx");
        }
    }
Exemplo n.º 5
0
    protected void Button3_Click(object sender, EventArgs e)
    {
        int id = Convert.ToInt32(Request["Id"]);


        kategori ur = kategori.Select(id);

        if (ur == null)
        {
            Labelbilgi.Text = "<p class='msg error'><b>KAYIT BULUNAMADI !</b></p>";
            return;
        }


        Result <int> sonuc = ur.Delete();

        if (sonuc.HasError)
        {
            Labelbilgi.Text = "<p class='msg error'><b>Hata :" + sonuc.CustomErrorMessage + "</b></p>";
            return;
        }
        else
        {
            Labelbilgi.Text = "<p class='msg done'><b>BAŞARIYLA SİLİNDİ...</b></p>";
            AccessDataSource1.Select(DataSourceSelectArguments.Empty);
            Response.Redirect("kategoriler.aspx");
        }
    }
Exemplo n.º 6
0
        protected void btnLogIn_Click(object sender, EventArgs e)
        {
            if ((bool)HttpContext.Current.Session["loggedIn"] == false)
            {
                try
                {
                    DataView customerTable = (DataView)AccessDataSource1.Select(DataSourceSelectArguments.Empty);
                    customerTable.RowFilter = "UserName = '******'";
                    DataRowView row = customerTable[0];

                    if (txtPassword.Text == row["Password"].ToString())
                    {
                        Customer c = new Customer();
                        c.CustomerID = (int)row["CustomerID"];
                        c.Name       = row["Name"].ToString();
                        c.Address    = row["Address"].ToString();
                        c.City       = row["City"].ToString();
                        c.State      = row["State"].ToString();
                        c.ZipCode    = row["ZipCode"].ToString();
                        c.Email      = row["Email"].ToString();
                        c.UserName   = row["UserName"].ToString();
                        c.Password   = row["Password"].ToString();

                        HttpContext.Current.Session["currentUser"] = c;

                        HttpContext.Current.Session["loggedIn"] = true;

                        btnLogIn.Text = "Log Out";
                        HttpContext.Current.Session["loginButtonText"] = "Log Out";

                        txtUserName.Enabled = false;
                        txtPassword.Enabled = false;
                        HttpContext.Current.Session["loginTextboxEnabled"] = false;
                        lblError.Text = "";
                    }
                    else
                    {
                        lblError.Text = "Invalid Password";
                    }
                }
                catch (IndexOutOfRangeException)
                {
                    lblError.Text = "Invalid Username";
                }
            }
            else
            {
                HttpContext.Current.Session["loggedIn"] = false;

                btnLogIn.Text = "Log In";
                HttpContext.Current.Session["loginButtonText"] = "Log In";

                txtUserName.Enabled = true;
                txtPassword.Enabled = true;
                HttpContext.Current.Session["loginTextboxEnabled"] = true;
            }
        }
Exemplo n.º 7
0
    void bindData()
    {
        PagedDataSource pds = new PagedDataSource();

        pds.AllowPaging      = true;
        pds.PageSize         = AspNetPager1.PageSize;
        pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
        DataView dv = (DataView)AccessDataSource1.Select(DataSourceSelectArguments.Empty);

        pds.DataSource       = dv;
        Repeater1.DataSource = pds;
        Repeater1.DataBind();
    }
Exemplo n.º 8
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        DataView dv = (DataView)AccessDataSource1.Select(DataSourceSelectArguments.Empty);

        if (dv.Count == 1)
        {
            Label2.Visible = true;
            return;
        }
        else
        {
            AccessDataSource1.Insert();
            Response.Redirect("~/Login.aspx");
        }
    }
Exemplo n.º 9
0
    private int BindPagedData(int pageIndex)
    {
        // Here you can put your custom code to fetch a portion of data from your datasource
        PagedDataSource pds = new PagedDataSource();

        pds.AllowPaging      = true;
        pds.PageSize         = 10;
        pds.CurrentPageIndex = pageIndex;
        pds.DataSource       = AccessDataSource1.Select(new DataSourceSelectArguments());

        Repeater1.DataSource = pds;
        Repeater1.DataBind();

        return(pds.PageCount);
    }
Exemplo n.º 10
0
        private DataTable CreatePivotData()
        {
            DataTable dt = new DataTable();

            if (Session["PivotData"] != null)
            {
                dt = (DataTable)Session["PivotData"];
            }
            else
            {
                dt = ((DataView)AccessDataSource1.Select(DataSourceSelectArguments.Empty)).Table;
                Session["PivotData"] = dt;
            }
            return(dt);
        }
Exemplo n.º 11
0
    protected void ASPxCallbackPanel1_Callback(object source, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
    {
        String param = e.Parameter.Replace("'", "''");

        AccessDataSource1.SelectCommand = "SELECT * FROM [Products] WHERE ProductName = '" + param + "'";
        IEnumerable data = AccessDataSource1.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView row in data)
        {
            ASPxLabel1.Text = "Price: " + row["UnitPrice"].ToString();
            ASPxLabel2.Text = "Units in Stock: " + row["UnitsInStock"].ToString();
            headerText      = row["ProductName"].ToString();
            break;
        }
    }
Exemplo n.º 12
0
 protected void btnGetIncidents_Click(object sender, EventArgs e)
 {
     incidentsTable = (DataView)
                      AccessDataSource1.Select(DataSourceSelectArguments.Empty);
     incidentsTable.RowFilter = "CustomerID = " + txtCustomerID.Text
                                + " And DateClosed Is Not Null";
     if (incidentsTable.Count > 0)
     {
         this.DisplayClosedIncidents();
         this.EnableControls(true);
         lstIncidents.Focus();
     }
     else
     {
         lblNoIncidents.Text = "There are no incidents for that customer.";
         this.EnableControls(false);
     }
 }
Exemplo n.º 13
0
    protected void Button3_Click(object sender, EventArgs e)
    {
        List <int> islenecekler = islenecekMesajlar();

        if (islenecekler == null || islenecekler.Count == 0)
        {
            Labelbilgi.Text = "<p class='msg warning'><b>Hiçbir kayıt seçmediniz!</b></p>";
            return;
        }

        foreach (int id in islenecekler)
        {
            iletisimmesaj mesaj = iletisimmesaj.Select(id);
            mesaj.Delete();
        }
        AccessDataSource1.Select(DataSourceSelectArguments.Empty);
        ListView1.DataBind();
    }
Exemplo n.º 14
0
        private Product GetSelectedProduct()
        {
            DataView productsTable = (DataView)AccessDataSource1.Select(DataSourceSelectArguments.Empty);

            productsTable.RowFilter = "ProductID = '" + ddlProducts.SelectedValue + "'";

            DataRowView row = (DataRowView)productsTable[0];

            Product p = new Product();

            p.ProductID        = row["ProductID"].ToString();
            p.Name             = row["Name"].ToString();
            p.ShortDescription = row["ShortDescription"].ToString();
            p.LongDescription  = row["LongDescription"].ToString();
            p.UnitPrice        = (decimal)row["UnitPrice"];
            p.ImageFile        = row["ImageFile"].ToString();

            return(p);
        }
    private Product GetSelectedProduct()
    {
        DataView productsTable = (DataView)
                                 AccessDataSource1.Select(DataSourceSelectArguments.Empty);

        productsTable.RowFilter =
            "isbn = '" + ddlProducts.SelectedValue + "'";
        DataRowView row = (DataRowView)productsTable[0];

        Product p = new Product();

        p.isbn        = row["isbn"].ToString();
        p.Title       = row["title"].ToString();
        p.Author      = row["author_name"].ToString();
        p.Publisher   = row["publisher_name"].ToString();
        p.RetailPrice = (double)row["retail_price"];

        return(p);
    }
    private Dictionary <string, string> GetParentFromDB(string parentID)
    {
        Dictionary <string, string> results = new Dictionary <string, string>();

        if (parentID == "null")
        {
            AccessDataSource1.SelectCommand = "SELECT [EmployeeID], [FirstName], [LastName] FROM [Employees] WHERE ([ReportsTo] is null)";
        }
        else
        {
            AccessDataSource1.SelectCommand = string.Format("SELECT [EmployeeID], [FirstName], [LastName] FROM [Employees] WHERE ([ReportsTo] = {0})", parentID);
        }
        DataView dv = (DataView)AccessDataSource1.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView view in dv)
        {
            results.Add(view[0].ToString(), view[2] + ", " + view[1]);
        }
        return(results);
    }
Exemplo n.º 17
0
    private Customer GetSelectedCustomer()
    {
        DataView customersTable = (DataView)AccessDataSource1.Select(DataSourceSelectArguments.Empty);

        customersTable.RowFilter = "CustomerID = '" + ddlCustomers.SelectedValue + "'";
        DataRowView row = (DataRowView)customersTable[0];

        Customer c = new Customer();

        c.ID      = (int)row["CustomerID"];
        c.Name    = row["Name"].ToString();
        c.Address = row["Address"].ToString();
        c.City    = row["City"].ToString();
        c.State   = row["State"].ToString();
        c.ZIPCode = row["ZipCode"].ToString();
        c.Phone   = row["Phone"].ToString();
        c.Email   = row["Email"].ToString();

        return(c);
    }
Exemplo n.º 18
0
    private Customer GetselectedCustomer()
    {
        DataView customerTable = (DataView)
                                 AccessDataSource1.Select(DataSourceSelectArguments.Empty);

        customerTable.RowFilter = "CustomerID = " + ddlCustomers.SelectedValue;
        DataRowView row = customerTable[0];

        Customer customer = new Customer();

        customer.CustomerID = Convert.ToInt32(row["CustomerID"]);
        customer.Name       = row["Name"].ToString();
        customer.Address    = row["Address"].ToString();
        customer.City       = row["City"].ToString();
        customer.State      = row["State"].ToString();
        customer.ZipCode    = row["ZipCode"].ToString();
        customer.Phone      = row["Phone"].ToString();
        customer.Email      = row["Email"].ToString();
        return(customer);
    }
Exemplo n.º 19
0
    // ARA
    protected void Ara(object sender, EventArgs e)
    {
        string filtre = "";

        //if (txtadi.Text != "")
        //{
        //    if (filtre != "")
        //        filtre += " and ";
        //    filtre += " Adi like '%" + txtadi.Text.Trim() + "%'";
        //}

        //if (DropDownList1.SelectedValue != "-1")
        //{
        //    if (filtre != "")
        //        filtre += " and ";
        //    filtre += " FkKategori = " + DropDownList1.SelectedValue;
        //}

        AccessDataSource1.Select(DataSourceSelectArguments.Empty);
        AccessDataSource1.FilterExpression = filtre;
        ListView1.DataBind();
    }
Exemplo n.º 20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ArrayList items = new ArrayList();

        IEnumerable data = AccessDataSource1.Select(new DataSourceSelectArguments());

        foreach (object item in data)
        {
            DataRowView row       = item as DataRowView;
            string      id        = row["CustomerId"].ToString();
            string      s         = row["ContactName"].ToString().ToUpper();
            string      groupText = "?";
            if (!string.IsNullOrEmpty(s))
            {
                char c = s.Substring(0, 1)[0];
                if ('A' <= c && c <= 'F')
                {
                    groupText = "A-F";
                }
                else if ('G' <= c && c <= 'M')
                {
                    groupText = "G-M";
                }
                else if ('N' <= c && c <= 'S')
                {
                    groupText = "N-S";
                }
                else if ('T' <= c && c <= 'Z')
                {
                    groupText = "T-Z";
                }
            }
            items.Add(new MyItem(id, s, groupText));
        }

        ASPxTitleIndex1.DataSource = items;
        ASPxTitleIndex1.DataBind();
    }
Exemplo n.º 21
0
    private bool GetSelectedCustomerIncidents(string strCustomerID)
    {
        Incident objIncident;
        bool     blnResult = false;

        DataView customerIncidents = (DataView)AccessDataSource1.Select(DataSourceSelectArguments.Empty);

        customerIncidents.RowFilter = "(CustomerID = " + strCustomerID + ") AND (DateClosed IS NOT NULL)";

        lstIncidents.Items.Clear();

        if (customerIncidents.Count > 0)
        {
            //Add instruction item
            lstIncidents.Items.Add(new ListItem("--Select an incident--", "None"));

            foreach (DataRowView row in customerIncidents)
            {
                objIncident             = new Incident();
                objIncident.ID          = (int)row["IncidentID"];
                objIncident.CustomerID  = (int)row["CustomerID"];
                objIncident.ProductCode = row["ProductCode"].ToString();
                objIncident.TechID      = (int)row["TechID"];
                objIncident.DateOpened  = (DateTime)row["DateOpened"];
                objIncident.DateClosed  = (DateTime)row["DateClosed"];
                objIncident.Title       = row["Title"].ToString();

                lstIncidents.Items.Add(new ListItem(objIncident.CustomerIncidentDisplay(),
                                                    objIncident.ID.ToString()));
            }

            lstIncidents.SelectedValue = "None";
            blnResult = true;
        }

        return(blnResult);
    }
Exemplo n.º 22
0
 protected void LoginBtn_Authenticate(object sender, AuthenticateEventArgs e)
 {
     AccessDataSource1.SelectCommand = "SELECT * FROM login WHERE User_name= '" + LoginBtn.UserName + "' AND User_password= '******'";
     AccessDataSource1.Select(DataSourceSelectArguments.Empty);
 }