コード例 #1
0
        public async Task <ActionResult> Edit([Bind(Include = "EmployeeID,EmployeeName,Address,City,State,CountryID,PersonalEmailID,CEmailID,ContactNo,EmergencyContactNo,GenderID,DOB,DOJ,Department,DesignationID,ManagerID,Pwd,EmployeePic,CreatedBy,CreatedDate,Active")] M_EmployeeMasters m_EmployeeMasters)
        {
            if (ModelState.IsValid)
            {
                if (!string.IsNullOrEmpty(Request.Files["EmployeePic"].FileName))
                {
                    string FolderPath           = Server.MapPath(Resources.HRMResources.EmployeePicPath); // + "\\" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.DayOfWeek;
                    string FullPathWithFileName = FolderPath + "\\" + Request.Files["EmployeePic"].FileName;
                    string FolderPathForImage   = Request.Files["EmployeePic"].FileName;                  //"\\" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.DayOfWeek + "\\" + Request.Files["StdProfilePicPath"].FileName;
                    if (CommonFunction.IsFolderExist(FolderPath))
                    {
                        Request.Files["EmployeePic"].SaveAs(FullPathWithFileName);
                        m_EmployeeMasters.EmployeePic = FolderPathForImage;
                    }
                }

                m_EmployeeMasters.ModifiedBy      = Session["LoginUserID"].ToString();
                m_EmployeeMasters.ModifiedDate    = DateTime.Now;
                db.Entry(m_EmployeeMasters).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.CountryID     = new SelectList(db.M_CommonMasterTable, "ID", "FieldValue", m_EmployeeMasters.CountryID);
            ViewBag.GenderID      = new SelectList(db.M_CommonMasterTable, "ID", "FieldValue", m_EmployeeMasters.GenderID);
            ViewBag.DesignationID = new SelectList(db.M_DesignationMaster, "DesignationID", "Designation", m_EmployeeMasters.DesignationID);
            ViewBag.ManagerID     = new SelectList(db.M_EmployeeMasters, "EmployeeID", "EmployeeName", m_EmployeeMasters.ManagerID);
            return(View(m_EmployeeMasters));
        }
コード例 #2
0
        public async Task <ActionResult> DeleteConfirmed(string id)
        {
            M_EmployeeMasters m_EmployeeMasters = await db.M_EmployeeMasters.FindAsync(id);

            db.M_EmployeeMasters.Remove(m_EmployeeMasters);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
コード例 #3
0
        public static string GenerateEmployeeCode()
        {
            string EmployeeCode = string.Empty;

            M_EmployeeMasters StudentMasterDetails = (from StudentMaster in db.M_EmployeeMasters select StudentMaster).OrderByDescending(x => x.EmployeeID).Take(1).FirstOrDefault();
            // var LastEmployeeCode =(from s in db.M_EmployeeMasters.OrderBy(x => x.EmployeeID).Take(1) select new {s.EmployeeID });
            int LastEmployeeDigit = Convert.ToInt32(StudentMasterDetails.EmployeeID.Substring(3, (StudentMasterDetails.EmployeeID.Length - 3)));

            EmployeeCode = Resources.HRMResources.EmployeeCodeFormate + (LastEmployeeDigit + 1).ToString(Resources.HRMResources.EmployeeCodeDigit);
            return(EmployeeCode);
        }
コード例 #4
0
        // GET: M_EmployeeMasters/Details/5
        public async Task <ActionResult> Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            M_EmployeeMasters m_EmployeeMasters = await db.M_EmployeeMasters.FindAsync(id);

            if (m_EmployeeMasters == null)
            {
                return(HttpNotFound());
            }
            return(View(m_EmployeeMasters));
        }
コード例 #5
0
        public async Task <ActionResult> Edit([Bind(Include = "EmployeeID,EmployeeName,Address,City,State,CountryID,PersonalEmailID,CEmailID,ContactNo,EmergencyContactNo,GenderID,DOB,DOJ,Department,DesignationID,ManagerID,CreatedBy,CreatedDate,ModifiedBy,ModifiedDate,Active")] M_EmployeeMasters m_EmployeeMasters)
        {
            if (ModelState.IsValid)
            {
                db.Entry(m_EmployeeMasters).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.CountryID     = new SelectList(db.M_CommonMasterTable, "ID", "FieldValue", m_EmployeeMasters.CountryID);
            ViewBag.GenderID      = new SelectList(db.M_CommonMasterTable, "ID", "FieldValue", m_EmployeeMasters.GenderID);
            ViewBag.DesignationID = new SelectList(db.M_DesignationMaster, "DesignationID", "Designation", m_EmployeeMasters.DesignationID);
            ViewBag.ManagerID     = new SelectList(db.M_EmployeeMasters, "EmployeeID", "EmployeeName", m_EmployeeMasters.ManagerID);
            return(View(m_EmployeeMasters));
        }
コード例 #6
0
        // GET: M_EmployeeMasters/Edit/5
        public async Task <ActionResult> Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            M_EmployeeMasters m_EmployeeMasters = await db.M_EmployeeMasters.FindAsync(id);

            if (m_EmployeeMasters == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CountryID     = new SelectList(db.M_CommonMasterTable, "ID", "FieldValue", m_EmployeeMasters.CountryID);
            ViewBag.GenderID      = new SelectList(db.M_CommonMasterTable, "ID", "FieldValue", m_EmployeeMasters.GenderID);
            ViewBag.DesignationID = new SelectList(db.M_DesignationMaster, "DesignationID", "Designation", m_EmployeeMasters.DesignationID);
            ViewBag.ManagerID     = new SelectList(db.M_EmployeeMasters, "EmployeeID", "EmployeeName", m_EmployeeMasters.ManagerID);
            return(View(m_EmployeeMasters));
        }
コード例 #7
0
        public async Task <ActionResult> Create([Bind(Include = "EmployeeID,EmployeeName,Address,City,State,CountryID,PersonalEmailID,CEmailID,ContactNo,EmergencyContactNo,GenderID,DOB,DOJ,Department,DesignationID,ManagerID,Pwd")] M_EmployeeMasters m_EmployeeMasters)
        {
            if (ModelState.IsValid)
            {
                m_EmployeeMasters.CreatedBy    = Session["LoginUserID"].ToString();
                m_EmployeeMasters.CreatedDate  = DateTime.Now;
                m_EmployeeMasters.ModifiedBy   = Session["LoginUserID"].ToString();
                m_EmployeeMasters.ModifiedDate = DateTime.Now;
                m_EmployeeMasters.Active       = true;
                db.M_EmployeeMasters.Add(m_EmployeeMasters);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.CountryID     = new SelectList(db.M_CommonMasterTable, "ID", "FieldValue", m_EmployeeMasters.CountryID);
            ViewBag.GenderID      = new SelectList(db.M_CommonMasterTable, "ID", "FieldValue", m_EmployeeMasters.GenderID);
            ViewBag.DesignationID = new SelectList(db.M_DesignationMaster, "DesignationID", "Designation", m_EmployeeMasters.DesignationID);
            ViewBag.ManagerID     = new SelectList(db.M_EmployeeMasters, "EmployeeID", "EmployeeName", m_EmployeeMasters.ManagerID);
            return(View(m_EmployeeMasters));
        }