private void gridActiveFile_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e) { foreach (var data in gridActiveFile.SelectedItems) { t_EmpMaster myData = data as t_EmpMaster; EmpIDActive = myData.EmpID; } }
private void gridHistoryFile_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e) { //foreach (var data in gridHistoryFile.SelectedItems) //{ // t_EmpMasterArchive myData = data as t_EmpMasterArchive; // EmpIDHistory = myData.EmpID; //} foreach (var data in gridHistoryFile.SelectedItems) { t_EmpMaster myData = data as t_EmpMaster; EmpIDHistory = myData.EmpID; } }
private void Button_Click_1(object sender, RoutedEventArgs e) { if (MessageBox.Show("Confirm?", "Remove from Archive", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) { try { //t_EmpMaster emp = db.t_EmpMaster.First(p => p.EmpID == EmpIDActive); //emp.IsDeleted = true; //db.SaveChanges(); //fillGrid(); t_EmpMaster emp = db.t_EmpMaster.First(p => p.EmpID == EmpIDHistory); emp.IsDeleted = false; db.SaveChanges(); fillGrid(); } catch { MessageBox.Show("select employee"); } } else { } }
private void radEmployee5thMonth_RowActivated(object sender, Telerik.Windows.Controls.GridView.RowEventArgs e) { foreach (var data in radEmployee5thMonth.SelectedItems) { t_EmpMaster myData = data as t_EmpMaster; EmpIDs2 = myData.EmpID; } string sMessageBoxText = "Mark as Evaluated"; string sCaption = "Complete Evaluated? "; MessageBoxButton btnMessageBox = MessageBoxButton.YesNo; MessageBoxImage icnMessageBox = MessageBoxImage.Warning; MessageBoxResult rsltMessageBox = MessageBox.Show(sMessageBoxText, sCaption, btnMessageBox, icnMessageBox); switch (rsltMessageBox) { case MessageBoxResult.Yes: try { t_EmpMaster eval = db.t_EmpMaster.First(p => p.EmpID == EmpIDs2.ToString()); eval.thirdevaluation = true; db.SaveChanges(); fillgrid(); } catch { } break; case MessageBoxResult.No: /* ... */ break; } }
private void btnSave_Click(object sender, RoutedEventArgs e) { if (DepartmentNew.SelectedValue == null || SectionNew.SelectedValue == null || PositionNew.SelectedValue == null || EmployementStatusNew.SelectedValue == null) { errormessage.Text = "Please complete classification"; } else { try { t_EmpMaster master = db.t_EmpMaster.First(p => p.EmpID == EmpName.SelectedValue); master.Department = DepartmentNew.SelectedValue.ToString(); master.Section = SectionNew.SelectedValue.ToString(); master.Position = PositionNew.SelectedValue.ToString(); master.EmploymentStatus = EmployementStatusNew.SelectedValue.ToString(); db.SaveChanges(); MessageBox.Show("Completed"); } catch { MessageBox.Show("Error"); } } }
private void getpersonalinfo() { t_EmpMaster empdata = new t_EmpMaster(); var selectQuery = db.t_EmpMaster.Where(x => x.EmpID == EmpID.Text); foreach (var item in selectQuery) { t_EmpMaster myData = item as t_EmpMaster; EmpID.Text = myData.EmpID; BatchNo.Text = Convert.ToString(myData.BatchNo); ProximityCardID.Text = myData.ProximityCardID; //MessageBox.Show(myData.ProximityCardID); LastName.Text = myData.LastName; FirstName.Text = myData.FirstName; MiddleName.Text = myData.MiddleName; Mobile.Text = myData.Mobile; Phone.Text = myData.Phone; EmailAddress.Text = myData.EmailAddress; ContactPerson.Text = myData.ContactPerson; ContactPhone.Text = myData.ContactPhone; ContactAddress.Text = myData.ContactAddress; //EducAttainment.SelectedValue = myData.HighestEducationalAttainment; BirthDate.SelectedDate = Convert.ToDateTime(myData.BirthDate); HireDate.SelectedDate = Convert.ToDateTime(myData.HireDate); if (myData.EndOfWork.HasValue) { EndDate.SelectedDate = Convert.ToDateTime(myData.EndOfWork); } else { EndDate.SelectedDate = null; } SSSno.Text = myData.SSSno; TIN.Text = myData.TIN; PHno.Text = myData.PHno; PagIbigNo.Text = myData.PagIbigNo; HeightUnit.SelectedValue = myData.HeightUnit; WeightUnit.SelectedValue = myData.WeightUnit; Weight.Text = myData.Weight; Height.Text = myData.Height; IDissued.IsChecked = myData.IDissued; AppointmentPaperIssued.IsChecked = myData.AppointmentPaperIssued; CivilStatus.SelectedValue = myData.CivilStatus; Nationality.SelectedValue = myData.Nationality; ShuttleDestination.SelectedValue = myData.ShuttleDestination; Religion.SelectedValue = myData.Religion; Sex.SelectedValue = myData.Sex; Department.SelectedValue = myData.Department; //get sect&pos dept(); Section.SelectedValue = myData.Section; Position.SelectedValue = myData.Position; EmploymentStatus.SelectedValue = myData.EmploymentStatus; empimage = myData.EmpPicture; MemoryStream strm = new MemoryStream(); strm.Write(empimage, 0, empimage.Length); strm.Position = 0; System.Drawing.Image img = System.Drawing.Image.FromStream(strm); BitmapImage bi = new BitmapImage(); bi.BeginInit(); MemoryStream ms = new MemoryStream(); img.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp); ms.Seek(0, SeekOrigin.Begin); bi.StreamSource = ms; bi.EndInit(); EmpPicture.Source = bi; } }
private void SaveMasterData() { t_EmpMaster empdata = new t_EmpMaster(); empdata.SerialID = SerialNo; empdata.BatchNo = Convert.ToInt32(BatchNo.Text); empdata.EmpID = NewEmpID; empdata.ProximityCardID = ProximityCardID.Text; empdata.LastName = LastName.Text; empdata.FirstName = FirstName.Text; empdata.MiddleName = MiddleName.Text; empdata.Phone = Phone.Text; empdata.Mobile = Mobile.Text; empdata.Sex = Sex.SelectedValue.ToString(); empdata.BirthDate = Convert.ToDateTime(BirthDate.DateTimeText); empdata.HireDate = Convert.ToDateTime(HireDate.DateTimeText); empdata.EmploymentStatus = EmploymentStatus.SelectedValue.ToString(); empdata.Nationality = Nationality.SelectedValue.ToString(); empdata.Religion = Religion.SelectedValue.ToString(); empdata.CivilStatus = CivilStatus.SelectedValue.ToString(); empdata.Position = Position.SelectedValue.ToString(); empdata.Department = Department.SelectedValue.ToString(); empdata.Section = Section.SelectedValue.ToString(); empdata.SSSno = SSSno.Text; empdata.PHno = PHno.Text; empdata.PagIbigNo = PagIbigNo.Text; empdata.TIN = TIN.Text; empdata.EmailAddress = EmailAddress.Text; empdata.ContactPerson = ContactPerson.Text; empdata.ContactPhone = ContactPhone.Text; empdata.ContactAddress = ContactAddress.Text; empdata.Height = Height.Text; empdata.HeightUnit = HeightUnit.SelectedValue.ToString(); empdata.Weight = Weight.Text; empdata.WeightUnit = WeightUnit.Text; if (!EndOfWork.SelectedDate.HasValue) { empdata.EndOfWork = null; } else { empdata.EndOfWork = Convert.ToDateTime(EndOfWork.DateTimeText); } empdata.LoaforManagerApproval = false; empdata.IsDeleted = false; empdata.firstevaluation = false; empdata.secondevaluation = false; empdata.thirdevaluation = false; empdata.InitialEntryBy = adminusers.Text; empdata.InitialEntryDate = DateTime.Now; empdata.ShuttleDestination = Convert.ToInt32(ShuttleDestination.SelectedValue.ToString()); empdata.HighestEducationalAttainment = HighestEducationalAttainment.SelectedValue.ToString(); empdata.IDissued = Convert.ToBoolean(IDissued.IsChecked); empdata.AppointmentPaperIssued = Convert.ToBoolean(AppointmentPaperIssued.IsChecked); empdata.EmpPicture = data; //_maindata.InitialEntryBy = adminusers.Text; db.t_EmpMaster.Add(empdata); db.SaveChanges(); }
void getpersonalinfo() { t_EmpMaster empdata = new t_EmpMaster(); var selectQuery = db.t_EmpMaster.Where(x => x.EmpID == EmpID.Text); foreach (var item in selectQuery) { t_EmpMaster myData = item as t_EmpMaster; EmpID.Text = myData.EmpID; BatchNo.Text = Convert.ToString(myData.BatchNo); ProximityCardID.Text = myData.ProximityCardID; LastName.Text = myData.LastName; FirstName.Text = myData.FirstName; MiddleName.Text = myData.MiddleName; Mobile.Text = myData.Mobile; Phone.Text = myData.Phone; EmailAddress.Text = myData.EmailAddress; ContactPerson.Text = myData.ContactPerson; ContactPhone.Text = myData.ContactPhone; ContactAddress.Text = myData.ContactAddress; EducAttainment.SelectedValue = myData.HighestEducationalAttainment; string sqlFormattedDate = myData.EndOfWork.HasValue ? myData.EndOfWork.Value.ToString("dd-MM-yyyy") : ""; DateEnd.DateTimeText = sqlFormattedDate; if (myData.HireDate.HasValue) { HireDate.DateTimeText = myData.HireDate.Value.ToString("dd-MM-yyyy"); } else { } SSSno.Text = myData.SSSno; TIN.Text = myData.TIN; PHno.Text = myData.PHno; PagIbigNo.Text = myData.PagIbigNo; IDissued.IsChecked = myData.IDissued; AppointmentPaperIssued.IsChecked = myData.AppointmentPaperIssued; CivilStatus.SelectedValue = myData.CivilStatus; ShuttleDestination.SelectedValue = myData.ShuttleDestination; Department.SelectedValue = myData.Department; dept(); Section.SelectedValue = myData.Section; Position.SelectedValue = myData.Position; EmploymentStatus.SelectedValue = myData.EmploymentStatus; empimage = myData.EmpPicture; MemoryStream strm = new MemoryStream(); strm.Write(empimage, 0, empimage.Length); strm.Position = 0; System.Drawing.Image img = System.Drawing.Image.FromStream(strm); BitmapImage bi = new BitmapImage(); bi.BeginInit(); MemoryStream ms = new MemoryStream(); img.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp); ms.Seek(0, SeekOrigin.Begin); bi.StreamSource = ms; bi.EndInit(); EmpPicture.Source = bi; } }
private void Button_Click(object sender, RoutedEventArgs e) { //MessageBox.Show("Confirm?", "Move to Archive", // MessageBoxButton.YesNo, MessageBoxImage.Warning); if (MessageBox.Show("Confirm?", "Move to Archive", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) { try { t_EmpMaster emp = db.t_EmpMaster.First(p => p.EmpID == EmpIDActive); emp.IsDeleted = true; db.SaveChanges(); fillGrid(); } catch { MessageBox.Show("select employee"); } } else { } //try //{ // foreach (var xe in db.t_EmpMaster.Where(p => p.EmpID == EmpIDActive)) // { // var newarchive = new t_EmpMasterArchive(); // newarchive.BatchNo = xe.BatchNo; // newarchive.SerialID = xe.SerialID; // newarchive.EmpID = xe.EmpID; // newarchive.ProximityCardID = xe.ProximityCardID; // newarchive.LastName = xe.LastName; // newarchive.FirstName = xe.FirstName; // newarchive.MiddleName = xe.MiddleName; // newarchive.Phone = xe.Phone; // newarchive.Mobile = xe.Mobile; // newarchive.Sex = xe.Sex; // newarchive.BirthDate = xe.BirthDate; // newarchive.HireDate = xe.HireDate; // newarchive.EmploymentStatus = xe.EmploymentStatus; // newarchive.Nationality = xe.Nationality; // newarchive.Religion = xe.Religion; // newarchive.CivilStatus = xe.CivilStatus; // newarchive.Position = xe.Position; // newarchive.Department = xe.Department; // newarchive.Section = xe.Section; // newarchive.SSSno = xe.SSSno; // newarchive.PHno = xe.PHno; // newarchive.PagIbigNo = xe.PagIbigNo; // newarchive.TIN = xe.TIN; // newarchive.EmailAddress = xe.EmailAddress; // newarchive.ContactPerson = xe.ContactPerson; // newarchive.ContactPhone = xe.ContactPhone; // newarchive.ContactAddress = xe.ContactAddress; // newarchive.Height = xe.Height; // newarchive.HeightUnit = xe.HeightUnit; // newarchive.Weight = xe.Weight; // newarchive.WeightUnit = xe.WeightUnit; // newarchive.EndOfWork = xe.EndOfWork; // newarchive.ShuttleDestination = xe.ShuttleDestination; // newarchive.HighestEducationalAttainment = xe.HighestEducationalAttainment; // newarchive.IDissued = xe.IDissued; // newarchive.AppointmentPaperIssued = xe.AppointmentPaperIssued; // newarchive.EmpPicture = xe.EmpPicture; // //_maindata.InitialEntryBy = adminusers.Text; // db.t_EmpMasterArchive.Add(newarchive); // } // db.SaveChanges(); // removeEmpToActive(); // fillActive(); // fillHistory(); //} //catch { } }