Exemple #1
0
        private void btnVisitorList_Click(object sender, EventArgs e)
        {
            frmVisitorList frmList = new frmVisitorList();

            frmList.IsList = true;
            frmList.ShowDialog();

            if (!frmList.IsListCancel & frmList.DBID > 0)
            {
                Visitor objVisitor = new Visitor();
                objVisitor               = VisitorManager.GetItem(frmList.DBID);
                objVisitorGP.VisitorID   = objVisitor.DBID;
                objVisitorGP.VisitorName = objVisitor.VName;
                objVisitorGP.CompanyName = objVisitor.Company;
                objVisitorGP.ContactNo   = objVisitor.MobileNo;

                lblVisitorName.Text = objVisitorGP.VisitorName;
                lblCompany.Text     = objVisitorGP.CompanyName;
                lblContactNo.Text   = objVisitorGP.ContactNo;

                // Fetch Here Last Image of same visitor
                byte[] vImage = VisitorGatePassManager.GetVisitorImage(objVisitor.DBID);
                if (vImage != null)
                {
                    MemoryStream mem = new MemoryStream(vImage);
                    picVisitorImg.Image       = Image.FromStream(mem);
                    objVisitorGP.VisitorImage = vImage;
                    picVideo.Visible          = false;
                    picVisitorImg.Visible     = true;
                }
                SendKeys.Send("{TAB}");
                //objVisitor.dispose();
            }
            frmList.Dispose();
        }
Exemple #2
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (lvwGPs.SelectedItems != null && lvwGPs.SelectedItems.Count != 0)
                {
                    if (!IsList)
                    {
                        if (objUIRights.DeleteRight)
                        {
                            DialogResult dr = new DialogResult();
                            dr = MessageBox.Show("Do You Really Want to Delete Record ?", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);

                            if (dr == DialogResult.Yes)
                            {
                                VisitorGatePass objVisitorGP = new VisitorGatePass();
                                objVisitorGP = VisitorGatePassManager.GetItem(Convert.ToInt32(lvwGPs.SelectedItems[0].Name));
                                VisitorGatePassManager.Delete(objVisitorGP);
                                lvwGPs.Items.Remove(lvwGPs.SelectedItems[0]);
                            }
                        }
                        else
                        {
                            throw new Exception("Not Authorised.");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Exemple #3
0
        private void btnAppointmentList_Click(object sender, EventArgs e)
        {
            frmAppointmentList frmList = new frmAppointmentList();

            frmList.Condition = "APPOINTMENTDATE = '" + objVisitorGP.GateDate.ToString("yyyy-MM-dd") + "'";
            frmList.IsList    = true;
            frmList.ShowDialog();

            if (!frmList.IsListCancel)
            {
                Appointment objApp = new Appointment();
                objApp = AppointmentManager.GetItem(frmList.DBID);

                // Fetch Appointment Detail
                objVisitorGP.AppointmentNo = objApp.AppointmentNo;
                objVisitorGP.VisitorID     = objApp.VisitorID;
                objVisitorGP.VisitorName   = objApp.Name;
                objVisitorGP.CompanyName   = objApp.Company;
                objVisitorGP.ContactNo     = objApp.ContactNo;

                //Fetch VIsitor Detail
                Employee objEmp = new Employee();
                objEmp = EmployeeManager.GetItem(objApp.EmployeeID);
                objVisitorGP.EmployeeID = objEmp.DBID;
                objVisitorGP.ToMeet     = objEmp.Initials;
                objVisitorGP.EmpDept    = objEmp.DeptName;
                objVisitorGP.EmpMobile  = objEmp.MobileNo;

                // Display Detail on Form
                lblAppointmentNo.Text = objVisitorGP.AppointmentNo;
                lblVisitorName.Text   = objApp.Name;
                lblCompany.Text       = objApp.Company;
                lblContactNo.Text     = objApp.ContactNo;

                lblToMeet.Text     = objVisitorGP.ToMeet;
                lblEmpDept.Text    = objVisitorGP.EmpDept;
                lblEmpContact.Text = objVisitorGP.EmpMobile;

                // Fetch Here Last Image of visitor
                byte[] vImage = VisitorGatePassManager.GetVisitorImage(objApp.VisitorID);
                if (vImage != null)
                {
                    MemoryStream mem = new MemoryStream(vImage);

                    picVisitorImg.Image       = Image.FromStream(mem);
                    objVisitorGP.VisitorImage = vImage;
                    picVideo.Visible          = false;
                    picVisitorImg.Visible     = true;
                }
                btnVisitorList.Enabled = false;
                btnEmpList.Enabled     = false;

                SendKeys.Send("{TAB}");
            }
            frmList.Dispose();
        }
Exemple #4
0
        private void FillList()
        {
            int totVisitors = 0, totInVisitors = 0, totOutVisitors = 0;
            VisitorGatePassList objList = new VisitorGatePassList();

            objList = VisitorGatePassManager.GetList("", dtpDate.Value, flgShowAll);

            lvwGPs.Items.Clear();

            if (objList != null)
            {
                foreach (VisitorGatePass objVisitorGP in objList)
                {
                    ListViewItem objLvwItem = new ListViewItem();
                    objLvwItem.Name = Convert.ToString(objVisitorGP.DBID);
                    objLvwItem.Text = objVisitorGP.GatePassNo;
                    objLvwItem.SubItems.Add(objVisitorGP.VisitorName);
                    objLvwItem.SubItems.Add(objVisitorGP.GateDate.ToShortDateString());
                    objLvwItem.SubItems.Add(objVisitorGP.TimeIn.ToShortTimeString());
                    objLvwItem.SubItems.Add(objVisitorGP.ToMeet);
                    objLvwItem.SubItems.Add(objVisitorGP.Purpose);
                    if (objVisitorGP.TimeOut != DateTime.MinValue)
                    {
                        objLvwItem.SubItems.Add(objVisitorGP.TimeOut.ToShortTimeString());
                    }
                    else
                    {
                        objLvwItem.SubItems.Add("");
                    }

                    totVisitors   += 1;
                    totInVisitors += 1;
                    if (objVisitorGP.TimeOut != DateTime.MinValue)
                    {
                        totOutVisitors += 1;
                    }

                    lvwGPs.Items.Add(objLvwItem);
                    if (objVisitorGP.TimeOut != DateTime.MinValue)
                    {
                        objLvwItem.ForeColor = Color.Red;
                    }
                    else
                    {
                        objLvwItem.ForeColor = Color.Blue;
                    }
                }
            }
            lblTotal.Text    = Convert.ToString(totVisitors);
            lblTotalIn.Text  = Convert.ToString(totInVisitors);
            lblTotalOut.Text = Convert.ToString(totOutVisitors);
        }
Exemple #5
0
        private void FillEmployees()
        {
            string[] EmployeeList = VisitorGatePassManager.GetEmployee();

            cboEmployee.Items.Clear();
            if (EmployeeList != null)
            {
                cboEmployee.Items.Add("ALL");
                foreach (string str in EmployeeList)
                {
                    cboEmployee.Items.Add(str);
                }
            }
        }
Exemple #6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                bool flgApplyEdit;
                flgApplyEdit = VisitorGatePassManager.Save(objVisitorGP, objUser);
                if (flgApplyEdit)
                {
                    if (objVisitorGP.IsNew)
                    {
                        if (objVisitorGP.AppointmentNo != "")
                        {
                            GetSMSRespons();
                        }
                    }
                    // instance the event args and pass it value
                    VisitorGPUpdateEventArgs args = new VisitorGPUpdateEventArgs(objVisitorGP.DBID, objVisitorGP.GatePassNo, objVisitorGP.GateDate, objVisitorGP.VisitorName, objVisitorGP.ToMeet, objVisitorGP.Purpose, objVisitorGP.TimeIn, objVisitorGP.TimeOut);

                    // raise event wtth  updated
                    if (Entry_DataChanged != null)
                    {
                        if (this.IsNew)
                        {
                            Entry_DataChanged(this, args, DataEventType.INSERT_EVENT);
                        }
                        else
                        {
                            Entry_DataChanged(this, args, DataEventType.UPDATE_EVENT);
                        }
                    }
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Record Not Saved.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                this.Close();
            }
        }
Exemple #7
0
        private void modifyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (lvwGPs.SelectedItems != null && lvwGPs.SelectedItems.Count != 0)
                {
                    if (IsList)
                    {
                        btnOk_Click(sender, e);
                    }
                    else
                    {
                        if (objUIRights.ModifyRight)
                        {
                            VisitorGatePass  objVisitorGP;
                            frmVisitorGPProp objFrmProp;

                            objVisitorGP                  = VisitorGatePassManager.GetItem(Convert.ToInt32(lvwGPs.SelectedItems[0].Name));
                            objFrmProp                    = new frmVisitorGPProp(objVisitorGP, currentUser);
                            objFrmProp.MdiParent          = this.MdiParent;
                            objFrmProp.Entry_DataChanged += new frmVisitorGPProp.VisitorGPUpdateHandler(Entry_DataChanged);
                            objFrmProp.Show();
                        }
                        else
                        {
                            throw new Exception("Not Authorised.");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                AppLogger.Error(ex.Message.ToString());
                AppLogger.Error(ex.StackTrace.ToString());
            }
        }
Exemple #8
0
        private void checkOutVisitorToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (objUIRights.AddRight)
                {
                    VisitorGatePass objVisitorGP;
                    objVisitorGP         = VisitorGatePassManager.GetItem(Convert.ToInt32(lvwGPs.SelectedItems[0].Name));
                    objVisitorGP.TimeOut = DateTime.Now;

                    bool flgApplyEdit;
                    flgApplyEdit = VisitorGatePassManager.Save(objVisitorGP, currentUser);
                    if (flgApplyEdit)
                    {
                        // instance the event args and pass it value
                        VisitorGPUpdateEventArgs args = new VisitorGPUpdateEventArgs(objVisitorGP.DBID, objVisitorGP.GatePassNo, objVisitorGP.GateDate, objVisitorGP.VisitorName, objVisitorGP.ToMeet, objVisitorGP.Purpose, objVisitorGP.TimeIn, objVisitorGP.TimeOut);

                        // raise event wtth  updated
                        Entry_DataChanged(this, args, DataEventType.UPDATE_EVENT);
                    }
                    else
                    {
                        MessageBox.Show("Record Not Saved.");
                    }
                    FillList();
                }
                else
                {
                    throw new Exception("Not Authorised.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }