Esempio n. 1
0
        public FormAjoutClient(FormClients clientForm, SchoolInfo infoEcole, Config AppConfig)
        {
            //
            // Requis pour la prise en charge du Concepteur Windows Forms
            //
            InitializeComponent();

            //cree un access a la dialog principal de l'application
            _formClients = clientForm;
            _infoEcole   = infoEcole;
            _AppConfig   = AppConfig;

            clientControl1.Now();

            //Numero de contrat
            Customer client = clientControl1.Client;

            client.ContratNumber = (AppConfig.LastContractNumber + 1).ToString();

            //Taux horaire par default
            client.TauxHorairePratique  = _infoEcole.TauxHorairePratique;
            client.TauxHoraireTheorique = _infoEcole.TauxHoraireTheorie;

            clientControl1.Client = client;
        }
Esempio n. 2
0
        public static async Task <int> GetVotes(SchoolInfo school)
        {
            var sUrl = $"https://weathermachine.com/Confirmation.aspx?county={school.County}&school={school.School}";

            WebClient client = new WebClient();

            client.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36");

            Stream       data   = client.OpenRead(sUrl);
            StreamReader reader = new StreamReader(data);
            string       s      = await reader.ReadToEndAsync();

            data.Close();
            reader.Close();


            var rx    = new Regex(@"<span id=""lblVotes"">(\d+)\s+votes</span>", RegexOptions.IgnoreCase);
            var match = rx.Match(s);

            if (match.Success)
            {
                return(Int32.Parse(match.Groups[1].Value));
            }

            // Invalid reading
            return(-1);
        }
Esempio n. 3
0
        /// <summary>
        /// Chargement des information sur l'ecole de conduite
        /// </summary>
        private void LoadSchoolInfo(SchoolInfo info)
        {
            // Informations de base
            cbCity.Text          = info.City;
            txtFax.Text          = info.Fax;
            txtPhoneNumber.Text  = info.Phone;
            txtCodePostal.Text   = info.PostalCode;
            txtSchoolName.Text   = info.SchoolName;
            txtStreetName.Text   = info.StreetName;
            txtStreetNumber.Text = info.StreetNumber.ToString();
            ctbTauxPratique.Text = info.TauxHorairePratique;
            ctbTauxTheorie.Text  = info.TauxHoraireTheorie;
            txtEmail.Text        = info.Email;
            txtResponsable.Text  = info.Responsable;

            //Info Lieu du cours
            txtCourseBatisseName.Text  = info.CourseBatisseName;
            txtCourseStreetNumber.Text = info.CourseStreetNumber.ToString();
            txtCourseStreetName.Text   = info.CourseStreetName;
            txtCourseCity.Text         = info.CourseCity;
            txtCourseCodePostal.Text   = info.CoursePostalCode;

            // Autre informations
            txtRegistreIncriptionAuto.Text = info.RegistrationAuto;
            txtRegistreIncriptionMoto.Text = info.RegistrationMoto;
            mtbTPS.Text = info.TPS;
            mtbTVQ.Text = info.TVQ;
        }
Esempio n. 4
0
        public async Task <ActionResult <SchoolInfo> > PostSchoolInfo(SchoolInfo schoolInfo)
        {
            _context.SchoolInfos.Add(schoolInfo);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetSchoolInfo", new { id = schoolInfo.Id }, schoolInfo));
        }
Esempio n. 5
0
        public void TestXsiNill_AllChildrenNil()
        {
            SchoolInfo            si   = new SchoolInfo();
            AddressableObjectName paon = new AddressableObjectName( );

            paon.Description = "The little white school house";
            paon.StartNumber = "321";
            Address      addr = new Address(AddressType.CURRENT, paon);
            GridLocation gl   = new GridLocation();

            gl.SetField(CommonDTD.GRIDLOCATION_PROPERTYEASTING, new SifDecimal(null));
            gl.SetField(CommonDTD.GRIDLOCATION_PROPERTYNORTHING, new SifDecimal(null));
            addr.GridLocation = gl;

            si.AddressList = new AddressList(addr);


            //  Write the object to a file
            Console.WriteLine("Writing to file...");
            using (Stream fos = File.Open("SifWriterTest.Temp.xml", FileMode.Create, FileAccess.Write))
            {
                SifWriter writer = new SifWriter(fos);
                si.SetChanged(true);
                writer.Write(si);
                writer.Flush();
                fos.Close();
            }

            //  Parse the object from the file
            Console.WriteLine("Parsing from file...");
            SifParser p = SifParser.NewInstance();

            using (Stream fis = File.OpenRead("SifWriterTest.Temp.xml"))
            {
                si = (SchoolInfo)p.Parse(fis, null);
            }


            AddressList al = si.AddressList;

            Assert.IsNotNull(al);

            addr = al.ItemAt(0);
            Assert.IsNotNull(addr);

            gl = addr.GridLocation;
            Assert.IsNotNull(gl);

            Assert.IsNull(gl.PropertyEasting);
            Assert.IsNull(gl.PropertyNorthing);

            SimpleField sf = gl.GetField(CommonDTD.GRIDLOCATION_PROPERTYEASTING);

            Assert.IsNotNull(sf);
            Assert.IsNull(sf.Value);

            sf = gl.GetField(CommonDTD.GRIDLOCATION_PROPERTYNORTHING);
            Assert.IsNotNull(sf);
            Assert.IsNull(sf.Value);
        }
 /// <summary>
 /// Process a response (of a request) for an SchoolInfo SIF Object.
 /// </summary>
 /// <param name="sifDataObject">SchoolInfo response received.</param>
 /// <param name="zone">Zone used.</param>
 protected override void ProcessResponse(SchoolInfo sifDataObject, IZone zone)
 {
     if (log.IsDebugEnabled)
     {
         log.Debug("Received a request response for SchoolInfo in Zone " + zone.ZoneId + ":\n" + sifDataObject.ToXml());
     }
 }
Esempio n. 7
0
        /// <summary>
        /// 编辑
        /// </summary>
        /// <returns></returns>
        public ActionResult RecordEditAction(Recording recording, string SchoolId, string StatusId, string RecordCustomerId, string locks)
        {
            recording.Id   = Convert.ToInt32(RecId);
            recording.Lock = 1;
            int scId  = Convert.ToInt16(SchoolId);
            int staId = Convert.ToInt16(StatusId);
            int cuId  = Convert.ToInt16(RecordCustomerId);


            SchoolInfo   school       = unit.SchoolInfo.Where(m => m.Id == scId).FirstOrDefault();
            UserStatus   status       = unit.UserStatus.Where(m => m.Id == staId).FirstOrDefault();
            CustomerInfo customerInfo = unit.CustomerInfo.Where(m => m.Id == cuId).FirstOrDefault();


            recording.SchoolId     = school;
            recording.UserStatusID = status;
            recording.CustomerId   = customerInfo;
            try
            {
                unit.Recording.Update(recording);
                unit.Save();
                return(Json(new { success = 1 }));
            }
            catch (Exception ex)
            {
                return(Json(new { success = 2 }));

                throw ex;
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 添加数据方法
        /// </summary>
        /// <returns></returns>
        public ActionResult RecordingAddDataAction(Recording recording, string SchoolId, string StatusId, string RecordCustomerId, string locks)
        {
            int Lock = Convert.ToInt16(locks);

            Lock = 1;
            int schoolId   = Convert.ToInt32(SchoolId);
            int statusId   = Convert.ToInt32(StatusId);
            int customerId = Convert.ToInt32(RecordCustomerId);

            SchoolInfo   schoolInfo   = unit.SchoolInfo.Where(m => m.Id == schoolId).FirstOrDefault();
            UserStatus   status       = unit.UserStatus.Where(m => m.Id == statusId).FirstOrDefault();
            CustomerInfo customerInfo = unit.CustomerInfo.Where(m => m.Id == customerId).FirstOrDefault();

            recording.Lock = Lock;

            recording.UserStatusID = status;
            recording.SchoolId     = schoolInfo;
            recording.CustomerId   = customerInfo;

            try
            {
                unit.Recording.Insert(recording);
                unit.Save();
                return(View("RecordingAddData"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 9
0
        public async Task <IActionResult> PutSchoolInfo(int id, SchoolInfo schoolInfo)
        {
            if (id != schoolInfo.Id)
            {
                return(BadRequest());
            }

            _context.Entry(schoolInfo).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SchoolInfoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 10
0
        private void SaveSchoolInfo(SchoolInfo info)
        {
            // Informations de base
            info.City         = cbCity.Text;
            info.Fax          = txtFax.Text;
            info.Phone        = txtPhoneNumber.Text;
            info.PostalCode   = txtCodePostal.Text;
            info.SchoolName   = txtSchoolName.Text;
            info.StreetName   = txtStreetName.Text;
            info.StreetNumber = txtStreetNumber.Value;
            info.Email        = txtEmail.Text;
            info.Responsable  = txtResponsable.Text;

            //Info Lieu du cours
            info.CourseBatisseName  = txtCourseBatisseName.Text;
            info.CourseStreetNumber = txtCourseStreetNumber.Value;
            info.CourseStreetName   = txtCourseStreetName.Text;
            info.CourseCity         = txtCourseCity.Text;
            info.CoursePostalCode   = txtCourseCodePostal.Text;

            //Taux horaire par default
            info.TauxHorairePratique = ctbTauxPratique.Text;
            info.TauxHoraireTheorie  = ctbTauxTheorie.Text;

            // Autre informations
            info.RegistrationAuto = txtRegistreIncriptionAuto.Text;
            info.RegistrationMoto = txtRegistreIncriptionMoto.Text;
            info.TPS = mtbTPS.Text;
            info.TVQ = mtbTVQ.Text;
        }
Esempio n. 11
0
        public ActionResult AddUser(UserInfo user, string SchoolId, string UserTypeId, string LoginPwd, string LoginPwd1)
        {
            user.Lock   = 1;
            user.Status = true;
            try
            {
                int SchId  = Convert.ToInt32(SchoolId);
                int TypeId = Convert.ToInt32(UserTypeId);

                SchoolInfo sch  = unit.SchoolInfo.GetAll(m => m.Id == SchId).FirstOrDefault();
                UserType   type = unit.UserType.GetAll(m => m.Id == TypeId).FirstOrDefault();

                user.SchoolId   = sch;
                user.UserTypeId = type;
                user.LoginPwd   = Md5.GetMd5(LoginPwd);

                if (LoginPwd == LoginPwd1 && user != null)
                {
                    unit.UserInfo.Insert(user);
                    unit.Save();
                }
                return(Json(new { susser = true }));
            }
            catch (Exception ex)
            {
                return(Json(new { susser = false }));

                throw ex;
            }
        }
Esempio n. 12
0
        public void AddSchoolData(string name, string city)
        {
            SchoolInfo si = new SchoolInfo();

            si.name = name;
            si.city = city;
            schoolInfoList.Add(si);
        }
        public override global::System.Data.DataSet Clone()
        {
            SchoolInfo cln = ((SchoolInfo)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
Esempio n. 14
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            SchoolInfo schoolInfo = await db.SchoolInfoes.FindAsync(id);

            db.SchoolInfoes.Remove(schoolInfo);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Esempio n. 15
0
        public static bool loadSchoolInfo()
        {
            log.Info("Global.loadSchoolInfo() Now.");
            loadSchoolConfig();

            string   dir      = Application.StartupPath + "\\conf\\";
            string   filename = m_schoolid + "-" + m_schoolid + ".conf";
            FileOper fo       = new FileOper(dir, filename);

            string strSchoolInfo = Common.getSchoolInfo();

            if (strSchoolInfo.Length > 0)
            {
                //更新本地缓存
                fo.WriteFile(strSchoolInfo);
                g_SchoolInfoStr = strSchoolInfo;
                log.Info("Global.loadSchoolInfo() ...2-ok..." + g_ClassInfoStr);
            }
            else
            {
                log.Info("getSchoolInfo error.");
                g_SchoolInfoStr = fo.ReadFile();
                log.Info("Global.loadClassInfo() ...2-err..." + g_ClassInfoStr);
            }

            if (strSchoolInfo.Length > 0)
            {
                SchoolInfo  info        = JsonOper.DeserializeJsonToObject <SchoolInfo>(strSchoolInfo);
                User[]      si          = info.teacherlist;
                List <User> teacherlist = new List <User>();
                foreach (User u in si)
                {
                    teacherlist.Add(u);
                }

                m_coursetable = info.coursetable;
                int nDel = m_db.delTeachers(m_schoolid);
                int nAdd = m_db.addUser(teacherlist);
                int a    = nDel;
                Global.setSchoolname(info.schoolname);
                m_db.delSchool(info.schoolid);
                m_db.addSchool(info.schoolid, info.schoolname);

                string coursetimes = info.coursetime;
                m_db.delCourseTime();
                m_db.addCourseTime(coursetimes);
                log.Info("Global.loadSchoolInfo() Over.");
                g_SchoolInfoStr = strSchoolInfo;
                return(true);
            }
            else
            {
                log.Info("getSchoolInfo error.");
                m_schoolname = m_db.getSchoolname(m_schoolid);
                return(false);
            }
        }
Esempio n. 16
0
    static void Main()
    {
        // create the instance of the class
        SchoolInfo mySchoolInfo = new SchoolInfo();

        // pass it into GetSchoolInfo to collect the data
        GetSchoolInfo(mySchoolInfo);
        // print the value of the name of the school
        Console.WriteLine(mySchoolInfo.NameOfTheSchool);
        Console.ReadKey();
    }
 private void CloneSchoolInfo(SchoolInfo schoolInfo)
 {
     originalSchoolInfo = new SchoolInfo()
     {
         Name    = schoolInfo.Name,
         Tel     = schoolInfo.Tel,
         Address = schoolInfo.Address,
         Email   = schoolInfo.Email,
         Logo    = schoolInfo.Logo,
     };
 }
 public void Save(SchoolInfo info)
 {
     if (info.SchoolInfoId > 0)
     {
         m_repository.Update(info);
     }
     else
     {
         m_repository.Insert(info);
     }
     m_repository.Commit();
 }
Esempio n. 19
0
        public async Task <ActionResult> Edit([Bind(Include = "S_Id,SchoolName,Address,ContactNo,AltContactNo,FaxNo,Email,Website,Logo,RegistrationNo,DiseNo,IndexNo,EstablishedYear,Class,SchoolType")] SchoolInfo schoolInfo)
        {
            if (ModelState.IsValid)
            {
                db.Entry(schoolInfo).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.SchoolType = new SelectList(db.SchoolTypes, "Type", "Type", schoolInfo.SchoolType);
            return(View(schoolInfo));
        }
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            SchoolInfo ds = new SchoolInfo();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
Esempio n. 21
0
        public ActionResult AddSchool(SchoolInfo school)
        {   //添加校区信息
            school.Lock    = 1;
            school.AddTime = DateTime.Now;

            if (school.SchoolAddress != null)
            {
                work.SchoolInfo.Insert(school);
                //保存到数据库
                work.Save();
            }
            return(RedirectToAction("AddSchool", "School"));
        }
Esempio n. 22
0
        // GET: SchoolInfoes/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SchoolInfo schoolInfo = await db.SchoolInfoes.FindAsync(id);

            if (schoolInfo == null)
            {
                return(HttpNotFound());
            }
            return(View(schoolInfo));
        }
        private List <SchoolInfo> CreateSchools()
        {
            SchoolInfo applecrossHigh = new SchoolInfo {
                SchoolName = "Applecross SHS"
            };
            SchoolInfo rossmoyneHigh = new SchoolInfo {
                SchoolName = "Rossmoyne SHS"
            };
            List <SchoolInfo> schoolCollection = new List <SchoolInfo> {
                applecrossHigh, rossmoyneHigh
            };

            return(schoolCollection);
        }
Esempio n. 24
0
        // GET: SchoolInfoes/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SchoolInfo schoolInfo = await db.SchoolInfoes.FindAsync(id);

            if (schoolInfo == null)
            {
                return(HttpNotFound());
            }
            ViewBag.SchoolType = new SelectList(db.SchoolTypes, "Type", "Type", schoolInfo.SchoolType);
            return(View(schoolInfo));
        }
Esempio n. 25
0
        private async Task OnSearchSchoolAsync(IDialogContext context, IAwaitable <SchoolInfo> result)
        {
            var info = await result;

            if (info != null)
            {
                context.ConversationData.SetValue(ContextConstants.SchoolConfigKey, info);
                schoolInfo = info;
                await context.PostAsync("설정을 완료했어요!");
            }
            else
            {
                await context.PostAsync("설정을 중단했어요!");
            }
            context.Wait(MessageReceivedAsync);
        }
Esempio n. 26
0
        public IActionResult EditSchoolInfo(int id, SchoolInfo schoolInfo)
        {
            var n = DB.SchoolInfo
                    .Where(x => x.Id == id)
                    .SingleOrDefault();

            if (n == null)
            {
                return(Content("没有该记录!"));
            }
            n.Title    = schoolInfo.Title;
            n.Content  = schoolInfo.Content;
            n.Datetime = schoolInfo.Datetime;
            DB.SaveChanges();
            return(RedirectToAction("DetailsSchoolInfo", "Admin"));
        }
Esempio n. 27
0
        public FormInfoEcole(SchoolInfo info, bool FirstRun, Config appconfig)
        {
            InitializeComponent();

            _appConfig = appconfig;

            //Assignation de l'information sur l'ecoles de conduites
            _InfoSchool = info;
            LoadSchoolInfo(_InfoSchool);

            //Desactive le boutton cancel
            if (FirstRun == true)
            {
                cmdCancel.Enabled = false;
            }
        }
Esempio n. 28
0
 /// <summary>
 /// 增加校区
 /// </summary>
 /// <param name="schoolCode"></param>
 /// <param name="schoolName"></param>
 /// <param name="schoolAddr"></param>
 /// <param name="remark"></param>
 /// <returns></returns>
 public bool AddSchoolPart(string schoolCode, string schoolName, string schoolAddr, string remark)
 {
     try
     {
         SchoolInfo school = new SchoolInfo();
         school.SI_Code    = schoolCode;
         school.SI_Name    = schoolName;
         school.SI_Address = schoolAddr;
         school.SI_Remark  = remark;
         _dataContext.SchoolInfos.InsertOnSubmit(school);
         _dataContext.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
        private void cbInstitute_TextChanged(object sender, EventArgs e)
        {
            SchoolInfo schoolInfo = new SchoolInfo();

            SchoolInfo.InstituteInfo instituteInfo = new SchoolInfo.InstituteInfo();

            cbMajor.Items.Clear(); /* 清除原有项 */
            for (int i = 0; i < schoolInfo.InstituteList.Count; i++)
            {
                instituteInfo = schoolInfo.InstituteList[i];
                if (instituteInfo.name == cbInstitute.Text)
                {
                    for (int j = 0; j < instituteInfo.major.Length; j++)
                    {
                        cbMajor.Items.Add(instituteInfo.major[j]);
                    }
                }
            }
        }
        /// <summary>
        /// 由选择的寝室楼切换相应的楼号
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cbBuilding_TextChanged(object sender, EventArgs e)
        {
            SchoolInfo schoolInfo = new SchoolInfo();

            SchoolInfo.BuildingInfo buildingInfo = new SchoolInfo.BuildingInfo();

            cbFloor.Items.Clear();      //清除已有的项
            for (int i = 0; i < schoolInfo.BuildingList.Count; i++)
            {
                buildingInfo = schoolInfo.BuildingList[i];
                if (buildingInfo.name == cbBuilding.Text)
                {
                    for (int j = 0; j < buildingInfo.floor.Length; j++)
                    {
                        cbFloor.Items.Add(buildingInfo.floor[j]);
                    }
                }
            }
        }
Esempio n. 31
0
        private List<SchoolInfo> CreateSchools()
        {
            SchoolInfo applecrossHigh = new SchoolInfo { SchoolName = "Applecross SHS" };
            SchoolInfo rossmoyneHigh = new SchoolInfo { SchoolName = "Rossmoyne SHS" };
            List<SchoolInfo> schoolCollection = new List<SchoolInfo> { applecrossHigh, rossmoyneHigh };

            return schoolCollection;
        }