public ActionResult AddGoals(EmployeeGoalsViewModel objGoals)
 {
     try
     {
         objGoals.objEmpGoals.dtStartdate = DateTime.Now;
         objGoals.objEmpGoals.varCompletion = objGoals.completion;
         objGoals.objEmpGoals.dtCreatedOn = DateTime.Now;
         db.tblEmployeeGoals.Add(objGoals.objEmpGoals);
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         string msg = ex.Message;
     }
     return RedirectToAction("AddGoals");
 }
Esempio n. 2
0
        public ActionResult Client(tblClientDetail objClientDetails)
        {
            objClientDetails.dtCreatedOn = DateTime.Now;
            db.tblClientDetails.Add(objClientDetails);
            db.SaveChanges();

            return(RedirectToAction("Client"));
        }
Esempio n. 3
0
        public ActionResult AddProject(ProjectViewModel objProjectViewModel)
        {
            try
            {
                int clientID     = 0;
                var ClientTeamId = from data in db.tblClientTeams
                                   where data.varClientTeamMemName == objProjectViewModel.strExtClientHead
                                   select new { ID = data.intClientTeamID };

                foreach (var i in ClientTeamId)
                {
                    clientID = i.ID;
                }

                int[] empId = objProjectViewModel.EmployeeID;

                string selEmpId = String.Join(",", empId);

                //if (clientID == 0)
                //{
                //    tblClientTeam tc = new tblClientTeam();
                //    tc.varClientTeamMemName = objProjectViewModel.strExtClientHead;
                //    tc.intActive = true;
                //    tc.dtCreatedOn = DateTime.Now;
                //    tc.varClientTeamMemEmail = objProjectViewModel.strExtClientEmailID;
                //    db.tblClientTeams.Add(tc);
                //    db.SaveChanges();
                //    clientID = tc.intClientTeamID;
                //}

                objProjectViewModel.objProjectDetails.varTeamMemDetails    = selEmpId;
                objProjectViewModel.objProjectDetails.dtCreatedOn          = DateTime.Now;
                objProjectViewModel.objProjectDetails.varClientProjectHead = clientID.ToString();
                db.tblProjectDetails.Add(objProjectViewModel.objProjectDetails);
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                string msg = ex.Message;
            }
            return(RedirectToAction("AddProject"));
        }
Esempio n. 4
0
        public ActionResult CreateEmployee(LoginViewModel objtlogin, int[] AccessId)
        {
            string accesslevels = "";

            try
            {
                //string accesslevels = string.Join(",", AccessId);

                foreach (var item in objtlogin.access)
                {
                    if (item.IsActive == true)
                    {
                        int accid = item.intAccessID;

                        // string str=string.Join(",", accid);
                        accesslevels = accesslevels + ',' + accid;
                    }
                }
                accesslevels = accesslevels.Remove(0, 1);
                string strOfficialEmailId = objtlogin.objtblLogin.tblEmployee.varOfficeEmailAdd;
                string strUserName        = objtlogin.objtblLogin.varLoginName;
                string strPassword        = objtlogin.objtblLogin.varPassword;

                objtlogin.objtblLogin.tblEmployee.varAccessLevel = accesslevels;
                objtlogin.objtblLogin.varLoginName = strOfficialEmailId;
                objtlogin.objtblLogin.IsActive     = true;

                db.tblLogins.Add(objtlogin.objtblLogin);

                //------------------- Checkbox
                StringBuilder sb = new StringBuilder();
                sb.Append(" ").AppendLine();

                foreach (var item in objtlogin.access)
                {
                    if (item.IsActive == true)
                    {
                        sb.Append(item.intAccessID + ", ").AppendLine();
                    }
                }
                ViewBag.Country = sb.ToString();
                // ---------------------- checkbox

                db.SaveChanges();

                sendMail(strOfficialEmailId, strPassword);



                ViewBag.Message = "Data has been submitted successfully!!.";
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        Trace.TraceInformation("Class: {0}, Property: {1}, Error: {2}",
                                               validationErrors.Entry.Entity.GetType().FullName,
                                               validationError.PropertyName,
                                               validationError.ErrorMessage);
                    }
                }

                throw;  // You can also choose to handle the exception here...
            }



            return(RedirectToAction("CreateEmployee"));
        }