Пример #1
0
 public ActionResult createCompany(tbl_company cmpny)
 {
     cmpny.ContactNo = "0" + cmpny.ContactNo;
     db.tbl_company.Add(cmpny);
     db.SaveChanges();
     return(Json(cmpny, JsonRequestBehavior.AllowGet));
 }
Пример #2
0
        public void savedlogic()
        {
            try
            {
                int        a    = Convert.ToInt32(Session["company_id"]);
                int        s    = Convert.ToInt32(ddlState.SelectedValue);
                string     user = Session["UserID"].ToString();
                SqlCommand cmd  = new SqlCommand();

                if (fileuplogo.HasFile)
                {
                    HttpPostedFile postedFile    = fileuplogo.PostedFile;
                    string         filename      = Path.GetFileName(postedFile.FileName);
                    string         fileExtension = Path.GetExtension(filename);
                    int            fileSize      = postedFile.ContentLength;

                    if (fileExtension.ToLower() == ".jpg" || fileExtension.ToLower() == ".png")
                    {
                        //Stream stream = postedFile.InputStream;
                        //BinaryReader binaryReader = new BinaryReader(stream);
                        //Byte[] bytes = binaryReader.ReadBytes((int)stream.Length);

                        fileuplogo.SaveAs(Server.MapPath("~/Uploads/" + filename));
                        string imagepath = "~/Uploads/" + filename;

                        tbl_company company = new tbl_company();
                        company.company_id      = a;
                        company.company_name    = txtName.Text;
                        company.company_address = txtAddress.Text;
                        company.state_id        = s;
                        company.city            = txtCity.Text;
                        company.telephone_no    = txttelephoneno.Text;
                        company.fax_no          = txtFaxno.Text;
                        company.website         = txtwebsite.Text;
                        company.logo            = imagepath;
                        company.logo_name       = filename;
                        company.GSTIN           = txtGSTIN.Text;
                        company.modified_by     = user;
                        company.modified_date   = DateTime.Now;


                        context.Entry(company).State = EntityState.Modified;
                        context.SaveChanges();

                        //context.tbl_company.(company);
                        //context.SaveChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorLog.saveerror(ex);
            }
        }
 public ActionResult Post([FromBody] tbl_company entity)
 {
     if (_companyService.RegisterCompany(entity))
     {
         return(Ok());
     }
     else
     {
         return(BadRequest());
     }
 }
Пример #4
0
 public Company Map(tbl_company table)
 {
     return(new Company
     {
         Id = table.company_id_PK,
         Name = table.company_name,
         AddressId = table.address_id_PK,
         BrandingId = table.branding_id,
         LevelId = table.tbl_company_level_id_PK,
         CommunityId = table.tbl_Centile_Community_id_FK
     });
 }
Пример #5
0
 public bool UpdateCompany(tbl_company entity)
 {
     _context.Entry(entity).State = EntityState.Modified;
     try
     {
         _context.SaveChanges();
         return(true);
     }
     catch (DbUpdateConcurrencyException)
     {
         return(false);
     }
 }
Пример #6
0
 public bool RegisterCompany(tbl_company entity)
 {
     try
     {
         _context.tbl_company.Add(entity);
         _context.SaveChanges();
         return(true);
     }
     catch (DbUpdateConcurrencyException)
     {
         return(false);
     }
 }
Пример #7
0
 public void UpdateAddress()
 {
     using (JobEntities db = new JobEntities())
     {
         tbl_company company = db.tbl_company.Find(companyId);
         company.region          = region;
         company.province        = province;
         company.city            = city;
         company.brgy            = brgy;
         db.Entry(company).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
 public bool RegisterCompany(tbl_company entity)
 {
     try
     {
         _context.tbl_company.Add(entity);
         _context.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Пример #9
0
 public void UpdateCompanyInformation()
 {
     using (JobEntities db = new JobEntities())
     {
         tbl_company company = db.tbl_company.Find(companyId);
         company.name            = name;
         company.categoryId      = categoryId;
         company.description     = description;
         company.cellnumber      = cellnumber;
         company.business_email  = business_email;
         db.Entry(company).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
Пример #10
0
        public void companyname()
        {
            tbl_company r          = new tbl_company();
            var         company_id = Convert.ToInt32(Session["company_id"]);

            r = context.tbl_company.Where(w => w.company_id == company_id).SingleOrDefault();
            try
            {
                if (Session["LoginuserName"] != null)
                {
                    lblusername.Text = Session["LoginuserName"].ToString();
                }
                if (r.logo != null)
                {
                    if (File.Exists(Server.MapPath(r.logo)))
                    {
                        imglogo.ImageUrl = r.logo;
                    }
                    else
                    {
                        imglogo.Visible = false;
                        lblIms.Visible  = true;
                    }
                }
                else
                {
                    imglogo.Visible = false;
                    lblIms.Visible  = true;
                }
            }
            catch (Exception ex)
            {
                ErrorLog.saveerror(ex);
            }
            finally
            {
                con.Close();
                con.Dispose();
            }


            //lblHeading.Text=
        }
Пример #11
0
 public void UpdateDetails()
 {
     using (JobEntities db = new JobEntities())
     {
         tbl_company company = db.tbl_company.Find(companyId);
         company.name            = name;
         company.description     = description;
         company.cellnumber      = cellnumber;
         company.categoryId      = categoryId;
         company.business_email  = business_email;
         company.region          = region;
         company.province        = province;
         company.city            = city;
         company.brgy            = brgy;
         company.prof_path       = "/Uploads/Company/Profile/eriri.png";
         company.cover_path      = "/Uploads/Company/Cover/kodaikana.jpg";
         db.Entry(company).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
Пример #12
0
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new JobUser {
                    UserName = model.UserName, Email = model.Email
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    if (model.IsWorker)
                    {
                        tbl_worker worker = new tbl_worker();
                        worker.asp_user_Id = user.Id;
                        db.tbl_worker.Add(worker);
                        await db.SaveChangesAsync();

                        try
                        {
                            await UserManager.AddToRoleAsync(user.Id, "Worker");
                        }
                        catch
                        {
                            tbl_asp_role role = new tbl_asp_role();
                            role.Name = "Worker";
                            db.tbl_asp_role.Add(role);
                            await db.SaveChangesAsync();

                            await UserManager.AddToRoleAsync(user.Id, "Worker");
                        }
                    }
                    else
                    {
                        tbl_company company = new tbl_company();
                        company.asp_user_Id = user.Id;
                        db.tbl_company.Add(company);
                        await db.SaveChangesAsync();

                        try
                        {
                            await UserManager.AddToRoleAsync(user.Id, "Company");
                        }
                        catch
                        {
                            tbl_asp_role role = new tbl_asp_role();
                            role.Name = "Company";
                            db.tbl_asp_role.Add(role);
                            await db.SaveChangesAsync();

                            await UserManager.AddToRoleAsync(user.Id, "Company");
                        }
                    }
                    await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                    //For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
                    //Send an email with this link
                    //string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    //var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    //await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                    return(RedirectToAction("PageByRole", "Home"));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
 public bool UpdateCompany(tbl_company entity)
 {
     throw new NotImplementedException();
 }