// El boton realiza un Add Dependiendo el tipo de Modelo que sesivira private void BtnAddData_Click(object sender, RoutedEventArgs e) { switch (TypeForm) { case "Student": StudentForm studentForm = new StudentForm(); studentForm.AddStudent(MainWindow); break; case "Career": CareerForm careerForm = new CareerForm(); careerForm.AddCareer(MainWindow); break; case "Professor": ProfessorForm professorForm = new ProfessorForm(); professorForm.AddProfessor(MainWindow); break; } Close(); }
public void InsertIntoTable() { using (VaranegarEntities db = new VaranegarEntities()) { CareerForm cfEnter = new CareerForm(); //FirstStep cfEnter.careerID = Guid.NewGuid(); cfEnter.FirstName = txtFirstName.Text; cfEnter.LastName = txtLastName.Text; cfEnter.FatherName = txtFathedName.Text; cfEnter.NationalSHCode = txtNationalSHID.Text; cfEnter.NationalCode = txtNationalID.Text; cfEnter.birthDate = returnBirthDate(); cfEnter.BirthPlace = txtBirthPlace.Text; cfEnter.Email = txtEmail.Text; cfEnter.Phone = txtPhone.Text; cfEnter.Mobile = txtMobile.Text; cfEnter.marriage = Convert.ToInt32(ddlMarriage.SelectedValue); cfEnter.childrenNumb = txtChildren.Text; cfEnter.HomeStatus = Convert.ToInt32(ddlHome.SelectedValue); cfEnter.IsInsurance = ReturnBooleanStatus(ddlInsurance); cfEnter.MilitaryStatus = Convert.ToInt32(ddlMilitary.SelectedValue); cfEnter.Address = txtAddress.Text; //SecondStep cfEnter.ExpertOn = Convert.ToInt32(ddlExpert.SelectedValue); cfEnter.languagesRate = Convert.ToInt32(ddlLang.SelectedValue); cfEnter.degree = Convert.ToInt32(ddlDegree.SelectedValue); cfEnter.familiarIndustry = Convert.ToInt32(ddlIntroduce.SelectedValue); cfEnter.howtoFind = Convert.ToInt32(ddlIntroducrVaranegar.SelectedValue); cfEnter.major = txtMajor.Text; cfEnter.History = txtHistory.Text; cfEnter.Software = txtSw.Text; cfEnter.OtherExpertTitle = txtOtherExpert.Text; cfEnter.OtherFamiliar = txtOhetFamiliar.Text; //ThirdStep cfEnter.OvertimeWork = ReturnBooleanStatus(ddlOvertimeWork); cfEnter.NightWork = ReturnBooleanStatus(ddlNightWork); cfEnter.missionWork = ReturnBooleanStatus(ddlmissionWork); cfEnter.WeekendWork = ReturnBooleanStatus(ddlWeekendWork); cfEnter.Surgery = ReturnBooleanStatus(ddlSurgery); cfEnter.Conviction = ReturnBooleanStatus(ddlConviction); cfEnter.Smoking = ReturnBooleanStatus(ddlSmoking); cfEnter.Warranty = ReturnBooleanStatus(ddlWarranty); //ForthStep string new_filename = string.Empty; if (fuResume.HasFile) { string original_filename = Path.GetFileName(fuResume.PostedFile.FileName); new_filename = Guid.NewGuid().ToString() + Path.GetExtension(original_filename); string new_filepath = Server.MapPath("~/Uploads/Resume/" + new_filename); fuResume.PostedFile.SaveAs(new_filepath); } cfEnter.WorkingType = Convert.ToInt32(ddlWorkingType.SelectedValue); cfEnter.sallary = txtSallary.Text; cfEnter.StartDate = txtStartDate.Text; cfEnter.resumeFile = new_filename; cfEnter.FinalDesc = txtDesc.Text; cfEnter.IsVisited = false; cfEnter.RegisterDate = DateTime.Now; cfEnter.Os = FindUserInfo.UserOS(); cfEnter.Ip = Request.UserHostAddress; System.Web.HttpBrowserCapabilities browser = Request.Browser; cfEnter.Browser = browser.Type; cfEnter.IsDelete = false; db.CareerForm.Add(cfEnter); db.SaveChanges(); ScriptManager.RegisterStartupScript(this, GetType(), "PageScriptsuccess", "SuccessMessages();", true); ScriptManager.RegisterStartupScript(this, GetType(), "PageScriptGoTop", "$('html,body').animate({ 'scrollTop': 0 }, 1000);", true); pnlForm4.Visible = false; pnlSuccess.Visible = true; string resumeLink = null; if (!string.IsNullOrEmpty(new_filename)) { resumeLink = "<a href=/Uploads/Resume/" + new_filename + @">دانلود</a>"; } string emailBody = @"<table><tr><td>تاریخ</td><td>" + cfEnter.RegisterDate + @"</td></tr> <tr><td>Ip</td><td>" + cfEnter.Ip + @"</td></tr> <tr><td>نام</td><td>" + cfEnter.FirstName + @"</td></tr> <tr><td>نام خانوادگی</td><td>" + cfEnter.LastName + @"</td></tr> <tr><td>نام پدر</td><td>" + cfEnter.FatherName + @"</td></tr> <tr><td>شماره شناسنامه</td><td>" + cfEnter.NationalSHCode + @"</td></tr> <tr><td>کد ملی</td><td>" + cfEnter.NationalCode + @"</td></tr> <tr><td>تاریخ تولد</td><td>" + cfEnter.birthDate + @"</td></tr> <tr><td>محل تولد</td><td>" + cfEnter.BirthPlace + @"</td></tr> <tr><td>ایمیل</td><td>" + cfEnter.Email + @"</td></tr> <tr><td>تلفن</td><td>" + cfEnter.Phone + @"</td></tr> <tr><td>موبایل</td><td>" + cfEnter.Mobile + @"</td></tr> <tr><td>وضعیت تاهل</td><td>" + ddlMarriage.SelectedItem.Text + @"</td></tr> <tr><td>تعداد فرزندان</td><td>" + cfEnter.childrenNumb + @"</td></tr> <tr><td>وضعیت مسکن</td><td>" + ddlHome.SelectedItem.Text + @"</td></tr> <tr><td>بیمه تامین اجتماعی هستید؟</td><td>" + ddlInsurance.SelectedItem.Text + @"</td></tr> <tr><td>وضعیت نظام وظیفه؟</td><td>" + ddlMilitary.SelectedItem.Text + @"</td></tr> <tr><td>آدرس</td><td>" + cfEnter.Address + @"</td></tr> </table> <hr /> <table><tr><td>تخصص</td><td>" + ddlExpert.SelectedItem.Text + @"</td></tr> <tr><td>تسلط به زبان انگلیسی</td><td>" + ddlLang.SelectedItem.Text + @"</td></tr> <tr><td>مقطع تحصیلی</td><td>" + ddlDegree.SelectedItem.Text + @"</td></tr> <tr><td>میزان آشنایی با صنعت پخش</td><td>" + ddlIntroduce.SelectedItem.Text + @"</td></tr> <tr><td>چگونه با ورانگر آشنا شدید</td><td>" + ddlIntroducrVaranegar.SelectedItem.Text + @"</td></tr> <tr><td>رشته تحصیلی</td><td>" + cfEnter.major + @"</td></tr> <tr><td>سوابق کاری</td><td>" + cfEnter.History + @"</td></tr> <tr><td>با چه نرم افزارهایی آشنایی دارید</td><td>" + cfEnter.Software + @"</td></tr> </table> <hr /> <table><tr><td>مايليد در زمان اضافه كار، كار كنيد؟</td><td>" + ddlOvertimeWork.SelectedItem.Text + @"</td></tr> <tr><td>مايليد در شيفت شب كار كنيد؟</td><td>" + ddlNightWork.SelectedItem.Text + @"</td></tr> <tr><td>مايليد به ماموريتهاي داخل كشور برويد؟</td><td>" + ddlmissionWork.SelectedItem.Text + @"</td></tr> <tr><td>مايليد در تعطيلات آخر هفته فعاليت داشته باشيد؟</td><td>" + ddlWeekendWork.SelectedItem.Text + @"</td></tr> <tr><td>آيا نقص عضو يا عمل جراحي يا بيماري دارید؟</td><td>" + ddlSurgery.SelectedItem.Text + @"</td></tr> <tr><td>آيا سابقه محكوميت كيفري داشتهايد؟</td><td>" + ddlConviction.SelectedItem.Text + @"</td></tr> <tr><td>آيا دخانيات مصرفي ميكنيد؟</td><td>" + ddlSmoking.SelectedItem.Text + @"</td></tr> <tr><td>آيا ضامن براي ضمانت كار خود داريد؟</td><td>" + ddlWarranty.SelectedItem.Text + @"</td></tr> </table> <hr /> <table><tr><td>نوع همکاری</td><td>" + ddlWorkingType.SelectedItem.Text + @"</td></tr> <tr><td>ميزان حقوق درخواستي (ريال)</td><td>" + cfEnter.sallary + @"</td></tr> <tr><td>تاریخ شروع همکاری</td><td>" + cfEnter.StartDate + @"</td></tr> <tr><td>توضیحات</td><td>" + cfEnter.FinalDesc + @"</td></tr> <tr><td>رزومه</td><td>" + resumeLink + @"</td></tr> </table>"; List <string> emailList = SendEmail.ReturnEmailList(2); SendEmail.Send(emailList, "پیوستن به ما", emailBody); SendEmail.SendToUser_User(txtEmail.Text, "پیوستن به ما"); } }
//Boton formulario carrera private void BtnCreateCareer_Click(object sender, RoutedEventArgs e) { CareerForm careerForm = new CareerForm(); UserControlOnly(careerForm, "Career"); }