Exemplo n.º 1
0
        public ActionResult Edit(Applicants app)
        {
            int Userid = app.Userid;
            string Fname = app.Fname, Lname = app.Lname, School = app.School, Aemail = app.Aemail,
                   Degree = app.Degree, DegreeField = app.DegreeField;

            ApplicantsRepository.UpdateApplicant(Userid, Fname, Lname, School, Aemail, Degree, DegreeField);

            return RedirectToAction("Index", "Jobs");
        }
Exemplo n.º 2
0
        public ActionResult Pro(Applicants app)
        {
            Database db = DatabaseFactory.CreateDatabase();

            DbCommand command = db.GetStoredProcCommand("Applicant_Update");

            db.AddInParameter(command, "@Appid", System.Data.DbType.Int32, 2);
            db.AddInParameter(command, "@Userid", System.Data.DbType.Int32, 1);
            db.AddInParameter(command, "@Fname", System.Data.DbType.String, app.Fname);
            db.AddInParameter(command, "@Lname", System.Data.DbType.String, app.Lname);
            db.AddInParameter(command, "@School", System.Data.DbType.String, app.School);
            db.AddInParameter(command, "@Aemail", System.Data.DbType.String, app.Aemail);
            db.AddInParameter(command, "@Degree", System.Data.DbType.String, app.Degree);
            db.AddInParameter(command, "@DegreeField", System.Data.DbType.String, app.DegreeField);

            db.ExecuteScalar(command);

            return RedirectToAction("Index", "Jobs");
        }
Exemplo n.º 3
0
        public Applicants FindAppid(int Userid)
        {
            DbCommand command = db.GetStoredProcCommand("Applicants_FindAppid");
            db.AddInParameter(command, "@Userid", System.Data.DbType.Int32, Userid);
            db.ExecuteScalar(command);
            var result = new Applicants();
            using (var reader = db.ExecuteReader(command))
            {
                while (reader.Read())
                {

                    if (!reader.IsDBNull(reader.GetOrdinal("Appid")))
                    {
                        result.Appid = reader.GetInt32(reader.GetOrdinal("Appid"));
                    }

                }
                return result;
            }
        }
Exemplo n.º 4
0
        public Applicants ViewEditApplicant(int id)
        {
            DbCommand command = db.GetStoredProcCommand("Applicants_BuildList");
            db.AddInParameter(command, "@Userid", System.Data.DbType.Int32, id);
            db.ExecuteScalar(command);
            var result = new Applicants();
            using (var reader = db.ExecuteReader(command))
            {
                while (reader.Read())
                {

                    if (!reader.IsDBNull(reader.GetOrdinal("Appid")))
                    {
                        result.Appid = reader.GetInt32(reader.GetOrdinal("Appid"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("Userid")))
                    {
                        result.Userid = reader.GetInt32(reader.GetOrdinal("Userid"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("Fname")))
                    {
                        result.Fname = reader.GetString(reader.GetOrdinal("Fname"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("Lname")))
                    {
                        result.Lname = reader.GetString(reader.GetOrdinal("Lname"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("Aemail")))
                    {
                        result.Aemail = reader.GetString(reader.GetOrdinal("Aemail"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("DegreeField")))
                    {
                        result.DegreeField = reader.GetString(reader.GetOrdinal("DegreeField"));
                    }
                    if (!reader.IsDBNull(reader.GetOrdinal("Degree")))
                    {
                        result.Degree = reader.GetString(reader.GetOrdinal("Degree"));
                    }

                    if (!reader.IsDBNull(reader.GetOrdinal("School")))
                    {
                        result.School = reader.GetString(reader.GetOrdinal("School"));
                    }

                }

            }
            return result;
        }
Exemplo n.º 5
0
 public ActionResult Create(Applicants app)
 {
     ApplicantsRepository.InsertApplicant(app.Userid, app.Fname, app.Lname, app.School, app.Aemail,
         app.Degree, app.DegreeField);
     return RedirectToAction("LogOn", "Account");
 }
 public void Update(string Id, Applicants applicantIn)
 {
     applicants.ReplaceOne(applicant => applicant.objectId == Id, applicantIn);
 }
 public void Remove(Applicants applicantIn)
 {
     applicants.DeleteOne(applicant => applicant.objectId == applicantIn.objectId);
 }
Exemplo n.º 8
0
 public void Update(Applicants applicants) =>
 _applicants.ReplaceOne(sub => sub.Id == applicants.Id, applicants);
 public Applicants Create(Applicants applicant)
 {
     applicants.InsertOne(applicant);
     return(applicant);
 }
Exemplo n.º 10
0
 public ApplicantsDto GetApplicantById(string id)
 {
     return(Applicants.FirstOrDefault((applicant) => applicant.Id == id));
 }
Exemplo n.º 11
0
 /// <summary>
 /// Click on the Applicants link on the main menu
 /// </summary>
 public void ClickApplicants()
 {
     Applicants.WaitRetry(_driver).Click();
 }
Exemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.ContentType = "application/json";

            string pattern = HttpUtility.UrlDecode(Request.QueryString["Pattern"]);

            string    geographyString = Request.QueryString["GeographyId"];
            int       geographyId     = int.Parse(geographyString);
            Geography geography       = Geography.FromIdentity(geographyId);

            if (
                !CurrentAuthority.HasAccess(new Access(CurrentOrganization, geography, AccessAspect.PersonalData,
                                                       AccessType.Read)))
            {
                throw new UnauthorizedAccessException("nope");
            }

            People matches = People.FromOrganizationAndGeographyWithPattern(CurrentOrganization, geography, pattern);

            matches = CurrentAuthority.FilterPeople(matches);

            if (matches == null)
            {
                matches = new People();
            }

            if (matches.Count > 1000)
            {
                matches.RemoveRange(1000, matches.Count - 1000);
            }

            List <string> jsonPeople = new List <string>();

            string editPersonTemplate =
                "\"actions\":\"<a href='javascript:masterBeginEditPerson({0})'><img src='/Images/Icons/iconshock-wrench-128x96px-centered.png' height='16' width='24' /></a>\"";

            Dictionary <int, Applicant> applicantLookup = new Dictionary <int, Applicant>();

            if (CurrentOrganization.Parameters.ParticipationEntry == "ApplicationApproval")
            {
                // There are applications possible for this org; find them and put the Score in the Notes field

                Applicants applicants = Applicants.FromPeopleInOrganization(matches, CurrentOrganization);

                foreach (Applicant applicant in applicants)
                {
                    applicantLookup[applicant.PersonId] = applicant;
                }
            }

            foreach (Person person in matches)
            {
                string notes = Participant.Localized(CurrentOrganization.RegularLabel, person.Gender);

                if (applicantLookup.ContainsKey(person.Identity))
                {
                    // If this is an applicant, use the "Notes" field for score
                    notes = "<span class='align-for-numbers'>" + applicantLookup[person.Identity].ScoreTotal.ToString("N0") + "</span>";
                }

                string onePerson = '{' +
                                   String.Format(
                    "\"id\":\"{0}\",\"name\":\"<span class='spanUser{0}Name'>{1}</span>\",\"avatar16Url\":\"{2}\",\"geographyName\":\"{3}\",\"mail\":\"<span class='spanUser{0}Mail'>{4}</span>\",\"notes\":\"{6}\",\"phone\":\"<span class='spanUser{0}Phone'>{5}</span>\"",
                    person.Identity,
                    JsonSanitize(person.Canonical),
                    person.GetSecureAvatarLink(16),
                    JsonSanitize(person.Geography.Localized),
                    JsonSanitize(person.Mail),
                    JsonSanitize(person.Phone),
                    JsonSanitize(notes)) + "," +
                                   String.Format(
                    editPersonTemplate, person.Identity)
                                   + '}';
                jsonPeople.Add(onePerson);
            }

            string result = '[' + String.Join(",", jsonPeople.ToArray()) + ']';

            Response.Output.WriteLine(result);

            Response.End();
        }
        public IActionResult Import([FromForm(Name = "file")] IFormFile file)
        {
            string filePath = string.Empty;

            if (file != null)
            {
                try
                {
                    string fileExtension = Path.GetExtension(file.FileName);
                    if (fileExtension != ".csv")
                    {
                        ViewBag.Message = "Please select the csv file";
                        return(RedirectToAction("ListApplicants", "Applicants"));
                    }
                    using (var reader = new StreamReader(file.OpenReadStream()))
                    {
                        string[] header = reader.ReadLine().Split(',');
                        while (!reader.EndOfStream)
                        {
                            string[] rows = reader.ReadLine().Split(',');
                            Console.WriteLine(rows[1]);
                            Console.WriteLine(rows[2]);
                            Console.WriteLine(rows[3]);
                            Console.WriteLine(rows[4]);
                            Console.WriteLine(rows[5]);
                            Console.WriteLine(rows[6]);
                            Console.WriteLine(rows[7]);
                            Console.WriteLine(rows[8]);
                            Console.WriteLine(rows[9]);
                            Console.WriteLine(rows[10]);
                            Console.WriteLine(rows[11]);
                            Console.WriteLine(rows[12]);
                            Console.WriteLine(rows[13]);
                            Console.WriteLine(rows[14]);
                            Console.WriteLine(rows[15]);
                            Console.WriteLine(rows[16]);
                            Console.WriteLine(rows[17]);
                            Console.WriteLine(rows[18]);
                            var emp = new Applicants()
                            {
                                Name                   = rows[1].ToString(),
                                Email                  = rows[2].ToString(),
                                Phone                  = rows[3].ToString(),
                                Gender                 = rows[4].ToString(),
                                BirthDate              = Convert.ToDateTime(rows[5].ToString()),
                                BirthPlace             = rows[6].ToString(),
                                Position               = rows[7].ToString(),
                                Departement            = rows[8].ToString(),
                                Address                = rows[9].ToString(),
                                Status                 = rows[10].ToString(),
                                CreatedAt              = Convert.ToDateTime(rows[11].ToString()),
                                NameEmergencyContact1  = rows[12].ToString(),
                                PhoneEmergencyContact1 = rows[13].ToString(),
                                NameEmergencyContact2  = rows[14].ToString(),
                                PhoneEmergencyContact2 = rows[15].ToString(),
                                NameEmergencyContact3  = rows[16].ToString(),
                                PhoneEmergencyContact3 = rows[17].ToString(),
                                Image                  = rows[18].ToString()
                            };
                            _AppDbContext.applicants.Add(emp);
                        }
                        _AppDbContext.SaveChanges();
                    }
                    return(RedirectToAction("ListApplicants", "Applicants"));
                }
                catch (Exception e)
                {
                    ;
                    ViewBag.Message = e.Message;
                }
            }
            return(RedirectToAction("ListApplicants", "Applicants"));
        }
Exemplo n.º 14
0
 protected override void OnSaving()
 {
     s_ApplicantCodes = string.Join(";", Applicants.Select(a => a.Code).ToList());
     s_ApplicantNames = string.Join(";", Applicants.Select(a => a.Name).ToList());
     base.OnSaving();
 }
Exemplo n.º 15
0
        public void GetPatentInfo()
        {
            EnumsAll.CaseType caseType = EnumsAll.CaseType.Internal;
            var sOurNo = CommonFunction.GetOurNo(_sOurNo, ref caseType);

            if (string.IsNullOrEmpty(sOurNo))
            {
                return;
            }
            s_OurNo = sOurNo;
            switch (caseType)
            {
            case EnumsAll.CaseType.Internal:
            {
                var dr = DbHelperOra.Query(
                    $"select RECEIVED,CLIENT,CLIENT_NAME,APPL_CODE1,APPLICANT1,APPLICANT_CH1,APPL_CODE2,APPLICANT2,APPLICANT_CH2,APPL_CODE3,APPLICANT3,APPLICANT_CH3,APPL_CODE4,APPLICANT4,APPLICANT_CH4,APPL_CODE5,APPLICANT5,APPLICANT_CH5,TITLE_CHINESE,CLIENT_NUMBER,FILING_DUE,TITLE from PATENTCASE where OURNO = '{_sOurNo}'").Tables[0].Rows[0];
                s_Name = dr["TITLE_CHINESE"].ToString();
                if (string.IsNullOrWhiteSpace(s_Name))
                {
                    s_Name = dr["TITLE"].ToString();
                }
                s_ClientRef = dr["CLIENT_NUMBER"].ToString();

                if (!string.IsNullOrWhiteSpace(dr["RECEIVED"].ToString()))
                {
                    dt_ReceiveDate = Convert.ToDateTime(dr["RECEIVED"].ToString());
                }
                if (!string.IsNullOrWhiteSpace(dr["FILING_DUE"].ToString()))
                {
                    dt_FilingDeadline = Convert.ToDateTime(dr["FILING_DUE"].ToString());
                }
                if (!string.IsNullOrWhiteSpace(dr["CLIENT"].ToString()))
                {
                    Client =
                        Session.FindObject <Corporation>(CriteriaOperator.Parse($"Code = '{dr["CLIENT"]}'")) ??
                        new Corporation(Session)
                    {
                        Code = dr["CLIENT"].ToString(),
                        Name = dr["CLIENT_NAME"].ToString()
                    }
                }
                ;
                Applicants.ToList().ForEach(a => Applicants.Remove(a));
                for (int i = 1; i <= 5; i++)
                {
                    if (!string.IsNullOrWhiteSpace(dr[$"APPL_CODE{i}"].ToString()))
                    {
                        Applicants.Add(
                            Session.FindObject <Corporation>(CriteriaOperator.Parse($"Code = '{dr[$"APPL_CODE{i}"]}'")) ??
                            new Corporation(Session)
                            {
                                Code = dr[$"APPL_CODE{i}"].ToString(),
                                Name =
                                    string.IsNullOrWhiteSpace(dr[$"APPLICANT{i}"].ToString())
                                                ? dr[$"APPLICANT_CH{i}"].ToString()
                                                : dr[$"APPLICANT{i}"].ToString()
                            });
                    }
                }
                var objDate =
                    DbHelperOra.GetSingle(
                        $"select duedate from generalalert where typeid = 'tohandle_presubmit' and comments like '%返稿发明人%' and ourno = '{s_OurNo}'");
                if (objDate != null)
                {
                    dt_ReturnInventorDate = Convert.ToDateTime(objDate);
                }
                objDate = DbHelperOra.GetSingle(
                    $"select duedate from generalalert where typeid = 'tohandle_presubmit' and comments like '%返稿工程师%' and ourno = '{s_OurNo}'");
                if (objDate != null)
                {
                    dt_ReturnIPRDate = Convert.ToDateTime(objDate);
                }
                break;
            }

            case EnumsAll.CaseType.Foreign:
            {
                var dr = DbHelperOra.Query(
                    $"select RECEIVED,CTITLE,TITLE from FCASE where OURNO = '{_sOurNo}'")
                         .Tables[0].Rows[0];
                if (!string.IsNullOrWhiteSpace(dr["RECEIVED"].ToString()))
                {
                    dt_ReceiveDate = Convert.ToDateTime(dr["RECEIVED"].ToString());
                }
                s_Name = dr["CTITLE"].ToString();
                if (string.IsNullOrWhiteSpace(s_Name))
                {
                    s_Name = dr["TITLE"].ToString();
                }
                var dt         = DbHelperOra.Query($"select EID,ROLE,ORIG_NAME,TRAN_NAME,ENT_ORDER from FCASE_ENT_REL where OURNO = '{_sOurNo}'").Tables[0];
                var tempclient = dt.Select("ROLE = 'CLI' OR ROLE = 'APPCLI'");
                if (tempclient.Length > 0)
                {
                    Client =
                        Session.FindObject <Corporation>(CriteriaOperator.Parse($"Code = '{tempclient[0]["EID"]}'")) ??
                        new Corporation(Session)
                    {
                        Code = tempclient[0]["EID"].ToString(),
                        Name = !string.IsNullOrWhiteSpace(tempclient[0]["ORIG_NAME"].ToString())
                                                ? tempclient[0]["ORIG_NAME"].ToString()
                                                : tempclient[0]["TRAN_NAME"].ToString()
                    }
                }
                ;

                Applicants.ToList().ForEach(a => Applicants.Remove(a));
                foreach (var dataRow in dt.Select("ROLE = 'APP' OR ROLE = 'APPCLI'", "ENT_ORDER ASC"))
                {
                    Applicants.Add(
                        Session.FindObject <Corporation>(CriteriaOperator.Parse($"Code = '{dataRow["EID"]}'")) ??
                        new Corporation(Session)
                        {
                            Code = dataRow["EID"].ToString(),
                            Name =
                                !string.IsNullOrWhiteSpace(dataRow["ORIG_NAME"].ToString())
                                            ? dataRow["ORIG_NAME"].ToString()
                                            : dataRow["TRAN_NAME"].ToString()
                        });
                }
                break;
            }
            }
            var sOurNoShort = s_OurNo.Substring(0, s_OurNo.IndexOf("-", StringComparison.Ordinal));

            if (sOurNoShort.Contains("I"))
            {
                s_PatentType = EnumsAll.PatentType.发明;
            }
            else if (sOurNoShort.Contains("U"))
            {
                s_PatentType = EnumsAll.PatentType.实用新型;
            }
            else if (sOurNoShort.Contains("D"))
            {
                s_PatentType = EnumsAll.PatentType.外观设计;
            }
            else if (sOurNoShort.Contains("CR"))
            {
                s_PatentType = EnumsAll.PatentType.软件著作权;
            }
            Save();
        }
    }
Exemplo n.º 16
0
        public People FilterPeople(People rawList, AccessAspect aspect = AccessAspect.Participation)
        {
            if (!this.Person.TwoFactorEnabled)
            {
                if (this.Organization.Identity != Organization.SandboxIdentity)
                {
                    // GPDR compliance: to see any personal data, require 2FA to be turned on

                    return(new People());
                }
            }

            if (aspect != AccessAspect.Participation && aspect != AccessAspect.PersonalData)
            {
                throw new ArgumentException(@"AccessAspect needs to reflect visibility of people data", "aspect");
            }

            // Three cases:

            // 1) the current Position has system-level access.
            // 2) the current Position has org-level, but not system-level, access.
            // 3) the current Position has org-and-geo-level access.

            Dictionary <int, bool> orgLookup = new Dictionary <int, bool>();
            Dictionary <int, bool> geoLookup = new Dictionary <int, bool>();

            People result = new People();

            // Org lookup will always be needed. Geo lookup may be needed for case 3.

            Organizations orgStructure = this.Organization.ThisAndBelow();

            int[] orgIds = orgStructure.Identities;
            foreach (int orgId in orgIds)
            {
                orgLookup[orgId] = true;
            }
            orgLookup[Organization.Identity] = true;

            Dictionary <int, List <BasicParticipation> > membershipLookup = null;
            Dictionary <int, List <BasicApplicant> >     applicantLookup  = null;

            if (HasSystemAccess(AccessType.Read) || HasAccess(new Access(Organization, aspect, AccessType.Read)))
            {
                // cases 1 and 2: systemwide access, return everybody at or under the current Organization,
                // or org-wide read access (at least) to participant/personal data at current Organization

                // Optimization: Get all memberships in advance, without instantiating logic objects
                membershipLookup = Participations.GetParticipationsForPeople(rawList, 0);
                applicantLookup  = Applicants.GetApplicantsFromPeople(rawList);

                foreach (Person person in rawList)
                {
                    // For each person, we must test the list of active memberships to see if one of
                    // them is visible to this Authority - if it's a membership in an org at or below the
                    // Authority object's organization

                    if (membershipLookup.ContainsKey(person.Identity))
                    {
                        List <BasicParticipation> list = membershipLookup[person.Identity];

                        foreach (BasicParticipation basicMembership in list)
                        {
                            if (orgLookup.ContainsKey(basicMembership.OrganizationId))
                            {
                                // hit - this person has an active membership that makes them visible to this Authority
                                result.Add(person);
                                break;
                            }
                        }
                    }

                    // If membership check fails, then check for membership applications

                    if (applicantLookup.ContainsKey(person.Identity))
                    {
                        List <BasicApplicant> applicantList = applicantLookup[person.Identity];

                        foreach (BasicApplicant applicant in applicantList)
                        {
                            if (orgLookup.ContainsKey(applicant.OrganizationId))
                            {
                                // hit - this person has an active membership _application_ that makes them visible to this Authority
                                result.Add(person);
                                break;
                            }
                        }
                    }
                }

                return(result);
            }

            // Case 3: Same as above but also check for Geography (in an AND pattern).

            if (this.Position == null)
            {
                // No access at all. That was an easy case!

                return(new People()); // return empty list
            }

            if (this.Position.Geography == null)
            {
                // Org-level position, but one that doesn't have access to personal data, apparently.

                return(new People()); // empty list again
            }

            if (!HasAccess(new Access(this.Organization, Position.Geography, aspect, AccessType.Read)))
            {
                // No people access for active position. Also a reasonably easy case.

                return(new People()); // also return empty list
            }

            Geographies geoStructure = this.Position.Geography.ThisAndBelow();

            int[] geoIds = geoStructure.Identities;
            foreach (int geoId in geoIds)
            {
                geoLookup[geoId] = true;
            }
            geoLookup[Position.GeographyId] = true;

            // Optimization: Get all memberships in advance, without instantiating logic objects
            Dictionary <int, List <BasicParticipation> > personLookup =
                Participations.GetParticipationsForPeople(rawList, 0);

            applicantLookup = Applicants.GetApplicantsFromPeople(rawList);

            foreach (Person person in rawList)
            {
                // For each person, we must test the list of active memberships to see if one of
                // them is visible to this Authority - if it's a membership in an org at or below the
                // Authority object's organization - and also test the person's Geography against
                // the list (lookup) of visible Geographies. We do Geographies first, because that test is
                // much cheaper.

                if (geoLookup[person.GeographyId])
                {
                    // Geography hit. Test Membership / Organization.

                    bool added = false;

                    List <BasicParticipation> participationList = personLookup[person.Identity];

                    foreach (BasicParticipation basicMembership in participationList)
                    {
                        if (orgLookup.ContainsKey(basicMembership.OrganizationId) && !added)
                        {
                            // Organization hit - this person has an active membership that makes them visible to this Authority

                            result.Add(person);
                            added = true;
                        }
                    }

                    List <BasicApplicant> applicantList = applicantLookup[person.Identity];

                    foreach (BasicApplicant basicApplicant in applicantList)
                    {
                        if (orgLookup.ContainsKey(basicApplicant.OrganizationId) && !added)
                        {
                            result.Add(person);
                            added = true;
                        }
                    }
                }
            }

            return(result);
        }