public ActionResult DeleteConfirmed(int id)
        {
            employer employer = db.employers.Find(id);

            db.employers.Remove(employer);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "id,email,firstname,middlename,lastname,companyid")] employer employer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(employer));
 }
        public ActionResult Create([Bind(Include = "id,email,firstname,middlename,lastname,companyid")] employer employer)
        {
            if (ModelState.IsValid)
            {
                db.employers.Add(employer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(employer));
        }
 public employer Insert_employer_select(int ID)
 {
     employer = employer.Select(ID);
     Insert_case_id_txt.Text     = Convert.ToString(employer.case_id);
     Insert_client_id_txt.Text   = Convert.ToString(employer.client_id);
     Insert_address_id_txt.Text  = Convert.ToString(employer.address_id);
     Insert_emplr_name_txt.Text  = Convert.ToString(employer.emplr_name);
     Insert_emplr_phone_txt.Text = Convert.ToString(employer.emplr_phone);
     Insert_end_date_txt.Text    = Convert.ToString(employer.end_date);
     Insert_strt_date_txt.Text   = Convert.ToString(employer.strt_date);
     Insert_term_reason_txt.Text = Convert.ToString(employer.term_reason);
     return(employer);
 }
Exemple #5
0
 public static employer DBUpdateFrom(this employer item, Employer svcItem) //for update
 {
     item.name                        = svcItem.Name;
     item.address                     = svcItem.Address;
     item.phone_number                = svcItem.PhoneNumber;
     item.contact_person_name         = svcItem.ContantPersonName;
     item.contact_person_phone_number = svcItem.ContactPersonPhoneNumber;
     item.employer_hp                 = svcItem.EmployerHP;
     item.about                       = svcItem.About;
     item.website_url                 = svcItem.WebSiteUrl;
     item.logo                        = svcItem.Logo;
     return(item);
 }
 public employer Delete_employer_select(int ID)
 {
     employer = employer.Select(ID);
     Delete_emplr_id_txt_lbl.Text = Convert.ToString(employer.emplr_id);
     Delete_case_id_txt_lbl.Text = Convert.ToString(employer.case_id);
     Delete_client_id_txt_lbl.Text = Convert.ToString(employer.client_id);
     Delete_address_id_txt_lbl.Text = Convert.ToString(employer.address_id);
     Delete_emplr_name_txt_lbl.Text = Convert.ToString(employer.emplr_name);
     Delete_emplr_phone_txt_lbl.Text = Convert.ToString(employer.emplr_phone);
     Delete_end_date_txt_lbl.Text = Convert.ToString(employer.end_date);
     Delete_strt_date_txt_lbl.Text = Convert.ToString(employer.strt_date);
     Delete_term_reason_txt_lbl.Text = Convert.ToString(employer.term_reason);
     return employer;
 }
        // GET: employers/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            employer employer = db.employers.Find(id);

            if (employer == null)
            {
                return(HttpNotFound());
            }
            return(View(employer));
        }
 public employer employer_insert()
 {
     employer.case_id = Convert.ToInt32(Insert_case_id_txt.Text);
     employer.client_id = Convert.ToInt32(Insert_client_id_txt.Text);
     employer.address_id = Convert.ToInt32(Insert_address_id_txt.Text);
     employer.emplr_name = Insert_emplr_name_txt.Text;
     employer.emplr_phone = Insert_emplr_phone_txt.Text;
     employer.end_date = Convert.ToDateTime(Insert_end_date_txt.Text);
     employer.strt_date = Convert.ToDateTime(Insert_strt_date_txt.Text);
     employer.term_reason = Insert_term_reason_txt.Text;
     employer = employer.Insert(employer);
     Insert_employer_GridView.DataBind();
     Update_employer_GridView.DataBind();
     Delete_employer_GridView.DataBind();
     return employer;
 }
Exemple #9
0
        static List <employer> readfile()
        {
            List <employer> list1 = new List <employer>();
            StreamReader    f     = new StreamReader("employers.txt");

            while (!f.EndOfStream)
            {
                string   s  = f.ReadLine();
                string[] ss = s.Split(new char[] { ' ' });
                employer bc = new employer();
                bc.name = ss[0]; bc.SetRate(double.Parse(ss[1]));
                list1.Add(bc);
            }
            f.Close();
            return(list1);
        }
 public employer employer_insert()
 {
     employer.case_id     = Convert.ToInt32(Insert_case_id_txt.Text);
     employer.client_id   = Convert.ToInt32(Insert_client_id_txt.Text);
     employer.address_id  = Convert.ToInt32(Insert_address_id_txt.Text);
     employer.emplr_name  = Insert_emplr_name_txt.Text;
     employer.emplr_phone = Insert_emplr_phone_txt.Text;
     employer.end_date    = Convert.ToDateTime(Insert_end_date_txt.Text);
     employer.strt_date   = Convert.ToDateTime(Insert_strt_date_txt.Text);
     employer.term_reason = Insert_term_reason_txt.Text;
     employer             = employer.Insert(employer);
     Insert_employer_GridView.DataBind();
     Update_employer_GridView.DataBind();
     Delete_employer_GridView.DataBind();
     return(employer);
 }
 public employer employer_update(int ID)
 {
     employer             = employer.Select(ID);
     employer.emplr_id    = Convert.ToInt32(Update_emplr_id_txt.Text);
     employer.case_id     = Convert.ToInt32(Update_case_id_txt.Text);
     employer.client_id   = Convert.ToInt32(Update_client_id_txt.Text);
     employer.address_id  = Convert.ToInt32(Update_address_id_txt.Text);
     employer.emplr_name  = Update_emplr_name_txt.Text;
     employer.emplr_phone = Update_emplr_phone_txt.Text;
     employer.end_date    = Convert.ToDateTime(Update_end_date_txt.Text);
     employer.strt_date   = Convert.ToDateTime(Update_strt_date_txt.Text);
     employer.term_reason = Update_term_reason_txt.Text;
     employer.Update(employer);
     Insert_employer_GridView.DataBind();
     Update_employer_GridView.DataBind();
     Delete_employer_GridView.DataBind();
     return(employer);
 }
 protected void Insert_Select_Record(object sender, EventArgs e)
 {
     employer = Insert_employer_select(Convert.ToInt32(Insert_employer_GridView.SelectedValue));
 }
 protected void INSERT(object sender, EventArgs e)
 {
     employer = employer_insert();
 }
Exemple #14
0
 public static Employer ToBusiness(this employer item) //for read
 {
     return(AutoMapper.Mapper.Instance.Map <employer, Employer>(item).CompleteCreate(item));
 }
        protected void Save_Employer_info()
        {
            decimal[] emplradd = new decimal[2];

            clientEmplrAddress.address_id = GlobalVariables.EmplrAddressID;
            clientemployer.emplr_id = GlobalVariables.EmployerID;

            clientEmplrAddress.address_type_id = 2;
            clientEmplrAddress.str_add = txtempr_str_addr.Text;
            clientEmplrAddress.str_add2 = Txtempr_str_addr2.Text;
            clientEmplrAddress.city = txtempr_city.Text;
            clientEmplrAddress.state = ddlempr_st.SelectedValue;
            clientEmplrAddress.zip_plus_four = txtempr_zip.Text;
            clientEmplrAddress.country = TxtEmpr_Country.Text;
            clientEmplrAddress.County_Township = Txtempr_CountyTownship.Text;

            emplradd = GeoLocation.getCoordinates(clientEmplrAddress.str_add, clientEmplrAddress.str_add2, clientEmplrAddress.city, clientEmplrAddress.state, clientEmplrAddress.zip_plus_four, "DMCS");

            clientEmplrAddress.latitude = emplradd[0];
            clientEmplrAddress.longitude = emplradd[1];

            if (clientEmplrAddress.address_id == 0)
            {
                clientEmplrAddress = clientEmplrAddress.Insert(clientEmplrAddress);
            }
            else
            {
                clientEmplrAddress.Update(clientEmplrAddress);
            }

            clientemployer.address_id = clientEmplrAddress.address_id;
            clientemployer.case_id = clientCase_intake.case_id;
            clientemployer.client_id = client.client_id;
            clientemployer.emplr_name = TxtEmplr_Name.Text;
            clientemployer.emplr_phone = TxtEmplr_Phone.Text;
            if (TxtEmpSrtDate.Text != "")
            {
                clientemployer.strt_date = Convert.ToDateTime(TxtEmpSrtDate.Text);
            }

            if (TxtEmpEndDate.Text != "")
            {
                clientemployer.end_date = Convert.ToDateTime(TxtEmpEndDate.Text);
            }
            else
            {
                clientemployer.end_date = Convert.ToDateTime("9/9/9999");
            }

            clientemployer.term_reason = TxtTermReas.Text;

            if (clientemployer.emplr_id == 0)
            {
                clientemployer = clientemployer.Insert(clientemployer);
            }
            else
            {
                clientemployer.Update(clientemployer);
            }
        }
Exemple #16
0
        public ActionResult Register(HttpPostedFileBase logo, employer model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    user          tempuser = new user();
                    employer_info employer = new employer_info();
                    tempuser.user_name = model.user_name;
                    tempuser.password  = CalculateMD5Hash(model.password);
                    tempuser.role      = "employer";
                    tempuser.status    = "ACTIVE";
                    db.users.Add(tempuser);
                    if (db.SaveChanges() > 0)
                    {
                        string filename = null;

                        if (logo != null)
                        {
                            string pic = Path.GetExtension(logo.FileName);
                            filename = Guid.NewGuid().ToString() + pic;
                            string path = Path.Combine(Server.MapPath("~/Content/images"), filename);
                            logo.SaveAs(path);
                        }

                        int insertId = tempuser.user_id;
                        employer.company_type = model.company_type;
                        employer.company_name = model.company_name;
                        employer.address      = model.address;
                        employer.contact      = model.contact;
                        employer.description  = model.description;
                        employer.email        = model.email;
                        employer.name         = model.name;
                        employer.phone        = model.phone;
                        employer.reg_type     = model.reg_type;
                        employer.login_info   = insertId;
                        employer.status       = "ACTIVE";
                        employer.created_at   = DateTime.Now;
                        employer.updated_at   = DateTime.Now;
                        employer.logo         = filename;
                        db.employer_info.Add(employer);
                        db.SaveChanges();
                        Session["name"]         = employer.company_name;
                        Session["userid"]       = employer.login_info;
                        Session["role"]         = "employer";
                        Session["profileimage"] = employer.logo;

                        Session["emp_id"]       = employer.emp_id;
                        Session["is_logged_in"] = true;
                        Session["username"]     = model.user_name;

                        return(RedirectToAction("EmployerProfile", "Employer"));
                    }
                    else
                    {
                        return(Json(new { errorMsg = "Cannot Insert!" }));
                    }
                }
                catch (Exception ex)
                {
                    return(Json(new { errorMsg = "Something went wrong! Error message (" + ex.ToString() + ")" }));
                }
            }
            else
            {
                return(Json(new { errorMsg = "validation error!" }));
            }
        }
 public employer employer_update(int ID)
 {
     employer = employer.Select(ID);
     employer.emplr_id = Convert.ToInt32(Update_emplr_id_txt.Text);
     employer.case_id = Convert.ToInt32(Update_case_id_txt.Text);
     employer.client_id = Convert.ToInt32(Update_client_id_txt.Text);
     employer.address_id = Convert.ToInt32(Update_address_id_txt.Text);
     employer.emplr_name = Update_emplr_name_txt.Text;
     employer.emplr_phone = Update_emplr_phone_txt.Text;
     employer.end_date = Convert.ToDateTime(Update_end_date_txt.Text);
     employer.strt_date = Convert.ToDateTime(Update_strt_date_txt.Text);
     employer.term_reason = Update_term_reason_txt.Text;
     employer.Update(employer);
     Insert_employer_GridView.DataBind();
     Update_employer_GridView.DataBind();
     Delete_employer_GridView.DataBind();
     return employer;
 }
 protected void UPDATE(object sender, EventArgs e)
 {
     employer = employer_update(Convert.ToInt32(Update_employer_GridView.SelectedValue));
 }
 protected void Update_Select_Record(object sender, EventArgs e)
 {
     employer = Update_employer_select(Convert.ToInt32(Update_employer_GridView.SelectedValue));
 }
 protected void UPDATE(object sender, EventArgs e)
 {
     employer = employer_update(Convert.ToInt32(Update_employer_GridView.SelectedValue));
 }
 protected void Insert_Select_Record(object sender, EventArgs e)
 {
     employer = Insert_employer_select(Convert.ToInt32(Insert_employer_GridView.SelectedValue));
 }
 protected void INSERT(object sender, EventArgs e)
 {
     employer = employer_insert();
 }
Exemple #23
0
 public Employer CompleteCreate(employer item)
 {
     EmployerUID = new Guid(item.employer_uid);
     return(this);
 }
 protected void Update_Select_Record(object sender, EventArgs e)
 {
     employer = Update_employer_select(Convert.ToInt32(Update_employer_GridView.SelectedValue));
 }