コード例 #1
0
        public ActionResult EditEmployee(string id)
        {
            Admin             objEmp  = new Admin();
            Manager           objmng  = new Manager();
            Country           country = new Country();
            DesignationMaster dm      = new DesignationMaster();
            RoleMaster        rm      = new RoleMaster();

            State state = new State();
            City  city  = new City();
            List <SelectListItem> Countries = new List <SelectListItem>();
            List <SelectListItem> States    = new List <SelectListItem>();
            List <SelectListItem> Cities    = new List <SelectListItem>();
            List <SelectListItem> Desig     = new List <SelectListItem>();
            List <SelectListItem> Role      = new List <SelectListItem>();

            objmng.EmployeeId = Convert.ToInt32(id);
            if (id != null && id != "")
            {
                try
                {
                    Countries         = country.GetCountry();
                    objEmp.EmployeeID = Convert.ToInt32(id);
                    //dm.CompanyID = Convert.ToInt16(User.Identity.Name.Split('|')[0]);
                    Desig        = dm.GetDesignation();
                    rm.CompanyID = Convert.ToInt16(User.Identity.Name.Split('|')[0]);
                    Role         = rm.GetRoleName();
                    if (objEmp.GetEmployeeByID())
                    {
                        foreach (DataRow dr in objEmp.dtbl.Rows)
                        {
                            objEmp.EmployeeID = Convert.ToInt32(id);
                            if (!dr.IsNull("RoleID"))
                            {
                                objEmp.RoleID = Convert.ToInt32(dr["RoleID"]);
                            }
                            if (!dr.IsNull("FullName"))
                            {
                                objEmp.FullName = Convert.ToString(dr["FullName"]);
                            }
                            if (!dr.IsNull("CommunicationSkill"))
                            {
                                objEmp.CommunicationSkill = Convert.ToString(dr["CommunicationSkill"]);
                            }
                            if (!dr.IsNull("OfficeEmailID"))
                            {
                                objEmp.OfficeEmailID = Convert.ToString(dr["OfficeEmailID"]);
                            }
                            if (!dr.IsNull("PersonalMailId"))
                            {
                                objEmp.PersonalMailId = Convert.ToString(dr["PersonalMailId"]);
                            }
                            if (!dr.IsNull("ProfilePic"))
                            {
                                objEmp.ProfilePic = Convert.ToString(dr["ProfilePic"]);
                            }
                            if (!dr.IsNull("JobLocation"))
                            {
                                objEmp.JobLocation = Convert.ToString(dr["JobLocation"]);
                            }
                            if (!dr.IsNull("JobCountry"))
                            {
                                objEmp.JobCountry = Convert.ToInt32(dr["JobCountry"]);
                            }
                            if (!dr.IsNull("JobCity"))
                            {
                                objEmp.JobCity = Convert.ToInt32(dr["JobCity"]);
                            }
                            if (!dr.IsNull("JobState"))
                            {
                                objEmp.JobState = Convert.ToInt32(dr["JobState"]);
                                city.StateID    = objEmp.JobState;
                                Cities          = city.GetCityByStateID();
                            }
                            if (!dr.IsNull("JobCountry"))
                            {
                                objEmp.JobCountry = Convert.ToInt32(dr["JobCountry"]);
                                state.CountryID   = objEmp.JobCountry;
                                States            = state.GetStateByCountryID();
                            }

                            if (!dr.IsNull("ObjPinCode"))
                            {
                                objEmp.ObjPinCode = Convert.ToString(dr["ObjPinCode"]);
                            }
                            if (!dr.IsNull("Password"))
                            {
                                objEmp.Password = Convert.ToString(dr["Password"]);
                            }
                            if (!dr.IsNull("OfficeMobileNo"))
                            {
                                objEmp.OfficeMobileNo = Convert.ToString(dr["OfficeMobileNo"]);
                            }
                            if (!dr.IsNull("PersonalMobileNumber"))
                            {
                                objEmp.PersonalMobileNumber = Convert.ToString(dr["PersonalMobileNumber"]);
                            }
                            if (!dr.IsNull("Designation"))
                            {
                                objEmp.Designation = Convert.ToInt32(dr["Designation"]);
                            }
                            //if (!dr.IsNull("Qualification"))
                            //{
                            //    objEmp.Qualification = Convert.ToString(dr["Qualification"]);
                            //}
                            if (!dr.IsNull("CommunicationAddress"))
                            {
                                objEmp.CommunicationAddress = Convert.ToString(dr["CommunicationAddress"]);
                            }
                            if (!dr.IsNull("PermanentAddress"))
                            {
                                objEmp.PermanentAddress = Convert.ToString(dr["PermanentAddress"]);
                            }
                            if (!dr.IsNull("PANNO"))
                            {
                                objEmp.PANNO = Convert.ToString(dr["PANNO"]);
                            }
                            if (!dr.IsNull("AdhaarNo"))
                            {
                                objEmp.AdhaarNo = Convert.ToString(dr["AdhaarNo"]);
                            }
                            //if (!dr.IsNull("AdhaarNo"))
                            //{
                            //    objEmp.AdhaarNo = Convert.ToString(dr["AdhaarNo"]);
                            //}
                        }
                    }
                }

                catch (Exception ex)
                {
                    ex.ToString();
                }
                finally
                {
                    GC.Collect();
                }
                ViewData["Employee"] = objEmp;
                ViewBag.Country      = Countries;
                ViewBag.States       = States;
                ViewBag.City         = Cities;
                ViewBag.Desig        = Desig;
                ViewBag.Role         = Role;
            }
            else
            {
                RedirectToAction("Employees", "Company");
            }



            return(View());
        }