Beispiel #1
0
        public object createcontact(Registration Lvm)
        {
            try
            {
                EmployeeEntities db = new EmployeeEntities();
                EmployeeMaster   Em = new EmployeeMaster();
                if (Em.UserId == 0)
                {
                    Em.UserName = Lvm.UserName;

                    Em.LoginName = Lvm.LoginName;
                    Em.Password  = Lvm.Password;
                    Em.Email     = Lvm.Email;
                    //Em.IsApproved = Lvm.IsApproved;
                    //Em.Status = Lvm.Status;
                    Em.IsApproved = 1;
                    Em.Status     = 3;
                    db.EmployeeMasters.Add(Em);
                    db.SaveChanges();
                    return(new Response
                    {
                        Status = "Success", Message = "Succesfully Saved"
                    });
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(new Response
            {
                Status = "Error", Message = "Invalid Data."
            });
        }
 public ActionResult DeleteDetails(EmployeeMaster empmaster)
 {
     empmaster.Status     = "InActive";
     empmaster.ModifiedOn = DateTime.Now;
     _EmployeeMasterService.UpdateEmployee(empmaster);
     return(RedirectToAction("ViewDetails/" + empmaster.EmpId, "Employee"));
 }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Surname,Address,Qualification,Contact_Number,DepartmentId")] EmployeeMaster employeeMaster)
        {
            if (id != employeeMaster.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employeeMaster);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeMasterExists(employeeMaster.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(employeeMaster));
        }
        public ActionResult _OrgChartGeo(string empId)
        {
            if (string.IsNullOrEmpty(empId))
            {
                return(Json(0, JsonRequestBehavior.AllowGet));
            }
            EmployeeMaster employeeMaster        = bEmployeeMaster.getEmployeeByEmpId(empId);
            List <EmployeeDiagramViewModel> data = bEmployeeMasterReport.getDiagramGEO(employeeMaster);

            if (data == null && employeeMaster != null)
            {
                data = new List <EmployeeDiagramViewModel>();
                EmployeeDiagramViewModel root = new EmployeeDiagramViewModel();
                root.EMPNAME     = employeeMaster.EMPNAME;
                root.EMPID       = employeeMaster.EMPID;
                root.SYS_EMPID   = employeeMaster.SYS_EMPID;
                root.ColorScheme = "#ee587b";
                if (string.IsNullOrEmpty(employeeMaster.IMAGE))
                {
                    root.Image = "default.jpg" + "?" + (new Random()).Next(0, 100);
                }
                else
                {
                    root.Image = employeeMaster.IMAGE + "?" + (new Random()).Next(0, 100);
                }
                data.Add(root);
            }
            return(Json(data, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Create(MainApplication model, HttpPostedFileBase file)
        {
            MainApplication mainapp = new MainApplication()
            {
                user = new User(),
            };

            EmployeeMaster emp    = _EmployeeMasterService.getLastInsertedEmp();
            int            lastid = 0;
            int            length = 0;

            if (emp != null)
            {
                lastid = emp.EmpId;
                lastid = lastid + 1;
                length = lastid.ToString().Length;
            }
            else
            {
                lastid = 1;
                length = 1;
            }
            string catCode = _utilityservice.getName("EMP", length, lastid);

            string msgbox = string.Empty;

            if (file != null)
            {
                var fileName = Path.GetFileName(file.FileName);
                var path     = ConfigurationManager.AppSettings["EmployeePhotos"].ToString() + "/" + fileName;
                file.SaveAs(path);

                model.EmployeeDetails.Photo = fileName;
            }
            if (!string.IsNullOrEmpty(msgbox))
            {
                TempData["errorMsg"] = msgbox;
                return(RedirectToAction("Create", "Employee"));
            }
            Int32 sid = Convert.ToInt32(model.EmployeeDetails.State);

            model.EmployeeDetails.State = _stateService.GetStateNamebyId(sid);
            Int32 cid = Convert.ToInt32(model.EmployeeDetails.City);

            model.EmployeeDetails.City         = _cityService.GetCityNamebyId(cid);
            model.EmployeeDetails.EmployeeCode = catCode;
            model.EmployeeDetails.Status       = "Active";
            model.EmployeeDetails.ModifiedOn   = DateTime.Now;
            model.EmployeeDetails.companyCode  = CompanyCode;

            _EmployeeMasterService.CreateEmployee(model.EmployeeDetails);
            var EmpDetails = _EmployeeMasterService.getLastInsertedEmp();
            int empId      = EmpDetails.EmpId;

            //Encoding the ShopId Parameter
            var encoded = Encode(empId.ToString());
            var Id      = _EmployeeMasterService.getLastInsertedEmp().EmpId;

            return(RedirectToAction("ViewDetailsCreate/" + encoded, "Employee"));
        }
Beispiel #6
0
        public bool UpdateEmployeeLeavingDetails(EmployeeMaster empdataobj)
        {
            bool result;

            using (IPDEntities ctx = new IPDEntities())
            {
                try
                {
                    var empdetails = ctx.EmployeeMasters.Where(m => m.Id == empdataobj.Id).FirstOrDefault();

                    if (empdetails != null)
                    {
                        empdetails.ReasonForleaving = empdataobj.ReasonForleaving;
                        empdetails.LeavingDate      = empdataobj.LeavingDate;
                        empdetails.Active           = 0;
                        empdetails.JoiningDate      = empdataobj.JoiningDate;
                        ctx.SaveChanges();
                    }
                    var logindetails = ctx.LoginDetails.Where(m => m.UserID == empdataobj.UserId).FirstOrDefault();
                    if (logindetails != null)
                    {
                        logindetails.IsActive = 0;
                    }

                    ctx.SaveChanges();
                    result = true;
                }
                catch (Exception ex)
                {
                    result = false;
                }
            }
            return(result);
        }
        public JsonResult getDeptCodeAndFuncCode(string empId)
        {
            if (string.IsNullOrEmpty(empId))
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }
            EmployeeMaster employeeMaster = bEmployeeMaster.getEmployeeByEmpId(empId);

            if (employeeMaster == null)
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var data = new
                {
                    GEOGRAPHICALORG  = employeeMaster.GEOGRAPHICALORG,
                    GEODIRECTREPORT  = employeeMaster.GEODIRECTREPORT,
                    GEOUSERNAME      = employeeMaster.DISPLAYGEODIRECTREPORT,
                    FUNCTIONALORG    = employeeMaster.FUNCTIONALORG,
                    FUNCDIRECTREPORT = employeeMaster.FUNCDIRECTREPORT,
                    FUNCTUSERNAME    = employeeMaster.DISPLAYFUNCDIRECTREPORT
                };
                return(Json(new { result = Json(data) }));
            }
        }
Beispiel #8
0
        public ActionResult Edit(string EmpCode)
        {
            SetSessionVariables();
            EmployeeMaster emp = new EmployeeMaster();

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Common.Instance.ApiEmployeeControllerName);
                //HTTP GET
                var responseTask = client.GetAsync(Common.Instance.ApiEmployeeGetEmployeeDetails + "/" + EmpCode);
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <EmployeeMaster>();
                    readTask.Wait();

                    emp = readTask.Result;
                }
                else //web api sent error response
                {
                    //log response status here..



                    ModelState.AddModelError(string.Empty, "Server error. Please contact administrator.");
                }
            }

            return(View(emp));
        }
Beispiel #9
0
        public ActionResult Create(EmployeeMaster employee)
        {
            SetSessionVariables();

            employee.CreatedBy       = GetSessionObject().UserID;
            employee.CreatedDateTime = DateTime.Now;

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Common.Instance.ApiEmployeeControllerName);

                //HTTP POST
                var postTask = client.PostAsJsonAsync <EmployeeMaster>(Common.Instance.ApiEmployeeAddEditEmployee, employee);
                postTask.Wait();

                var result = postTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    //var rs = result.Content.ReadAsAsync<ClientMaster>();
                    ////return RedirectToAction("Index");
                    //NewClient = rs.Result;
                    var rs = result.Content.ReadAsAsync <bool>().Result;
                }
            }

            return(RedirectToAction("Index"));
        }
 public ActionResult LeaveRequest(Leave model)
 {
     CSvc = new BALCommon(ConStr);
     try
     {
         EmployeeMaster EMself   = CSvc.GetSingleEmployee(_UserTypeBaseID);
         EmployeeMaster EMParent = CSvc.GetSingleEmployee(EMself.ParentID);
         model.SenderID      = _UserTypeBaseID;
         model.SenderName    = EMself.FIRSTNAME;
         model.SenderType    = Convert.ToString(_UserType);
         model.ApproverID    = EMself.ParentID;
         model.ApproverName  = EMParent.FIRSTNAME;
         model.ApproverType  = Convert.ToString(_UserType);
         model.LeaveStatus   = "Pending";
         model.SchoolID      = _OrgnisationID;
         model.FinancialYear = _Financialyearid;
         model.LeaveType     = model.LeaveType.Split('_')[0];
         model.Action        = "INS";
         bool res = CSvc.InsertUpdateLeaveRequest(model);
         if (res)
         {
             TempData[Constants.MessageInfo.SUCCESS] = "Request sent successfully.";
         }
         else
         {
             TempData[Constants.MessageInfo.ERROR] = "Request could not sent successfully.";
         }
     }
     catch (Exception ex)
     {
     }
     return(RedirectToAction("Leave"));
 }
        public bool DeleteEmployeeMaster(int?id, EmployeeMaster employeeMaster)
        {
            try
            {
                var obj = JsonConvert.SerializeObject
                              (new EmployeeMaster
                {
                    EmployeeId = employeeMaster.EmployeeId,
                    UserId     = employeeMaster.UserId,
                    TokenId    = employeeMaster.TokenId
                });

                var EmpObj = obj.ToString();

                var JsonObj = db.RemoveExamination(id, EmpObj);

                return(true);
                //var employeeMaster = db.EmployeeMasters.Where(x => x.EmployeeId == id).FirstOrDefault();
                //if (employeeMaster == null) return false;
                //db.Entry(employeeMaster).State = System.Data.Entity.EntityState.Deleted;
                //db.SaveChanges();
                //return true;
            }
            catch (Exception ex)
            {
                Console.WriteLine("NotImplementedException", ex);
                return(false);
            }
        }
        public ActionResult LeaveRequest()
        {
            Leave model = new Leave();

            CSvc = new BALCommon(ConStr);
            List <selectList> SL = new List <selectList>();

            try
            {
                EmployeeMaster EM = CSvc.GetSingleEmployee(_UserTypeBaseID);
                SL.Add(new selectList
                {
                    Text  = "CL",
                    Value = "CL_" + EM.LEAVE_CL_ENTITLED
                });
                SL.Add(new selectList
                {
                    Text  = "PL",
                    Value = "PL_" + EM.LEAVE_PL_ENTITLED
                });
                SL.Add(new selectList
                {
                    Text  = "SL",
                    Value = "SL_" + EM.LEAVE_SL_ENTITLED
                });
                model.LeaveTypeList = SL;
            }
            catch (Exception ex)
            {
            }
            return(View(model));
        }
Beispiel #13
0
        public Form1()
        {
            InitializeComponent();
            string            message = "You did not enter a server name. Cancel this operation?";
            string            caption = "Error Detected in Input";
            MessageBoxButtons buttons = MessageBoxButtons.YesNo;
            DialogResult      result;

            // Displays the MessageBox.
            result = MessageBox.Show(message, caption, buttons);
            DatabaseContext context = new DatabaseContext();

            Console.WriteLine("Enter Employee name");
            string         name     = "duc 2";
            EmployeeMaster employee = new EmployeeMaster()
            {
                EmpName = name
            };

            context.EmployeeMaster.Add(employee);
            context.SaveChanges();

            var data    = context.EmployeeMaster.ToList();
            var history = context.History.ToList();

            foreach (var item in data)
            {
                Console.Write(string.Format("ID : {0}  Name : {1}  Salary : {2}", item.ID, item.EmpName, Environment.NewLine));
            }
        }
        public async Task <IActionResult> Edit(int id, [Bind("EmployeeId,EmployeeFirstName,EmployeeLastName")] EmployeeMaster employeeMaster)
        {
            if (id != employeeMaster.EmployeeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employeeMaster);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeMasterExists(employeeMaster.EmployeeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(employeeMaster));
        }
Beispiel #15
0
        private void MIEmployeeMaster_Click(object sender, EventArgs e)
        {
            EmployeeMaster objEmp = new EmployeeMaster();

            objEmp.MdiParent = this;
            objEmp.Show();
        }
        //public bool UpdateDesignationList(string designationName)
        // {
        //     var designationList = GetDesignationList();
        //     var count = 0;
        //     if(designationList != null)
        //     {
        //         foreach(var designation in designationList)
        //         {
        //             if(designation.Designation == designationName)
        //             {
        //                 count++;
        //             }
        //             if(count > 0)
        //             {


        //             }
        //         }
        //     }
        // return true;
        // }

        public bool UpdateProfessionalDetails(EmployeeMaster empobj, EmployeeProfessionalDetail profobj)
        {
            using (IPDEntities ctx = new IPDEntities())
            {
                var employeedata = ctx.EmployeeMasters.Where(m => m.EmpNo == empobj.EmpNo).FirstOrDefault();
                if (employeedata != null)
                {
                    employeedata.EmployeeName = empobj.EmployeeName;
                    employeedata.EmpNo        = empobj.EmpNo;
                }
                var proffesionaldata = ctx.EmployeeProfessionalDetails.Where(m => m.EmpProfID == profobj.EmpProfID).FirstOrDefault();
                if (proffesionaldata != null)
                {
                    proffesionaldata.TotalExprInMonths = profobj.TotalExprInMonths;
                    proffesionaldata.TotalExprInYears  = profobj.TotalExprInYears;
                    proffesionaldata.DesignationID     = profobj.DesignationID;
                    proffesionaldata.DepartmentID      = profobj.DepartmentID;
                }
                else
                {
                    EmployeeProfessionalDetail profInsertObj = new EmployeeProfessionalDetail();
                    if (profobj.UserID != 0) //dont save details if userid is not available
                    {
                        profInsertObj.TotalExprInMonths = profobj.TotalExprInMonths;
                        profInsertObj.TotalExprInYears  = profobj.TotalExprInYears;
                        profInsertObj.DesignationID     = profobj.DesignationID;
                        profInsertObj.DepartmentID      = profobj.DepartmentID;
                        profInsertObj.UserID            = profobj.UserID;
                        ctx.EmployeeProfessionalDetails.Add(profInsertObj);
                    }
                }
                ctx.SaveChanges();
            }
            return(true);
        }
Beispiel #17
0
        private void InitialEmpDetail()
        {
            EmployeeMaster_Manage manage  = new EmployeeMaster_Manage();
            EmployeeMaster        empData = new EmployeeMaster();

            empData = manage.GetData(hdfEmployeeID.Value.Trim());

            lblEmployeeName.Text = empData.EmployeeName;
            lblDepartment.Text   = empData.DepartmentName;
            lblPosition.Text     = empData.Position;
            if (empData.StartDate != null)
            {
                lblJoinDate.Text = empData.StartDate.Value.ToString(@"dd\/MM\/yyyy");
            }
            if (empData.ContractStart != null)
            {
                lblContractStart.Text = empData.ContractStart.Value.ToString(@"dd\/MM\/yyyy");
            }
            if (empData.ContractEnd != null)
            {
                lblContractEnd.Text = empData.ContractEnd.Value.ToString(@"dd\/MM\/yyyy");
            }

            //hdfCompanyID.Value = empData.CompanyID;
            txt2ndMgtName.Text  = empData.SecondManager;
            txt2ndMgtEmail.Text = empData.SecondManagerMail;

            txt1stMgtName.Text  = empData.FirstManager;
            txt1stMgtEmail.Text = empData.FirstManagerMail;
        }
Beispiel #18
0
        public IHttpActionResult PutEmployeeMaster(int id, EmployeeMaster employeeMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != employeeMaster.EmployeeId)
            {
                return(BadRequest());
            }

            db.Entry(employeeMaster).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmployeeMasterExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #19
0
        public bool DeleteUser(int ID)
        {
            bool result;

            using (IPDEntities ctx = new IPDEntities())
            {
                try
                {
                    LoginDetail loginDetail = ctx.LoginDetails.Where(m => m.UserID == ID).FirstOrDefault();
                    //Code change - Column datatype changed from int to bool
                    loginDetail.IsDelete = true;
                    EmployeeMaster empMaster = ctx.EmployeeMasters.Where(m => m.UserId == ID).FirstOrDefault();
                    if (empMaster != null)
                    {
                        empMaster.Active = 0;
                    }
                    ctx.SaveChanges();

                    result = true;
                }
                catch (Exception ex)
                {
                    result = false;
                }
            }
            return(result);
        }
Beispiel #20
0
        private void button1_Click(object sender, EventArgs e)
        {
            DatabaseContext context = new DatabaseContext();
            //Console.WriteLine("Enter Employee name");
            //string name = Console.ReadLine();
            //Console.WriteLine("Enter Salary");
            //double salary = Convert.ToDouble(Console.ReadLine());
            //Console.WriteLine("Enter Designation");
            //string designation = Console.ReadLine();
            EmployeeMaster employee = new EmployeeMaster()
            {
                EmpName     = "wqwqw",
                Designation = "wedwds",
                Salary      = 13234
            };

            context.EmployeeMaster.Add(employee);
            context.SaveChanges();

            var data = context.EmployeeMaster.ToList();

            foreach (var item in data)
            {
                Console.Write(string.Format("ID : {0}  Name : {1}  Salary : {2}   Designation : {3}{4}", item.ID, item.EmpName, item.Salary, item.Designation, Environment.NewLine));
            }
        }
        public ActionResult Edit(string empId)
        {
            EmployeeMaster employeeMaster = bEmployeeMaster.getEmployeeByEmpId(empId);

            ViewBag.isMode = 1;
            //if (Session["geoorganizationreport_tree"] == null)
            //    Session["geoorganizationreport_tree"] = bGeoReport.getTreeGeoDepts();
            //if (Session["functreport_tree"] == null)
            //    Session["functreport_tree"] = bFunctionReport.getTreeFunctionDepts();
            if (employeeMaster != null)
            {
                ViewBag.Countries   = SelectListCountries(employeeMaster.NATIONALITY);
                ViewBag.Gender      = SelectListGender(employeeMaster.GENDER);
                ViewBag.Academics   = SelectListAcademicLevels(employeeMaster.ACADEMIC);
                ViewBag.Positions   = SelectListPositions(employeeMaster.POSITION);
                ViewBag.Skills      = SelectListSkills(employeeMaster.SKILL);
                ViewBag.geoInline   = getGeOrganizations_Default_Inline_Data();
                ViewBag.functInline = getFunctReports_Default_Inline_Data();
                return(PartialView(employeeMaster));//View(employeeMaster);
            }
            else
            {
                ViewBag.Countries   = SelectListCountries("");
                ViewBag.Gender      = SelectListGender("");
                ViewBag.Academics   = SelectListAcademicLevels("");
                ViewBag.Positions   = SelectListPositions("");
                ViewBag.Skills      = SelectListSkills("");
                ViewBag.isMode      = 0;
                ViewBag.geoInline   = getGeOrganizations_Default_Inline_Data();
                ViewBag.functInline = getFunctReports_Default_Inline_Data();
                //EmployeeMaster employee = new EmployeeMaster();
                //employee.IMAGE = "default.jpg";
                return(PartialView("New"));
            }
        }
Beispiel #22
0
    protected void BtnDelete_Click(object sender, EventArgs e)
    {
        try
        {
            int DeleteId = 0;
            if (ViewState["EditID"] != null)
            {
                DeleteId = Convert.ToInt32(ViewState["EditID"]);
            }
            if (DeleteId != 0)
            {
                Entity_EM.EmployeeId = DeleteId;
                Entity_EM.UserId     = Convert.ToInt32(Session["UserID"]);
                Entity_EM.LoginDate  = DateTime.Now;
                Entity_EM.IsDeleted  = true;

                int iDelete = Obj_EM.DeleteRecord(ref Entity_EM, out StrError);

                if (iDelete != 0)
                {
                    obj_Comm.ShowPopUpMsg("Record Deleted SuccessFully..!", this.Page);
                    MakeEmptyForm();
                }
                Entity_EM = null;
                obj_Comm  = null;
            }
        }
        catch (Exception ex)
        {
            StrError = ex.Message;
        }
    }
        public ActionResult Async_Upload_Image(IEnumerable <HttpPostedFileBase> imgUpload, string empId)
        {
            if (string.IsNullOrEmpty(empId))
            {
                return(Content(""));
            }
            string filePath = "";

            if (imgUpload != null)
            {
                var file = imgUpload.ToList()[0];
                var size = file.ContentLength / 1024;
                if (size > 50)
                {
                    return(Json(new { sys_empid = empId, img_url = "size" }, "text/plain"));
                }
                var            fileName = Path.GetFileName(file.FileName);
                EmployeeMaster employee = bEmployeeMaster.getEmployeeByEmpId(empId);
                string         newName  = string.Empty;
                string[]       array    = fileName.Split('.');
                if (array.Length > 0)
                {
                    newName = empId + "." + array[1];
                }
                employee.IMAGE = newName;
                filePath       = "/FileServer/Photos/" + newName;
                var pysicalPath = Path.Combine(Server.MapPath("~/FileServer/Photos"), newName);
                file.SaveAs(pysicalPath);
                bEmployeeMaster.UpdateEmployee(employee);
            }
            return(Json(new { sys_empid = empId, img_url = filePath }, "text/plain"));
        }
        public async Task <IActionResult> PutEmployeeMaster(int id, EmployeeMaster employeeMaster)
        {
            if (id != employeeMaster.Id)
            {
                return(BadRequest());
            }

            _context.Entry(employeeMaster).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmployeeMasterExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public ActionResult EditDetails(EmployeeMaster empmaster)
        {
            empmaster.Status     = "Active";
            empmaster.ModifiedOn = DateTime.Now;
            if (empmaster.Photo == " ")
            {
                if (TempData["PhotoName"] != null)
                {
                    empmaster.Photo       = TempData["PhotoName"].ToString();
                    TempData["PhotoName"] = empmaster.Photo;
                }
                else
                {
                    empmaster.Photo = "";
                }
            }
            Int32 sid = Convert.ToInt32(empmaster.State);

            empmaster.State = _stateService.GetStateNamebyId(sid);
            bool str = (empmaster.City).All(char.IsDigit);

            if (str != true)
            {
            }
            else
            {
                Int32 cid = Convert.ToInt32(empmaster.City);
                empmaster.City = _cityService.GetCityNamebyId(cid);
            }
            _EmployeeMasterService.UpdateEmployee(empmaster);
            return(RedirectToAction("SuccessMsg", "Employee"));
        }
Beispiel #26
0
        public static List <EmployeeMaster> getUserFunctionReports(string funccode)
        {
            List <EmployeeMaster> functionReports = new List <EmployeeMaster>();
            FunctionReportAccess  access          = new FunctionReportAccess();
            DataTable             dtResult        = access.GetUsersFunctionReports(funccode);

            foreach (DataRow dtr in dtResult.Rows)
            {
                EmployeeMaster item = new EmployeeMaster
                {
                    SYS_EMPID = dtr["SYS_EMPID"].ToString(),
                    EMPID     = dtr["EMPID"].ToString(),
                    EMPNAME   = dtr["EMPNAME"].ToString(),
                    POSITION  = dtr["POSITION"].ToString(),
                    SKILL     = dtr["SKILL"].ToString()
                };
                CategoryValueEntity position = bEmployeeMaster.getPositions().Where(p => p.Code == item.POSITION).FirstOrDefault();
                CategoryValueEntity skill    = bEmployeeMaster.getSkills().Where(p => p.Code == item.SKILL).FirstOrDefault();
                if (position != null)
                {
                    item.POSITION = position.CategoryValue;
                }
                if (skill != null)
                {
                    item.SKILL = skill.CategoryValue;
                }
                functionReports.Add(item);
            }
            return(functionReports);
        }
Beispiel #27
0
        public ActionResult DeleteConfirmed(int id)
        {
            EmployeeMaster   a = (from c in db.EmployeeMasters where c.EmployeeID == id select c).FirstOrDefault();
            UserRegistration u = (from c in db.UserRegistrations where c.UserName == a.Email select c).FirstOrDefault();

            if (a == null)
            {
                return(HttpNotFound());
            }
            else
            {
                if (a != null)
                {
                    db.EmployeeMasters.Remove(a);
                    db.SaveChanges();
                }
                if (u != null)
                {
                    db.UserRegistrations.Remove(u);
                    db.SaveChanges();
                }
                TempData["SuccessMsg"] = "You have successfully Deleted Employee.";
                return(RedirectToAction("Index"));
            }
        }
Beispiel #28
0
        public async Task <IActionResult> PutEmployeeMaster([FromRoute] int id, [FromBody] EmployeeMaster employeeMaster)
        {
            if (_context.EmployeeMaster.Any(name => name.Email.Equals(employeeMaster.Email) && name.Employee_Id != employeeMaster.Employee_Id && name.IsDelete == 0))
            {
                ModelState.AddModelError(string.Empty, "Employee is already exists");
                return(BadRequest(ModelState));
            }
            employeeMaster.IsDelete = 0;
            _context.Entry(employeeMaster).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmployeeMasterExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        private void InitialEmpDetail()
        {
            EmployeeMaster_Manage manage  = new EmployeeMaster_Manage();
            EmployeeMaster        empData = new EmployeeMaster();

            empData = manage.GetData(hdfEmployeeID.Value.Trim());
            if (empData != null)
            {
                lblEmployeeName.Text = empData.EmployeeName;
                lblDepartment.Text   = empData.DepartmentName;
                lblPosition.Text     = empData.Position;

                hdfFirstManagerMail.Value = empData.FirstManagerMail;
                hdfFirstManager.Value     = empData.FirstManager;

                hdfSecondManager.Value = empData.SecondManager;

                if (empData.StartDate != null)
                {
                    lblJoinDate.Text = empData.StartDate.Value.ToString(@"dd\/MM\/yyyy");
                }
            }
            else
            {
                btnSubmit.Visible = false;
                btnReject.Visible = false;
                lbtnPopupErr_ModalPopupExtender.Show();
            }
        }
        public ActionResult Reject2(FormCollection collect)
        {
            if (!string.IsNullOrWhiteSpace(collect["rejectMsg"]) || !string.IsNullOrEmpty(collect["rejectMsg"]))
            {
                string token = Common.AccessToken();
                token = token.Replace("/", "");
                token = token.Replace("+", "");

                //next to reject
                var userT = _userBService.GetDetail(Convert.ToInt32(collect["UserId"]));
                userT.Status      = 6;
                userT.UpdatedAt   = DateTime.Now;
                userT.MobileToken = token;
                _userBService.Edit(userT);
                User userData = _userBService.Edit(userT);

                EmployeeMaster SuperiorData1 = _mstEmployeeBService.GetDetail(_mstEmployeeBService.GetDetail(userData.EmployeeId).Superior_ID);
                EmployeeMaster SuperiorData2 = _mstEmployeeBService.GetDetail(SuperiorData1.Superior_ID);
                //insert UserMessage
                UserMessage userM = Factory.Create <UserMessage>("UserMessage", ClassType.clsTypeDataModel);
                userM.Message     = collect["rejectMsg"];
                userM.MessageType = "Reject 2";
                userM.ToUserId    = Convert.ToInt32(collect["UserId"]);
                //UserM.FromUserId = Convert.ToInt32(Session["userid"]);
                userM.CreatedAt      = DateTime.Now;
                userM.ToEmployeeId   = userT.EmployeeId;
                userM.FromEmployeeId = userT.Approval2;

                _userMessageBService.Add(userM);
                Email.SendMailResApp1(userT, collect["rejectMsg"], 2, 0);
                //send email
                Email.SendMailReject(userT, userM, SuperiorData2);
            }
            return(RedirectToAction("Index"));
        }