protected override void Load(ContainerBuilder builder) { var schoolCollection = new SchoolCollection(); schoolCollection.Add(new School { Identifier = "098f6bcd4621d373cade4e832627b4f6", ID = 1, Name = "test" }); var metaRepoMock = new Mock<IMetaRepository>(); metaRepoMock.Setup(r => r.GetAllSchools()).Returns(schoolCollection); metaRepoMock.Setup(r => r.AddOrUpdateSchool( It.IsAny<School>(), It.IsAny<Action<bool>>())) .Callback<School, Action<bool>>((school, action) => { var model = schoolCollection.ByIdentifier(school.Identifier); model.UniqueToken = school.UniqueToken; new Task(() => { System.Threading.Thread.Sleep(500); action(true); }).Start(); }); builder.Register(c => new TestIdentityProvider()).As<IIdentifierProvider>(); builder.Register(c => new TestRsaKeyProvider()).As<ICryptoKeyProvider>(); builder.Register(c => metaRepoMock.Object).As<IMetaRepository>().SingleInstance(); builder.Register((c, p) => new SampleCommand( p.Named<IoSession>("session"), c.ResolveOptional<TimeoutNotifyProducerConsumer<AbstractAsyncCommand>>() )).Keyed<AbstractAsyncCommand>(CommandCode.Test); }
public MetaTestRepo() { schoolCollection = new SchoolCollection(); schoolCollection.Add(new School { Identifier = "098f6bcd4621d373cade4e832627b4f6", ID = 1, Name = "test" }); }
/// <summary> /// Constructeur du Formulaire /// </summary> /// <param name="_lisEcoles"></param> /// <param name="_saison"></param> public frmMailing(ApplClass _applClass, SchoolCollection _lisEcoles, string _saison) { p_listEcoles = _lisEcoles; p_saisonEnCours = _saison; InitializeComponent(); lvwColumnSorter = new ListViewColumnSorter(); this.lstMailingSchool.ListViewItemSorter = lvwColumnSorter; cmbNbDest.SelectedIndex = 4; p_applClass = _applClass; }
protected override void Load(ContainerBuilder builder) { var schoolCollection = new SchoolCollection(); schoolCollection.Add(new School { Identifier = identifiers[0], ID = 1, Name = "test1" }); schoolCollection.Add(new School { Identifier = identifiers[1], ID = 2, Name = "test2" }); schoolCollection.Add(new School { Identifier = identifiers[2], ID = 3, Name = "test3" }); schoolCollection.Add(new School { Identifier = identifiers[3], ID = 4, Name = "test4" }); schoolCollection.Add(new School { Identifier = identifiers[4], ID = 5, Name = "test5" }); var metaRepoMock = new Mock <IMetaRepository>(); metaRepoMock.Setup(r => r.GetAllSchools()).Returns(schoolCollection); metaRepoMock.Setup(r => r.AddOrUpdateSchool( It.IsAny <School>(), It.IsAny <Action <bool> >())) .Callback <School, Action <bool> >((school, action) => { new Task(() => { action(true); }).Start(); }); var identifierMock = new Mock <IIdentifierProvider>(); identifierMock.Setup(r => r.GetIdentifier()).Returns(identifiers[count++]); builder.Register(c => identifierMock.Object).As <IIdentifierProvider>(); builder.Register(c => metaRepoMock.Object).As <IMetaRepository>(); }
/// <summary> /// Génére une liste Excel /// </summary> /// <param name="_applClass"></param> /// <param name="_listEcole"></param> /// <param name="_labelPeriode"></param> /// <param name="_fileName"></param> public static void generateReport(ApplClass _applClass, SchoolCollection _listEcole, string _labelPeriode, string _fileName) { Log.Debug("Gérénation du Reporting"); try { clsReport _reportCls = new clsReport(_applClass); _reportCls.NumRow = 1; _reportCls.createReport(_listEcole, _labelPeriode, "Liste"); // Sauvegarde du fichier EXCEL _reportCls.saveExcel(_fileName); } catch (Exception _exc) { Log.Error("Erreur lors de la création du rapport.", _exc); System.Windows.Forms.MessageBox.Show("Une erreur est survenue lors de la création du rapport.\r\nMessage : " + _exc.Message, "Anomalie !", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error, System.Windows.Forms.MessageBoxDefaultButton.Button1, System.Windows.Forms.MessageBoxOptions.RightAlign); } }
public async System.Threading.Tasks.Task<ActionResult> EditSchool(string id) { SchoolCollection coll = new SchoolCollection(); using (var connection = new MySqlConnection(ConfigurationManager.ConnectionStrings[Constants.ConnectionStringName].ConnectionString)) { await connection.OpenAsync(); var result = new SchoolRepository(connection).GetSchool(id); var result2 = new SchoolRepository(connection).GetSchools(); coll.singleSchool = (IEnumerable<Models.School>)result.Result.ToArray(); coll.allSchools = (IEnumerable<Models.School>)result2.Result.ToArray(); coll.schoolselectlist = new SelectList(result2.Result.ToList(), "school_id", "name", new { id = "SchoolID", @required = "required" }); } return View(coll); }
public DeliveryReceipt GetDeliveryReceipt(int checkId) { var check = db.Checks.Where(c => c.CheckID == checkId).FirstOrDefault(); return(new DeliveryReceipt { SchoolName = SchoolCollection.GetSchoolName(check.SchoolCode), TodayDate = DateTime.Now.ToPersianDate(), CheckNumber = check.Number, CheckDate = check.Date.ToPersianDate(), Amount = check.Amount, AccountNumber = check.AccountNumber, Bank = check.Bank, ReturnDate = check.ReturnCheckDate.ToPersianDate(), StudentParent = check.Deliverer, StudentName = check.StudentName, Phone = check.Phone }); }
public Models.Api.SchoolListClassifiedRS GetSchoolListClassified(ApiRequest apiRQ) { var schoolCollection1 = new SchoolCollection(); schoolCollection1.Add(new School { ID = 1, Name = "上海海富幼儿园龙阳校区" }); schoolCollection1.Add(new School { ID = 2, Name = "上海私立蒙特梭利幼儿园" }); schoolCollection1.Add(new School { ID = 3, Name = "上海市建青实验学校幼儿部" }); schoolCollection1.Add(new School { ID = 4, Name = "上海中国福利会幼儿园" }); schoolCollection1.Add(new School { ID = 5, Name = "上海市浦东新区冰厂田幼儿园(云山路寄宿部)" }); var area1 = new Area { ID = 1, Name = "黄浦区", Schools = schoolCollection1 }; var schoolCollection2 = new SchoolCollection(); schoolCollection2.Add(new School { ID = 6, Name = "上海市实验幼儿园(杏山园)" }); schoolCollection2.Add(new School { ID = 7, Name = "孔祥东音乐幼儿园(巨野路园区)" }); schoolCollection2.Add(new School { ID = 8, Name = "上海市徐汇区科技幼儿园" }); var area2 = new Area { ID = 2, Name = "徐汇区", Schools = schoolCollection2 }; var schoolCollection3 = new SchoolCollection(); schoolCollection3.Add(new School { ID = 9, Name = "上海乌南幼儿园" }); schoolCollection3.Add(new School { ID = 10, Name = "上海市本溪路幼儿园" }); schoolCollection3.Add(new School { ID = 11, Name = "上海市宝山区行知实验幼儿园" }); var area3 = new Area { ID = 3, Name = "长宁区", Schools = schoolCollection3 }; var areaCollection1 = new AreaCollection(); areaCollection1.Add(area1); areaCollection1.Add(area2); areaCollection1.Add(area3); var schoolCollection4 = new SchoolCollection(); schoolCollection4.Add(new School { ID = 12, Name = "宁波市第一幼儿园" }); schoolCollection4.Add(new School { ID = 13, Name = "宁波市宝韵音乐幼儿园" }); schoolCollection4.Add(new School { ID = 14, Name = "宁波市华光幼儿园" }); var schoolCollection5 = new SchoolCollection(); schoolCollection5.Add(new School { ID = 15, Name = "杭州市行知幼儿园" }); schoolCollection5.Add(new School { ID = 16, Name = "杭州市清波幼儿园" }); schoolCollection5.Add(new School { ID = 17, Name = "杭州市娃哈哈幼儿园" }); var area4 = new Area { ID = 4, Name = "杭州市", Schools = schoolCollection5 }; var area5 = new Area { ID = 5, Name = "宁波市", Schools = schoolCollection4 }; var areaCollection2 = new AreaCollection(); areaCollection2.Add(area4); areaCollection2.Add(area5); var sh = new Province { ID = 1, Areas = areaCollection1, Name = "上海市" }; var zj = new Province { ID = 2, Areas = areaCollection2, Name = "浙江省" }; return new SchoolListClassifiedRS { Ok = true, Provinces = new List<Province> { sh, zj } }; }
public SchoolCollection GetAllSchools() { var sqlItem = ItemManager.Get(SqlName.AllSchools); return(sqlItem.Cache.GetOrAdd(string.Format("{0}-{1}", KeyName.META_DATABASE, SqlName.AllSchools), () => { SchoolCollection collection = new SchoolCollection(); try { using (var connection = sqlItem.OpenReadConnection(KeyName.META_DATABASE)) { collection = Mapper.Map <IEnumerable <School>, SchoolCollection>(connection.Query <School>(sqlItem.Sql)); } } catch (Exception ex) { Log.Error(LogTitle.DB_ERROR, ex); } return collection; }, TimeSpan.FromMinutes(SCHOOL_COLLECTION_CACHE_TIME_MINUTES)) as SchoolCollection); }
private void LoadChecks() { Checks.Items.Clear(); string schoolCode = Schools.SelectedIndex < 0 ? string.Empty : SchoolCollection.GetSchoolCode(Schools.SelectedItem.ToString()); IEnumerable <ChecksViewModel> list = CheckRepository.GetChecks(Filter.Text, schoolCode); int counter = 1; foreach (var item in list) { ListViewItem lItem = new ListViewItem { Tag = item.CheckID, Text = counter.ToString() }; counter++; lItem.SubItems.AddRange(new string[] { item.StudentName, item.Number, item.Date.ToPersianDate(), item.Amount.ToString("#,##0"), item.Bank, item.Deliverer ?? string.Empty, Status.GetString(item.StatusType) }, Color.Black, item.StatusType == Status.Type.Delivery ? Color.LightSeaGreen : lItem.BackColor, this.Font); Checks.Items.Add(lItem); } this.SearchResultCounter.Text = string.Format("تعداد چک ها: {0}", (counter - 1).ToString()); }
protected override void Load(ContainerBuilder builder) { var schoolCollection = new SchoolCollection(); schoolCollection.Add(new School { Identifier = "098f6bcd4621d373cade4e832627b4f6", ID = 1, Name = "test" }); var metaRepoMock = new Mock <IMetaRepository>(); metaRepoMock.Setup(r => r.GetAllSchools()).Returns(schoolCollection); metaRepoMock.Setup(r => r.AddOrUpdateSchool( It.IsAny <School>(), It.IsAny <Action <bool> >())) .Callback <School, Action <bool> >((school, action) => { var model = schoolCollection.ByIdentifier(school.Identifier); model.UniqueToken = school.UniqueToken; new Task(() => { System.Threading.Thread.Sleep(500); action(true); }).Start(); }); builder.Register(c => new TestIdentityProvider()).As <IIdentifierProvider>(); builder.Register(c => new TestRsaKeyProvider()).As <ICryptoKeyProvider>(); builder.Register(c => metaRepoMock.Object).As <IMetaRepository>().SingleInstance(); builder.Register((c, p) => new SampleCommand( p.Named <IoSession>("session"), c.ResolveOptional <TimeoutNotifyProducerConsumer <AbstractAsyncCommand> >() )).Keyed <AbstractAsyncCommand>(CommandCode.Test); }
/// <summary> /// Permet de dénombrer le nombre d'école planifiée à partie d'une liste /// </summary> /// <param name="_listEcole">Liste d'écoles</param> /// <returns>Nb d'écoles planifiées</returns> public static int getNbToSchedule(SchoolCollection _listEcole) { int _nbToSchedule = 0; _nbToSchedule = _listEcole.Count(a => a.isSchedule == true); return _nbToSchedule; }
/// <summary> /// Création du Rapport /// </summary> /// <param name="_sessionContent"></param> public void createReport(SchoolCollection _listEcoles, string _labelPeriode, string _nameSheet) { Log.Debug("createReport ." + _nameSheet); #region DEFINITION DE LA LIGNE DE RUPTURE HSSFCellStyle cellRuptStyle = (HSSFCellStyle)p_templateWorkbook.CreateCellStyle(); cellRuptStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin; cellRuptStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin; cellRuptStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin; cellRuptStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin; cellRuptStyle.FillPattern = NPOI.SS.UserModel.FillPattern.SolidForeground; //cellRuptStyle.FillBackgroundColor = HSSFColor.BrightGreen.Index; cellRuptStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center; HSSFFont _font = (HSSFFont)p_templateWorkbook.CreateFont(); _font.FontName = "Segoe UI"; _font.FontHeightInPoints = 12; _font.Color = HSSFColor.White.Index; cellRuptStyle.SetFont(_font); #endregion // Getting the worksheet by its name... HSSFSheet sheet = (HSSFSheet)p_templateWorkbook.GetSheet(_nameSheet); // On fait une Ligne de rupture pour la Classe HSSFRow dataRow = (HSSFRow)sheet.CreateRow(p_numRow); this.createCell(dataRow, cellRuptStyle, 0, _labelPeriode); // Période d'extraction sheet.AddMergedRegion(new CellRangeAddress(p_numRow, p_numRow, 0, 6)); p_numRow++; p_numRow++; // Maintenant il faut balayer tous les élèves foreach (Ecole _ecole in _listEcoles) { HSSFCellStyle cellStyle = this.getStyleFromRowNum(p_numRow); HSSFRow dataEcole = (HSSFRow)sheet.CreateRow(p_numRow); this.createCell(dataEcole, cellStyle, 0, _ecole.IdEcole); // Référence de l'école this.createCell(dataEcole, cellStyle, 1, _ecole.Libelle); // Libellé de l'école this.createCell(dataEcole, cellStyle, 2, _ecole.Ville); // Localité this.createCell(dataEcole, cellStyle, 3, _ecole.NbClasses); // Nb de classes this.createCell(dataEcole, cellStyle, 4, _ecole.Effectif); // Effectif this.createCell(dataEcole, cellStyle, 5, _ecole._planifEnCours.StartDate.ToString("dd/MM/yyyy")); // Date de Prise de Vue this.createCell(dataEcole, cellStyle, 6, p_appClass.Param.GetNamePhotoGrapheFromId(_ecole._planifEnCours.IdPhotographe)); // Photographe p_numRow++; } this.definePrintSetup(sheet, "Bon de Production : Individuels.", (short)80); }
protected override void Load(ContainerBuilder builder) { var schoolCollection = new SchoolCollection(); schoolCollection.Add(new School { Identifier = identifiers[0], ID = 1, Name = "test1" }); schoolCollection.Add(new School { Identifier = identifiers[1], ID = 2, Name = "test2" }); schoolCollection.Add(new School { Identifier = identifiers[2], ID = 3, Name = "test3" }); schoolCollection.Add(new School { Identifier = identifiers[3], ID = 4, Name = "test4" }); schoolCollection.Add(new School { Identifier = identifiers[4], ID = 5, Name = "test5" }); var metaRepoMock = new Mock<IMetaRepository>(); metaRepoMock.Setup(r => r.GetAllSchools()).Returns(schoolCollection); metaRepoMock.Setup(r => r.AddOrUpdateSchool( It.IsAny<School>(), It.IsAny<Action<bool>>())) .Callback<School, Action<bool>>((school, action) => { new Task(() => { action(true); }).Start(); }); var identifierMock = new Mock<IIdentifierProvider>(); identifierMock.Setup(r => r.GetIdentifier()).Returns(identifiers[count++]); builder.Register(c => identifierMock.Object).As<IIdentifierProvider>(); builder.Register(c => metaRepoMock.Object).As<IMetaRepository>(); }
/// <summary> /// Chargement du Planning /// </summary> public void loadPlanning() { Log.Debug("Chargement du Planning "); //DataTable _dt = p_applClass.DB.GetDataTable(@"SELECT * FROM Etablissements"); noBackUp = true; try { XmlSerializer xmlListe = new XmlSerializer(p_listEcole.GetType()); XmlSerializer xmlFile = new XmlSerializer(p_fileSchool.GetType()); // Si le fichier est null ==> On est dans le cas où on a aucun Planning par défaut if (SchoolFile != null) { Log.Debug("Fichier Planning : " + SchoolFile.Name); if (SchoolFile.Exists) { noBackUp = false; // On importe sur le nouveau format using (Stream s = SchoolFile.OpenRead()) { p_fileSchool = xmlFile.Deserialize(s) as SchoolFileFormat; p_listEcole = p_fileSchool.ListEcoles; } _savePlanning = false; // Il faut ajouter le Handler car la Serialization empêche sa création p_listEcole.Changed += new EventHandler<EcoleChangedEventArgs>(p_listEcole_Changed); p_listEcole.Loaded += new EventHandler<EcoleLoadedEventArgs>(p_listEcole_Loaded); p_isModified = false; this.setTitle(); this.initListEcole(FilterType.All); } } else { Log.Debug("Fichier Planning non défini "); this.displayStatusGoogle("Planning non défini..."); } } catch (Exception err) { Log.Error("Une erreur est survenue lors du chargement du planning.", err); p_isModified = false; MessageBox.Show("Une erreur est survenue lors du chargement du planning." + Environment.NewLine + "Message : " + err.Message, "Anomalie lors du chargement !", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Constructeur de l'application /// </summary> public frmAppli(InfoRegistration _infoReg) { p_applClass = new ApplClass(); p_applClass.InfoReg = _infoReg; p_fileSchool = new SchoolFileFormat(); p_listEcole = new SchoolCollection(); InitializeComponent(); // Créer une instance d'une méthode de trie de la colonne ListView et l'attribuer // au contrôle ListView. lvwColumnSorter = new SchoolCollectionSorter(); this.lstToSchedule.ListViewItemSorter = lvwColumnSorter; this.lstToSchedule.ContextMenuStrip = contextMenuStrip1; }
public Models.Api.SchoolListClassifiedRS GetSchoolListClassified(ApiRequest apiRQ) { var schoolCollection1 = new SchoolCollection(); schoolCollection1.Add(new School { ID = 1, Name = "上海海富幼儿园龙阳校区" }); schoolCollection1.Add(new School { ID = 2, Name = "上海私立蒙特梭利幼儿园" }); schoolCollection1.Add(new School { ID = 3, Name = "上海市建青实验学校幼儿部" }); schoolCollection1.Add(new School { ID = 4, Name = "上海中国福利会幼儿园" }); schoolCollection1.Add(new School { ID = 5, Name = "上海市浦东新区冰厂田幼儿园(云山路寄宿部)" }); var area1 = new Area { ID = 1, Name = "黄浦区", Schools = schoolCollection1 }; var schoolCollection2 = new SchoolCollection(); schoolCollection2.Add(new School { ID = 6, Name = "上海市实验幼儿园(杏山园)" }); schoolCollection2.Add(new School { ID = 7, Name = "孔祥东音乐幼儿园(巨野路园区)" }); schoolCollection2.Add(new School { ID = 8, Name = "上海市徐汇区科技幼儿园" }); var area2 = new Area { ID = 2, Name = "徐汇区", Schools = schoolCollection2 }; var schoolCollection3 = new SchoolCollection(); schoolCollection3.Add(new School { ID = 9, Name = "上海乌南幼儿园" }); schoolCollection3.Add(new School { ID = 10, Name = "上海市本溪路幼儿园" }); schoolCollection3.Add(new School { ID = 11, Name = "上海市宝山区行知实验幼儿园" }); var area3 = new Area { ID = 3, Name = "长宁区", Schools = schoolCollection3 }; var areaCollection1 = new AreaCollection(); areaCollection1.Add(area1); areaCollection1.Add(area2); areaCollection1.Add(area3); var schoolCollection4 = new SchoolCollection(); schoolCollection4.Add(new School { ID = 12, Name = "宁波市第一幼儿园" }); schoolCollection4.Add(new School { ID = 13, Name = "宁波市宝韵音乐幼儿园" }); schoolCollection4.Add(new School { ID = 14, Name = "宁波市华光幼儿园" }); var schoolCollection5 = new SchoolCollection(); schoolCollection5.Add(new School { ID = 15, Name = "杭州市行知幼儿园" }); schoolCollection5.Add(new School { ID = 16, Name = "杭州市清波幼儿园" }); schoolCollection5.Add(new School { ID = 17, Name = "杭州市娃哈哈幼儿园" }); var area4 = new Area { ID = 4, Name = "杭州市", Schools = schoolCollection5 }; var area5 = new Area { ID = 5, Name = "宁波市", Schools = schoolCollection4 }; var areaCollection2 = new AreaCollection(); areaCollection2.Add(area4); areaCollection2.Add(area5); var sh = new Province { ID = 1, Areas = areaCollection1, Name = "上海市" }; var zj = new Province { ID = 2, Areas = areaCollection2, Name = "浙江省" }; return(new SchoolListClassifiedRS { Ok = true, Provinces = new List <Province> { sh, zj } }); }