Beispiel #1
0
        public override void DataBind()
        {
            if (_bound)
            {
                return;
            }
            _bound = true;

            Display = false;

            if (_source != "")
            {
                Control ctrl = Page.FindControl(_source);
                if (ctrl != null)
                {
                    CustomDataSource dataSrc = ctrl as CustomDataSource;
                    if (ctrl != null)
                    {
                        Display = !dataSrc.HasData;
                    }
                }
            }

            base.DataBind();
        }
Beispiel #2
0
        public void CustomDataSource_Constructor_CreateEmptyDictionary()
        {
            var source = new CustomDataSource();

            Assert.IsNotNull(source.Data);
            Assert.AreEqual(0, source.Data.Count);
        }
Beispiel #3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            NavigationItem.BackBarButtonItem = new UIBarButtonItem("Back", UIBarButtonItemStyle.Plain, null);

            var source = new CustomDataSource(this, this.TableView, new NSString("TodoListViewCell"));

            TableView.Source = source;

            var set = this.CreateBindingSet <HomeView, ViewModels.HomeViewModel>();

            set.Bind(source)
            .For(x => x.SelectionChangedCommand)
            .To(vm => vm.SelectItem);
            set.Bind(source)
            .For(x => x.ItemsSource)
            .To(vm => vm.TodoLists);
            set.Bind(NavigationItem)
            .For(x => x.Title)
            .To(vm => vm.Title);
            set.Bind(AddButton)
            .To(vm => vm.AddNewItem);
            set.Apply();
        }
Beispiel #4
0
        /// <summary>
        /// InsertMachine
        /// </summary>
        /// <returns>Liste supports</returns>
        public int InsertMachine(Machine s)
        {
            int result = -1;
            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            try
            {
                maDataSource.StartGlobalTransaction();

                result = maDataSource.ExecuterDML(REQUETE_AJOUTER_MACHINE, true, s.Code, s.Nom, s.Historique, s.Caracteristiques, s.DateSortie);

                maDataSource.CommitGlobalTransaction();

            }
            catch (Exception ex)
            {
                maDataSource.RollBackGlobalTransaction();

                throw ex;
            }
            finally
            {
                
            }

            return result;
        }
Beispiel #5
0
        private FilterArgs GetSql(FilterArgs args)
        {
            #region CS
            //RemoteDataHelper rdh = null;
            //if (args != null && !string.IsNullOrEmpty(args.ClassName.Trim()))
            //{
            //    if (args.DataSource.Type == CustomDataSourceTypeEnum.TemplateTable)
            //        args.DataSource.SQL = CustomDataSource.GetATableName();
            //    if (_context.ReportState == ReportStates.WebBrowse)
            //    {
            //        rdh = DefaultConfigs.GetRemoteHelper();
            //        args = rdh.GetSql(_context.UserToken, _context.TaskID, _context.SubID, _context.FilterArgs);
            //    }
            //    else
            //    {
            //        rdh = new RemoteDataHelper();
            //        ClientReportContext.Login = _login;
            //        rdh.GetSql(args);
            //    }
            //}
            #endregion

            var rdHelper = new RemoteDataHelper();
            //return rdHelper.GetSql(_login.UserToken, _login.TaskID, _login.SubID, args);
            if (args.DataSource.Type == CustomDataSourceTypeEnum.TemplateTable)
            {
                //args.DataSource.SQL = CustomDataSource.GetATableNameWithTaskId(_login.TaskID);
                args.DataSource.SQL = CustomDataSource.GetATableName();
            }
            ClientReportContext.Login = _login;
            rdHelper.GetSql(args);
            return(args);
        }
Beispiel #6
0
        private void GetSql()
        {
            if (_context.ReportState == ReportStates.OutU8)
            {
                return;
            }
            RemoteDataHelper rdh = null;

            if (_context.FilterArgs != null && !string.IsNullOrEmpty(_context.FilterArgs.ClassName.Trim()))
            {
                if (_context.FilterArgs.DataSource.Type == CustomDataSourceTypeEnum.TemplateTable)
                {
                    //_context.FilterArgs.DataSource.SQL = CustomDataSource.GetATableName();
                    _context.FilterArgs.DataSource.SQL = CustomDataSource.GetATableNameWithTaskId(_context.TaskID);
                }
                if (_context.ReportState == ReportStates.WebBrowse)
                {
                    rdh = DefaultConfigs.GetRemoteHelper();
                    _context.FilterArgs = rdh.GetSql(_context.UserToken, _context.TaskID, _context.SubID, _context.FilterArgs);
                }
                else
                {
                    rdh = new RemoteDataHelper();
                    rdh.GetSql(_context.FilterArgs);
                }
            }
        }
Beispiel #7
0
 public IHttpActionResult PostCustomDataSource([FromBody] CustomDataSource ds)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     if (db.CustomDataSources.Count(t => t.Name.Trim() == ds.Name.Trim()) == 0)
     {
         CustomDataSource cds = new CustomDataSource()
         {
             CreatedBy    = db.Members.FirstOrDefault(d => d.Email == User.Identity.Name),
             DateCreated  = DateTime.Now,
             HtmlTemplate = ds.HtmlTemplate,
             Name         = ds.Name,
             Query        = ds.Query
         };
         db.CustomDataSources.Add(cds);
         db.SaveChanges();
         return(CreatedAtRoute("DefaultApi", new { id = cds.ID }, cds));
     }
     else
     {
         return(BadRequest("Data source with same name exist."));
     }
 }
 /// <summary>
 /// 数据转移到临时表的基础服务类构造函数
 /// </summary>
 /// <param name="rdf">UFIDA.U8.UAP.Services.ReportData.ReportDataFacade类型,主要是使用其提供的UFDataCnnString</param>
 /// <param name="customDataSource">通过此参数将临时表名称返回调用者</param>
 public Base2TempTable(
     ReportDataFacade rdf,
     CustomDataSource customDataSource)
 {
     this._loginInfor       = rdf._U8LoginInfor;
     this._customDataSource = customDataSource;
 }
Beispiel #9
0
        private IDataSource AddDataSource(DataSource settings)
        {
            lock (_syncRoot)
            {
                IDataSource dataSource;
                if (!string.IsNullOrEmpty(settings.LogFileFolderPath))
                {
                    dataSource = new FolderDataSource(_taskScheduler, _logSourceFactory, _filesystem, settings);
                }
                else if (!string.IsNullOrEmpty(settings.File))
                {
                    dataSource = new FileDataSource(_logSourceFactory, _taskScheduler, settings, _maximumWaitTime);
                }
                else if (settings.CustomDataSourceConfiguration != null)
                {
                    dataSource = new CustomDataSource(_logSourceFactory, _taskScheduler, settings, _maximumWaitTime);
                }
                else
                {
                    if (settings.DisplayName == null)
                    {
                        settings.DisplayName = "Merged Data Source";
                    }

                    dataSource = new MergedDataSource(_taskScheduler, settings, _maximumWaitTime);
                }

                _dataSources.Add(dataSource);
                _dataSourceIds.Add(dataSource.Id);
                _bookmarks.AddDataSource(dataSource);
                return(dataSource);
            }
        }
Beispiel #10
0
        /// <summary>
        /// Get a CustomDataSource: filtered, ordered
        /// ex: secondFilter = "it.SectionID = @SectionId"
        /// </summary>
        public CustomDataSource <TEntity> BindData(string sidx, string sord, int page, int rows, bool search, string filters, string secondFilter = "")
        {
            var serializer  = new JavaScriptSerializer();
            var filtersTemp = (!search || string.IsNullOrEmpty(filters)) ? null : serializer.Deserialize <Filters>(filters);

            ObjectContext       objectContext = ((System.Data.Entity.Infrastructure.IObjectContextAdapter)Context).ObjectContext;
            ObjectSet <TEntity> objectSet     = objectContext.CreateObjectSet <TEntity>();

            ObjectQuery <TEntity> filteredQuery = filtersTemp == null ? objectSet : filtersTemp.FilterObjectSet(objectSet);

            filteredQuery.MergeOption = MergeOption.NoTracking; // we don't want to update the data

            if (!string.IsNullOrEmpty(secondFilter))
            {
                filteredQuery = filteredQuery.Where(secondFilter);
            }

            var totalRecords = filteredQuery.Count();
            var pagedQuery   = filteredQuery.Skip("it." + sidx + " " + sord, "@skip", new ObjectParameter("skip", (page - 1) * rows))
                               .Top("@limit", new ObjectParameter("limit", rows));

            var customDataSource = new CustomDataSource <TEntity>(pagedQuery.ToList(), totalRecords);

            return(customDataSource);
        }
Beispiel #11
0
        public CustomDataSource <PersonDto> BindData(string sidx, string sord, int page, int rows, bool search, string filters)
        {
            CustomDataSource <Person> personList = Uow.PersonRepository.BindData(sidx, sord, page, rows, search, filters);
            var customDataSource = new CustomDataSource <PersonDto>(personList.RecordList.Select(FromEntityToModel).ToList(),
                                                                    personList.TotalRecords);

            return(customDataSource);
        }
Beispiel #12
0
        public CustomDataSource<PersonDto> BindData(string sidx, string sord, int page, int rows, bool search, string filters)
        {
            CustomDataSource<Person> personList = Uow.PersonRepository.BindData(sidx, sord, page, rows, search, filters);
            var customDataSource = new CustomDataSource<PersonDto>(personList.RecordList.Select(FromEntityToModel).ToList(),
                personList.TotalRecords);

            return customDataSource;
        }
        /// <summary>
        /// ObtenirProprietaire
        /// </summary>
        /// <returns>Le proprietaire</returns>
        public Proprietaire ObtenirProprietaire(string pLogin)
        {
            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            maDataSource.ExecuterDML(REQUETE_HISTORIQUE_CONNEXION, false, pLogin);

            return maDataSource.ExecuterRequete<Proprietaire>(REQUETE_OBTENIR_PROPRIETAIRE, new ProprietaireRowMapper(), false, pLogin);
       
        }
Beispiel #14
0
 public bool Delete(int id)
 {
     using (RockyingDataClassesDataContext dc = new RockyingDataClassesDataContext(Utility.ConnectionString))
     {
         CustomDataSource item = (from t in dc.CustomDataSources where t.ID == id select t).SingleOrDefault <CustomDataSource>();
         dc.CustomDataSources.DeleteOnSubmit(item);
         dc.SubmitChanges();
         return(true);
     }
 }
Beispiel #15
0
        public void CustomDataSource_GetValue_ReturnsValuesFromDictionary()
        {
            var source = new CustomDataSource();

            source.Data["key1"] = "value1";
            source.Data["key2"] = "value2";
            Assert.AreEqual("value1", source.GetValue("key1"));
            Assert.AreEqual("value2", source.GetValue("key2"));
            Assert.IsNull(source.GetValue("key3"));
        }
Beispiel #16
0
        public void CascadeSettingsContainer_AddSource_AddsToSourcesAndReturnsInstance()
        {
            var source    = new CustomDataSource();
            var container = new CascadeSettingsContainer();

            var source1 = container.AddSource(source);

            Assert.True(container.Sources.Contains(source));
            Assert.Equal(source, source1);
        }
Beispiel #17
0
        public override void DataBind()
        {
            if (_bound)
            {
                return;
            }
            _bound = true;


            CustomDataSource dataSrc = null;

            if (!String.IsNullOrWhiteSpace(source))
            {
                Control ctrl = Page.FindControl(source);
                if (ctrl != null)
                {
                    dataSrc = ctrl as CustomDataSource;
                }
            }
            else
            {
                dataSrc = this.Parent as CustomDataSource;
            }

            if (dataSrc != null)
            {
                DataTable ds = dataSrc.Data as DataTable;
                Visible = false;
                if (ds != null && dataSrc.HasData)
                {
                    int pageId = (int)ControlUtils.GetBoundedDataField(this.NamingContainer, "PageId");

                    for (int i = 0; i < ds.Rows.Count; i++)
                    {
                        DataRow p = ds.Rows[i];

                        if ((int)p["PageId"] == pageId && i < ds.Rows.Count - 1)
                        {
                            Visible = true;

                            p = ds.Rows[i + 1];

                            this.Title   = p["Title"].ToString();
                            this.FullURL = p["FullURL"].ToString();
                            this.PageId  = (int)p["PageId"];

                            break;
                        }
                    }
                }
            }
            base.DataBind();
        }
Beispiel #18
0
        public void BaseSettingValue_Value_ReturnsEffectiveValue()
        {
            var definition = new IntegerSettingDefinition("key1", "desc", 0);
            var source     = new CustomDataSource();
            var container  = new CascadeSettingsContainer();

            container.AddSource(source);
            var settingValue = new SettingValue <int>(container, definition);

            source.Data["key1"] = "100";

            Assert.Equal(100, settingValue.Value);
        }
Beispiel #19
0
        public void BaseSettingValue_Value_RaisesExceptionIfNotConvertible()
        {
            var definition = new IntegerSettingDefinition("key1", "desc", 0);
            var source     = new CustomDataSource();
            var container  = new CascadeSettingsContainer();

            container.AddSource(source);
            var settingValue = new SettingValue <int>(container, definition);

            source.Data["key1"] = "text";

            Assert.Throws <InvalidOperationException>(() => settingValue.Value);
        }
Beispiel #20
0
        public ActionResult BindData(string sidx, string sord, int page, int rows, bool search, string filters)
        {
            BindDataParam = new BindDataParamDto {
                Sidx = sidx, Sord = sord, Page = page, Rows = rows, Filters = filters
            };

            Response.Cache.SetCacheability(HttpCacheability.ServerAndPrivate);
            Response.Cache.SetMaxAge(new TimeSpan(0));

            CustomDataSource <PersonDto> dataSource = personBl.BindData(sidx, sord, page, rows, search, filters);

            // to be able to use ToString() below which is NOT exist in the LINQ to Entity
            // we should include in queryDetails only the properies which we will use below
            var queryDetails = (from item in dataSource.RecordList
                                select new { item.Id, item.FirstName, item.LastName, item.Age }).ToList();
            var retult = new
            {
                total = (dataSource.TotalRecords + rows - 1) / rows,
                page,
                records = dataSource.TotalRecords,
                rows    = (from item in queryDetails
                           select new[] {
                    item.Id + "",
                    item.FirstName,
                    item.LastName,
                    item.Age + ""
                }).ToList()
            };

            // calculate MD5 from the returned data and use it as ETag
            var serializer = new JavaScriptSerializer();
            var str        = serializer.Serialize(retult);

            byte[] inputBytes = Encoding.ASCII.GetBytes(str);
            byte[] hash       = MD5.Create().ComputeHash(inputBytes);
            string newETag    = Convert.ToBase64String(hash);

            Response.Cache.SetETag(newETag);
            // compare ETag of the data which already has the client with ETag of response
            string incomingEtag = Request.Headers["If-None-Match"];

            if (String.Compare(incomingEtag, newETag, StringComparison.Ordinal) == 0)
            {
                // we don't need return the data which the client already have
                Response.SuppressContent = true;
                Response.StatusCode      = (int)HttpStatusCode.NotModified;
                return(null);
            }

            return(Json(retult, JsonRequestBehavior.AllowGet));
        }
Beispiel #21
0
 public bool Update(int id, string name, string query, string template, long memberid)
 {
     using (RockyingDataClassesDataContext dc = new RockyingDataClassesDataContext(Utility.ConnectionString))
     {
         CustomDataSource item = (from t in dc.CustomDataSources where t.ID == id select t).SingleOrDefault <CustomDataSource>();
         item.Name         = name;
         item.Query        = query;
         item.HtmlTemplate = template;
         item.ModifiedBy   = memberid;
         item.DateModified = DateTime.Now;
         dc.SubmitChanges();
         return(true);
     }
 }
Beispiel #22
0
        public IHttpActionResult DeleteCustomDataSource(int id)
        {
            CustomDataSource customDataSource = db.CustomDataSources.Find(id);

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

            db.CustomDataSources.Remove(customDataSource);
            db.SaveChanges();

            return(Ok(customDataSource));
        }
        private string GetTempTableName()
        {
            if (!string.IsNullOrEmpty(this._customDataSource.SQL) &&
                this._customDataSource.SQL.StartsWith("tempdb..[me_"))
            {
                this._tempTableName = this._customDataSource.SQL;
            }
            else
            {
                //this._tempTableName = CustomDataSource.GetATableName();
                this._tempTableName = CustomDataSource.GetATableNameWithTaskId(_loginInfor.TaskID);
            }

            return(this._tempTableName);
        }
Beispiel #24
0
 public bool Add(string name, string query, string template, long memberid)
 {
     using (RockyingDataClassesDataContext dc = new RockyingDataClassesDataContext(Utility.ConnectionString))
     {
         CustomDataSource item = new CustomDataSource();
         item.Name         = name;
         item.Query        = query;
         item.HtmlTemplate = template;
         item.DateCreated  = DateTime.Now;
         item.CreatedBy    = memberid;
         dc.CustomDataSources.InsertOnSubmit(item);
         dc.SubmitChanges();
         return(true);
     }
 }
Beispiel #25
0
        public IHttpActionResult GetCustomDataSource(int id)
        {
            if (id == 0)
            {
                return(Ok(new CustomDataSource()));
            }
            CustomDataSource customDataSource = db.CustomDataSources.Find(id);

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

            return(Ok(customDataSource));
        }
Beispiel #26
0
        public string LoadContent(string name)
        {
            if (CacheManager.Get <string>(name) != null)
            {
                return(CacheManager.Get <string>(name));
            }
            else
            {
                CustomDataSource cds = GetByName(name);
                if (cds != null)
                {
                    if (cds.Query.Trim() == string.Empty)
                    {
                        CacheManager.Add(name, cds.HtmlTemplate.Trim(), DateTime.Now.AddDays(2));
                        return(CacheManager.Get <string>(name));
                    }
                    else
                    {
                        using (RockyingDataClassesDataContext dc = new RockyingDataClassesDataContext(Utility.ConnectionString))
                        {
                            dc.Connection.Open();
                            SqlCommand comm   = new SqlCommand(string.Format("{0} FOR XML RAW , ROOT('DataSource'), Elements;", cds.Query), dc.Connection as SqlConnection);
                            XmlReader  reader = comm.ExecuteXmlReader();
                            if (reader.Read())
                            {
                                string data = string.Format("<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:msxsl=\"urn:schemas-microsoft-com:xslt\" exclude-result-prefixes=\"msxsl\"> <xsl:output method=\"xml\" omit-xml-declaration=\"yes\" /> {0} </xsl:stylesheet>", cds.HtmlTemplate.Trim());
                                // Load the style sheet.
                                XslCompiledTransform xslt    = new XslCompiledTransform();
                                XmlReader            xmlread = XmlReader.Create(new StringReader(data));
                                xslt.Load(xmlread);

                                // Execute the transform and output the results to a file.
                                StringBuilder builder   = new StringBuilder();
                                XmlWriter     xmlOutput = XmlWriter.Create(builder);

                                xslt.Transform(reader, xmlOutput);
                                CacheManager.Add(name, builder.ToString(), DateTime.Now.AddDays(2));
                                return(CacheManager.Get <string>(name));
                            }
                        }
                    }
                }
            }

            return(string.Empty);
        }
        /// <summary>
        /// ObtenirProprietaire
        /// </summary>
        /// <returns>Le proprietaire</returns>
        public int UpdateProprietaire(Proprietaire p, string pPasswordHash)
        {

            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            if (String.IsNullOrEmpty(pPasswordHash))
            {
                return maDataSource.ExecuterDML(REQUETE_MODIFIER_PROPRIETAIRE, false, p.Login, p.Nom, p.Prenom, p.Adresse, p.CP, p.Ville, p.Code);

            }
            else
            {
                return maDataSource.ExecuterDML(REQUETE_MODIFIER_PROPRIETAIRE_ET_PASSWORD, false, p.Login, p.Nom, p.Prenom, p.Adresse, p.CP, p.Ville, pPasswordHash, p.Code);
            }
            
            
        }
Beispiel #28
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="rdf">传给父类Base2TempTable的构造函数的参数</param>
 /// <param name="customDataSource">自定义数据源对象,其作用主要产生和传输临时表名称</param>
 /// <param name="dataSourceId">数据引擎中数据源的标识</param>
 /// <param name="functionName">数据引擎中数据源的查询函数</param>
 /// <param name="filterSrv">过滤条件信息对象</param>
 public U8DataEngine2TempTable(
     ReportDataFacade rdf,
     CustomDataSource customDataSource,
     string dataSourceId,
     string functionName,
     FilterSrv filterSrv,
     string extendingDataSourceTempDBName)
     : base(rdf, customDataSource)
 {
     this._filterSrv          = filterSrv;
     this._u8DataEngineHelper = new U8DataEngineHelper(
         dataSourceId,
         functionName,
         customDataSource.FilterString,
         rdf._U8LoginInfor,
         extendingDataSourceTempDBName);
     this._u8DataEngineHelper.ReadConfigurate();
 }
Beispiel #29
0
        public IHttpActionResult PutCustomDataSource(int id, [FromBody] CustomDataSource ds)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (string.IsNullOrEmpty(ds.Name) || string.IsNullOrEmpty(ds.HtmlTemplate))
            {
                return(BadRequest("Either name or html template is missing"));
            }

            try
            {
                CustomDataSource cds = db.CustomDataSources.FirstOrDefault(t => t.ID == id);
                if (cds != null)
                {
                    cds.HtmlTemplate    = ds.HtmlTemplate;
                    cds.Name            = ds.Name;
                    cds.Query           = ds.Query;
                    cds.ModifiedBy      = db.Members.FirstOrDefault(d => d.Email == User.Identity.Name);
                    cds.DateModified    = DateTime.Now;
                    db.Entry(cds).State = EntityState.Modified;
                    db.SaveChanges();
                }
                else
                {
                    return(BadRequest("Unable to find data source with this id."));
                }
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CustomDataSourceExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Ok());
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            NavigationItem.BackBarButtonItem = new UIBarButtonItem("Back", UIBarButtonItemStyle.Plain, null);

            this.Title = "Todo List Info";

            UpdateDescriptionStyle();

            var save    = new UIBarButtonItem(UIBarButtonSystemItem.Save);
            var options = new UIBarButtonItem(UIImage.FromBundle("ic_more"), UIBarButtonItemStyle.Done, null);

            this.NavigationItem.RightBarButtonItems = new UIBarButtonItem[] { options, save };


            var source = new CustomDataSource(this, TableView, new NSString("ToDoItemCell"));

            TableView.Source = source;

            var set = this.CreateBindingSet <ListInfoView, ViewModels.ListInfoViewModel>();

            set.Bind(NavigationItem)
            .For(x => x.Title)
            .To(vm => vm.Title);
            set.Bind(source)
            .For(x => x.ItemsSource)
            .To(vm => vm.Items);
            set.Bind(source)
            .For(x => x.SelectionChangedCommand)
            .To(vm => vm.CompleteItem);
            set.Bind(TitleTextField)
            .To(vm => vm.ListTitle);
            set.Bind(DescrptionTextView)
            .To(vm => vm.ListDescription);
            set.Bind(AddButton)
            .To(vm => vm.AddNewItem);
            set.Bind(save)
            .To(vm => vm.SaveList);
            set.Bind(options)
            .To(vm => vm.ShowOptions);
            set.Apply();
        }
Beispiel #31
0
        ///// <summary>
        ///// SupprimerFilm (et exemplaires associés)
        ///// </summary>
        ///// <param name="pCode">pCode</param>
        //public int SupprimerFilm(Guid pCode)
        //{
        //    Log.MonitoringLogger().Info(KS_NOM_MODULE + "Début SupprimerFilm");

        //    CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);
        //    int result = -1;
        //    try
        //    {
        //        maDataSource.StartGlobalTransaction();

        //        result = maDataSource.ExecuterDML(REQUETE_SUPPRIMER_FILM, false, pCode);

        //        result = maDataSource.ExecuterDML(REQUETE_SUPPRIMER_EXEMPLAIRE, false, pCode);

        //        if (result.Equals(1))
        //        {
        //            result = maDataSource.ExecuterDML(REQUETE_SUPPRIMER_MEDIA, false, pCode);
        //        }

        //    }
        //    catch (Exception ex)
        //    {
        //        Log.MonitoringLogger().Info(KS_NOM_MODULE + "Erreur = " + ex.Message);
        //        maDataSource.RollBackGlobalTransaction();
        //        throw ex;
        //    }
        //    finally
        //    {
        //        Log.MonitoringLogger().Info(KS_NOM_MODULE + "Fin SupprimerFilm");
        //    }

        //    return result;
        //}

     

        /// <summary>
        /// UpdateFilm
        /// </summary>
        /// <param name="f">Film</param>
        /// <returns></returns>
        public int UpdateFilm(Film f)
        {
            int result = -1;
            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            try
            {               
                maDataSource.StartGlobalTransaction();

                result = maDataSource.ExecuterDML(REQUETE_MODIFICATION_FILM, false, f.Duree,
                   f.Synopsys, f.Realisateur, f.Acteurs, f.Code);

                if (result == 1)
                {
                    result = maDataSource.ExecuterDML(REQUETE_MODIFICATION_MEDIA, false, f.Titre,
                        f.LeGenre.Code, f.DateSortie, f.Photo, f.UrlFiche, f.PEGI, f.Note, f.Code);
                }

                if (result == 1)
                {
                    maDataSource.CommitGlobalTransaction();
                }
                else
                {
                    maDataSource.RollBackGlobalTransaction();
                }

                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Enregistrement du film OK");

            }
            catch (Exception ex)
            {
                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Erreur = " + ex.Message);
                maDataSource.RollBackGlobalTransaction();
                throw ex;
            }
            finally
            {
                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Fin UpdateFilm");
            }

            return result;
        }
Beispiel #32
0
        /// <summary>
        /// ObtenirJeuComplet
        /// </summary>
        /// <param name="pCode"></param>
        /// <returns></returns>
        public Jeu ObtenirJeuComplet(Guid pCode)
        {
            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            Jeu leJeu = maDataSource.ExecuterRequete<Jeu>(REQUETE_OBTENIR_JEU, new JeuRowMapper(), false, pCode);

            return leJeu;
        }
Beispiel #33
0
        /// <summary>
        /// AjouterEmprunt
        /// </summary>
        /// <param name="pCodeFilm"></param>
        /// <param name="pCodeProprietaire"></param>
        /// <param name="pCodeSupport"></param>
        /// <param name="pNom"></param>
        /// <param name="pPrenom"></param>
        public void AjouterEmprunt(Guid pCodeFilm, Guid pCodeProprietaire, String pCodeSupport, Emprunteur pEmprunteur)
        {
            Log.MonitoringLogger().Info(KS_NOM_MODULE + "Début AjouterEmprunt");

            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            try
            {
                maDataSource.StartGlobalTransaction();

                Guid codeEmprunteur;

                if (!String.IsNullOrEmpty(pEmprunteur.Nom))
                {
                    codeEmprunteur = Guid.Empty;
                }
                else
                {
                    codeEmprunteur = pEmprunteur.Code;

                    ProprietaireDAO proprietaireDAO = new ProprietaireDAO();
                    Proprietaire p = proprietaireDAO.ObtenirListeProprietaires().Find(item=>item.Code==codeEmprunteur);
                    pEmprunteur.Nom = p.Nom;
                    pEmprunteur.Prenom = p.Prenom;
                }

                maDataSource.ExecuterDML(REQUETE_AJOUTER_EMPRUNT, true, pCodeProprietaire, pCodeFilm, pCodeSupport, codeEmprunteur, pEmprunteur.Nom, pEmprunteur.Prenom, DateTime.Now);

                maDataSource.CommitGlobalTransaction();

                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Enregistrement de l'emprunt OK");

            }
            catch (Exception ex)
            {
                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Erreur = " + ex.Message);
                maDataSource.RollBackGlobalTransaction();
                throw ex;
            }
            finally
            {
                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Fin AjouterEmprunt");
            }
        }
Beispiel #34
0
        /// <summary>
        /// UpdateEmprunt
        /// </summary>
        /// <param name="pCodeFilm"></param>
        /// <param name="pCodeProprietaire"></param>
        /// <param name="pCodeSupport"></param>
        /// <returns></returns>
        public int UpdateEmprunt(Guid pCodeFilm, Guid pCodeProprietaire, String pCodeSupport)
        {
            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            return maDataSource.ExecuterDML(REQUETE_CLORE_EMPRUNT, false, DateTime.Now, pCodeFilm, pCodeProprietaire, pCodeSupport);
        }
        /// <summary>
        /// ObtenirListeFilms
        /// </summary>
        /// <returns>Liste films</returns>
        public List<Proprietaire> ObtenirListeProprietaires()
        {
            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            return maDataSource.ExecuterRequeteList<Proprietaire>(REQUETE_OBTENIR_LISTE_PROPRIETAIRES, new ProprietaireRowMapper(), false, null);
        }
Beispiel #36
0
        /// <summary>
        /// UpdateFilm
        /// </summary>
        /// <returns>Liste films</returns>
        public int UpdateFilm(Film f)
        {
            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            return maDataSource.ExecuterDML(REQUETE_MODIFICATION_FILM, false, f.Titre, f.Duree, 
                f.LeGenre.Code, f.DateSortie, f.Synopsys, f.Jaquette, f.Realisateur, f.Acteurs, f.Note, f.Code);
        }
Beispiel #37
0
        /// <summary>
        /// UpdateGenre
        /// </summary>
        /// <returns>Liste Genres</returns>
        public int UpdateGenre(Genre s, string pOldCode)
        {
            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            return maDataSource.ExecuterDML(REQUETE_MODIFICATION_GENRE, false, s.Code, s.Libelle, pOldCode);
        }
Beispiel #38
0
        /// <summary>
        /// ObtenirListeJeux
        /// </summary>
        /// <returns>Liste jeux</returns>
        public List<Jeu> ObtenirListeJeux()
        {
            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            return maDataSource.ExecuterRequeteList<Jeu>(REQUETE_OBTENIR_LISTE_JEUX, new JeuRowMapper(), false, null);
        }
Beispiel #39
0
        /// <summary>
        /// ObtenirGenre
        /// </summary>
        /// <returns>Genre</returns>
        public Genre ObtenirGenre(string pCode)
        {
            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            return maDataSource.ExecuterRequete<Genre>(REQUETE_OBTENIR_GENRE, new GenreRowMapper(), false, pCode);
        }
Beispiel #40
0
        /// <summary>
        /// CreerJeuEtSouhait
        /// </summary>
        /// <param name="pJeu">pJeu</param>
        /// <param name="pCodeProprietaire">pCodeProprietaire</param>
        /// <returns></returns>
        public Jeu CreerJeuEtSouhait(Jeu pJeu, Guid pCodeProprietaire)
        {
            Log.MonitoringLogger().Info(KS_NOM_MODULE + "Début CreerJeuEtSouhait");

            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            try
            {
                maDataSource.StartGlobalTransaction();

                pJeu.Code = Guid.NewGuid();

                //TODO : échec
                Jeu jeuExistant = maDataSource.ExecuterRequete<Jeu>(REQUETE_EXISTE_JEU, new JeuRowMapper(), false, pJeu.Titre, pJeu.LaMachine.Code);

                if (jeuExistant == null)
                {
                    Log.MonitoringLogger().Info(KS_NOM_MODULE + "Le jeu n'existe pas, on l'ajoute");

                    if (!String.IsNullOrEmpty(pJeu.Developpeur.Nom))
                    {
                        pJeu.Developpeur = CreerDeveloppeur(maDataSource, pJeu.Developpeur.Nom);
                    }
                    else
                    {
                        pJeu.Developpeur = new Developpeur();
                    }

                    if (!String.IsNullOrEmpty(pJeu.Editeur.Nom))
                    {
                        pJeu.Editeur = CreerEditeur(maDataSource, pJeu.Editeur.Nom);
                    }
                    else
                    {
                        pJeu.Editeur = new Editeur();
                    }

                    maDataSource.ExecuterDML(REQUETE_AJOUTER_JEU, true, pJeu.Code, pJeu.Titre,
                        pJeu.LeGenre.Code, pJeu.DateSortie, pJeu.Synopsys, pJeu.Photo, pJeu.Developpeur.Code, pJeu.Editeur.Code, pJeu.LaMachine.Code, 1, pJeu.Note);

                }
                else
                {
                    Log.MonitoringLogger().Info(KS_NOM_MODULE + "Le jeu existe déjà");

                    pJeu.Code = jeuExistant.Code;
                }

                maDataSource.ExecuterDML(REQUETE_AJOUTER_SOUHAIT_ACHAT, true, pCodeProprietaire, pJeu.Code, null, DateTime.Now);

                maDataSource.CommitGlobalTransaction();

                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Enregistrement de l'exemplaire OK");

                return pJeu;
                
            }
            catch (Exception ex)
            {
                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Erreur = " + ex.Message);
                maDataSource.RollBackGlobalTransaction();
                throw ex;
            }
            finally
            {
                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Fin CreerJeuEtSouhait");
            }
        }
Beispiel #41
0
        /// <summary>
        /// AjouterSouhait
        /// </summary>
        /// <param name="pCodeFilm">pCodeFilm</param>
        /// <param name="pCodeSupport">pCodeSupport</param>
        /// <param name="pCodeProprietaire">pCodeProprietaire</param>
        public void AjouterSouhait(Guid pCodeFilm, string pCodeSupport, Guid pCodeProprietaire)
        {

            Log.MonitoringLogger().Info(KS_NOM_MODULE + "Début AjouterSouhait");

            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            try
            {
                maDataSource.StartGlobalTransaction();

                maDataSource.ExecuterDML(REQUETE_AJOUTER_SOUHAIT, true, pCodeProprietaire, pCodeFilm, pCodeSupport);

                maDataSource.CommitGlobalTransaction();

                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Enregistrement de l'exemplaire OK");

            }
            catch (Exception ex)
            {
                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Erreur = " + ex.Message);
                maDataSource.RollBackGlobalTransaction();
                throw ex;
            }
            finally
            {
                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Fin AjouterSouhait");
            }
        }
Beispiel #42
0
        /// <summary>
        /// ObtenirFilm
        /// </summary>
        /// <param name="pCode">code film</param>
        /// <returns>Le film trouvé en base</returns>
        public Film ObtenirFilmComplet(Guid pCode)
        {
            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            Film leFilm = maDataSource.ExecuterRequete<Film>(REQUETE_OBTENIR_FILM, new FilmRowMapper(), false, pCode);

            List<Exemplaire> listeExpl = maDataSource.ExecuterRequeteList<Exemplaire>(REQUETE_OBTENIR_LISTE_EXEMPLAIRES_FILM, new ExemplaireFilmRowMapper(), false, pCode);
            List<Exemplaire> listeSouhaits = maDataSource.ExecuterRequeteList<Exemplaire>(REQUETE_OBTENIR_LISTE_SOUHAITS_FILM, new ExemplaireFilmRowMapper(), false, pCode);

            //On associe le film à chaque exemplaire
            foreach (Exemplaire expl in listeExpl) {
                expl.LeMedia = leFilm;
            }

            //On associe le film à chaque exemplaire
            foreach (Exemplaire expl in listeSouhaits)
            {
                expl.LeMedia = leFilm;
            }

            leFilm.ListeExemplaire = listeExpl;
            leFilm.ListeSouhaits = listeSouhaits;

            return leFilm;
        }
Beispiel #43
0
        /// <summary>
        /// ObtenirFilm
        /// </summary>
        /// <param name="pCode">code film</param>
        /// <returns>Le film trouvé en base</returns>
        public Film ObtenirFilm(Guid pCode)
        {
            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            Film leFilm = maDataSource.ExecuterRequete<Film>(REQUETE_OBTENIR_FILM, new FilmRowMapper(), false, pCode);

            return leFilm;

        }
Beispiel #44
0
        /// <summary>
        /// InsertGenre
        /// </summary>
        /// <returns>Liste Genres</returns>
        public int InsertGenre(Genre s)
        {
            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            return maDataSource.ExecuterDML(REQUETE_AJOUTER_GENRE, false, s.Code, s.Libelle);
        }
Beispiel #45
0
        /// <summary>
        /// ModifierExemplaire
        /// </summary>
        /// <param name="pCodeFilm"></param>
        /// <param name="pCodeProprietaire"></param>
        /// <param name="pCodeSupport"></param>
        /// <param name="dateAcquisition"></param>
        public void ModifierExemplaire(Guid pCodeFilm, Guid pCodeProprietaire, String pCodeSupport, String pOldCodeSupport, DateTime dateAcquisition)
        {
            Log.MonitoringLogger().Info(KS_NOM_MODULE + "Début ModifierExemplaire");

            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            try
            {
                maDataSource.StartGlobalTransaction();

                maDataSource.ExecuterDML(REQUETE_MODIFIER_EXEMPLAIRE, true, pCodeSupport, dateAcquisition, pCodeProprietaire, pCodeFilm, pOldCodeSupport);

                maDataSource.CommitGlobalTransaction();

                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Enregistrement de l'exemplaire OK");
            }
            catch (Exception ex)
            {
                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Erreur = " + ex.Message);
                maDataSource.RollBackGlobalTransaction();
                throw ex;
            }
            finally
            {
                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Fin ModifierExemplaire");
            }
        }
Beispiel #46
0
        /// <summary>
        /// DeleteGenre
        /// </summary>
        /// <returns>Liste Genres</returns>
        public int DeleteGenre(string pCode)
        {
            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            return maDataSource.ExecuterDML(REQUETE_SUPPRESSION_GENRE, false, pCode);
        }
Beispiel #47
0
        /// <summary>
        /// SupprimerSouhait
        /// </summary>
        /// <param name="pCodeFilm"></param>
        /// <param name="pCodeProprietaire"></param>
        /// <param name="pCodeSupport"></param>
        public void SupprimerSouhait(Guid pCodeFilm, Guid pCodeProprietaire, String pCodeSupport)
        {
            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            maDataSource.ExecuterDML(REQUETE_SUPPRIMER_SOUHAIT, false, pCodeFilm, pCodeProprietaire, pCodeSupport);
        }
Beispiel #48
0
        ///// <summary>
        ///// AjouterExemplaire
        ///// </summary>
        ///// <param name="pCodeFilm"></param>
        ///// <param name="pCodeSupport"></param>
        ///// <param name="pCodeProprietaire"></param>
        //public void AjouterExemplaire(Guid pCodeFilm, string pCodeSupport, Guid pCodeProprietaire, DateTime pDateAcquisition)
        //{

        //    Log.MonitoringLogger().Info(KS_NOM_MODULE + "Début AjouterExemplaire");

        //    CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

        //    try
        //    {
        //        maDataSource.StartGlobalTransaction();

        //        maDataSource.ExecuterDML(REQUETE_AJOUTER_EXEMPLAIRE, true, pCodeProprietaire, pCodeFilm, pCodeSupport, DateTime.Now, pDateAcquisition);

        //        maDataSource.CommitGlobalTransaction();

        //        Log.MonitoringLogger().Info(KS_NOM_MODULE + "Enregistrement de l'exemplaire OK");

        //    }
        //    catch (Exception ex)
        //    {
        //        Log.MonitoringLogger().Info(KS_NOM_MODULE + "Erreur = " + ex.Message);
        //        maDataSource.RollBackGlobalTransaction();
        //        throw ex;
        //    }
        //    finally
        //    {
        //        Log.MonitoringLogger().Info(KS_NOM_MODULE + "Fin AjouterExemplaire");
        //    }
        //}

        

        /// <summary>
        /// ObtenirFilm
        /// </summary>
        /// <param name="pCode">code film</param>
        /// <returns>Le film trouvé en base</returns>
        public Film CreerFilmEtExemplaire(Film pFilm, string pCodeSupport, Guid pCodeProprietaire, DateTime pDateAcquisition, int pEtat)
        {
            Log.MonitoringLogger().Info(KS_NOM_MODULE + "Début CreerFilmEtExemplaire");

            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            try
            {
                maDataSource.StartGlobalTransaction();

                if (pFilm.Code.Equals(Guid.Empty)) {
                    pFilm.Code = Guid.NewGuid();
                }
 
                Film filmExistant = maDataSource.ExecuterRequete<Film>(REQUETE_EXISTE_FILM, new FilmRowMapper(), false, pFilm.Titre, pFilm.Realisateur);

                if (filmExistant == null)
                {
                    Log.MonitoringLogger().Info(KS_NOM_MODULE + "Le film n'existe pas, on l'ajoute");

                    maDataSource.ExecuterDML(
                        REQUETE_AJOUTER_MEDIA, true,
                        pFilm.Code, Constantes.EnumTypeMedia.FILM, pFilm.Titre, pFilm.DateSortie, pFilm.Photo, pFilm.UrlFiche, pFilm.PEGI, pFilm.LeGenre.Code, pFilm.Note);


                    maDataSource.ExecuterDML(
                        REQUETE_AJOUTER_FILM, true, pFilm.Code, pFilm.Duree, pFilm.Synopsys, pFilm.Realisateur, pFilm.Acteurs);

                }
                else
                {
                    Log.MonitoringLogger().Info(KS_NOM_MODULE + "Le film existe déjà");

                    pFilm.Code = filmExistant.Code;                   
                }

                maDataSource.ExecuterDML(REQUETE_AJOUTER_EXEMPLAIRE, true, pCodeProprietaire, pFilm.Code, pEtat, pCodeSupport, DateTime.Now, pDateAcquisition);

                maDataSource.CommitGlobalTransaction();

                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Enregistrement de l'exemplaire OK");


                return pFilm;

            }
            catch (Exception ex)
            {
                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Erreur = " + ex.Message);
                maDataSource.RollBackGlobalTransaction();
                throw ex;
            }
            finally
            {
                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Fin CreerFilmEtExemplaire");
            }
        }
Beispiel #49
0
        /// <summary>
        /// CreerDeveloppeur
        /// </summary>
        /// <param name="pDataSource"></param>
        /// <param name="pNomDeveloppeur"></param>
        /// <returns></returns>
        private Developpeur CreerDeveloppeur(CustomDataSource pDataSource, string pNomDeveloppeur) 
        {
            Developpeur developpeur = null;

            if (!String.IsNullOrEmpty(pNomDeveloppeur))
            {
                Developpeur developpeurExistant = pDataSource.ExecuterRequete<Developpeur>(REQUETE_EXISTE_DEVELOPPEUR, new DeveloppeurRowMapper(), false, pNomDeveloppeur);

                //Création du développeur
                if (developpeurExistant == null)
                {
                    Log.MonitoringLogger().Info(KS_NOM_MODULE + "Le développeur n'existe pas, on l'ajoute");

                    developpeur = new Developpeur();
                    developpeur.Nom = pNomDeveloppeur;
                    developpeur.Code = Guid.NewGuid();
                    pDataSource.ExecuterDML(REQUETE_AJOUTER_DEVELOPPEUR, true, developpeur.Code, developpeur.Nom);
                }
                else
                {
                    developpeur = developpeurExistant;
                }
            }

            return developpeur;
        }
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="rdf">传给父类Base2TempTable的构造函数的参数</param>
 /// <param name="customDataSource">自定义数据源的定义</param>
 public CustomDataSource2TempTable(
     ReportDataFacade rdf,
     CustomDataSource customDataSource)
     : base(rdf, customDataSource)
 {
 }
Beispiel #51
0
        /// <summary>
        /// SupprimerFilm (et exemplaires associés)
        /// </summary>
        /// <param name="pCode">pCode</param>
        public void SupprimerFilm(Guid pCode)
        {
            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            maDataSource.ExecuterDML(REQUETE_SUPPRIMER_FILM, false, pCode);
        }
Beispiel #52
0
        /// <summary>
        /// ListeSouhaitsProprietaire
        /// </summary>
        /// <param name="pCodeProprietaire">Le proprio</param>
        /// <returns></returns>
        public List<Emprunt> ListeEmpruntsProprietaire(Guid pCodeProprietaire)
        {
            Log.MonitoringLogger().Info(KS_NOM_MODULE + "Début ListeEmpruntsProprietaire");

            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            try
            {
                maDataSource.StartGlobalTransaction();

                List<Emprunt> listeEmprunts = maDataSource.ExecuterRequeteList<Emprunt>(REQUETE_OBTENIR_LISTE_EMPRUNTS_PROPRIETAIRE, new EmpruntFilmRowMapper(), false, pCodeProprietaire);

                maDataSource.CommitGlobalTransaction();

                return listeEmprunts;

            }
            catch (Exception ex)
            {
                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Erreur = " + ex.Message);
                maDataSource.RollBackGlobalTransaction();
                throw ex;
            }
            finally
            {
                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Fin ListeEmpruntsProprietaire");
            }
        }
Beispiel #53
0
        public void CustomDataSource_Scope_User()
        {
            var source = new CustomDataSource();

            Assert.AreEqual(SettingScopeEnum.User, source.Scope);
        }
Beispiel #54
0
        /// <summary>
        /// CreerEditeur
        /// </summary>
        /// <param name="pDataSource"></param>
        /// <param name="pNomEditeur"></param>
        /// <returns></returns>
        public Editeur CreerEditeur(CustomDataSource pDataSource, string pNomEditeur)
        {
            Editeur editeur = null;

            if (!String.IsNullOrEmpty(pNomEditeur))
            {
                Editeur editeurExistant = pDataSource.ExecuterRequete<Editeur>(REQUETE_EXISTE_EDITEUR, new EditeurRowMapper(), false, pNomEditeur);

                //Création de l'éditeur
                if (editeurExistant == null)
                {
                    Log.MonitoringLogger().Info(KS_NOM_MODULE + "L'éditeur n'existe pas, on l'ajoute");

                    editeur = new Editeur();

                    editeur.Nom = pNomEditeur;
                    editeur.Code = Guid.NewGuid();
                    pDataSource.ExecuterDML(REQUETE_AJOUTER_EDITEUR, true, editeur.Code, editeur.Nom);
                }
                else
                {
                    editeur = editeurExistant;
                }
            }

            return editeur;
        }
Beispiel #55
0
        /// <summary>
        /// CreerFilmEtSouhait
        /// </summary>
        /// <param name="pFilm">pFilm</param>
        /// <param name="pCodeSupport">pCodeSupport</param>
        /// <param name="pCodeProprietaire">pCodeProprietaire</param>
        /// <returns></returns>
        public Film CreerFilmEtSouhait(Film pFilm, string pCodeSupport, Guid pCodeProprietaire)
        {
            Log.MonitoringLogger().Info(KS_NOM_MODULE + "Début CreerFilmEtSouhait");

            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            try
            {
                maDataSource.StartGlobalTransaction();

                pFilm.Code = Guid.NewGuid();

                Film filmExistant = maDataSource.ExecuterRequete<Film>(REQUETE_EXISTE_FILM, new FilmRowMapper(), false, pFilm.Titre, pFilm.Realisateur);

                if (filmExistant == null)
                {
                    Log.MonitoringLogger().Info(KS_NOM_MODULE + "Le film n'existe pas, on l'ajoute");

                    maDataSource.ExecuterDML(REQUETE_AJOUTER_FILM, true, pFilm.Code, pFilm.Titre, pFilm.Duree,
                    pFilm.LeGenre.Code, pFilm.DateSortie, pFilm.Synopsys, pFilm.Jaquette, pFilm.Realisateur,
                    pFilm.Acteurs, 1, pFilm.Note, pFilm.UrlFiche);

                }
                else
                {
                    Log.MonitoringLogger().Info(KS_NOM_MODULE + "Le film existe déjà");

                    pFilm.Code = filmExistant.Code;
                }

                maDataSource.ExecuterDML(REQUETE_AJOUTER_SOUHAIT, true, pCodeProprietaire, pFilm.Code, pCodeSupport);

                maDataSource.CommitGlobalTransaction();

                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Enregistrement du souhait OK");

                return pFilm;

            }
            catch (Exception ex)
            {
                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Erreur = " + ex.Message);
                maDataSource.RollBackGlobalTransaction();
                throw ex;
            }
            finally
            {
                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Fin CreerFilmEtSouhait");
            }
        }
Beispiel #56
0
        /// <summary>
        /// UpdateJeu
        /// </summary>
        /// <returns>int</returns>
        public int UpdateJeu(Jeu pJeu)
        {
            Log.MonitoringLogger().Info(KS_NOM_MODULE + "Début UpdateJeu");

            int result = -1;
            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            try
            {
                maDataSource.StartGlobalTransaction();

                pJeu.Developpeur = CreerDeveloppeur(maDataSource, pJeu.Developpeur.Nom);
                pJeu.Editeur = CreerEditeur(maDataSource, pJeu.Editeur.Nom);

                result = maDataSource.ExecuterDML(REQUETE_MODIFICATION_JEU, false, pJeu.LaMachine.Code,
                   pJeu.Synopsys, pJeu.Developpeur.Code, pJeu.Editeur.Code, pJeu.NbJoueurs, pJeu.Code);

                if (result == 1)
                {
                    result = maDataSource.ExecuterDML(REQUETE_MODIFICATION_MEDIA, false, pJeu.Titre,
                        pJeu.LeGenre.Code, pJeu.DateSortie, pJeu.Photo, pJeu.UrlFiche, pJeu.PEGI, pJeu.Note, pJeu.Code);
                }

                if (result == 1)
                {
                    maDataSource.CommitGlobalTransaction();
                }
                else
                {
                    maDataSource.RollBackGlobalTransaction();
                }

                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Enregistrement du jeu OK");

            }
            catch (Exception ex)
            {
                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Erreur = " + ex.Message);
                maDataSource.RollBackGlobalTransaction();
                throw ex;
            }
            finally
            {
                Log.MonitoringLogger().Info(KS_NOM_MODULE + "Fin UpdateJeu");
            }

            return result;
        }
Beispiel #57
0
        /// <summary>
        /// ObtenirListeFilms
        /// </summary>
        /// <returns>Liste films</returns>
        public List<Film> ObtenirListeFilms()
        {
            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            return maDataSource.ExecuterRequeteList<Film>(REQUETE_OBTENIR_LISTE_FILMS, new FilmRowMapper(), false, null);
        }
        /// <summary>
        /// ObtenirProprietaire
        /// </summary>
        /// <returns>Le proprietaire</returns>
        public int DeleteProprietaire(Guid pCode)
        {

            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            return maDataSource.ExecuterDML(REQUETE_SUPPRIMER_PROPRIETAIRE, false, pCode);

        }
 public CustomTableView()
 {
     RegisterClassForCellReuse(typeof(CustomTableViewCell), MyCellId);
     Source = new CustomDataSource();
 }