Esempio n. 1
0
File: Data.cs Progetto: hoolanla/VMS
        public DataTable Update_Data(MODEL.Data criteria)
        {
            try
            {
                criteria.update_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                criteria.out_time    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                Class.clsDB db = new Class.clsDB();
                string      sql;
                sql  = "Update vm_visitor SET flag_out='1',  ";
                sql += "out_time='" + criteria.out_time + "',";
                sql += "update_date='" + criteria.update_date + "' Where vm_id='" + criteria.vm_id + "'";

                int ret;
                ret = db.ExecuteNonQuery(sql);
                db.Close();
                if (ret == 1)
                {
                    DataTable dt;
                    sql = "Select * From vm_visitor Where vm_id = '" + criteria.vm_id + "'";
                    dt  = db.ExecuteDataTable(sql);
                    return(dt);
                }
                return(null);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Esempio n. 2
0
        protected void Timer1_Tick(object sender, EventArgs e)
        {
            MODEL.Production mod  = new MODEL.Production();
            BLL.Data         _BLL = new BLL.Data();

            mod = _BLL.getStatus();

            ArrayList arrL = new ArrayList();

            arrL = mod.line;
            MODEL.Data mod_data = new MODEL.Data();
            if (arrL.Count > 0)
            {
                for (int i = 0; i < arrL.Count; i++)
                {
                    mod_data = (MODEL.Data)arrL[i];

                    if (mod_data.Production_active == "1")
                    {
                        count(mod_data);
                    }
                    else
                    {
                        //  L1.Attributes["class"] = "btn btn-danger center-block";
                    }
                }
            }



            //L1.Attributes["class"] = "btn btn-success center-block";

            //Span1.InnerHtml = "1";
        }
Esempio n. 3
0
        private void txtBarcode_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                MODEL.Data model = new MODEL.Data();
                model.vm_id = txtBarcode.Text;
                BLL.Data  _BLL = new BLL.Data();
                DataTable dt;
                dt = _BLL.Update_Data(model);
                if (dt.Rows.Count > 0)
                {
                    lbName2.Text    = dt.Rows[0]["name"].ToString();
                    lbSurname2.Text = dt.Rows[0]["lastname"].ToString();
                    lbCard2.Text    = dt.Rows[0]["id_card"].ToString();

                    lbCompany2.Text        = dt.Rows[0]["company"].ToString();
                    lbContact_person2.Text = dt.Rows[0]["contact_person"].ToString();
                    lbDept2.Text           = dt.Rows[0]["dept"].ToString();
                    lbLicense2.Text        = dt.Rows[0]["license_plate"].ToString();
                    lb_in_time.Text        = dt.Rows[0]["in_time"].ToString();
                    lb_out_time.Text       = dt.Rows[0]["out_time"].ToString();

                    Bitmap bm = new Bitmap(Application.StartupPath + "//Photo//" + model.vm_id + ".Jpg");
                    picShow2.Image = bm;
                }
            }
        }
Esempio n. 4
0
 private void Form1_Load(object sender, EventArgs e)
 {
     webcam = new WebCam();
     webcam.InitializeWebCam(ref imgVideo);
     _Data            = new MODEL.Data();
     dt1.CustomFormat = "yyyy-MM-dd";
     dt2.CustomFormat = "yyyy-MM-dd";
     dt1.Format       = DateTimePickerFormat.Custom;
     dt2.Format       = DateTimePickerFormat.Custom;
 }
Esempio n. 5
0
File: Data.cs Progetto: hoolanla/VMS
        public int Insert_Data(MODEL.Data criteria)
        {
            try
            {
                criteria.create_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                criteria.in_time     = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                Class.clsDB db = new Class.clsDB();
                string      sql;
                sql  = "Insert into vm_visitor ( ";
                sql += "vm_id,";
                sql += "name,";
                sql += "lastname,";
                sql += "birthday,";
                sql += "address ,";
                sql += "company ,";
                sql += "contact_person ,";
                sql += "dept ,";
                sql += "id_card ,";
                sql += "license_plate ,";
                sql += "create_by ,";
                sql += "in_time ,";
                sql += "create_date) VALUES(";
                sql += "'" + criteria.vm_id + "',";
                sql += "'" + criteria.name + "',";
                sql += "'" + criteria.lastname + "',";
                sql += "'" + criteria.birth + "',";
                sql += "'" + criteria.address + "',";
                sql += "'" + criteria.company + "',";
                sql += "'" + criteria.contact_person + "',";
                sql += "'" + criteria.dept + "',";
                sql += "'" + criteria.id_card + "',";
                sql += "'" + criteria.license_plate + "',";
                sql += "'" + criteria.create_by + "',";
                sql += "'" + criteria.in_time + "',";
                sql += "'" + criteria.create_date + "')";

                int ret;
                ret = db.ExecuteNonQuery(sql);
                db.Close();

                return(ret);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
Esempio n. 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            MODEL.Data _model = new MODEL.Data();

            string strDT1, strDT2;

            strDT1 = dt1.Value.ToString("yyyy-MM-dd") + " 08:00:00";
            strDT2 = dt2.Value.ToString("yyyy-MM-dd") + " 08:00:00";

            _model.in_time  = strDT1;
            _model.out_time = strDT2;

            BLL.Data  _BLL = new BLL.Data();
            DataTable dt;

            dt            = _BLL.Select_Data(_model);
            DG.DataSource = dt;
        }
Esempio n. 7
0
        public static void SaveImageBarcode(System.Drawing.Image image, MODEL.Data model)
        {
            try
            {
                using (Bitmap bitmap = new Bitmap(image))
                {
                    string filename = Application.StartupPath + "\\Barcode\\" + model.vm_id + ".Jpg";

                    //  Thread.Sleep(1000);
                    bitmap.Save(filename, System.Drawing.Imaging.ImageFormat.Jpeg);

                    bitmap.Dispose();//To Do…. isprobaj
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 8
0
File: Data.cs Progetto: hoolanla/VMS
        public DataTable Select_Data(MODEL.Data criteria)
        {
            try
            {
                Class.clsDB db = new Class.clsDB();
                string      sql;



                DataTable dt;
                sql = "Select * From vm_visitor Where in_time >= '" + criteria.in_time + "' and out_time <= '" + criteria.out_time + "'";
                dt  = db.ExecuteDataTable(sql);
                return(dt);

                return(null);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Esempio n. 9
0
File: Data.cs Progetto: hoolanla/VMS
 public DataTable Select_Data(MODEL.Data criteria)
 {
     return(_DAL.Select_Data(criteria));
 }
Esempio n. 10
0
File: Data.cs Progetto: hoolanla/VMS
 public DataTable Update_Data(MODEL.Data criteria)
 {
     return(_DAL.Update_Data(criteria));
 }
Esempio n. 11
0
File: Data.cs Progetto: hoolanla/VMS
 public int Insert_Data(MODEL.Data criteria)
 {
     return(_DAL.Insert_Data(criteria));
 }
Esempio n. 12
0
        private void count(MODEL.Data model)
        {
            HtmlButton button      = new HtmlButton();
            HtmlButton button_stop = new HtmlButton();
            string     tmp         = "0";

            tmp = Session[model.Line_Name].ToString();
            switch (model.Line_Name)
            {
            case "1":
                button      = L1;
                button_stop = S1;
                Session[model.Line_Name] = Convert.ToInt32(tmp) + 1;
                Span1.InnerHtml          = Session[model.Line_Name].ToString();
                break;

            case "2":
                button      = L2;
                button_stop = S2;
                Session[model.Line_Name] = Convert.ToInt32(tmp) + 1;
                Span2.InnerHtml          = Session[model.Line_Name].ToString();
                break;

            case "3":
                button      = L3;
                button_stop = S3;
                Session[model.Line_Name] = Convert.ToInt32(tmp) + 1;
                Span3.InnerHtml          = Session[model.Line_Name].ToString();
                break;

            case "4":
                button      = L4;
                button_stop = S4;
                Session[model.Line_Name] = Convert.ToInt32(tmp) + 1;
                Span4.InnerHtml          = Session[model.Line_Name].ToString();
                break;

            case "5":
                button      = L5;
                button_stop = S5;
                Session[model.Line_Name] = Convert.ToInt32(tmp) + 1;
                Span5.InnerHtml          = Session[model.Line_Name].ToString();
                break;

            case "6":
                button      = L6;
                button_stop = S6;
                Session[model.Line_Name] = Convert.ToInt32(tmp) + 1;
                Span6.InnerHtml          = Session[model.Line_Name].ToString();
                break;

            case "7":
                button      = L7;
                button_stop = S7;
                Session[model.Line_Name] = Convert.ToInt32(tmp) + 1;
                Span7.InnerHtml          = Session[model.Line_Name].ToString();
                break;

            case "8":
                button      = L8;
                button_stop = S8;
                Session[model.Line_Name] = Convert.ToInt32(tmp) + 1;
                Span8.InnerHtml          = Session[model.Line_Name].ToString();
                break;

            case "9":
                button      = L9;
                button_stop = S9;
                Session[model.Line_Name] = Convert.ToInt32(tmp) + 1;
                Span9.InnerHtml          = Session[model.Line_Name].ToString();
                break;

            case "10":
                button      = L10;
                button_stop = S10;
                Session[model.Line_Name] = Convert.ToInt32(tmp) + 1;
                Span10.InnerHtml         = Session[model.Line_Name].ToString();
                break;

            case "11":
                button      = L11;
                button_stop = S11;
                Session[model.Line_Name] = Convert.ToInt32(tmp) + 1;
                Span11.InnerHtml         = Session[model.Line_Name].ToString();
                break;

            case "12":
                button      = L12;
                button_stop = S12;
                Session[model.Line_Name] = Convert.ToInt32(tmp) + 1;
                Span12.InnerHtml         = Session[model.Line_Name].ToString();
                break;

            case "13":
                button      = L13;
                button_stop = S13;
                Session[model.Line_Name] = Convert.ToInt32(tmp) + 1;
                Span13.InnerHtml         = Session[model.Line_Name].ToString();
                break;

            case "14":
                button      = L14;
                button_stop = S14;
                Session[model.Line_Name] = Convert.ToInt32(tmp) + 1;
                Span14.InnerHtml         = Session[model.Line_Name].ToString();
                break;

            case "15":
                button      = L15;
                button_stop = S15;
                Session[model.Line_Name] = Convert.ToInt32(tmp) + 1;
                Span15.InnerHtml         = Session[model.Line_Name].ToString();
                break;

            case "16":
                button      = L16;
                button_stop = S16;
                Session[model.Line_Name] = Convert.ToInt32(tmp) + 1;
                Span16.InnerHtml         = Session[model.Line_Name].ToString();
                break;

            case "17":
                button      = L17;
                button_stop = S17;
                Session[model.Line_Name] = Convert.ToInt32(tmp) + 1;
                Span17.InnerHtml         = Session[model.Line_Name].ToString();
                break;
            }


            button.Attributes["class"] = "btn btn-success center-block";


            if (tmp == "31")
            {
                BLL.Data bLL = new BLL.Data();
                bLL.NoActive(model);
                button.Attributes["class"] = "btn btn-danger center-block";
                return;
            }


            Int32 tmpCountBack;

            tmpCountBack        = 30 - Convert.ToInt32(tmp);
            SHOWCOUNT.InnerHtml = tmpCountBack.ToString() + "/30";
        }
Esempio n. 13
0
        public static void SaveImageCapture(System.Drawing.Image image, MODEL.Data model)
        {
            try
            {
                using (Bitmap bitmap = new Bitmap(image))
                {
                    string filename = Application.StartupPath + "\\Photo\\" + model.vm_id + ".Jpg";

                    //  Thread.Sleep(1000);
                    bitmap.Save(filename, System.Drawing.Imaging.ImageFormat.Jpeg);

                    bitmap.Dispose();//To Do…. isprobaj
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            //Bitmap newBitmap = new Bitmap(image);
            //image.Dispose();
            //image = null;
            //newBitmap.Save("C://1.Jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);
            //using (MemoryStream memory = new MemoryStream())
            //{
            //    using (FileStream fs = new FileStream(outputFileName, FileMode.Create, FileAccess.ReadWrite))
            //    {
            //        thumbBMP.Save(memory, ImageFormat.Jpeg);
            //        byte[] bytes = memory.ToArray();
            //        fs.Write(bytes, 0, bytes.Length);
            //    }
            //}



            //SaveFileDialog s = new SaveFileDialog();
            //s.FileName = "Image";// Default file name
            //s.DefaultExt = ".Jpg";// Default file extension
            //s.Filter = "Image (.jpg)|*.jpg"; // Filter files by extension

            //// Show save file dialog box
            //// Process save file dialog box results
            //if (s.ShowDialog() == DialogResult.OK)
            //{
            //    // Save Image
            //    string filename = s.FileName;
            //    FileStream fstream = new FileStream(filename, FileMode.Create);
            //    Thread.Sleep(3);
            //    image.Save(fstream, System.Drawing.Imaging.ImageFormat.Jpeg);
            //    fstream.Close();

            //}



            // Save Image
            //string filename = Application.StartupPath + "\\" + model.vm_id + ".Png";
            //FileStream fstream = new FileStream(filename, FileMode.Create);
            //Thread.Sleep(1000);
            //image.Save(fstream, System.Drawing.Imaging.ImageFormat.Png);


            //byte[] byt;
            //byt = imageToByteArray(image);
            //byteArrayToImage(byt);
        }