Beispiel #1
0
        public int AddEmployer(LoginEmployer ObjEmp, Employer ObjE)
        {
            try
            {
                _unitOfWork.Repository<Employer>().Insert(ObjE);
                //_unitOfWork.Save();
                ObjEmp.EmployerID = _unitOfWork.Repository<Employer>().GetAll().Where(c => c.EmailID == ObjE.EmailID).Select(c => c.EmpID).FirstOrDefault();
                _unitOfWork.Repository<LoginEmployer>().Insert(ObjEmp);
                _unitOfWork.Save();
                return 1;
            }
            catch (Exception)
            {

                return 0;
            }

            //using (JobASPContext context = new JobASPContext())
            //{
            //    try
            //    {
            //        context.Employees.Add(ObjE);
            //        context.SaveChanges();
            //        ObjEmp.EmployerID = context.Employees.Where(c => c.EmailID == ObjEmp.EmailID).Select(c => c.EmpID).FirstOrDefault();
            //        context.LoginEmployer.Add(ObjEmp);
            //        context.SaveChanges();
            //        return 1;
            //    }
            //    catch (Exception)
            //    {

            //        return 0;
            //    }

            //}
        }
Beispiel #2
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                    Employer Obj = new Employer();
                    Obj.EmpName = txtName.Text;
                    Obj.EmpLName = txtLName.Text;
                    Obj.Gender = ddlGender.SelectedItem.Text;
                    Obj.Designation = txtDesignation.Text;
                    if (!String.IsNullOrWhiteSpace(txtCompany.Text))
                    {
                        Obj.CompanyName = txtCompany.Text;
                    }
                    else
                    {
                        Obj.CompanyName = String.Empty;
                    }
                    if (!String.IsNullOrWhiteSpace(txtContactTitle.Text))
                    {
                        Obj.ContactTitle = txtContactTitle.Text;
                    }
                    else
                    {
                        Obj.ContactTitle = String.Empty;
                    }
                    if (!String.IsNullOrWhiteSpace(txtAddress.Text))
                    {
                        Obj.Address = txtAddress.Text;
                    }
                    else
                    {
                        Obj.Address = String.Empty;
                    }
                    Obj.Country =Convert.ToInt32(ddlCountry.SelectedItem.Value);
                    Obj.State =Convert.ToInt32(ddlState.SelectedItem.Value);
                    Obj.City = Convert.ToInt32(ddlCity.SelectedItem.Value);
                    Obj.PostalCode = txtPostalCode.Text;
                    Obj.Phone = txtPhNum.Text;
                    Obj.EmailID = txtEmailID.Text;
                    LoginEmployer objLogEmp = new LoginEmployer();
                    objLogEmp.EmailID = txtEmailID.Text;
                    objLogEmp.Password = txtPassword.Text;
                    int val = new RegisterBO().AddEmployer(objLogEmp, Obj);
                    if (val == 1)
                    {
                        //sms sending
                        SMS.APIType = SMSGateway.Site2SMS;
                        string message = "Hello..! you registered in successful" ;
                        SMS.MashapeKey = "7c4xATbTr7mshehqdw53rmcYbfOtp1WdEtbjsnOU2FJvTrjeQs";
                        SMS.Username = "******";
                        SMS.Password = "******";
                       if (txtPhNum.Text != "")
                       {
                           string num = txtPhNum.Text.Trim();
                            SMS.SendSms(num, message);
                       }
                        ////////////

                        new CCDDLWebService().SendMail(txtEmailID.Text, "Employer");
                        Response.Redirect("Login.aspx");
                    }
                    else
                    {
                        lblRegError.Text = "Something went wrong";
                    }

            }
            catch (Exception)
            {
                lblRegError.Text = "Something went wrong";
            }
        }