Example #1
0
        public void deleteStaffBySchool(schools record)
        {
            var staff = (from e in record.staff_by_schools
                         where e.school_code == record.code
                         select e).ToList <staff_by_schools>();

            foreach (staff_by_schools item in staff)
            {
                fmp.staff_by_schools.Remove(item);
            }
        }
Example #2
0
        public async Task <IHttpActionResult> Getschools(string id)
        {
            schools schools = await db.schools.FindAsync(id);

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

            return(Ok(schools));
        }
Example #3
0
 public void parseStaffSchool(ref schools school, dynamic employees)
 {
     foreach (dynamic item in employees)
     {
         staff_by_schools sbs = new staff_by_schools();
         sbs.status        = item.status;
         sbs.school_code   = school.code;
         sbs.employee_code = item.employee_code;
         sbs.order         = item.order;
         school.staff_by_schools.Add(sbs);
     }
 }
Example #4
0
    public bool callInit { get { return target != Targets.sl; } set { } } //ma se do inicializacniho JS generovat volani Init

    //*** funkce
    public schools.config copyTo(schools.config cfg) {
      base.copyTo(cfg);
      if (!(cfg is ConfigLow)) return cfg;
      ConfigLow cl = cfg as ConfigLow;
      cl.version = version;
      cl.lang = lang;
      cl.expiresDays = expiresDays;
      cl.arm = arm;
      cl.install = install;
      //cfg.isTest = isTest;
      return cfg;
    }
Example #5
0
        public string getNextPaymentCode(string username)
        {
            string payment_code = "";

            schools school = (from s in fmp.schools
                              from u in fmp.users
                              where u.username == username &&
                              s.code == u.school_code
                              select s).FirstOrDefault <schools>();

            int last_payment_code = school.last_payment_code_secuence == null ? 0 : (int)school.last_payment_code_secuence;

            last_payment_code++;
            payment_code = String.Format(CultureInfo.InvariantCulture, "{0:PRL0000000000}", last_payment_code);

            return(payment_code);
        }
 public ActionResult SchoolRegistration(schools obj)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.schools.Add(obj);
             db.SaveChanges();
             ModelState.Clear();
             return(View());
         }
         return(View());
     }
     catch (Exception ex)
     {
     }
     return(View());
 }
Example #7
0
        public IHttpActionResult saveSchool([FromBody] dynamic school)
        {
            try
            {
                bool    updating    = false;
                string  school_code = school.code;
                schools record      = (from s in fmp.schools
                                       where s.code == school_code
                                       select s).FirstOrDefault <schools>();

                if (record == null)
                {
                    record = new schools();
                }
                else
                {
                    deleteStaffBySchool(record);
                    updating = true;
                }

                record.code             = school.code;
                record.location         = school.location;
                record.size             = school.size;
                record.employee_manager = school.employee_manager;
                record.supervisor       = school.supervisor;
                record.name             = school.name;
                record.budget           = school.budget;

                parseStaffSchool(ref record, school.employees);

                if (!updating)
                {
                    fmp.schools.Add(record);
                }
                fmp.SaveChanges();
                return(Ok(1));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
Example #8
0
        public bool updatePaymentCode(string username)
        {
            try
            {
                schools school = (from s in fmp.schools
                                  from u in fmp.users
                                  where u.username == username &&
                                  s.code == u.school_code
                                  select s).FirstOrDefault <schools>();

                int last_payment_code = school.last_payment_code_secuence == null ? 0 : (int)school.last_payment_code_secuence;
                school.last_payment_code_secuence = last_payment_code + 1;
                fmp.SaveChanges();
                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
Example #9
0
  //Sitemap gramatiky s lokalizaci
  //Pouzito v Products.export (= generace sitemap pro kurz)
  public static Dictionary<Langs, string> getGrammar(ProductsDefine.productDescrLow prod, out schools.grammarNode gramm) {
    int[] gramLevs = prod.grammarLevels().ToArray();
    gramm = null;
    if (gramLevs.Length == 0)
      return prod.locs().ToDictionary(l => l, l => "{}");
    CourseIds crsId = prod.course;
    XElement root = XElement.Load(Machines.lmcomData + @"Statistic_Grammar.xml");
    var crsNode = root.Elements("folder").FirstOrDefault(nd => LowUtils.EnumParse<CourseIds>(nd.AttributeValue("id")) == crsId);
    if (crsNode == null)
      return prod.locs().ToDictionary(l => l, l => "{}");
    //******************* grammar sitemap for crsId a lmLevels
    int gramLev = -1;
    gramm = new schools.grammarNode() {
      title = crsNode.AttributeValue("title"),
      courseId = crsId,
      items = crsNode.Elements("folder").
        Where((e, idx) => gramLevs.Contains(gramLev = getGramLev(crsId, idx))).
        Select(e => new schools.grammarNode() {
          title = e.AttributeValue("title"),
          jsonId = fileName(crsId, gramLev), //napr. english_0
          LMLevel = gramLev,
          items = grItems(e.Elements("folder")).ToArray()
        }).ToArray()
    };
    if (gramm != null && gramm.items.Length == 1) { gramm = (schools.grammarNode)gramm.items[0]; gramm.courseId = crsId; }

    //******************* sitemap localization for crsId a lmLevels
    var rootToLoc = new XElement("folder", new XAttribute("title", crsNode.AttributeValue("title")), crsNode.Elements().Where(el => el.Name.LocalName != "folder"));
    var s1 = new XElement[] { crsNode };
    var s2 = crsNode.Elements("folder").Where((e, idx) => gramLevs.Contains(getGramLev(crsId, idx)));
    var s3 = s2.SelectMany(n => n.Descendants("folder"));

    var siteLocs = prod.locs().
      Select(l => new {
        lang = l,
        locs = JsonConvert.SerializeObject(
          s1.Concat(s2).Concat(s3).
            Select(n => n.Elements(l.ToString()).SingleOrDefault()).
            Where(n => n != null).
            Select(n => new { id = n.Parent.AttributeValue("title"), title = n.Value }).
            Where(it => it.id.StartsWith("{{")).
            ToArray().
            ToDictionary(it => it.id.Substring(2, it.id.Length - 4), it => it.title),
          Newtonsoft.Json.Formatting.Indented, EADeployLib.jsonSet
        )
      }).
      ToDictionary(l => l.lang, l => l.locs);

    return siteLocs;
  }