示例#1
0
        public void ProcessRequest(HttpContext context)
        {
            System.Collections.Specialized.NameValueCollection forms = context.Request.Form;
            string strOperation = forms.Get("oper");
              SearchDetails objS = new SearchDetails();
            objS.EmpID =ProfileEmployer.Id;
            var collectionEmployee = new AddJobBO().ListVacancy(objS);
            var collectionCompanies = new DDLDataBO().getCompanies(ProfileEmployer.Id);
            string strResponse = string.Empty;
            var filter = context.Request.QueryString["id"];
            if (strOperation == null)
            {

                if (filter == "1")
                {
                    //oper = null which means its first load.
                    var jsonSerializer = new JavaScriptSerializer();
                    context.Response.Write(jsonSerializer.Serialize(collectionEmployee.AsQueryable<Vacancy>().ToList<Vacancy>()));
                }
                else
                {
                    var jsonSerializer = new JavaScriptSerializer();
                    context.Response.Write(jsonSerializer.Serialize(collectionCompanies.AsQueryable<CompanyProfile>().ToList<CompanyProfile>()));
                }
            }
            else if (strOperation == "del")
            {
                 if (filter == "1")
                 {
                     // var query = Query.EQ("JobID", forms.Get("JobId").ToString());
                     int jobid = Convert.ToInt32(forms.Get("JobId"));
                     new AddJobBO().RemoveJob(jobid);
                     //collectionEmployee.Remove(query);
                 }
                     strResponse = "Employee record successfully removed";
                     context.Response.Write(strResponse);

            }
            else
            {
                string strOut = string.Empty;
                if (filter == "1")
                {
                    AddEdit(forms, collectionEmployee, out strOut);
                }
                else
                {
                    AddEditCompany(forms, collectionCompanies, out strOut);
                }
                context.Response.Write(strOut);
            }
        }
示例#2
0
        private void AddEditCompany(NameValueCollection forms, List<CompanyProfile> collectioncompanies, out string strResponse)
        {
            CompanyProfile objCompany = new CompanyProfile();
            objCompany.CompanyID = Convert.ToInt32(forms.Get("CompanyId").ToString());
            objCompany.CompanyName = forms.Get("CompanyName");
            objCompany.Domain = forms.Get("Domain");
            objCompany.Address = forms.Get("Address");
            objCompany.Branches = forms.Get("Branches");
            objCompany.UrlLink = forms.Get("UrlLink");
            objCompany.EmailID = forms.Get("EmailID");
            objCompany.PhNum = forms.Get("PhNum");
            objCompany.NoofEmp = Convert.ToInt32(forms.Get("NoofEmp").ToString());

            int res = new DDLDataBO().UpdateCompany(objCompany);
            if (res == 1)
            {
                strResponse = "Employee record successfully updated";
            }
            else
            {
                strResponse = "Something went wrong";
            }
        }