コード例 #1
0
        public ActionResult Dashboard_Employee(tblSkill data)
        {
            Session["skusername"] = Session["eUsername"];
            ViewBag.Name          = Session["eFirstName"].ToString();

            List <tblSkill> userdata = db.tblSkills.Where(x => x.skUsername == data.skUsername).ToList();

            loggedinUser = data.skUsername;
            return(View(userdata));
        }
コード例 #2
0
        public ActionResult Approve(int id)
        {
            int      ID   = id;
            tblSkill idea = entity.tblSkills.FirstOrDefault(g => g.skId == id);

            idea.skStatus            = "Approved";
            entity.Entry(idea).State = System.Data.Entity.EntityState.Modified;
            entity.SaveChanges();
            return(RedirectToAction("ConfirmEmail", new { id = ID }));
        }
コード例 #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            tblSkill tblSkill = db.tblSkills.Find(id);

            db.tblSkills.Remove(tblSkill);
            db.SaveChanges();
            Response.Write("<script>alert(" + loggedinUser + ")</script>");
            string un = loggedinUser;

            return(RedirectToAction("Dashboard_Employee", new { uname = loggedinUser }));
        }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "skId,skName,skExperience,skPrevProjects,skCurrentProject,skDomain,skUsername")] tblSkill tblSkill)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblSkill).State = EntityState.Modified;
         db.SaveChanges();
         string un = loggedinUser;
         return(RedirectToAction("Dashboard_Employee", new { uname = loggedinUser }));
     }
     return(View(tblSkill));
 }
コード例 #5
0
ファイル: sp_Skill_DAL.cs プロジェクト: CISC181/VolTeerNET
 /// <summary>
 /// InsertSkillContext - Will insert a record into Skill table via SProc
 /// </summary>
 /// <param name="_cSkill"></param>
 public void InsertSkillContext(ref sp_Skill_DM _cSkill)
 {
     using (VolTeerEntities context = new VolTeerEntities())
     {
         var cSkill = new tblSkill
         {
             SkillName = _cSkill.SkillName,
             MstrSkillID = _cSkill.MstrSkillID
         };
         context.tblSkills.Add(cSkill);
         context.SaveChanges();
         _cSkill.SkillID = cSkill.SkillID;
     }
 }
コード例 #6
0
        // GET: Home2/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblSkill tblSkill = db.tblSkills.Find(id);

            if (tblSkill == null)
            {
                return(HttpNotFound());
            }
            return(View(tblSkill));
        }
コード例 #7
0
        public ActionResult User_Data_Entry(tblSkill data)
        {
            if (ModelState.IsValid)
            {
                if (Session["eLoginId"] != null)
                {
                    entity.tblSkills.Add(data);
                    data.skUsername = Session["eUsername"].ToString();
                    data.skStatus   = "Pending";
                    entity.SaveChanges();

                    return(RedirectToAction("Dashboard_Employee", "Home2", new { @uname = data.skUsername }));
                }
            }
            return(View());
        }
コード例 #8
0
        public ActionResult ConfirmEmail(System.Web.Mvc.FormCollection form, int id)
        {
            string   cnfemail = form["confirmemail"];
            tblSkill idea     = entity.tblSkills.FirstOrDefault(g => g.skId == id);
            tblLogin user;
            tblSkill skill;

            user  = entity.tblLogins.Where(x => x.eUsername == idea.skUsername).FirstOrDefault();
            skill = entity.tblSkills.Where(x => x.skId == id).FirstOrDefault();
            string email = user.eEmail;

            if (user != null)
            {
                string username = user.eUsername;
                entity.SaveChanges();
                if (!string.IsNullOrEmpty(email))
                {
                    MimeMessage    mm   = new MimeMessage();
                    MailboxAddress from = new MailboxAddress("ADMIN", "*****@*****.**");
                    mm.From.Add(from);
                    MailboxAddress to = new MailboxAddress(username, email);
                    mm.To.Add(to);
                    mm.Subject = "Idea Approval";
                    var body = "Hi, <br/>" + user.eFirstName + "." + user.eLastName + "Your idea of " + skill.skCurrentProject + "of" + skill.skDomain + "<br/>" +
                               "<div style='background-color: white; display: block; font-family: sans-serif; text-align: center'> " +
                               "<div style='background-color:#1ED5A2; width: 80%; color: white; text-align: center; font-size: 2rem; padding: 1rem;'> " +
                               "<h2 style='color:black'>" + skill.skStatus + "</h2>Your idea has been Accepted, and Contact him: " + cnfemail + "</div><div></div>" +
                               "<br/> Thank you</div>";
                    BodyBuilder bodyBuilder = new BodyBuilder();
                    bodyBuilder.HtmlBody = string.Format(body, skill.skStatus, skill.skCurrentProject, user.eFirstName, user.eLastName, skill.skDomain);
                    bodyBuilder.TextBody = string.Format(body, skill.skStatus, skill.skCurrentProject, user.eFirstName, user.eLastName, skill.skDomain);
                    mm.Body = bodyBuilder.ToMessageBody();
                    using (var client = new SmtpClient())
                    {
                        client.Connect("smtp.gmail.com", 465, true);
                        client.Authenticate("*****@*****.**", "dxcproject");
                        client.Send(mm);
                        client.Disconnect(true);
                        client.Dispose();
                    }
                }
            }
            return(RedirectToAction("Index"));
        }
コード例 #9
0
        public IActionResult Create(EmployeeViewModel Ev)
        {
            if (Ev != null)
            {
                var tblEmployee = new tblEmployee()
                {
                    EmployeeID   = Ev.EmployeeID,
                    EmployeeName = Ev.EmployeeName,
                    PhoneNumber  = Ev.PhoneNumber,
                    //   Skil = Ev.Skill,
                    YearsExperience = Ev.YearsExperience
                };

                var tblSkill = new tblSkill()
                {
                    Title = Ev.Skill
                };

                _dbContext.tblEmployees.Add(tblEmployee);
                _dbContext.tblSkills.Add(tblSkill);
                _dbContext.SaveChanges();
            }
            return(View());
        }
コード例 #10
0
    protected void txtAddSkill_TextChanged(object sender, EventArgs e)
    {
        try
        {
            var DC = new DataClassesDataContext();

            tblSkill SkillID = (from ob in DC.tblSkills
                                where ob.SkillName == txtAddSkill.Text
                                select ob).Single();
            int Skill = (from ob in DC.tblEmpXSkills
                         join obj in DC.tblSkills
                         on ob.SkillID equals obj.SkillID
                         where ob.EmpID == Convert.ToInt32(Session["EmpID"]) && ob.SkillID == SkillID.SkillID
                         select ob).Count();
            if (Skill > 0)
            {
                erroSkill.Text    = "Skill already exist!!";
                erroSkill.Visible = true;
            }
            else
            {
                erroSkill.Visible = false;
                objEmployee.AddEmpSkill(Convert.ToInt32(Session["EmpID"]), txtAddSkill.Text);
                txtAddSkill.Text      = "";
                panelAddSkill.Visible = false;


                BindData();

                //Employee Appraisal
                int cnt = (from obj in DC.tblEmpAppraisals
                           where obj.EmpID == Convert.ToInt32(Session["EmpID"])
                           select obj).Count();
                if (cnt > 0)
                {
                    tblEmpAppraisal data = (from obj in DC.tblEmpAppraisals
                                            where obj.EmpID == Convert.ToInt32(Session["EmpID"])
                                            select obj).SingleOrDefault();
                    data.Skills = data.Skills.Value + 1;
                    DC.SubmitChanges();
                }
                else
                {
                    tblEmployee EmpData = (from obj in DC.tblEmployees
                                           where obj.EmpID == Convert.ToInt32(Session["EmpID"])
                                           select obj).First();
                    tblEmpAppraisal EmpAppraisal = new tblEmpAppraisal();
                    EmpAppraisal.EmpID          = EmpData.EmpID;
                    EmpAppraisal.Skills         = Convert.ToDecimal(1.0);
                    EmpAppraisal.Quality        = Convert.ToDecimal(0.0);
                    EmpAppraisal.Avialibility   = Convert.ToDecimal(0.0);
                    EmpAppraisal.Deadlines      = Convert.ToDecimal(0.0);
                    EmpAppraisal.Communication  = Convert.ToDecimal(0.0);
                    EmpAppraisal.Cooperation    = Convert.ToDecimal(0.0);
                    EmpAppraisal.ClientFeedback = Convert.ToDecimal(0.0);
                    EmpAppraisal.CreatedBy      = Convert.ToInt32(Session["EmpID"]);
                    EmpAppraisal.CreatedOn      = DateTime.Now;
                    DC.tblEmpAppraisals.InsertOnSubmit(EmpAppraisal);
                }

                DC.SubmitChanges();
            }
        }
        catch (Exception ex)
        {
            int    session    = Convert.ToInt32(Session["EmpID"].ToString());
            string PageName   = System.IO.Path.GetFileName(Request.Url.AbsolutePath);
            string MACAddress = GetMacAddress();
            AddErrorLog(ref ex, PageName, "Employee", session, 0, MACAddress);
            ClientScript.RegisterStartupScript(GetType(), "abc", "alert('Something went wrong! Try again');", true);
        }
    }