protected void Btn1_Click(object sender, EventArgs e)
    {
        GridViewRow gvRow    = (GridViewRow)(sender as Control).Parent.Parent;
        int         rowIndex = gvRow.RowIndex;
        String      sap_id   = GridView_leaves.Rows[rowIndex].Cells[1].Text;
        byte        x        = Data_Access.Approve_Reject(sap_id, "warden", 1, "branch not req(hostel Leave)");

        if (x == 1)
        {
            Response.Write("Approved");
        }

        SqlConnection  con = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString);
        SqlDataAdapter da  = new SqlDataAdapter();

        if (Session["post"].ToString() == "warden")
        {
            da.SelectCommand = new SqlCommand("select student.sap_id,student.name,student.year,student.course,student.mobile_self,hostel_leave.date_from,hostel_leave.reason,hostel_leave.time_departure from student inner join hostel_leave on hostel_leave.sap_id=student.sap_id where hostel_leave.leave_status=0 and hostel_leave.departed='False'", con);
        }
        DataTable dt = new DataTable();

        da.Fill(dt);
        if (dt.Columns.Count != 0)
        {
            GridView_leaves.DataSource = dt;
            GridView_leaves.DataBind();
        }
        else
        {
            Label_leave_available.Visible = true;
            Label_leave_available.Text    = "No Leaves Found";
        }
    }
    protected void Button_cancelLeave_Click(object sender, EventArgs e)
    {
        int hostelOrAcademic;
        int status = Data_Access.StatusSameDayLeave(Session["sap_id"].ToString(), out hostelOrAcademic);

        if (status == 10)
        {
            Label_sameDay_result.Visible = true;
            Label_sameDay_result.Text    = "You have not applied for Leave";
        }
        else
        {
            int i;
            if (hostelOrAcademic == 1)
            {
                i = Data_Access.CancelSameDayLeave(Session["sap_id"].ToString(), hostelOrAcademic);
            }
            else
            {
                i = Data_Access.CancelSameDayLeave(Session["sap_id"].ToString(), hostelOrAcademic);
            }
            if (i >= 0)
            {
                Label_sameDay_result.Visible = true;
                Label_sameDay_result.Text    = "Leave has been cancelled";
            }
        }
    }
Ejemplo n.º 3
0
        public ServiceRecord()
        {
            Data_Access data = Data_Access.getInstance();

            Services = new List <Service>();
            Services = data.ShowAllServices();
        }
    protected void Button_viewStatus_Click(object sender, EventArgs e)
    {
        int hostelOrAcademic;
        int status = Data_Access.StatusSameDayLeave(Session["sap_id"].ToString(), out hostelOrAcademic);

        // hostelorAcademic=1 means academic & 0 means hostel wali
        Label_sameDay_result.Visible = true;
        if (hostelOrAcademic == 0 && status == 0)
        {
            Label_sameDay_result.Text = "Leave forwarded to Warden";
        }
        else if (hostelOrAcademic == 0 && status == 3)
        {
            Label_sameDay_result.Text = "Leave approved by Warden";
        }
        else if (hostelOrAcademic == 1 && (status == 0 || status == 2))
        {
            Label_sameDay_result.Text = "You have already applied for leave";
        }
        else if (hostelOrAcademic == 1 && status == 1)
        {
            Label_sameDay_result.Text = "Leave forwarded to HOD";
        }
        else if (hostelOrAcademic == 1 && status == 3)
        {
            Label_sameDay_result.Text = "Leave approved by HOD";
        }
        else if (status == 10)
        {
            Label_sameDay_result.Text = "You have not applied for Leave";
        }
    }
    protected void Button2_submit_Click(object sender, EventArgs e)
    {
        DateTime t2 = Convert.ToDateTime("04:59:59 PM");
        DateTime t1 = Convert.ToDateTime(TextBox_timeAndDay.Text);

        if (TimeSpan.Compare(t1.TimeOfDay, t2.TimeOfDay) == 1) //forward to warden
        {
            int i = Data_Access.apply_sameDayLeave(Session["sap_id"].ToString(), t1.Date.ToString(), TextBox_reason_sameDay.Text, t1.TimeOfDay.ToString());
            if (i == 0)
            {
                Label_sameDay_result.Text    = "You have already applied for same day leave";
                Label_sameDay_result.Visible = true;
            }
            else
            {
                Label_sameDay_result.Text    = "Successfully Applied for Leave";
                Label_sameDay_result.Visible = true;
            }
        }
        else
        {
            String mentor_email;

            String i = Data_Access.Apply_Leave(Session["sap_id"].ToString(), t1.Date.ToString(), t1.Date.ToString(), TextBox_reason_sameDay.Text, out mentor_email, 1);
            Label_sameDay_result.Text    = i;
            Label_sameDay_result.Visible = true;
            Data_Access.MailSend(mentor_email, "Same Day Leave", "Same day leave has been posted, you may take your action before 4:00 PM");
        }
    }
Ejemplo n.º 6
0
        public Report(DateTimePicker fromDate, DateTimePicker toDate, string type)
        {
            InitializeComponent();
            com         = new common();
            data_Access = new Data_Access(iid);
            reportViewer1.LocalReport.DataSources.Clear();
            ReportDataSource rds = new ReportDataSource("DataSet1", data_Access.getReportBetweenTwoDate(fromDate, toDate, type.Equals("الصادرة") ? "قطاعات الومنيوم" : type.Equals("الواردة") ? "اخرى" : ""));

            reportViewer1.LocalReport.DataSources.Add(rds);
            ReportParameterCollection reportParameter = new ReportParameterCollection();

            reportParameter.Add(new ReportParameter("type", type));
            reportParameter.Add(new ReportParameter("fromDate", fromDate.Value.ToString("yyyy/MM/dd")));
            reportParameter.Add(new ReportParameter("toDate", toDate.Value.ToString("yyyy/MM/dd")));
            if (type.Equals("الصادرة"))
            {
                this.reportViewer1.LocalReport.ReportPath = "Reports\\Rep_alum.rdlc";
            }
            else if (type.Equals("الواردة"))
            {
                this.reportViewer1.LocalReport.ReportPath = "Reports\\Rep_Other.rdlc";
            }
            this.reportViewer1.LocalReport.SetParameters(reportParameter);
            this.reportViewer1.RefreshReport();
        }
Ejemplo n.º 7
0
        // UseUp aktualizuje ilość produktów będących w bazie danych (zużycie)
        public void UseUp(SingleUseProduct product, uint quantity)
        {
            Data_Access data = Data_Access.getInstance();

            product.Count = (int)((uint)product.Count - quantity);
            data.UpdateProductCount(product, product.Count);
        }
Ejemplo n.º 8
0
        public void AddNew(Product product)
        {
            Data_Access data = Data_Access.getInstance();

            if (!data.ProductExists(product))
            {
                data.AddProduct(product);
            }
        }
Ejemplo n.º 9
0
        public void AddNew(string name, string lastname, string phone)
        {
            Client      client = new Client(name, lastname, phone);
            Data_Access data   = Data_Access.getInstance();

            if (!data.ClientExists(client))// Czy taki klient już istnieje?
            {
                data.AddClient(client);
            }
        }
    protected void Btn_disapprove_Click(object sender, EventArgs e)
    {
        GridViewRow gvRow    = (GridViewRow)(sender as Control).Parent.Parent;
        int         rowIndex = gvRow.RowIndex;
        String      sap_id   = GridView_leaves.Rows[rowIndex].Cells[1].Text;
        byte        x        = Data_Access.Approve_Reject(sap_id, "warden", 0, "branch not req(hostel Leave)");

        if (x == 1)
        {
            Response.Write("Rejected");
        }
    }
Ejemplo n.º 11
0
        public Report(int iid, ReportParameterCollection reports)
        {
            InitializeComponent();
            btnBack.Visible = false;
            com             = new common();
            data_Access     = new Data_Access(iid);
            reportViewer1.LocalReport.DataSources.Clear();
            ReportDataSource rds = new ReportDataSource("Wieghts", data_Access.getReportData());

            reportViewer1.LocalReport.DataSources.Add(rds);
            this.reportViewer1.LocalReport.ReportPath = "Reports\\Rep_weight.rdlc";
            this.reportViewer1.LocalReport.SetParameters(reports);
            this.reportViewer1.RefreshReport();
        }
Ejemplo n.º 12
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         String password = Encrypt(TextBox_password.Text);
         int    j        = Data_Access.Register_employee(TextBox_emp_id.Text, TextBox_name.Text, password, DropDownList_post.SelectedValue,
                                                         TextBox_email.Text, DropDownList_branch.SelectedValue, TextBox_mobile.Text);
         if (j == 1)
         {
             Response.Write("Successful");
         }
         else if (j == 2)
         {
             Response.Write("Employee ID already registered");
         }
     }
 }
Ejemplo n.º 13
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            ToWord word = new ToWord(Convert.ToDecimal(finalWieght()), new CurrencyInfo(CurrencyInfo.Currencies.Kilo));
            ReportParameterCollection reportParameter = new ReportParameterCollection();

            reportParameter.Add(new ReportParameter("toArabic", word.ConvertToArabic()));
            reportParameter.Add(new ReportParameter("User", Properties.Settings.Default.username));
            LocalReport localReport = new LocalReport();

            localReport.ReportPath = Application.StartupPath + "\\Report1.rdlc";
            Data_Access      data_Access = new Data_Access(Convert.ToInt32(lblCode.Text));
            ReportDataSource rds         = new ReportDataSource("Wieghts", data_Access.getReportData());

            localReport.DataSources.Clear();
            localReport.DataSources.Add(rds);
            localReport.SetParameters(reportParameter);
            localReport.PrintToPrinter();
        }
Ejemplo n.º 14
0
        private void print(DataGridView dataGridView1)
        {
            ToWord word = new ToWord(Convert.ToDecimal(dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[8].Value.Equals(DBNull.Value) ? "0" : dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[8].Value), new CurrencyInfo(CurrencyInfo.Currencies.Kilo));
            ReportParameterCollection reportParameter = new ReportParameterCollection();

            reportParameter.Add(new ReportParameter("toArabic", word.ConvertToArabic()));
            reportParameter.Add(new ReportParameter("User", Properties.Settings.Default.username));
            LocalReport localReport = new LocalReport();

            localReport.ReportPath = Application.StartupPath + "\\Report1.rdlc";
            Data_Access      data_Access = new Data_Access(Convert.ToInt16(Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[0].Value)));
            ReportDataSource rds         = new ReportDataSource("Wieghts", data_Access.getReportData());

            localReport.DataSources.Clear();
            localReport.DataSources.Add(rds);
            localReport.SetParameters(reportParameter);
            localReport.PrintToPrinter();
        }
    protected void Btn1_Click(object sender, EventArgs e)
    {
        GridViewRow gvRow = (GridViewRow)(sender as Control).Parent.Parent;
        int         index = gvRow.RowIndex;

        //Fetches the employee id corresponding to the row index
        string sap_id         = GridView_leaves.Rows[index].Cells[2].Text;
        string student_branch = GridView_leaves.Rows[index].Cells[4].Text;
        byte   x = Data_Access.Approve_Reject(sap_id, Session["post"].ToString(), 1, student_branch);

        if (x == 1)
        {
            Response.Write("Approved");
        }

        SqlConnection  con = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString);
        SqlDataAdapter da  = new SqlDataAdapter();

        if (Session["post"].ToString() == "mentor")
        {
            da.SelectCommand = new SqlCommand("select student.sap_id,student.name,student.branch,student.year,student.course,student.mobile_self,leave.date_from,leave.date_to,leave.reason from student inner join leave on leave.sap_id=student.sap_id where leave.leave_status=0 and leave.departed='False' and leave.emp_id='" + Session["emp_id"].ToString() + "'", con);
        }
        else if (Session["post"].ToString() == "hod")
        {
            da.SelectCommand = new SqlCommand("select student.sap_id,student.name,student.branch,student.year,student.course,student.mobile_self,leave.date_from,leave.date_to,leave.reason from student inner join leave on leave.sap_id=student.sap_id where leave.leave_status=1 and leave.departed='False' and student.branch='" + Session["branch"].ToString() + "'", con);
        }
        else if (Session["post"].ToString() == "dean")
        {
            da.SelectCommand = new SqlCommand("select student.sap_id,student.name,student.branch,student.year,student.course,student.mobile_self,leave.date_from,leave.date_to,leave.reason from student inner join leave on leave.sap_id=student.sap_id where leave.leave_status=2 and leave.departed='False'", con);
        }
        DataTable dt = new DataTable();

        da.Fill(dt);
        if (dt.Columns.Count != 0)
        {
            GridView_leaves.DataSource = dt;
            GridView_leaves.DataBind();
        }
        else
        {
            Label_leave_available.Visible = true;
            Label_leave_available.Text    = "No Leaves Found";
        }
    }
Ejemplo n.º 16
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        int             days_holiday = 0;                //number of days having holiday
        List <DateTime> date_range   = GetDateRange(Convert.ToDateTime(TextBox_date_from.Text), Convert.ToDateTime(TextBox_date_to.Text).Date);
        int             days_leave   = date_range.Count; // total number of days leave applied for

        foreach (DateTime item in date_range)
        {
            if (item.DayOfWeek == DayOfWeek.Sunday)
            {
                days_holiday++;
            }
            else
            {
                SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString);
                if (con.State != ConnectionState.Open)
                {
                    con.Open();
                }
                SqlCommand cmd = new SqlCommand("select date from academic_leave where date='" + item.ToString("yyyy-MM-dd") + "'", con);
                object     c   = cmd.ExecuteScalar();
                if (c != null)
                {
                    days_holiday++;
                }
                con.Close();
            }
        }
        Label_result.Visible = true;
        String mentor_email = "";

        if ((days_leave - days_holiday) != 0)
        {
            Label_result.Text = Data_Access.Apply_Leave(Session["sap_id"].ToString(), TextBox_date_from.Text, TextBox_date_to.Text, TextBox_reason.Text, out mentor_email, days_leave - days_holiday);
        }
        else
        {
            Label_result.Text = Data_Access.Apply_Leave(Session["sap_id"].ToString(), TextBox_date_from.Text, TextBox_date_to.Text, TextBox_reason.Text, out mentor_email, days_holiday);
        }

        Data_Access.MailSend(mentor_email, "Mentor Leave Notification", "New leave has been posted");
    }
 protected void Button_applyLeave_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         DateTime start_time     = Convert.ToDateTime(TextBox_date_from.Text) + new TimeSpan(16, 59, 59);
         DateTime return_time    = Convert.ToDateTime(TextBox_date_from.Text) + new TimeSpan(21, 59, 59);
         DateTime departure_time = Convert.ToDateTime(TextBox_time_departure.Text);
         DateTime arrival_time   = Convert.ToDateTime(TextBox_time_arrival.Text);
         if (TimeSpan.Compare(departure_time.TimeOfDay, start_time.TimeOfDay) == 1)
         {
             int i = Data_Access.apply_sameDayLeave(Session["sap_id"].ToString(), TextBox_date_from.Text, TextBox_reason.Text, TextBox_time_departure.Text);
             if (i == 1)
             {
                 Response.Write("forwarded to warden");
             }
         }
         else
         {
             Response.Write("forward to hod");
         }
     }
 }
Ejemplo n.º 18
0
        public void UseUp(Product product, uint milliliters)
        {
            Data_Access data = Data_Access.getInstance();

            //Obliczenie zużycia
            while (milliliters > 0)
            {
                if (milliliters <= product.Ml)                          //Jeśli w otwartym opakowaniu jest więcej produktu niż zużyto
                {
                    product.Ml = (int)((uint)product.Ml - milliliters); //odejmij

                    data.UpdateProductMl(product, product.Ml);          //zaktualizuj
                    data.UpdateProductCount(product, product.Count);
                    return;
                }
                else
                {
                    milliliters = milliliters - (uint)product.Ml;//otwórz nowe opakowanie
                    product.Ml  = product.Capacity;
                    product.Count--;
                }
            }
        }
    protected void Button_submit_Click(object sender, EventArgs e)
    {
        if (TextBox_sap.Text != "" && TextBox_name.Text != "" && DropDownList_branch.SelectedValue != "" &&
            DropDownList_year.SelectedValue != "" && DropDownList_course.SelectedValue != "" && DropDownList_gender.SelectedValue != "" &&
            TextBox_mobile_self.Text != "" && TextBox_mobile_parent.Text != "" &&
            TextBox_email.Text != "" && TextBox_address.Text != "" && DropDownList_mentor.SelectedValue != "")
        {
            if (Page.IsValid)
            {
                //encrypt sap_id here

                String password = Encrypt(TextBox_sap.Text.Trim());
                int    i        = Data_Access.Register_student(TextBox_sap.Text, TextBox_name.Text, password, DropDownList_branch.SelectedValue,
                                                               DropDownList_year.SelectedValue, DropDownList_course.SelectedValue, DropDownList_gender.SelectedValue, TextBox_mobile_self.Text, TextBox_mobile_parent.Text,
                                                               TextBox_email.Text, TextBox_address.Text, DropDownList_mentor.SelectedValue
                                                               );

                if (i == 2)
                {
                    Response.Write("Successful");
                }
                else if (i == 3)
                {
                    Response.Write("SAP ID already registered");
                }
                else
                {
                    Response.Write("Unsuccessful");
                }
            }
        }
        else
        {
            Response.Write("Enter all the fields");
        }
    }
Ejemplo n.º 20
0
        public void Add(Product product, uint quantity)
        {
            Data_Access data = Data_Access.getInstance();

            data.UpdateProductCount(product, (int)(quantity));
        }
Ejemplo n.º 21
0
        public void GetAllSingleUseProducts(string name)
        {
            Data_Access data = Data_Access.getInstance();

            SingleUseProducts = data.SearchSingleUseProductByName(name);
        }
Ejemplo n.º 22
0
        public void Add(Visit visit)
        {
            Data_Access data = Data_Access.getInstance();

            data.AddVisit(visit);
        }
Ejemplo n.º 23
0
        //Pobieranie list produktów
        public void GetProducts(string name)
        {
            Data_Access data = Data_Access.getInstance();

            Products = data.SearchAvailableProducts(name);
        }
Ejemplo n.º 24
0
 protected void Button_check_status_Click(object sender, EventArgs e)
 {
     Label_result.Visible = true;
     Label_result.Text    = Data_Access.Check_Status(Session["sap_id"].ToString());
 }
Ejemplo n.º 25
0
        // Pobranie na listę wizyt konkretnego klienta
        public void GetVisits(Client client)
        {
            Data_Access data = Data_Access.getInstance();

            Visits = data.ShowVisitsForClient(client);
        }
Ejemplo n.º 26
0
        public void GetClients(string name = "", string surname = "")
        {
            Data_Access data = Data_Access.getInstance();

            Clients = data.FindClient(name, surname);
        }
Ejemplo n.º 27
0
        public void Add(Visit visit, List <Product> products, List <SingleUseProduct> sProducts)
        {
            Data_Access data = Data_Access.getInstance();

            data.AddVisit(visit, products, sProducts);
        }
Ejemplo n.º 28
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        String post, branch;

        if (Page.IsValid)
        {
            String password = Encrypt(TextBox_password.Text);
            String name;
            if (RadioButtonList1.SelectedValue == "Student")
            {
                name = Data_Access.Login(TextBox_ID.Text, password, 1, out post, out branch);
                if (name == "")
                {
                    Response.Write("ID not registered");
                }
                else if (name == "Invalid Password")
                {
                    Response.Write(name);
                }
                else
                {
                    Session["student_name"] = name;
                    Session["sap_id"]       = TextBox_ID.Text;
                    FormsAuthentication.RedirectFromLoginPage(name, false);
                    Response.Redirect("Home_Student/Leave_Apply.aspx");
                }
            }
            else
            {
                name = Data_Access.Login(TextBox_ID.Text, password, 0, out post, out branch);
                if (name == "")
                {
                    Response.Write("Employee ID not registered");
                }
                else if (name == "Invalid Password")
                {
                    Response.Write(name);
                }
                else
                {
                    Session["employee_name"] = name;
                    Session["emp_id"]        = TextBox_ID.Text;
                    Session["post"]          = post;
                    Session["branch"]        = branch;
                    FormsAuthentication.RedirectFromLoginPage(name, false);
                    if (Session["post"].ToString() == "gate_check")
                    {
                        Response.Redirect("Gate_Check.aspx");
                    }
                    else if (Session["post"].ToString() == "warden")
                    {
                        Response.Redirect("Hostel_Check_Leave.aspx");
                    }
                    else
                    {
                        Response.Redirect("Employee_Check_Leave.aspx");
                    }
                }
            }
        }
    }