예제 #1
0
        private void SaveOutlivingPass()
        {
            if (outlivingPassDetail == null)
            {
                outlivingPassDetail             = new OutlivingPassDetail();
                outlivingPassDetail.NSGPassID   = nsgPassId;
                outlivingPassDetail.EntryDate   = DateTime.Now;
                outlivingPassDetail.EntryUserID = GlobalClass.LoggedInUserID;
            }
            else
            {
                outlivingPassDetail.UpdateDate   = DateTime.Now;
                outlivingPassDetail.UpdateUserID = GlobalClass.LoggedInUserID;
            }

            outlivingPassDetail.IdentificationMark = txtIdentificationMark_Outliving.Text;
            outlivingPassDetail.BloodGroup         = txtBloodGroup.Text;
            outlivingPassDetail.NSGEmployeeCode    = txtEmployeeId_Outliving.Text;
            outlivingPassDetail.RankID             = Convert.ToInt16(cmbRank_Outliving.SelectedValue);
            outlivingPassDetail.UnitID             = Convert.ToInt16(cmbUnit_Outliving.SelectedValue);

            if (outlivingPassDetail.OutlivingPassDetailID == 0)
            {
                DB.OutlivingPassDetails.Add(outlivingPassDetail);
            }

            DB.SaveChanges();
        }
예제 #2
0
        private void LoadOutlivingPassDetail()
        {
            outlivingPassDetail = DB.OutlivingPassDetails.Where(opd => opd.NSGPassID == nsgPassId).FirstOrDefault();

            txtIdentificationMark_Outliving.Text = outlivingPassDetail.IdentificationMark;
            txtBloodGroup.Text              = outlivingPassDetail.BloodGroup;
            txtEmployeeId_Outliving.Text    = outlivingPassDetail.NSGEmployeeCode;
            cmbRank_Outliving.SelectedValue = outlivingPassDetail.RankID;
            cmbUnit_Outliving.SelectedValue = outlivingPassDetail.UnitID;
        }
예제 #3
0
        private void RefreshMe(bool reEntry = false)
        {
            if (reEntry)
            {
                nsgPassId = 0;
            }

            nsgPass                  = null;
            civilianPassDetail       = null;
            guestDependantPassDetail = null;
            vehiclePassDetail        = null;
            outlivingPassDetail      = null;
            passDocuments            = null;

            cmbPassType.SelectedIndex = -1;
            txtFirstName.Text         = string.Empty;
            txtLastName.Text          = string.Empty;
            cmbGender.SelectedIndex   = -1;
            txtMobileNo.Text          = string.Empty;
            txtGuardianName.Text      = string.Empty;
            txtPassHolderAddress.Text = string.Empty;
            cmbState.SelectedIndex    = -1;
            cmbCity.SelectedIndex     = -1;

            dteIssueDate.Value  = DateTime.Today;
            dteExpiryDate.Value = DateTime.Today.AddDays(30);

            dteBirthDate.Value = DateTime.Today;

            txtDesignation.Text    = string.Empty;
            txtContractorName.Text = string.Empty;

            txtIdentificationMark_Guest.Text = string.Empty;
            txtRelativeOfName.Text           = string.Empty;
            txtEmployeeId_Guest.Text         = string.Empty;
            cmbRank_Guest.SelectedIndex      = -1;
            cmbUnit_Guest.SelectedIndex      = -1;
            cmbRelationship.SelectedIndex    = -1;

            txtRegistrationNumber.Text    = string.Empty;
            txtVehicleType.Text           = string.Empty;
            txtVehicleMake.Text           = string.Empty;
            txtEmployeeId_Vehicle.Text    = string.Empty;
            cmbRank_Vehicle.SelectedIndex = -1;
            cmbUnit_Vehicle.SelectedIndex = -1;

            txtIdentificationMark_Outliving.Text = string.Empty;
            txtBloodGroup.Text              = string.Empty;
            txtEmployeeId_Outliving.Text    = string.Empty;
            cmbRank_Outliving.SelectedIndex = -1;
            cmbUnit_Outliving.SelectedIndex = -1;

            picVisitorPhoto.Image = null;

            grpCivilianPassDetail.BackColor = Color.Gray;
            grpCivilianPassDetail.Enabled   = false;

            grpGuestDependantPassDetail.BackColor = Color.Gray;
            grpGuestDependantPassDetail.Enabled   = false;

            grpOutlivingPassDetail.BackColor = Color.Gray;
            grpOutlivingPassDetail.Enabled   = false;

            grpVehiclePassDetail.BackColor = Color.Gray;
            grpVehiclePassDetail.Enabled   = false;


            if (nsgPassId > 0)
            {
                LoadData();
                this.Text = "NSG Pass [EDIT] - " + (nsgPassId).ToString().PadLeft(6, '0');
            }
            else
            {
                var nsgLastPass = DB.NSGPasses.OrderByDescending(p => p.NSGPassID).FirstOrDefault();

                if (nsgLastPass == null)
                {
                    this.Text = "NSG Pass [ADD] - 000001";
                }
                else
                {
                    this.Text = "NSG Pass [ADD] - " + (nsgLastPass.NSGPassID + 1).ToString().PadLeft(6, '0');
                }

                dteIssueDate.Value  = DateTime.Today;
                dteExpiryDate.Value = DateTime.Today.AddDays(30);
            }
        }