Example #1
0
        public void position(string emp)
        {
            emp_positionModel pos = new emp_positionModel();

            ViewData["check_position"] = pos.checkCount(emp);
            pos.selectPositionByemp(emp);
            ViewData["position_name"] = pos.pos_position_name;
            ViewData["position_comp"] = pos.pos_comp_name;
            ViewData["position_sect"] = pos.pos_sect_name;
            ViewData["position_dept"] = pos.pos_dept_name;
            ViewData["position_type"] = pos.pos_type_name;

            info_positionModel post = new info_positionModel();

            ViewData["drop_position"] = post.dropDownPosition();
            emp_typeModel type = new emp_typeModel();

            ViewData["drop_type"] = type.dropdown_type();
            companyModel comp = new companyModel();

            ViewData["company"] = comp.drop_company();
            sectionModel sect = new sectionModel();

            ViewData["section"] = sect.drop_section();
            departmentModel dept = new departmentModel();

            ViewData["department"] = dept.drop_dep();
        }
        public IHttpActionResult PutcompanyModel(int id, companyModel companyModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public ActionResult SaveCompany()
        {
            companyModel model = new companyModel();

            byte[] byteArray = null;

            foreach (string upload in Request.Files)
            {
                string       filename     = Request.Files[upload].FileName;
                BinaryReader binaryReader = new BinaryReader(Request.Files[upload].InputStream);
                byteArray = binaryReader.ReadBytes((Request.Files[upload].ContentLength));
            }

            cityModel companyCity = new cityModel();

            companyCity.cityID          = 1;
            companyCity.cityDescription = "Dallas";
            model.companyLocation       = companyLocation;
            model.companyName           = Request.Form["companyName"];
            model.companyDescription    = Request.Form["companyDescription"];
            model.companyDemographic    = Request.Form["companyDemographic"];
            model.companyLogo           = byteArray;
            model.companyLocation       = companyLocation;

            ct2CompanyDataController companyDC = new ct2CompanyDataController("");

            companyDC.CreateCompany(model);

            companyDC.insertCompanyLogo(model);



            return(View(model));
        }
Example #4
0
        // GET: /<controller>/
        public IActionResult Index()
        {
            info_prefixModels  prefix = new info_prefixModels();
            info_statusModel   status = new info_statusModel();
            emp_typeModel      type   = new emp_typeModel();
            personalModel      ps     = new personalModel();
            info_positionModel posi   = new info_positionModel();
            companyModel       comp   = new companyModel();
            sectionModel       sect   = new sectionModel();
            departmentModel    dep    = new departmentModel();
            view_employeeModel emp    = new view_employeeModel();


            ViewData["prefix_th"]         = prefix.select_prefixTH();
            ViewData["prefix_en"]         = prefix.select_prefixEN();
            ViewData["type"]              = type.dropdown_type();
            ViewData["status"]            = status.dropdown_status();
            ViewData["national_id"]       = ps.national();
            ViewData["personal_name"]     = ps.personal();
            ViewData["position"]          = posi.dropDownPosition();
            ViewData["company"]           = comp.drop_company();
            ViewData["section"]           = sect.drop_section();
            ViewData["department"]        = dep.drop_dep();
            ViewData["emp_data"]          = emp.emp_data();
            ViewData["option_position"]   = posi.positionList();
            ViewData["option_department"] = dep.deptList();
            ViewData["option_section"]    = sect.sectList();
            ViewData["option_company"]    = comp.compList();
            ViewData["option_status"]     = status.statusList();
            ViewData["option_type"]       = type.typeList();

            HttpContext.Session.SetString("empTab", "");

            return(View());
        }
Example #5
0
        public IActionResult comp()
        {
            companyModel cp = new companyModel();

            ViewData["company"] = cp.list_comp();

            return(View());
        }
        public IHttpActionResult GetcompanyModel(int id)
        {
            companyModel companyModel = db.Company.Find(id);

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

            return(Ok(companyModel));
        }
        public IHttpActionResult PostcompanyModel(companyModel companyModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Company.Add(companyModel);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = companyModel.Id }, companyModel));
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="getCompanyLogo"></param>
        /// <returns></returns>
        public byte[] getCompanyLogo(companyModel getCompanyLogo)
        {
            byte[] image;
            ///uses read procedure to get company logo
            DbCommand get_CompanyLogo = db.GetStoredProcCommand("sp_readCt2CompanyLogo");

            db.AddInParameter(get_CompanyLogo, "@companyLogo", DbType.Binary, getCompanyLogo.companyLogo);

            image = (byte[])get_CompanyLogo.ExecuteScalar();

            return(image);
        }
        public companyModel CreateCompany(companyModel currentCompany)
        {
            ///uses create procedure to insert values into the model parameters
            DbCommand create_Company = db.GetStoredProcCommand("sp_createct2Company");

            db.AddInParameter(create_Company, "@companyID", DbType.Int32, currentCompany.companyID);
            db.AddInParameter(create_Company, "@companyName", DbType.String, currentCompany.companyName);
            db.AddInParameter(create_Company, "@stateID", DbType.Int32, currentCompany.stateID);
            db.AddInParameter(create_Company, "@cityID", DbType.Int32, currentCompany.cityID);
            db.AddInParameter(create_Company, "@companyDemographic", DbType.Int32, currentCompany.companyDemographic);
            return(currentCompany);
        }
        public companyModel CreateCompany(companyModel currentCompany)
        {
            ///uses create procedure to insert values into the model parameters
            DbCommand create_Company = db.GetStoredProcCommand("sp_createct2Company");

            db.AddInParameter(create_Company, "@companyName", DbType.String, currentCompany.companyName);
            db.AddInParameter(create_Company, "@companyDescription", DbType.String, currentCompany.companyDescription);
            db.AddInParameter(create_Company, "@companyLocation", DbType.Int32, currentCompany.companyLocation.locationID);
            db.AddInParameter(create_Company, "@companyDemographic", DbType.String, currentCompany.companyDemographic);

            db.ExecuteNonQuery(create_Company);

            return(currentCompany);
        }
        public IHttpActionResult DeletecompanyModel(int id)
        {
            companyModel companyModel = db.Company.Find(id);

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

            db.Company.Remove(companyModel);
            db.SaveChanges();

            return(Ok(companyModel));
        }
        public bool UpdateListcompany(companyModel selectedCompany)
        {
            ///uses update procedure to make changes to parameter values
            Boolean   success        = false;
            DbCommand update_Company = db.GetStoredProcCommand("sp_updatect2Company");

            db.AddInParameter(update_Company, "@companyID", DbType.Int32, selectedCompany.companyID);
            db.AddInParameter(update_Company, "@companyName", DbType.String, selectedCompany.companyName);
            db.AddInParameter(update_Company, "@companyDescription", DbType.String, selectedCompany.companyDescription);
            db.AddInParameter(update_Company, "@stateID", DbType.Int32, selectedCompany.companyLocation.stateID);
            db.AddInParameter(update_Company, "@cityID", DbType.Int32, selectedCompany.companyLocation.selectedCity.cityID);
            db.AddInParameter(update_Company, "@companyDemographic", DbType.String, selectedCompany.companyDemographic);

            success = Convert.ToBoolean(update_Company.ExecuteNonQuery());


            return(success);
        }
        public bool insertCompanyLogo(companyModel currentCompany)
        {
            bool success = false;

            DbCommand insert_CompanyLogo = db.GetStoredProcCommand("sp_createCt2CompanyLogo");

            db.AddInParameter(insert_CompanyLogo, "@companyIDFK", DbType.Int32, currentCompany.companyID);
            db.AddInParameter(insert_CompanyLogo, "@companyLogo", DbType.Binary, currentCompany.companyLogo);

            if (db.ExecuteNonQuery(insert_CompanyLogo) > 0)
            {
                success = true;
            }
            else
            {
                success = false;
            }

            return(success);
        }
Example #14
0
        public ActionResult fyrirtaeki()
        {
            companyModel companyInfo = new companyModel();

            using (var client = new HttpClient())
            {
                setClientSettings(client);

                var Res = client.GetAsync("api/companyModels/1").Result;

                if (Res.IsSuccessStatusCode)
                {
                    var responseContent = Res.Content.ReadAsStringAsync().Result;

                    //Deserializing the response recieved from web api and storing into the Employee list
                    companyInfo = JsonConvert.DeserializeObject <companyModel>(responseContent);
                }

                return(PartialView(companyInfo));
            }
        }
        public bool DeleteCompany(companyModel deleteCompany)
        {
            ///uses delete procedure to remove list and all its values by the primary ID
            DbCommand delete_Company = db.GetStoredProcCommand("sp_deletect2Company");

            db.AddInParameter(delete_Company, "@companyID", DbType.Int32, deleteCompany.companyID);

            db.AddOutParameter(delete_Company, "@success", DbType.Boolean, 1);

            bool success;

            try
            {
                db.ExecuteNonQuery(delete_Company);
                success = Convert.ToBoolean(db.GetParameterValue(delete_Company, "@success"));
            }
            catch
            {
                success = false;
            }

            return(success);
        }
Example #16
0
        public async Task <ActionResult> Index(companyModel company)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    using (var client = new HttpClient())
                    {
                        setClientSettings(client);
                        //serialize object to Json and create the HttpContent
                        HttpContent content = new StringContent(JsonConvert.SerializeObject(company));
                        content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");


                        //Sending request to find web api REST service resource GetAllEmployees using HttpClient
                        HttpResponseMessage Res = await client.PutAsync("api/companyModels/", content);

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

                        ModelState.Clear();
                    }
                }

                return(View(company));
            }

            catch
            {
                return(View(company));
            }
        }
Example #17
0
        // GET: CompanySettings
        public async Task <ActionResult> Index()
        {
            companyModel company = new companyModel();

            using (var client = new HttpClient())
            {
                setClientSettings(client);

                //Get list of Unions
                HttpResponseMessage Res = await client.GetAsync("api/companyModels/1");

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

                    //Deserializing the response recieved from web api and storing into the Employee list
                    company = JsonConvert.DeserializeObject <companyModel>(companyResponse);
                }
            }

            return(View(company));
        }
 public ActionResult Save(companyModel model)
 {
     return(Json("Success"));
 }
 // GET: Company
 public ActionResult ManageCompany(companyModel company)
 {
     return(View(company));
 }
Example #20
0
        public IActionResult emp(string code, string txt)
        {
            code_test = code;
            personalModel ps = new personalModel();

            ViewData["person_edit"] = ps.personal_for_edit();

            info_positionModel posi = new info_positionModel();
            companyModel       comp = new companyModel();
            sectionModel       sect = new sectionModel();
            departmentModel    dep  = new departmentModel();
            emp_typeModel      type = new emp_typeModel();

            ViewData["position_dropdown"] = posi.dropDownPosition();
            ViewData["company"]           = comp.drop_company();
            ViewData["section"]           = sect.drop_section();
            ViewData["department"]        = dep.drop_dep();
            ViewData["type"] = type.dropdown_type();


            info_prefixModels   prefix = new info_prefixModels();
            info_statusModel    status = new info_statusModel();
            personal_studyModel study  = new personal_studyModel();

            ViewData["prefix_th"] = prefix.select_prefixTH();
            ViewData["prefix_en"] = prefix.select_prefixEN();
            ViewData["type_emp"]  = type.dropdown_type();
            ViewData["status"]    = status.dropdown_status();


            //view employee//
            view_employeeModel emp = new view_employeeModel();

            emp.selectData(code);

            ViewData["emp_id"]          = code;
            ViewData["emp_code"]        = emp.ep_code;
            ViewData["emp_name_th"]     = emp.prefix_name_en + " " + emp.ps_name_th + " " + emp.ps_lastname_th;
            ViewData["emp_name_en"]     = emp.prefix_name_en + " " + emp.ps_name_en + " " + emp.ps_lastname_en;
            ViewData["emp_type"]        = emp.type_name;
            ViewData["emp_status"]      = emp.ep_status;
            ViewData["emp_start_date"]  = emp.ep_start;
            ViewData["emp_end_date"]    = emp.ep_end;
            ViewData["emp_email"]       = emp.contact_email;
            ViewData["emp_table"]       = emp.contact_table;
            ViewData["emp_phone"]       = emp.contact_phone;
            ViewData["emp_mobile1"]     = emp.contact_mobile1;
            ViewData["emp_mobile2"]     = emp.contact_mobile2;
            ViewData["position_name"]   = emp.post_name;
            ViewData["position_type"]   = emp.type_name;
            ViewData["position_dept"]   = emp.dept_name;
            ViewData["position_sect"]   = emp.Section_name;
            ViewData["position_comp"]   = emp.T_Company;
            ViewData["gender"]          = emp.ps_gender;
            ViewData["age"]             = Convert.ToInt32((DateTime.Now.Year)) - Convert.ToInt32((Convert.ToDateTime(emp.ps_birthday).Year));
            ViewData["nationality"]     = emp.ps_nationality;
            ViewData["race"]            = emp.ps_race;
            ViewData["religion"]        = emp.ps_religion;
            ViewData["blood"]           = emp.ps_blood;
            ViewData["birthday"]        = Convert.ToDateTime(emp.ps_birthday).ToString("dd MMMM yyyy");
            ViewData["birthday_format"] = Convert.ToDateTime(emp.ps_birthday).ToString("dd/MM/yyyy");
            ViewData["identification"]  = emp.ps_national_id;
            ViewData["date_issue"]      = emp.ps_national_date_start;
            ViewData["expired_date"]    = emp.ps_national_date_end;
            ViewData["marital"]         = emp.ps_status_marital;
            ViewData["emp_person_id"]   = emp.ep_ref_personal_id;

            ViewData["type_"] = type.dropdown_type_id(emp.ep_ref_type_id);

            emp_positionModel posit = new emp_positionModel();

            ViewData["position"] = posit.emp_position_list(code);

            //

            /// address
            dataAddress(code);
            ///
            // study
            ViewData["data_study"] = study.tb_study(code);
            //

            // work
            personal_workModel work = new personal_workModel();

            ViewData["data_work"] = work.tb_work(code);
            //

            // train
            personal_trainModel train = new personal_trainModel();

            ViewData["data_train"] = train.tb_train(code);
            //

            // family
            personal_familyModel fam = new personal_familyModel();

            fam.get_family(code);
            ViewData["dad_name"]    = fam.fam_name_dad + " " + fam.fam_lastname_dad;
            ViewData["dad_age"]     = fam.fam_age_dad;
            ViewData["dad_tel"]     = fam.fam_tel_dad;
            ViewData["dad_mobile"]  = fam.fam_mobile_dad;
            ViewData["dad_address"] = fam.fam_num_dad + " หมู่ " + fam.fam_moo_dad + " " + fam.fam_district_dad + ", " + fam.fam_amphur_dad + ", " + fam.fam_province_dad + " " + fam.fam_postcode_dad;

            ViewData["mom_name"]    = fam.fam_name_mom + " " + fam.fam_lastname_mom;
            ViewData["mom_age"]     = fam.fam_age_mom;
            ViewData["mom_tel"]     = fam.fam_tel_mom;
            ViewData["mom_mobile"]  = fam.fam_mobile_mom;
            ViewData["mom_address"] = fam.fam_num_mom + " หมู่ " + fam.fam_moo_mom + " " + fam.fam_district_mom + ", " + fam.fam_amphur_mom + ", " + fam.fam_province_mom + " " + fam.fam_postcode_mom;

            ViewData["marry_name"]    = fam.fam_name_marry + " " + fam.fam_lastname_marry;
            ViewData["marry_age"]     = fam.fam_age_marry;
            ViewData["marry_tel"]     = fam.fam_tel_marry;
            ViewData["marry_mobile"]  = fam.fam_mobile_marry;
            ViewData["marry_address"] = fam.fam_num_marry + " หมู่ " + fam.fam_moo_marry + " " + fam.fam_district_marry + ", " + fam.fam_amphur_marry + ", " + fam.fam_province_marry + " " + fam.fam_postcode_marry;

            //

            // child
            personal_kidModel child = new personal_kidModel();

            ViewData["data_child"] = child.tb_kid(code);
            //

            /// income
            checkPay(code);
            select_income();
            ///
            /// minus
            minus();
            minusSalary(code);
            ///
            /// fund
            fund(code);
            empFundResign fn = new empFundResign();
            empFundChange fc = new empFundChange();

            ViewData["fundResign"] = fn.list_fundResignEmp(code);
            ViewData["fundChange"] = fc.list_fundChange_emp(code);
            ///

            /// commend
            commend(code);
            ///

            /// admonish
            admonish(code);
            ///

            ////
            provinceModel province = new provinceModel();

            ViewData["province"] = province.selectProvince();

            amphurModel amphur = new amphurModel();

            ViewData["amphur"] = amphur.select_amphur();

            districtModel district = new districtModel();

            ViewData["district"] = district.select_district();

            //profile img
            empModel em = new empModel();

            em.check_img(code);

            if (string.IsNullOrEmpty(em.img_name) == true)
            {
                ViewData["profile_img"] = "../../profile/face-2.jpg";
            }
            else
            {
                ViewData["profile_img"] = "../../profile/" + em.img_name;
            }

            empPositionChangeModel pc = new empPositionChangeModel();

            pc.pc_emp_id = code;
            ViewData["data_change_position"] = pc.list_posiotnChane_emp_id();


            EmpPositionResignModel rs = new EmpPositionResignModel();

            ViewData["data_resign_position"] = rs.list_position_resign_emp(code);


            return(View());
        }