Exemple #1
0
        void DoSave(object parameter)
        {
            var ctl = parameter as ContentControl;
            var o   = ctl.Content as BaseObjDto;

            if (o.Id == 0)
            {
                BaseObj objNew = null;
                objNew = ObjFromDto(o, objNew);
                _bll.Add(objNew);
            }
            else
            {
                var objExisting = _bll.GetItemById(o.Id);
                ModuleAModule.TheMapper.Map(o, objExisting);
            }
            _bll.Flush();

            _bll = _container.Resolve <IBLL>(new ResolverOverride[]
            {
                new ParameterOverride("filePath", StoragePath)
            });
            var lst = _bll.GetFiltered("", 10, _currentOffset);

            PopulateFilteredList(lst);
        }
Exemple #2
0
        public bool Upload()
        {
            try
            {
                string cookies = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string;
                string session = Session.SessionID.ToString();
                if (!cookies.Equals(session))
                {
                    return(false);//身份验证失败
                }
                MLogin.GetExeUname();
                System.Web.HttpContext.Current.Response.ContentType = "image/jpeg";
                //var file = System.Web.HttpContext.Current.Request.Files[0];
                //if(file.FileName == "")
                //{
                //    return "filename为空!";
                //}
                string result  = null;
                string result2 = null;
                result  = System.Web.HttpContext.Current.Request["value1"];
                result2 = System.Web.HttpContext.Current.Request["value2"];

                HttpPostedFile f         = System.Web.HttpContext.Current.Request.Files[0];
                Random         rad       = new Random();          //实例化随机数产生器rad;
                int            value     = rad.Next(1000, 10000); //用rad生成大于等于1000,小于等于9999的随机数;
                string         file_name = System.DateTime.Now.ToString("yyyyMMddHHmmss") + "_" + result + "_" + value.ToString() + ".jpg";

                // f.SaveAs(Server.MapPath(file_name));

                byte[] bytes = StreamToBytes(f.InputStream);

                //将需要存储的图片读取为数据流
                // FileStream fileStream = new FileStream(Server.MapPath(file_name), FileMode.Open, FileAccess.Read);
                //BinaryReader binaryReader = new BinaryReader(fileStream);
                //byte[] res = binaryReader.ReadBytes(Convert.ToInt32(fileStream.Length));
                //binaryReader.Close();
                //fileStream.Close();
                IBLL.售后附件(bytes, file_name, result2, result);
                return(true);
                // return string.IsNullOrEmpty(result) ? "" : result;
            }
            catch (Exception ex)
            {
                return(false);
            }

            //Stream s = System.Web.HttpContext.Current.Request.InputStream;
            //byte[] b = new byte[s.Length];
            //s.Read(b, 0, (int)s.Length);
            //Encoding.UTF8.GetString(b);

            //string cookies = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string;
            //string session = Session.SessionID.ToString();
            //if (!cookies.Equals(session))
            //{
            //    return null;//身份验证失败
            //}
            //MLogin.GetExeUname();
        }
 public void SetUp()
 {
     _searcher      = new Searcher();
     _bll           = new BLL(_searcher);
     _db            = new DatabaseService(new SqlStoreDatabaseFactory());
     itemGroupName  = "Step10ItemGroup";
     itemName       = "Step10Item";
     storesectionID = (int)_db.TableStoreSection.CreateStoreSection("Step10StoreSection", 100, 100, 1);
     _db.TableItemSectionPlacement.PlaceItem(_db.TableItem.CreateItem(itemName, _db.TableItemGroup.CreateItemGroup(itemGroupName)), storesectionID);
 }
Exemple #4
0
 public DriversViewModel(INavigationService navigationService, IBLL bLL) : base(navigationService)
 {
     Title = "Liste des pilotes";
     _BLL  = bLL;
     //MessagingCenter.Subscribe<SeasonsViewModel, DriversViewModel>(this, "IsDark", // essai implementation messaging center
     //    (ViewModelBase, IsDark) =>
     //    {
     //        Console.WriteLine(IsDark);
     //    });
     Console.WriteLine(IsDark); // Ouput false but switch is true on parent page binded with two way to view model base property
 }
Exemple #5
0
        private void LoadBLL()
        {
            // Database substitute returns table substitutes
            _db.TableItem.Returns(_tableItem);
            _db.TableFloorplan.Returns(_tableFloorplan);
            _db.TableItemGroup.Returns(_tableItemGroup);
            _db.TableItemSectionPlacement.Returns(_tablePlacement);
            _db.TableStoreSection.Returns(_tableStoreSection);

            // Creates uut
            _uut = new BLL(_searcher, _db);
        }
Exemple #6
0
        void OpenStorage(object parameter)
        {
            var openFileDialog = new OpenFileDialog();
            var b = openFileDialog.ShowDialog();

            if (b.HasValue && b.Value)
            {
                _currentOffset = 0;
                StoragePath    = openFileDialog.FileName;
                _bll           = _container.Resolve <IBLL>(new ResolverOverride[]
                {
                    new ParameterOverride("filePath", StoragePath)
                });
                var lst = _bll.GetFiltered("", 10, _currentOffset);
                PopulateFilteredList(lst);
            }
        }
Exemple #7
0
        public ActionResult Index()
        {
            //IUnityContainer container = new UnityContainer();
            //container.LoadConfiguration();
            //var context = container.Resolve<IUserRepository>();
            IBLL BLL = BLLGetter.GetBLL();

            Result <IEnumerable <IUser> > result = BLL.GetAllUsers();

            if (result.success)
            {
                return(View(result.ResultData));
            }
            else
            {
                return(View("Error", result.message));
            }
        }
Exemple #8
0
        public SeasonsViewModel(INavigationService navigationService, IBLL bLL, IDeviceService deviceService)
            : base(navigationService)
        {
            Title              = "Choisissez une année";
            _deviceService     = deviceService;
            _navigationService = navigationService;
            //GoToDrivers = new DelegateCommand(GoToDriversMethod);
            GoToDriverPageCommande = new AsyncCommand(GoToDriversMethod, o => CanExecute(o), async exception => {
                // Handle exceptions if no season is selected
                Console.WriteLine(exception);

                // Alert the user
                await Application.Current.MainPage.DisplayAlert(
                    "Saison invalide",
                    "Vous devez choisir une saison !",
                    "OK");
            });
            _BLL = bLL;
            this.GetAllSeasons();
            this.GetPlatform();
        }
Exemple #9
0
        public MainWindowVM()
        {
            StoragePath = @"c:\tmp\1";
            _bll        = _container.Resolve <IBLL>(new ResolverOverride[]
            {
                new ParameterOverride("filePath", StoragePath)
            });
            var lst = _bll.GetFiltered();

            PopulateFilteredList(lst);

            SearchCommand        = new RelayCommand(DoSearch);
            SaveCommand          = new RelayCommand(DoSave);
            CancelCommand        = new RelayCommand(DoCancel);
            AddNoteCommand       = new RelayCommand(DoAddNote);
            AddWebUrlCommand     = new RelayCommand(DoAddWebUrl);
            AddCreditCardCommand = new RelayCommand(DoAddCreditCard);
            PrevCommand          = new RelayCommand(GetPrev);
            NextCommand          = new RelayCommand(GetNext);
            OpenCommand          = new RelayCommand(OpenStorage);
        }
Exemple #10
0
        public void TestDelete()
        {
            _bll = GetBLL();
            _bll.Add(new Note
            {
                Name    = "qqq",
                Content = "demo 1"
            });
            _bll.Add(new Note
            {
                Name    = "www",
                Content = "demo 2"
            });
            _bll.Add(new WebAcc
            {
                Name = "www",
                Url  = "www.jdpa.com"
            });
            _bll.Add(new CreditCard
            {
                Name   = "Visa",
                Number = "1111 2222 3333 demo"
            });
            _bll.Add(new CreditCard
            {
                Name    = "Amex",
                Number  = "4444 5555 3333 7777",
                ExpDate = DateTime.UtcNow
            });
            _bll.Flush();

            var bll2 = GetBLL();

            bll2.DeleteById(4);
            var cc2 = bll2.GetItemById(4);

            Assert.IsNull(cc2);
            File.Delete(StoragePath);
        }
Exemple #11
0
        public void TestSearch()
        {
            _bll = GetBLL();
            _bll.Add(new Note
            {
                Name    = "qqq",
                Content = "demo 1"
            });
            _bll.Add(new Note
            {
                Name    = "www",
                Content = "demo 2"
            });
            _bll.Add(new WebAcc
            {
                Name = "www",
                Url  = "www.jdpa.com"
            });
            _bll.Add(new CreditCard
            {
                Name   = "Visa",
                Number = "1111 2222 3333 demo"
            });
            _bll.Add(new CreditCard
            {
                Name    = "Amex",
                Number  = "4444 5555 3333 7777",
                ExpDate = DateTime.UtcNow
            });
            _bll.Flush();

            var bll2 = GetBLL();
            var col2 = new List <BaseObj>(bll2.GetFiltered("ww"));

            Assert.IsTrue(col2.Count == 2);
            File.Delete(StoragePath);
        }
 public UserManagerController(IBLL.UsersIBLL iuserbll,IBLL.RolesIBLL irolebll,IBLL.UserRoleIBLL urbll)
 {
     userbll = iuserbll;
     rolebll = irolebll;
     userolebll = urbll;
 }
Exemple #13
0
 public HomeController(IBLL.UsersIBLL ubll)
 {
     userbll = ubll;
 }
 public void SetUp()
 {
     _searcher = Substitute.For <ISearcher>();
     _BLL      = new BLL(_searcher);
 }
Exemple #15
0
 public HomeController(IBLL.IPersonBLL personBLL)
 {
     personbll = personBLL;
 }
Exemple #16
0
 public Customer()
 {
     customerBLL = (IBLL)WinClient.ApplicationContext["CustomerBLL"];
 }
Exemple #17
0
 public RobotHandler(IBLL businessInterface, ILogWriter logWriter)
 {
     _businessInterface = businessInterface;
     _log = logWriter;
 }
            public bool ShowUseMethod()
            {
                TestID model = new TestID();

                TestID[] models = new TestID[] { };
                int      id     = 0;

                string where = string.Empty;
                KeyObject[] kos = new KeyObject[] { };
                int         top = 0;

                KeyBoolean[] kbs    = new KeyBoolean[] { };
                int          pcount = 0;
                int          pindex = 0;
                int          psum   = 0;
                DataSet      ds     = null;
                DataRow      dr     = null;
                string       sort   = string.Empty;

                string[] sqls = new string[] { };

                // BLL
                YTS.BLL.MSSQLServer_IntID <TestID, YTS.DAL.MSSQLServer_IntID <TestID> > bll = new YTS.BLL.MSSQLServer_IntID <TestID, YTS.DAL.MSSQLServer_IntID <TestID> >();
                bll.Insert(model);
                bll.Insert(models);
                bll.Delete(where);
                bll.Update(kos, where);
                bll.Select(top, where, kbs);
                bll.Select(pcount, pindex, out psum, where, kbs);
                bll.GetRecordCount(where);
                bll.GetModel(where, kbs);
                bll.GetTableName();
                bll.QueryRecords(top, where, sort);
                bll.QueryRecords(pcount, pindex, out psum, where, sort);
                bll.DataRowToModel(dr);
                bll.DataSetToModels(ds);
                bll.IDInsert(model, out id);
                bll.IDDelete(id);
                bll.IDUpdate(kos, id);
                bll.IDGetModel(id);

                BLL_MSSQLServer <TestID, YTS.DAL.MSSQLServer_IntID <TestID> > ms_bll = bll;

                ms_bll.Insert(model);
                ms_bll.Insert(models);
                ms_bll.Delete(where);
                ms_bll.Update(kos, where);
                ms_bll.Select(top, where, kbs);
                ms_bll.Select(pcount, pindex, out psum, where, kbs);
                ms_bll.GetRecordCount(where);
                ms_bll.GetModel(where, kbs);
                ms_bll.GetTableName();
                ms_bll.QueryRecords(top, where, sort);
                ms_bll.QueryRecords(pcount, pindex, out psum, where, sort);
                ms_bll.DataRowToModel(dr);
                ms_bll.DataSetToModels(ds);

                AbsBLL <TestID, YTS.DAL.MSSQLServer_IntID <TestID>, string, ColumnModelParser <TestID>, ColumnInfo> abs_bll = ms_bll;

                abs_bll.Insert(model);
                abs_bll.Insert(models);
                abs_bll.Delete(where);
                abs_bll.Update(kos, where);
                abs_bll.Select(top, where, kbs);
                abs_bll.Select(pcount, pindex, out psum, where, kbs);
                abs_bll.GetRecordCount(where);
                abs_bll.GetModel(where, kbs);

                AbsBLL_OnlyQuery <TestID, YTS.DAL.MSSQLServer_IntID <TestID>, string, ColumnModelParser <TestID>, ColumnInfo> abs_bll_onlquery = abs_bll;

                abs_bll_onlquery.Select(top, where, kbs);
                abs_bll_onlquery.Select(pcount, pindex, out psum, where, kbs);
                abs_bll_onlquery.GetRecordCount(where);
                abs_bll_onlquery.GetModel(where, kbs);

                IBLL <TestID, YTS.DAL.MSSQLServer_IntID <TestID>, string, ColumnModelParser <TestID>, ColumnInfo> i_bll = ms_bll;

                i_bll.Insert(model);
                i_bll.Insert(models);
                i_bll.Delete(where);
                i_bll.Update(kos, where);
                i_bll.Select(top, where, kbs);
                i_bll.Select(pcount, pindex, out psum, where, kbs);
                i_bll.GetRecordCount(where);
                i_bll.GetModel(where, kbs);

                IBLL_OnlyQuery <TestID, YTS.DAL.MSSQLServer_IntID <TestID>, string, ColumnModelParser <TestID>, ColumnInfo> i_bll_onlyquery = abs_bll_onlquery;

                i_bll_onlyquery.Select(top, where, kbs);
                i_bll_onlyquery.Select(pcount, pindex, out psum, where, kbs);
                i_bll_onlyquery.GetRecordCount(where);
                i_bll_onlyquery.GetModel(where, kbs);


                // DAL
                YTS.DAL.MSSQLServer_IntID <TestID> dal = bll.SelfDAL;
                dal.Insert(model);
                dal.Insert(models);
                dal.Delete(where);
                dal.Update(kos, where);
                dal.Select(top, where, kbs);
                dal.Select(pcount, pindex, out psum, where, kbs);
                dal.GetRecordCount(where);
                dal.GetModel(where, kbs);
                dal.GetTableName();
                dal.QueryRecords(top, where, sort);
                dal.QueryRecords(pcount, pindex, out psum, where, sort);
                dal.DataRowToModel(dr);
                dal.DataSetToModels(ds);
                dal.IsNeedSupplementary();
                dal.ExecutionSupplementary();
                dal.IDInsert(model, out id);
                dal.IDDelete(id);
                dal.IDUpdate(kos, id);
                dal.IDGetModel(id);
                dal.Transaction(sqls);

                DAL_MSSQLServer <TestID> ms_dal = dal;

                ms_dal.Insert(model);
                ms_dal.Insert(models);
                ms_dal.Delete(where);
                ms_dal.Update(kos, where);
                ms_dal.Select(top, where, kbs);
                ms_dal.Select(pcount, pindex, out psum, where, kbs);
                ms_dal.GetRecordCount(where);
                ms_dal.GetModel(where, kbs);
                ms_dal.GetTableName();
                ms_dal.QueryRecords(top, where, sort);
                ms_dal.QueryRecords(pcount, pindex, out psum, where, sort);
                ms_dal.DataRowToModel(dr);
                ms_dal.DataSetToModels(ds);
                ms_dal.IsNeedSupplementary();
                ms_dal.ExecutionSupplementary();
                ms_dal.Transaction(sqls);

                AbsDAL <TestID, string, ColumnModelParser <TestID>, ColumnInfo> abs_dal = ms_dal;

                abs_dal.Insert(model);
                abs_dal.Insert(models);
                abs_dal.Delete(where);
                abs_dal.Update(kos, where);
                abs_dal.Select(top, where, kbs);
                abs_dal.Select(pcount, pindex, out psum, where, kbs);
                abs_dal.GetRecordCount(where);
                abs_dal.GetModel(where, kbs);

                AbsDAL_OnlyQuery <TestID, string, ColumnModelParser <TestID>, ColumnInfo> abs_dal_onlyquery = abs_dal;

                abs_dal_onlyquery.Select(top, where, kbs);
                abs_dal_onlyquery.Select(pcount, pindex, out psum, where, kbs);
                abs_dal_onlyquery.GetRecordCount(where);
                abs_dal_onlyquery.GetModel(where, kbs);

                IDAL <TestID, string, ColumnModelParser <TestID>, ColumnInfo> i_dal = abs_dal;

                i_dal.Insert(model);
                i_dal.Insert(models);
                i_dal.Delete(where);
                i_dal.Update(kos, where);
                i_dal.Select(top, where, kbs);
                i_dal.Select(pcount, pindex, out psum, where, kbs);
                i_dal.GetRecordCount(where);
                i_dal.GetModel(where, kbs);

                IDAL_OnlyQuery <TestID, string, ColumnModelParser <TestID>, ColumnInfo> i_dal_onlyquery = i_dal;

                i_dal_onlyquery.Select(top, where, kbs);
                i_dal_onlyquery.Select(pcount, pindex, out psum, where, kbs);
                i_dal_onlyquery.GetRecordCount(where);
                i_dal_onlyquery.GetModel(where, kbs);

                return(true);
            }
Exemple #19
0
 public Driver()
 {
     driverBLL = (IBLL)WinClient.ApplicationContext["DriverBLL"];
 }
Exemple #20
0
 public void SetUp()
 {
     _bll = Substitute.For <IBLL>();
     _uut = new HomeController(_bll);
 }
Exemple #21
0
 public Customer()
 {
     customerBLL = (IBLL) WinClient.ApplicationContext["CustomerBLL"];
 }
Exemple #22
0
 public Logic()
 {
     Entity.Helpers.Logger.InitLogger();
     Code = AuctionResolver.GetBll();
 }
Exemple #23
0
 public PL()
 {
     _dbConnect = new BLL.Bridges.BLL();
 }
Exemple #24
0
 public Employee()
 {
     employeeBLL = (IBLL)WinClient.ApplicationContext["EmployeeBLL"];
 }
 public UsersController(IBLL.IUsersBLL _UsersBLL)
 {
     UsersBLL = _UsersBLL;
 }
Exemple #26
0
 public HomeController()
 {
     _bll   = new BLL(new Searcher());
     _model = new Model();
 }
Exemple #27
0
 public HomeController(IBLL bll)
 {
     _bll   = bll;
     _model = new Model();
 }
 public RoleManagerController(IBLL.RolesIBLL bll,IBLL.MenuIBLL mbll,IBLL.FunctionIBLL fuctionBll)
 {
     rolebll = bll;
     iMbll = mbll;
     fBll = fuctionBll;
 }
Exemple #29
0
 /// <summary>
 /// Create a new instance of repository
 /// </summary>
 /// <param name="unitOfWork">Associated Unit Of Work</param>
 public Repository(IBLL unitOfWork)
 {
     _UnitOfWork = unitOfWork;
 }
Exemple #30
0
 public Service1()
 {
     _bll = new MyBLL(new MyDAL(new InterShopModel()));
 }
Exemple #31
0
 public MenuController(IBLL.MenuIBLL menubll,IBLL.FunctionIBLL fbll)
 {
     imenubll = menubll;
     ifunctionbll = fbll;
 }
 //通过构造函数注入需要使用的业务类
 public LoginController(IBLL.UsersIBLL bll)
 {
     userbll = bll;
 }