コード例 #1
0
ファイル: frmVehInOutList.cs プロジェクト: ganeshsoley/VMS
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (lvwVehInOut.SelectedItems != null && lvwVehInOut.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)
                            {
                                VehInOut objVehInOut = new VehInOut();
                                objVehInOut = VehInOutManager.GetItem(Convert.ToInt32(lvwVehInOut.SelectedItems[0].Name));
                                VehInOutManager.Delete(objVehInOut);
                                lvwVehInOut.Items.Remove(lvwVehInOut.SelectedItems[0]);
                            }
                        }
                        else
                        {
                            throw new Exception("Not Authorised.");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
コード例 #2
0
ファイル: frmVehInOutList.cs プロジェクト: ganeshsoley/VMS
        private void modifyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (lvwVehInOut.SelectedItems != null && lvwVehInOut.SelectedItems.Count != 0)
                {
                    if (IsList)
                    {
                        btnOk_Click(sender, e);
                    }
                    else
                    {
                        //if (objUIRights.ModifyRight)
                        //{
                        VehInOut        objVehInOut;
                        frmVehInOutProp objFrmProp;

                        objVehInOut                   = VehInOutManager.GetItem(Convert.ToInt32(lvwVehInOut.SelectedItems[0].Name));
                        objFrmProp                    = new frmVehInOutProp(objVehInOut, objCurUser);
                        objFrmProp.MdiParent          = this.MdiParent;
                        objFrmProp.Entry_DataChanged += new frmVehInOutProp.VehInOutUpdateHandler(Entry_DataChanged);
                        objFrmProp.Show();
                        //}
                        //else
                        //{
                        //    throw new Exception("Not Authorised.");
                        //}
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
コード例 #3
0
        private void FillCity()
        {
            string[] CityList = VehInOutManager.GetCities();

            cboCity.Items.Clear();
            if (CityList != null)
            {
                foreach (string str in CityList)
                {
                    cboCity.Items.Add(str);
                }
            }
        }
コード例 #4
0
        private void FillOutVendors()
        {
            string[] OutVendorList = VehInOutManager.GetOutVendors();

            cboVendorOut.Items.Clear();
            if (OutVendorList != null)
            {
                foreach (string str in OutVendorList)
                {
                    cboVendorOut.Items.Add(str);
                }
            }
        }
コード例 #5
0
        private void FillInVendors()
        {
            string[] InVendorList = VehInOutManager.GetInVendors();

            cboVendorIn.Items.Clear();
            if (InVendorList != null)
            {
                foreach (string str in InVendorList)
                {
                    cboVendorIn.Items.Add(str);
                }
            }
        }
コード例 #6
0
        private void FillVehicle()
        {
            string[] VehicleList = VehInOutManager.GetVehicles();

            cboVehicleNo.Items.Clear();
            if (VehicleList != null)
            {
                foreach (string str in VehicleList)
                {
                    cboVehicleNo.Items.Add(str);
                }
            }
        }
コード例 #7
0
        private void FillDriver()
        {
            string[] DriverList = VehInOutManager.GetDrivers();

            cboDriver.Items.Clear();
            if (DriverList != null)
            {
                //cboDriver.Items.Add("All");
                foreach (string str in DriverList)
                {
                    cboDriver.Items.Add(str);
                }
                // cboDriver.Text = "All";
            }
        }
コード例 #8
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                bool flgApplyEdit;
                flgApplyEdit = VehInOutManager.Save(objVehInOut);
                if (flgApplyEdit)
                {
                    // instance the event args and pass it value
                    VehInOutUpdateEventArgs args = new VehInOutUpdateEventArgs(objVehInOut.Dbid, objVehInOut.EntryNo, objVehInOut.VehNo, objVehInOut.EntryDate, objVehInOut.DriverName, objVehInOut.InDate, objVehInOut.InTime, objVehInOut.OutDate, objVehInOut.OutTime, objVehInOut.Type, objVehInOut.InOut);

                    // 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);
            }
        }
コード例 #9
0
ファイル: frmVehInOutList.cs プロジェクト: ganeshsoley/VMS
        private void FillList()
        {
            int intEntryType = 0;

            if (EntryType == "IN/OUT OTHER")
            {
                intEntryType = 1;
            }
            else
            if (EntryType == "COMPANY")
            {
                intEntryType = 4;
            }

            VehInOutList objList = new VehInOutList();

            objList = VehInOutManager.GetList(dtpDate.Value, flgShowAll, intEntryType);

            lvwVehInOut.Items.Clear();

            if (objList != null)
            {
                foreach (VehInOut objVehInOut in objList)
                {
                    ListViewItem objLvwItem = new ListViewItem();
                    objLvwItem.Name = Convert.ToString(objVehInOut.Dbid);
                    objLvwItem.Text = Convert.ToString(objVehInOut.EntryNo);
                    if (objVehInOut.Type == 1)
                    {
                        objLvwItem.SubItems.Add("IN/OUT OTHER");
                    }
                    else if (objVehInOut.Type == 4)
                    {
                        objLvwItem.SubItems.Add("COMPANY");
                    }
                    objLvwItem.SubItems.Add(Convert.ToString(objVehInOut.VehNo));
                    if (objVehInOut.InOut == 1)
                    {
                        objLvwItem.SubItems.Add("IN");
                    }
                    else if (objVehInOut.InOut == 2)
                    {
                        objLvwItem.SubItems.Add("OUT");
                    }

                    objLvwItem.SubItems.Add(objVehInOut.DriverName);
                    if (objVehInOut.InDate != DateTime.MinValue)
                    {
                        objLvwItem.SubItems.Add(objVehInOut.InDate.ToShortDateString());
                    }
                    else
                    {
                        objLvwItem.SubItems.Add("");
                    }

                    if (objVehInOut.InTime != DateTime.MinValue)
                    {
                        objLvwItem.SubItems.Add(objVehInOut.InTime.ToShortTimeString());
                    }
                    else
                    {
                        objLvwItem.SubItems.Add("");
                    }

                    if (objVehInOut.OutDate != DateTime.MinValue)
                    {
                        objLvwItem.SubItems.Add(objVehInOut.OutDate.ToShortDateString());
                    }
                    else
                    {
                        objLvwItem.SubItems.Add("");
                    }

                    if (objVehInOut.OutTime != DateTime.MinValue)
                    {
                        objLvwItem.SubItems.Add(objVehInOut.OutTime.ToShortTimeString());
                    }
                    else
                    {
                        objLvwItem.SubItems.Add("");
                    }

                    lvwVehInOut.Items.Add(objLvwItem);
                    if (objVehInOut.InOut == 1)
                    {
                        objLvwItem.ForeColor = Color.Blue;
                    }
                    else if (objVehInOut.InOut == 2)
                    {
                        objLvwItem.ForeColor = Color.Red;
                    }
                }
            }
        }