الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

[مخالف - طلب حل : ]مطلوب شرح اكواد...

مغلق
بدأه ملامح البراءة في 24 أبريل 2012 · 2 رد · 607 مشاهدة · في Microsoft Visual Basic.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم

عندي أكواد في مشروع التخرج

أبي مهندس يشرحها لي.. لو سمحتوا...

top4top_f222052fd31.png

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim UserName As String = Me.txtUserName.Text
        Dim Password As String = Me.txtPassword.Text
        If UserName.Trim = "" OrElse Password.Trim = "" Then
            Me.lblMessage.Text = "Please Enter User Name And Password"
            Me.lblMessage.ForeColor = Drawing.Color.Red
            Exit Sub
        End If
        Dim em As New EmployeeManagement
        Dim dt As DataTable = em.LogIn(UserName, Password)
        If dt.Rows.Count = 0 Then
            Me.lblMessage.Text = "Invalid User Name or Password"
            Me.lblMessage.ForeColor = Drawing.Color.Red
            Exit Sub
        End If
        Session("Employee") = dt
        If CBool(dt.Rows(0)("IsAdmin")) = True Then
            Response.Redirect("HomePage.aspx")
        Else
            Dim sm As New RestaurantManagement
            Dim ss As New SearchRestaurant
            ss.SetEmployeeID(dt.Rows(0)("EmployeeID"))
            Dim DTS As DataTable = sm.FindRestaurant(ss)
            If DTS.Rows.Count = 0 Then
                Me.lblMessage.Text = "You Cant Log In Because You Have not Been Assigned to a Restaurant as a Restaurant employee"
                Me.lblMessage.ForeColor = Drawing.Color.Red
                Exit Sub
            End If
            Session("Restaurant") = DTS
            Response.Redirect("Restaurant_HomePage.aspx")
        End If

    End Sub

top4top_f222052fd32.png

 Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        Dim objEmployee As New Employee
        Dim objManageEmployee As New EmployeeManagement

        objEmployee.setEmployeeName(Me.txtEmployeeName.Text)
        objEmployee.setEmployeePhone(Me.txtEmployeePhone.Text)
        objEmployee.setUserName(Me.txtUserName.Text)
        objEmployee.setPassword(Me.txtPassword.Text)
        objEmployee.setIsAdmin(1)
        If objManageEmployee.isValidEmployee(objEmployee) Then
            objManageEmployee.AddEmployee(objEmployee)
            Me.lblMessage.ForeColor = Drawing.Color.Green
            Me.lblMessage.Text = "Employee has been added successfully"
            Me.txtEmployeeName.Text = ""
            Me.txtEmployeePhone.Text = ""
            Me.txtUserName.Text = ""
            Me.txtPassword.Text = ""


        Else
            Me.lblMessage.ForeColor = Drawing.Color.Red
            Me.lblMessage.Text = objManageEmployee.getError()
        End If
    End Sub

top4top_f222052fd33.png

Private Sub Search()
    Me.lblSearchMessage.Text = ""
        Dim objSearchEmployee As New SearchEmployee
        Dim objManageEmployee As New EmployeeManagement

        objSearchEmployee.setEmployeeName(Me.txtSearchEmployeeName.Text)
        objSearchEmployee.setEmployeePhone(Me.txtSearchEmployeePhone.Text)
        objSearchEmployee.setIsAdmin(1)
        Dim dt As DataTable = objManageEmployee.findEmployee(objSearchEmployee)
        dt.Columns.Remove("IsAdmin")
        dt.Columns.Remove("(IsAdmin)")
        dt.Columns.Remove("Password")
        Me.GridView1.DataSource = dt
        Me.GridView1.DataBind()
        If dt.Rows.Count = 0 Then
            Me.lblSearchMessage.Text = "No Data Found..."
        End If
    End Sub

top4top_f222052fd34.png

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        Dim objRestaurantCategory As New RestaurantCategory
        Dim objManageRestaurantCategory As New RestaurantCategoryManagement

        objRestaurantCategory.setRestaurantCategoryName(Me.txtRestaurantCategoryName.Text)
        If objManageRestaurantCategory.isValidRestaurantCategory(objRestaurantCategory) Then
            objManageRestaurantCategory.AddRestaurantCategory(objRestaurantCategory)
            Me.lblMessage.ForeColor = Drawing.Color.Green
            Me.lblMessage.Text = "Restaurant Category has been added successfully"
            Me.txtRestaurantCategoryName.Text = ""

        Else
            Me.lblMessage.ForeColor = Drawing.Color.Red
            Me.lblMessage.Text = objManageRestaurantCategory.getError()
        End If
    End Sub

يتبع...

#2

top4top_f222052fd35.png

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        Dim objOffers As New Offers
        Dim objManageOffers As New OffersManagement
        objOffers.setDiscountAmount(Me.txtDiscountAmount.Text)
        objOffers.setItemID(Me.listItemID.SelectedValue)
        objOffers.setStartDate(Me.txtStartDate.Text)
        objOffers.setEndDate(Me.txtEndDate.Text)
        If objManageOffers.isValidOffers(objOffers) Then
            objManageOffers.AddOffers(objOffers)
            Me.lblMessage.ForeColor = Drawing.Color.Green
            Me.lblMessage.Text = "Offers has been added successfully"
            Me.txtDiscountAmount.Text = ""
            Me.listItemID.SelectedValue = 0
            Me.txtStartDate.Text = ""
            Me.txtEndDate.Text = ""
        Else
            Me.lblMessage.ForeColor = Drawing.Color.Red
            Me.lblMessage.Text = objManageOffers.getError()
        End If
    End Sub

top4top_f222052fd36.png

Protected Sub btnAddCustomer_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAddCustomer.Click
        Dim customername As String = txtAddCustomername.Text
        Dim Customerphone As String = txtAddcustomerPhone.Text
        Dim customeremail As String = txtAddcustomeremail.Text
        Dim address As String = txtAddress.Text
        Dim username As String = txtAddusername.Text
        Dim password As String = txtAddPassword.Text
        Dim cu As New Customermanagement
        Dim cou As New Customer
        cou.SetCustomerName(customername)
        cou.SetCustomerPhone(Customerphone)
        cou.SetCustomerEmail(customeremail)
        cou.SetAddress(address)
        cou.SetUserName(username)
        cou.SetPassword(password)
        If Me.lblId.Text <> "" Then
            cou.SetCustomerID(Me.lblId.Text)
        End If
        If cu.ValidCustomer2(cou) = True Then
            Dim CustomerID As Integer = 0
            If Me.lblId.Text = "" Then
                CustomerID = cu.AddCustomer(cou)
            Else
                CustomerID = Me.lblId.Text
                cu.UpdateCustomer(cou)
            End If

            Dim sc As New SearchCustomer
            sc.SetCustomerID(CustomerID)
            Dim dt As DataTable = cu.FindCustomer(sc)
            Session("Customer") = dt
            Response.Redirect("Customer_Home.aspx")
        Else
            lblAddcustomerMessage.Text = cu.getError()
            lblAddcustomerMessage.ForeColor = Drawing.Color.Red
        End If
    End Sub

top4top_f222052fd37.png

Sub GetItems()
        Me.lblMessage.Text = ""
        Dim dtEmployee As DataTable = Session("Employee")
        Dim ss As New SearchRestaurant
        Dim sm As New RestaurantManagement
        ss.setEmployeeID(dtEmployee.Rows(0)("EmployeeID"))
        Dim dtRestaurant As DataTable = sm.findRestaurant(ss)
        Dim RestaurantID As Integer = dtRestaurant.Rows(0)("RestaurantID")

        Dim ssic As New SearchItemCategory
        Dim icm As New ItemCategoryManagement
        ssic.setItemCategoryID(Me.ddlSearchItemCategoryID.SelectedValue)
        ssic.setItemName(Me.txtSearchItemName.Text)
        ssic.setRestaurantID(dtRestaurant.Rows(0)("RestaurantID"))
        Dim dtCategories As DataTable = icm.findItemCategory(ssic)
        Me.DataList1.DataSource = dtCategories
        Me.DataList1.DataBind()

        Dim im As New ItemManagement
        Dim si As New SearchItem

        For i As Integer = 0 To dtCategories.Rows.Count - 1
            Dim ItemCategoryID As Integer = dtCategories.Rows(i)("ItemCategoryID")
            Dim g As GridView = Me.DataList1.Items(i).FindControl("GridView1")
            si.setItemCategoryID(ItemCategoryID)
            si.setRestaurantID(RestaurantID)
            Dim dtItems As DataTable = im.findItem(si)
            g.DataSource = dtItems
            g.DataBind()
            For j As Integer = 0 To g.Rows.Count - 1
                Dim ItemImagebyte() As Byte = dtItems.Rows(j)("ItemImage")
                Dim iImage As Image = g.Rows(j).FindControl("ItemImage")
                Try
                    Dim FilePath As String = Server.MapPath("ItemImage") & "/" & dtItems.Rows(j)("ItemID")
                    Dim fs As New IO.FileStream(FilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite)
                    fs.Write(ItemImagebyte, 0, ItemImagebyte.Length)
                    fs.Close()
                    iImage.ImageUrl = "ItemImage/" & dtItems.Rows(j)("ItemID")
                Catch ex As Exception
                End Try
            Next
        Next
        If Me.DataList1.Items.Count = 0 Then
            Me.lblMessage.Text = "No Data Found..."
        End If
    End Sub

top4top_71781bfd688.png

Sub GetSales()
        Me.lblPendeingMessage.Text = ""

        Dim dtRestaurant As DataTable = Session("Restaurant")
        Dim dt As DataTable = GeneralFunctions.GetTableOf("select SalesInvoiceID, SalesInvoiceDate, CustomerName, CustomerPhone, Address from SalesInvoice, Customer where SalesInvoice.CustomerID = Customer.CustomerID and IsPaidAndDeliverd=0 and SalesInvoiceID in (select SalesInvoiceID from SalesInvoiceItem,Item where SalesInvoiceItem.ItemID = Item.ItemID and Item.RestaurantID=" & dtRestaurant.Rows(0)("RestaurantID") & ")")
        Me.DataList1.DataSource = dt
        Me.DataList1.DataBind()
        For i As Integer = 0 To dt.Rows.Count - 1
            Dim g As GridView = Me.DataList1.Items(i).FindControl("GridView1")
            Dim dtItems As DataTable = GeneralFunctions.GetTableOf("select ItemName, SalesInvoiceItem.Qty, SalesInvoiceItem.Price  from SalesInvoiceItem,Item where SalesInvoiceItem.ItemID = Item.ItemID and Item.RestaurantID=" & dtRestaurant.Rows(0)("RestaurantID") & " and SalesInvoiceID=" & dt.Rows(i)("SalesInvoiceID"))
            g.DataSource = dtItems
            g.DataBind()
        Next
        If dt.Rows.Count = 0 Then
            Me.lblPendeingMessage.Text = "No Invoices"
        End If


    End Sub

يتبع....

top4top_71781bfd689.png

 Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        Dim objRestaurant As New Restaurant
        Dim objManageRestaurant As New RestaurantManagement

        objRestaurant.setRestaurantName(Me.txtRestaurantName.Text)
        If Me.FileUploadLogo.HasFile = False Then
            Me.lblMessage.ForeColor = Drawing.Color.Red
            Me.lblMessage.Text = "Please enter Logo"
            Exit Sub
        End If
        Dim Logo() As Byte = Nothing
        Try
            ReDim Logo(Me.FileUploadLogo.PostedFile.InputStream.Length)
            Me.FileUploadLogo.PostedFile.InputStream.Read(Logo, 0, Logo.Length)
        Catch ex As Exception
        End Try
        objRestaurant.setLogo(Logo)
        objRestaurant.setPhoneNumber(Me.txtPhoneNumber.Text)
        objRestaurant.setRestaurantCategoryID(Me.listRestaurantCategoryID.SelectedValue)

        objRestaurant.setEmployeeID(-1)

        Dim Ename As String = txtEmployeeName.Text
        Dim Ephone As String = txtEmployeePhone.Text
        Dim EUserName As String = txtUserName.Text
        Dim EPassword As String = txtPassword.Text

        Dim em As New EmployeeManagement()
        Dim emp As New Employee
        emp.setEmployeeName(Ename)
        emp.setEmployeePhone(Ephone)
        emp.setPassword(EPassword)
        emp.setUserName(EUserName)
        emp.setIsAdmin(0)

        If objManageRestaurant.isValidRestaurant(objRestaurant) Then
            If em.isValidEmployee(emp) = True Then
                Dim EID As Integer = em.AddEmployee(emp)
                txtEmployeeName.Text = ""
                txtEmployeePhone.Text = ""
                txtUserName.Text = ""
                txtPassword.Text = ""

                objRestaurant.setEmployeeID(EID)
                objManageRestaurant.AddRestaurant(objRestaurant)
                Me.lblMessage.ForeColor = Drawing.Color.Green
                Me.lblMessage.Text = "Restaurant has been added successfully"
                Me.txtRestaurantName.Text = ""
                Me.txtPhoneNumber.Text = ""
                Me.listRestaurantCategoryID.SelectedValue = 0
            Else
                lblMessage.Text = em.getError()
                lblMessage.ForeColor = Drawing.Color.Red
            End If
        Else
            Me.lblMessage.ForeColor = Drawing.Color.Red
            Me.lblMessage.Text = objManageRestaurant.getError()
        End If
    End Sub
#3

الأخ الكريم/الأخت الكريمة

السلام عليكم ورحمة الله وبركاته.

مرحباً بكم في منتدى الفريق العربي للبرمجة

تأسف إدارة المنتدى لغلق الموضوع وذلك لمخالفته قوانين المشاركات، فقرة طلب حل الواجبات والتمارين.

قواعد طرح المشاركات

/index.php?showtopic=29343

شاكرين لكم حُسن تعاونكم

هذا الموضوع مغلق.

مواضيع مشابهة