Пример #1
0
        private void metroTile1_Click(object sender, EventArgs e)
        {
            List<user> sList = new List<user>();
            userList u = new userList();
            sList = u.getuserType(uname.Text, pass.Text);
            String type= null;
            for (int i = 0; i < sList.Count; i++)
            {
                type = sList[i].UserType;
            }

            if (type == "ADMINISTRATOR")
            {
                users frm = new users();
                frm.Show();
            }
            else
            {
                MetroFramework.MetroMessageBox.Show(this, "Username and Password does not match", "Error Connection", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #2
0
        private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
        {
            Graphics g = e.Graphics;

            g.PageUnit = GraphicsUnit.Millimeter;
            Font messageFont = new Font("Times New Roman", 14, System.Drawing.GraphicsUnit.Point);
            int  total;

            if (j == 1)
            {
                g.DrawString("INSTITUTE DISPENSARY", messageFont, Brushes.Black, 75, 9);
                g.DrawString("INDIAN INSTITUTE OF TECHNOLOGY ROORKEE, SAHARANPUR CAMPUS", messageFont, Brushes.Black, 22, 15);
                messageFont = new Font("Times New Roman", 15, System.Drawing.GraphicsUnit.Point);
                g.DrawString("STORE - MONTHLY EXPIRED REPORT (" + monthCalendar1.SelectionStart.Date.ToString("MMMM, yyyy").ToUpper() + ")", messageFont, Brushes.Black, 40, 21);
                Pen blackPen = new Pen(Color.Black, 1);
                g.DrawLine(blackPen, 5, 28, 205, 28);
                messageFont = new Font("Times New Roman", 12, System.Drawing.GraphicsUnit.Point);
                g.DrawString("Dated: " + DateTime.Today.ToString("dd MMM, yyyy"), messageFont, Brushes.Black, 150, 32);
                total = 30;
            }
            else
            {
                total = 5;
            }
            messageFont = new Font("Times New Roman", 15, System.Drawing.GraphicsUnit.Point);
            g.DrawString("----------------------------------------------------------------------------------------------------------", messageFont, Brushes.Black, 7, total + 7);
            g.DrawString("----------------------------------------------------------------------------------------------------------", messageFont, Brushes.Black, 7, total + 17);
            messageFont = new Font("Times New Roman", 10, System.Drawing.GraphicsUnit.Point);
            g.DrawString("SNo.", messageFont, Brushes.Black, 10, total + 13);
            g.DrawString("Salt Name", messageFont, Brushes.Black, 22, total + 13);
            g.DrawString("Type", messageFont, Brushes.Black, 87, total + 13);
            g.DrawString("Quantity", messageFont, Brushes.Black, 107, total + 13);
            g.DrawString("Entry On", messageFont, Brushes.Black, 127, total + 13);
            g.DrawString("User", messageFont, Brushes.Black, 167, total + 13);
            total += 25;
            store     store = new store();
            dbconnect db    = new dbconnect("medicines");

            //MessageBox.Show("SELECT medicine_name, medicine_type, quantity, timestamp, user FROM expired WHERE transaction_id>='" + monthCalendar1.SelectionRange.Start.ToString("yyyyMM") + "01" + "' AND transaction_id<'" + monthCalendar1.SelectionRange.Start.AddMonths(1).ToString("yyyyMM") + "01" + "'");
            store.expiredStockReport("store", monthCalendar1.SelectionRange.Start.ToString("yyyyMM") + "01", monthCalendar1.SelectionRange.Start.AddMonths(1).ToString("yyyyMM") + "01", db);
            int i = 1;

            while (store.dr.Read())
            {
                if (i < j)
                {
                    i++;
                    continue;
                }
                if (total >= 265)
                {
                    e.HasMorePages = true;
                    return;
                }
                messageFont = new Font("Times New Roman", 10, System.Drawing.GraphicsUnit.Point);
                g.DrawString((j).ToString() + ".", messageFont, Brushes.Black, 10, total);
                g.DrawString(store.dr[0].ToString(), messageFont, Brushes.Black, 22, total);
                g.DrawString(store.dr[1].ToString(), messageFont, Brushes.Black, 87, total);
                g.DrawString(store.dr[2].ToString(), messageFont, Brushes.Black, 107, total);
                g.DrawString(store.dr[3].ToString(), messageFont, Brushes.Black, 127, total);
                users userDetails = new users(store.dr[4].ToString());
                g.DrawString(userDetails.fname + " " + userDetails.lname, messageFont, Brushes.Black, 167, total);
                messageFont = new Font("Times New Roman", 5, System.Drawing.GraphicsUnit.Point);
                g.DrawString("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -", messageFont, Brushes.Black, 10, total + 4);
                total += 6;
                j++;
                i++;
                e.HasMorePages = false;
            }
            messageFont = new Font("Times New Roman", 15, System.Drawing.GraphicsUnit.Point);
            g.DrawString("----------------------------------------------------------------------------------------------------------", messageFont, Brushes.Black, 7, total + 5);
            messageFont = new Font("Times New Roman", 8, System.Drawing.GraphicsUnit.Point);
            g.DrawString("© IMG Labs, IIT Roorkee, SRE", messageFont, Brushes.Black, 87, total + 10);
        }