public IHttpActionResult PutemployeeModel(int id, employeeModel employeeModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != employeeModel.Id)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 2
0
        public void del_emp(string id)
        {
            employeeModel emp = new employeeModel();

            emp.emp_id = id;
            emp.del_emp();
        }
Exemplo n.º 3
0
        public IEnumerable <sp_emp_profile_search_v2_Result> search(employeeModel value)
        {
            try
            {
                if (String.IsNullOrEmpty(value.user_id))
                {
                    throw new Exception("Unauthorized Access");
                }
                var userId = JwtHelper.GetUserIdFromToken(value.user_id);
                if (String.IsNullOrEmpty(userId))
                {
                    throw new Exception("Unauthorized Access");
                }

                StandardCanEntities context = new StandardCanEntities();
                IEnumerable <sp_emp_profile_search_v2_Result> result = context.sp_emp_profile_search_v2(value.emp_code_start, value.emp_code_stop,
                                                                                                        value.sh_start, value.sh_stop, value.depart_start, value.depart_stop, value.emp_status_start, value.emp_status_stop,
                                                                                                        value.emp_fname, value.emp_lname, value.head_fname, value.head_lname).AsEnumerable();
                return(result);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        public async Task <ActionResult> Edit(int id)
        {
            employeeModel emp = new employeeModel();

            using (var client = new HttpClient())
            {
                setClientSettings(client);
                //Sending request to find web api REST service resource GetAllEmployees using HttpClient
                HttpResponseMessage Res = await client.GetAsync("api/employeeModels/" + id);

                //Checking the response is successful or not which is sent using HttpClient
                if (Res.IsSuccessStatusCode)
                {
                    //Storing the response details recieved from web api
                    var EmpResponse = Res.Content.ReadAsStringAsync().Result;

                    //Deserializing the response recieved from web api and storing into the Employee list
                    emp = JsonConvert.DeserializeObject <employeeModel>(EmpResponse);
                }

                List <groupModel> groupInfo = new List <groupModel>();

                emp.group = new groupModel();

                //Sending request to find web api REST service resource GetAllEmployees using HttpClient
                Res = await client.GetAsync("api/groupModels");

                //Checking the response is successful or not which is sent using HttpClient
                if (Res.IsSuccessStatusCode)
                {
                    //Storing the response details recieved from web api
                    var EmpResponse = Res.Content.ReadAsStringAsync().Result;

                    //Deserializing the response recieved from web api and storing into the Employee list
                    groupInfo = JsonConvert.DeserializeObject <List <groupModel> >(EmpResponse);
                }

                emp.group.groupList = new SelectList(groupInfo, "Id", "name", emp.idGroup);

                emp.jobCatagory = new jobCatagoryModel();
                List <jobCatagoryModel> jobCatagoryInfo = new List <jobCatagoryModel>();

                //Sending request to find web api REST service resource GetAllEmployees using HttpClient
                Res = await client.GetAsync("api/jobCatagoryModels");

                //Checking the response is successful or not which is sent using HttpClient
                if (Res.IsSuccessStatusCode)
                {
                    //Storing the response details recieved from web api
                    var EmpResponse = Res.Content.ReadAsStringAsync().Result;

                    //Deserializing the response recieved from web api and storing into the Employee list
                    jobCatagoryInfo = JsonConvert.DeserializeObject <List <jobCatagoryModel> >(EmpResponse);
                }

                emp.jobCatagory.jobCatagoryList = new SelectList(jobCatagoryInfo, "Id", "name", emp.IdJobCatagory);

                return(View(emp));
            }
        }
Exemplo n.º 5
0
        public string getname(string emailid)
        {
            string name = string.Empty;

            using (var pgsql = new NpgsqlConnection(config.PostgresConnectionString))
            {
                try
                {
                    string query = "select name from wms.employee where email='" + emailid + "'";


                    pgsql.Open();
                    employeeModel emp = new employeeModel();
                    emp = pgsql.QueryFirstOrDefault <employeeModel>(
                        query, null, commandType: CommandType.Text);
                    name = emp.name;
                    return(name);
                }
                catch (Exception Ex)
                {
                    log.ErrorMessage("EmailUtilities", "getname", Ex.StackTrace.ToString());
                    return(null);
                }
                finally
                {
                    pgsql.Close();
                }
            }
        }
        public async Task <ActionResult> Index()
        {
            employeeModel        emp     = new employeeModel();
            List <employeeModel> EmpInfo = new List <employeeModel>();

            using (var client = new HttpClient())
            {
                setClientSettings(client);
                //Sending request to find web api REST service resource GetAllEmployees using HttpClient
                HttpResponseMessage Res = await client.GetAsync("api/employeeModels");

                //Checking the response is successful or not which is sent using HttpClient
                if (Res.IsSuccessStatusCode)
                {
                    //Storing the response details recieved from web api
                    var EmpResponse = Res.Content.ReadAsStringAsync().Result;

                    //Deserializing the response recieved from web api and storing into the Employee list
                    EmpInfo = JsonConvert.DeserializeObject <List <employeeModel> >(EmpResponse);
                }
            }

            emp.employeeList = new SelectList(EmpInfo, "Id", "name");
            return(View(emp));
        }
Exemplo n.º 7
0
        public empTabNoteModel tab_note_search(employeeModel value)
        {
            empTabNoteModel result = new empTabNoteModel();

            try
            {
                using (var context = new StandardCanEntities())
                {
                    if (String.IsNullOrEmpty(value.user_id))
                    {
                        throw new Exception("Unauthorized Access");
                    }
                    var userId = JwtHelper.GetUserIdFromToken(value.user_id);
                    if (String.IsNullOrEmpty(userId))
                    {
                        throw new Exception("Unauthorized Access");
                    }

                    var note = context.sp_emp_profile_tabnote_search(value.emp_code).FirstOrDefault();
                    result.note = note ?? "";
                }
            }
            catch (Exception ex)
            {
                //result.status = "E";
                //result.message = ex.Message.ToString();
                throw new Exception(ex.Message);
            }

            return(result);
        }
Exemplo n.º 8
0
        public messageModel tab_work_delete(employeeModel value)
        {
            messageModel result = new messageModel();

            try
            {
                using (var context = new StandardCanEntities())
                {
                    if (String.IsNullOrEmpty(value.user_id))
                    {
                        throw new Exception("Unauthorized Access");
                    }
                    var userId = JwtHelper.GetUserIdFromToken(value.user_id);
                    if (String.IsNullOrEmpty(userId))
                    {
                        throw new Exception("Unauthorized Access");
                    }

                    context.sp_emp_profile_tabwork_delete(value.emp_code, value.id);
                }

                result.status  = "S";
                result.message = "";
            }
            catch (Exception ex)
            {
                result.status  = "E";
                result.message = ex.Message.ToString();
            }

            return(result);
        }
Exemplo n.º 9
0
        public empTab3Model tab3_search(employeeModel value)
        {
            empTab3Model result = new empTab3Model();

            try
            {
                using (var context = new StandardCanEntities())
                {
                    if (String.IsNullOrEmpty(value.user_id))
                    {
                        throw new Exception("Unauthorized Access");
                    }
                    var userId = JwtHelper.GetUserIdFromToken(value.user_id);
                    if (String.IsNullOrEmpty(userId))
                    {
                        throw new Exception("Unauthorized Access");
                    }
                    result.quota = context.sp_emp_profile_tab3_quota(value.emp_code).ToList();
                    result.data  = context.sp_emp_profile_tab3(value.emp_code, value.start_date, value.stop_date).ToList();
                }
            }
            catch (Exception ex)
            {
                //result.status = "E";
                //result.message = ex.Message.ToString();
                throw new Exception(ex.Message);
            }

            return(result);
        }
Exemplo n.º 10
0
        public empMasterModel master(employeeModel value)
        {
            empMasterModel result = new empMasterModel();

            try
            {
                using (var context = new StandardCanEntities())
                {
                    if (String.IsNullOrEmpty(value.user_id))
                    {
                        throw new Exception("Unauthorized Access");
                    }
                    var userId = JwtHelper.GetUserIdFromToken(value.user_id);
                    if (String.IsNullOrEmpty(userId))
                    {
                        throw new Exception("Unauthorized Access");
                    }

                    result.sh         = context.sp_sh_search().ToList();
                    result.depart     = context.sp_depart_search().ToList();
                    result.emp_status = context.sp_emp_status_search().ToList();
                }
            }
            catch (Exception ex)
            {
                //result.status = "E";
                //result.message = ex.Message.ToString();
                throw new Exception(ex.Message);
            }

            return(result);
        }
Exemplo n.º 11
0
        public async Task <IActionResult> Edit(int id, [Bind("firstName,middleName,lastName,birthDate,hireDate,department,jobTitle,salary,salaryType,ID,availableHours")] employeeModel employeeModel)
        {
            if (id != employeeModel.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employeeModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!employeeModelExists(employeeModel.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(employeeModel));
        }
Exemplo n.º 12
0
        public async Task <IActionResult> insert_emp(IList <IFormFile> selectFile, string emp_code, string emp_prefix, string emp_name, string emp_lastname, string emp_position, string emp_address, string emp_road, string emp_province, string emp_amphur, string emp_district, string emp_postcode, string emp_tel, string emp_fax, string emp_email, string emp_national_id, string emp_tax, string emp_gender, string emp_birth, string emp_start, string emp_end)
        {
            employeeModel emp = new employeeModel();

            var uploads = Path.Combine(_hostingEnvironment.WebRootPath, "images");
            int num     = selectFile.Count();

            if (num != 0)
            {
                foreach (var file in selectFile)
                {
                    if (file.Length > 0)
                    {
                        var filePath = Path.Combine(uploads, file.FileName);
                        emp.emp_img = file.FileName;

                        using (var fileStream = new FileStream(filePath, FileMode.Create))
                        {
                            await file.CopyToAsync(fileStream);
                        }
                    }
                    else
                    {
                        emp.emp_img = "nopicture.jpg";
                    }
                }
            }
            else
            {
                emp.emp_img = "nopicture.jpg";
            }


            emp.emp_code        = emp_code;
            emp.emp_prefix      = emp_prefix;
            emp.emp_name        = emp_name;
            emp.emp_lastname    = emp_lastname;
            emp.emp_position    = emp_position;
            emp.emp_address     = emp_address;
            emp.emp_road        = emp_road;
            emp.emp_district    = emp_district;
            emp.emp_amphur      = emp_amphur;
            emp.emp_province    = emp_province;
            emp.emp_postcode    = emp_postcode;
            emp.emp_tel         = emp_tel;
            emp.emp_fax         = emp_fax;
            emp.emp_email       = emp_email;
            emp.emp_national_id = emp_national_id;
            emp.emp_tax         = emp_tax;
            emp.emp_gender      = emp_gender;
            emp.emp_birthday    = emp_birth;
            emp.emp_start_date  = emp_start;
            emp.emp_end_date    = emp_end;

            emp.insert_emp();


            return(RedirectToAction("employee", "Information"));
        }
Exemplo n.º 13
0
        public IActionResult Delete(int id)
        {
            employeeModel employees = dbContext.employee.Find(id);

            dbContext.employee.Remove(employees);
            dbContext.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 14
0
        public IActionResult employee()
        {
            employeeModel emp = new employeeModel();

            ViewData["employee"] = emp.list_emp();

            return(View());
        }
Exemplo n.º 15
0
 public IActionResult Edit([FromForm] employeeModel editemployee)
 {
     if (ModelState.IsValid)
     {
         dbContext.employee.Update(editemployee);
         dbContext.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(editemployee));
 }
Exemplo n.º 16
0
        public ActionResult Employee(employeeModel model)
        {
            if (ModelState.IsValid)
            {
                int recordsCreated = createEmployee(2, model.age, model.attrition, model.business_travel, model.daily_rate, model.department, model.distanceFromHome, model.education, model.education_field, model.employee_count, model.employee_number, model.environmental_satisfaction, model.gender, model.hourly_rate, model.job_involvement, model.job_level, model.job_role, model.job_satisfaction, model.marital_status, model.monthly_income, model.monthly_rate, model.num_companies_worked, model.overtime, model.over_18, model.percentageSalaryHike, model.performance_rating, model.relationship_satisfaction, model.standard_hours, model.stockOptionLevel, model.totalWorkingYears, model.trainingTimeLastYear, model.workLifeBalance, model.yearsAtCompany, model.yearsInCurrentRole, model.yearsSinceLastPromotion, model.yearsWithCurrentManager);
                return(RedirectToAction("Index"));
            }

            return(View());
        }
Exemplo n.º 17
0
        public async Task <IActionResult> Create([Bind("firstName,middleName,lastName,birthDate,hireDate,department,jobTitle,salary,salaryType,ID,availableHours")] employeeModel employeeModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employeeModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employeeModel));
        }
        public IHttpActionResult GetemployeeModel(int id)
        {
            employeeModel employeeModel = db.Employee.Find(id);

            if (employeeModel == null)
            {
                return(NotFound());
            }

            return(Ok(employeeModel));
        }
        public IHttpActionResult PostemployeeModel(employeeModel employeeModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Employee.Add(employeeModel);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = employeeModel.Id }, employeeModel));
        }
Exemplo n.º 20
0
 public IEnumerable <sp_emp_profile_tabcard_search_Result> tab_card_search(employeeModel value)
 {
     try
     {
         StandardCanEntities context = new StandardCanEntities();
         IEnumerable <sp_emp_profile_tabcard_search_Result> result = context.sp_emp_profile_tabcard_search(value.emp_code).AsEnumerable();
         return(result);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
        public IHttpActionResult DeleteemployeeModel(int id)
        {
            employeeModel employeeModel = db.Employee.Find(id);

            if (employeeModel == null)
            {
                return(NotFound());
            }

            db.Employee.Remove(employeeModel);
            db.SaveChanges();

            return(Ok(employeeModel));
        }
Exemplo n.º 22
0
        public IActionResult typeEmp()
        {
            lineModel      ln  = new lineModel();
            employeeModel  emp = new employeeModel();
            line_saleModel ls  = new line_saleModel();
            line_transport lt  = new line_transport();

            ViewData["line"]      = ln.drop_line("");
            ViewData["employee"]  = emp.drop_emp("");
            ViewData["line_sale"] = ls.list_line_sale();
            ViewData["line_tran"] = lt.list_line_tran();

            return(View());
        }
Exemplo n.º 23
0
        public List <empMachine> empMachine(employeeModel value)
        {
            List <empMachine> empMachines = new List <empMachine>();

            try
            {
                empMachines.Add(new empMachine
                {
                    id          = "1",
                    no          = "1",
                    emp_code    = "e001",
                    emp_name    = "fName001 lName001",
                    job_start   = "2021-03-12",
                    job_stop    = "2021-03-12",
                    machineName = "เครื่องจักร1",
                    sts_color   = "#ffa87d",
                    sts_text    = "Submit"
                });
                empMachines.Add(new empMachine
                {
                    id          = "2",
                    no          = "2",
                    emp_code    = "e002",
                    emp_name    = "fName002 lName002",
                    job_start   = "2021-03-13",
                    job_stop    = "2021-03-15",
                    machineName = "เครื่องจักร2",
                    sts_color   = "#FFE633",
                    sts_text    = "Approve"
                });
                empMachines.Add(new empMachine
                {
                    id          = "3",
                    no          = "3",
                    emp_code    = "e003",
                    emp_name    = "fName003 lName003",
                    job_start   = "2021-03-15",
                    job_stop    = "2021-03-21",
                    machineName = "เครื่องจักร3",
                    sts_color   = "#ffa87d",
                    sts_text    = "Submit"
                });
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(empMachines);
        }
Exemplo n.º 24
0
        public messageModel getUploadFile(employeeModel value)
        {
            messageModel result = new messageModel();

            try
            {
                using (StandardCanEntities context = new StandardCanEntities())
                {
                    var           _Gapi    = context.MAS_GLOBAL_CONFIG.SingleOrDefault(x => x.GGC_KEY == "API_PATH");
                    var           _Gpath   = context.MAS_GLOBAL_CONFIG.SingleOrDefault(x => x.GGC_KEY == "FILE_PATH");
                    JsonPathModel jsonPath = new JsonPathModel();
                    if (_Gpath != null)
                    {
                        jsonPath = (JsonPathModel)Newtonsoft.Json.JsonConvert.DeserializeObject(_Gpath.GGC_VAL, typeof(JsonPathModel));
                    }
                    if (String.IsNullOrEmpty(value.user_id))
                    {
                        throw new Exception("Unauthorized Access");
                    }
                    var userId = JwtHelper.GetUserIdFromToken(value.user_id);
                    if (String.IsNullOrEmpty(userId))
                    {
                        throw new Exception("Unauthorized Access");
                    }
                    var empDetail = context.EMP_PROFILE.SingleOrDefault(a => a.emp_code == value.emp_code);
                    if (empDetail != null)
                    {
                        string path = Path.Combine(HostingEnvironment.MapPath("~" + jsonPath.employee),
                                                   Path.GetFileName(empDetail.emp_image));
                        byte[] bytes = File.ReadAllBytes(path);
                        result.value = Convert.ToBase64String(bytes);
                    }
                    else
                    {
                        throw new Exception("Data not found");
                    }
                }

                result.status  = "S";
                result.message = "";
            }
            catch (Exception ex)
            {
                result.status  = "E";
                result.message = ex.Message.ToString();
            }
            return(result);
        }
Exemplo n.º 25
0
        public IActionResult viewEmployee(string id)
        {
            employeeModel emp = new employeeModel();
            prefixModel   px  = new prefixModel();
            provinceModel pv  = new provinceModel();
            ampuresModel  am  = new ampuresModel();
            districts     dt  = new districts();
            positionModel ps  = new positionModel();

            emp.select_emp("emp_id = '" + id + "'");


            ViewData["emp_code"]        = emp.emp_code;
            ViewData["emp_prefix"]      = px.drop_prefix(emp.emp_prefix);
            ViewData["emp_name"]        = emp.emp_name;
            ViewData["emp_lastname"]    = emp.emp_lastname;
            ViewData["emp_position"]    = ps.drop_position(emp.emp_position);
            ViewData["emp_address"]     = emp.emp_address;
            ViewData["emp_road"]        = emp.emp_road;
            ViewData["emp_province"]    = pv.drop_province(emp.emp_province);
            ViewData["emp_amphur"]      = am.dorp_amphur(emp.emp_amphur);
            ViewData["emp_district"]    = dt.drop_district(emp.emp_district);
            ViewData["emp_postcode"]    = emp.emp_postcode;
            ViewData["emp_tel"]         = emp.emp_tel;
            ViewData["emp_fax"]         = emp.emp_fax;
            ViewData["emp_email"]       = emp.emp_email;
            ViewData["emp_national_id"] = emp.emp_national_id;
            ViewData["emp_gender"]      = emp.emp_gender;
            ViewData["emp_tax"]         = emp.emp_tax;
            ViewData["emp_birth"]       = emp.emp_birthday;
            ViewData["emp_start"]       = emp.emp_start_date;
            ViewData["emp_end"]         = emp.emp_end_date;
            ViewData["emp_id"]          = id;
            if (string.IsNullOrEmpty(emp.emp_img) == true)
            {
                ViewData["emp_img"] = "nopicture.jpg";
            }
            else
            {
                ViewData["emp_img"] = emp.emp_img;
            }

            return(View());
        }
Exemplo n.º 26
0
        // POST: api/approval
        public HttpResponseMessage Post([FromBody] employeeModel value)
        {
            if (value == null)
            {
                return(null);
            }
            JavaScriptSerializer js = new JavaScriptSerializer();



            approvalService     service  = new approvalService();
            HttpResponseMessage response = null;
            Object result = null;

            switch (value.method)
            {
            case "search-leve":
                result = service.empLeave(value);
                break;

            case "leave-detail":
                result = service.empLeaveDetail(value);
                break;

            case "search-machine":
                result = service.empMachine(value);
                break;

            //case "machine-detail":
            //    result = service.empLeaveDetail(value);
            //    break;

            default:
                break;
            }


            string json = js.Serialize(result);

            response         = Request.CreateResponse(HttpStatusCode.OK);
            response.Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
            return(response);
        }
Exemplo n.º 27
0
        public messageModel tab_note_update(employeeModel value)
        {
            messageModel result = new messageModel();

            try
            {
                JavaScriptSerializer js = new JavaScriptSerializer();
                string json             = js.Serialize(value);

                using (var context = new StandardCanEntities())
                {
                    if (String.IsNullOrEmpty(value.user_id))
                    {
                        throw new Exception("Unauthorized Access");
                    }
                    var userId = JwtHelper.GetUserIdFromToken(value.user_id);
                    if (String.IsNullOrEmpty(userId))
                    {
                        throw new Exception("Unauthorized Access");
                    }
                    context.interface_log.Add(new interface_log
                    {
                        module      = "tab_behavior_update",
                        data_log    = json,
                        update_date = DateTime.Now
                    });
                    context.SaveChanges();

                    context.sp_emp_profile_tabnote_update(value.emp_code, value.note);
                }

                result.status  = "S";
                result.message = "";
            }
            catch (Exception ex)
            {
                result.status  = "E";
                result.message = ex.Message.ToString();
            }

            return(result);
        }
Exemplo n.º 28
0
 public IEnumerable <sp_emp_search_byid_Result> search_byid(employeeModel value)
 {
     try
     {
         if (String.IsNullOrEmpty(value.user_id))
         {
             throw new Exception("Unauthorized Access");
         }
         var userId = JwtHelper.GetUserIdFromToken(value.user_id);
         if (String.IsNullOrEmpty(userId))
         {
             throw new Exception("Unauthorized Access");
         }
         StandardCanEntities context = new StandardCanEntities();
         IEnumerable <sp_emp_search_byid_Result> result = context.sp_emp_search_byid(value.emp_code).AsEnumerable();
         return(result);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Exemplo n.º 29
0
        public IActionResult Add([FromForm] employeeModel newemployee)
        {
            string rootPath   = _env.WebRootPath;
            string uploadName = newemployee.UploadImage.FileName;
            string fileName   = Guid.NewGuid().ToString() + uploadName;
            string uploadPath = rootPath + "/imgs/" + fileName;

            newemployee.photo = fileName;

            using (var filestream = new FileStream(uploadPath, FileMode.Create))
            {
                newemployee.UploadImage.CopyTo(filestream);
            }

            if (ModelState.IsValid)
            {
                dbContext.employee.Add(newemployee);
                dbContext.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(newemployee));
        }
Exemplo n.º 30
0
 public ActionResult AddEmploye(employeeModel employee)
 {
     if (ModelState.IsValid)
     {
         DdContextDataContext _db = new DdContextDataContext();
         Employee             obj = new Employee();
         obj.EmployeeName  = employee.EmployeeName;
         obj.EmailAddress  = employee.EmailAddress;
         obj.EmployeeCode  = employee.EmployeeId + "1000";
         obj.Username      = employee.Username;
         obj.Password      = employee.Password;
         obj.QuestionID    = employee.QuestionID;
         obj.Answer        = employee.Answer;
         obj.CreateDate    = DateTime.Now;
         obj.LastUpdatedBy = employee.EmployeeName;
         obj.IsActive      = employee.IsActive;
         _db.Employees.InsertOnSubmit(obj);
         _db.SubmitChanges();
         ViewBag.msg = "System Msg: Saved";
     }
     QuestionDropDownlistLoad();
     return(View("Employee"));
 }