Пример #1
0
        public Form_ShopVerison()
        {
            InitializeComponent();


            ShopID = GlobalParams.ShopID;
            if (ShopID < 0)
            {
                MessageBox.Show("您不属于任何店铺,请联系系统管理员分配您的店铺所属!", "错误!", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                this.Close();
            }
            CarSummery_Client = (CarSummeryClient)ClientFactory.GetClient(ClientType.Type.CarSummery);
            Brand_Client      = (BrandClient)ClientFactory.GetClient(ClientType.Type.Brand);
            Type_Client       = (TypeClient)ClientFactory.GetClient(ClientType.Type.Type);
            Version_Client    = (VersionClient)ClientFactory.GetClient(ClientType.Type.Version);

            List_Brand       = Brand_Client.SelectAllBrands().ToList();
            List_Type        = Type_Client.SelectAllTypes().ToList();
            List_VersionInfo = CarSummery_Client.SelectAllCar().ToList();
            Mark             = false;
            LB_VersionBind();
            CB_BrandBind();
            CB_TypeBind();
            BT_UpdateVersion.Visible = false;
        }
Пример #2
0
        public static void Start()
        {
            if (Navigator.Manager.NotDefined(MethodInfo.GetCurrentMethod()))
            {
                TypeClient.Start();
                QueryClient.Start();
                Navigator.AddSetting(new EntitySettings <UserQueryEntity> {
                    View = _ => new UserQuery(), Icon = ExtensionsImageLoader.GetImageSortName("userQuery.png")
                });
                SearchControl.GetMenuItems += SearchControl_GetCustomMenuItems;
                UserAssetsClient.Start();
                UserAssetsClient.RegisterExportAssertLink <UserQueryEntity>();

                Constructor.Register <UserQueryEntity>(ctx =>
                {
                    MessageBox.Show(Window.GetWindow(ctx.Element),
                                    ChartMessage._0CanOnlyBeCreatedFromTheSearchWindow.NiceToString().FormatWith(typeof(UserQueryEntity).NicePluralName()),
                                    ChartMessage.CreateNew.NiceToString(),
                                    MessageBoxButton.OK, MessageBoxImage.Information);
                    return(null);
                });

                LinksClient.RegisterEntityLinks <Entity>((entity, ctrl) =>
                {
                    if (!UserQueryPermission.ViewUserQuery.IsAuthorized())
                    {
                        return(null);
                    }

                    return(Server.Return((IUserQueryServer us) => us.GetUserQueriesEntity(entity.EntityType))
                           .Select(cp => new UserQueryQuickLink(cp, entity)).ToArray());
                });
            }
        }
Пример #3
0
 public Form_OrderManage()
 {
     InitializeComponent();
     UserManager_Client  = (UserManagerClient)ClientFactory.GetClient(ClientType.Type.UserManager);
     Type_Client         = (TypeClient)ClientFactory.GetClient(ClientType.Type.Type);
     Action_Client       = (ActionClient)ClientFactory.GetClient(ClientType.Type.Action);
     Version_Client      = (VersionClient)ClientFactory.GetClient(ClientType.Type.Version);
     Order_Client        = (OrderClient)ClientFactory.GetClient(ClientType.Type.Order);
     OrderSummery_Client = (OrderSummeryClient)ClientFactory.GetClient(ClientType.Type.OrderSummery);
     ShopID = GlobalParams.ShopID;
     if (ShopID < 0)
     {
         MessageBox.Show("您不属于任何店铺,请联系系统管理员分配您的店铺所属!", "错误!", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
         this.Close();
     }
     else
     {
         List_Version = Version_Client.SelectAllVersions().Where(P => P.Version_Shop == ShopID).ToList();
     }
     List_Action           = Action_Client.SelectAllActions().ToList();
     List_Type             = Type_Client.SelectAllTypes().ToList();
     List_UserEX           = UserManager_Client.SelectUserEXInfo_All().ToList();
     List_User             = UserManager_Client.SelectUserInfo_All().ToList();
     PL_NewUser.Visible    = false;
     PL_UserResult.Visible = false;
     Bind_Action();
     Bind_Type();
     Bind_Version();
 }
Пример #4
0
 public Form_CarTypeManage()
 {
     InitializeComponent();
     Type_Client = (TypeClient)ClientFactory.GetClient(ClientType.Type.Type);
     Bind_Type();
     BT_UpdateType.Visible = false;
     Mark = false;
 }
Пример #5
0
 public Client(TypeClient type, int id, string name, string document, double loanLimit, double availableLoanLimit)
 {
     Type               = type;
     Id                 = id;
     Name               = name;
     Document           = document;
     LoanLimit          = loanLimit;
     AvailableLoanLimit = availableLoanLimit;
 }
Пример #6
0
 public Client(string name, TypeClient type, string city, string address, string phone, string email, string contact)
 {
     Name    = name;
     Type    = type;
     City    = city;
     Address = address;
     Phone   = phone;
     Email   = email;
     Contact = contact;
 }
        public JsonNetResult TypeAutocomplete(string types, string q, int l)
        {
            var result = TypeClient.ViewableServerTypes()
                         .Where(t => t.CleanName.Contains(q, StringComparison.InvariantCultureIgnoreCase)).
                         Take(l)
                         .Select(o => new AutocompleteResult
            {
                id   = o.Id.ToString(),
                text = o.ToString(),
                type = Navigator.ResolveWebTypeName(o.GetType())
            }).ToList();

            return(this.JsonNet(result));
        }
Пример #8
0
        public static void Start()
        {
            if (Navigator.Manager.NotDefined(MethodInfo.GetCurrentMethod()))
            {
                TypeClient.Start();
                QueryClient.Start();

                Navigator.AddSettings(new List <EntitySettings>()
                {
                    new EntitySettings <UserChartEntity> {
                        View = e => new UserChart(), Icon = ExtensionsImageLoader.GetImageSortName("chartIcon.png")
                    },
                    new EntitySettings <ChartScriptEntity> {
                        View = e => new ChartScript(), Icon = ExtensionsImageLoader.GetImageSortName("chartScript.png")
                    },
                });

                UserAssetsClient.Start();
                UserAssetsClient.RegisterExportAssertLink <UserChartEntity>();

                SearchControl.GetMenuItems += SearchControl_GetCustomMenuItems;

                UserChartEntity.SetConverters(query => QueryClient.GetQueryName(query.Key), queryname => QueryClient.GetQuery(queryname));

                string processName = Path.GetFileName(Process.GetCurrentProcess().MainModule.FileName);

                var main = Registry.CurrentUser
                           .CreateSubKey("Software")
                           .CreateSubKey("Microsoft")
                           .CreateSubKey("Internet Explorer")
                           .CreateSubKey("Main")
                           .CreateSubKey("FeatureControl")
                           .CreateSubKey("FEATURE_BROWSER_EMULATION");

                main.SetValue(processName, 9999, RegistryValueKind.DWord);

                Constructor.Register <UserChartEntity>(ctx =>
                {
                    MessageBox.Show(Window.GetWindow(ctx.Element),
                                    ChartMessage._0CanOnlyBeCreatedFromTheChartWindow.NiceToString().FormatWith(typeof(UserChartEntity).NicePluralName()),
                                    ChartMessage.CreateNew.NiceToString(),
                                    MessageBoxButton.OK, MessageBoxImage.Information);
                    return(null);
                });

                LinksClient.RegisterEntityLinks <Entity>((entity, ctrl) =>
                                                         Server.Return((IChartServer us) => us.GetUserChartsEntity(entity.EntityType))
                                                         .Select(cp => new UserChartQuickLink(cp, entity)).ToArray());
            }
        }
Пример #9
0
        private void button_vendeur_Click(object sender, EventArgs e)
        {
            listView_resultat.Items.Clear();
            typeClientChoisi = TypeClient.VENDEUR;



            /*  List<string> villes = (from v in modeleBase.VILLE
            *               select v.NOM_VILLE).ToList();
            *
            *  foreach (string s in villes) Console.WriteLine(s); */


            /*       // Create a new Order object.
             * VILLE ville = new VILLE()
             * {
             *  IDVILLE = 12000,
             *  NOM_VILLE = "Seattle",
             *  CODE_POSTAL = 47500
             *
             * };
             * modeleBase.VILLE.Add(ville);
             *
             *
             *
             * // Submit the change to the database.
             * try
             * {
             *  modeleBase.SaveChanges();
             * }
             * catch (Exception e2)
             * {
             *  Console.WriteLine(e2);
             *  // Make some adjustments.
             *  // ...
             *  // Try again.
             * //     modeleBase.SaveChanges();
             * } */
        }
Пример #10
0
 public Form_VersionManage()
 {
     InitializeComponent();
     Mark = false;
     CarSummery_Client = (CarSummeryClient)ClientFactory.GetClient(ClientType.Type.CarSummery);
     Province_Client   = (ProvinceClient)ClientFactory.GetClient(ClientType.Type.Province);
     City_Client       = (CityClient)ClientFactory.GetClient(ClientType.Type.City);
     Shop_Client       = (ShopClient)ClientFactory.GetClient(ClientType.Type.Shop);
     Brand_Client      = (BrandClient)ClientFactory.GetClient(ClientType.Type.Brand);
     Type_Client       = (TypeClient)ClientFactory.GetClient(ClientType.Type.Type);
     Version_Client    = (VersionClient)ClientFactory.GetClient(ClientType.Type.Version);
     List_VersionInfo  = CarSummery_Client.SelectAllCar().ToList();
     List_Car_Province = Province_Client.SelectAllProvinces().ToList();
     List_City         = City_Client.SelectAllCitys().ToList();
     List_Shop         = Shop_Client.SelectAllShops().ToList();
     List_Brand        = Brand_Client.SelectAllBrands().ToList();
     List_Type         = Type_Client.SelectAllTypes().ToList();
     CB_ProviceBind();
     CB_BrandBind();
     CB_TypeBind();
     BT_UpdateVersion.Visible = false;
 }
Пример #11
0
        public static Client CreateObject(TypeClient type)
        {
            Client obj = null;

            switch (type)
            {
            case TypeClient.NORMAL:
                obj = new ClientNormal();
                break;

            case TypeClient.PREMIUM:
                obj = new ClientPremium();
                break;

            case TypeClient.ASURVEILLER:
                obj = new ClientAsurveiller();
                break;

            default:
                break;
            }

            return(obj);
        }
Пример #12
0
        /// <summary>
        /// 客户端服务实例产生器
        /// </summary>
        /// <param name="type">产生的服务类型</param>
        /// <returns></returns>
        private static object build(ClientType.Type type)
        {
            switch (type)
            {
            case ClientType.Type.Account:
            {
                AccountClient temp = new AccountClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <AccountClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.Action:
            {
                ActionClient temp = new ActionClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <ActionClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.Brand:
            {
                BrandClient temp = new BrandClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <BrandClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.CarSummery:
            {
                CarSummeryClient temp = new CarSummeryClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <CarSummeryClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.Checkout:
            {
                CheckoutClient temp = new CheckoutClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <CheckoutClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.City:
            {
                CityClient temp = new CityClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <CityClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.Order:
            {
                OrderClient temp = new OrderClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <OrderClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.OrderSummery:
            {
                OrderSummeryClient temp = new OrderSummeryClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <OrderSummeryClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.Province:
            {
                ProvinceClient temp = new ProvinceClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <ProvinceClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.RAP:
            {
                RAPClient temp = new RAPClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <RAPClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.Salary:
            {
                SalaryClient temp = new SalaryClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <SalaryClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.SalaryAppend:
            {
                SalaryAppendClient temp = new SalaryAppendClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <SalaryAppendClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.SalaryInfoSummery:
            {
                SalaryInfoSummeryClient          temp  = new SalaryInfoSummeryClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <SalaryInfoSummeryClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.SalaryLog:
            {
                SalaryLogClient temp = new SalaryLogClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <SalaryLogClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.Shop:
            {
                ShopClient temp = new ShopClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <ShopClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.Type:
            {
                TypeClient temp = new TypeClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <TypeClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.Version:
            {
                VersionClient temp = new VersionClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <VersionClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.WorkRAP:
            {
                WorkRAPClient temp = new WorkRAPClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <WorkRAPClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.UserManager:
            {
                UserManagerClient temp = new UserManagerClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <UserManagerClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.UserSummery:
            {
                UserSummeryClient temp = new UserSummeryClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <UserSummeryClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.GetCar:
            {
                GetCarClient temp = new GetCarClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <GetCarClient>(type, temp);
                return(temp);
            }
            }
            ;
            return(null);
        }
Пример #13
0
 private void buttonAcheteur_Click(object sender, EventArgs e)
 {
     listView_resultat.Items.Clear();
     typeClientChoisi = TypeClient.ACHETEUR;
 }
        public int LigneCreate(
            int declarationNo,
            int numeroOrdre,
            string numeroFacture,
            DateTime dateFacture,
            TypeClient typeClient,
            string identifiantClient,
            string nomPrenomClient,
            string adresseClient,
            string numeroAutorisation,
            DateTime dateAutorisation,
            decimal prixVenteHt,
            decimal tauxFodec,
            decimal montantFodec,
            decimal tauxDroitConsommation,
            decimal montantDroitConsommation,
            decimal tauxTva,
            decimal montantTva
            )
        {
            if (Exercice.IsCloturer)
            {
                throw new InvalidOperationException("Exercice est cloturé");
            }

            //charger la declaration
            var declaration = _declarationRepository.GetDeclaration(declarationNo);

            if (declaration == null)
            {
                throw new ApplicationException("Déclaration invalide!");
            }


            // tester si la daclaration est clôturer
            if (declaration.IsCloture)
            {
                throw new InvalidOperationException("Opération invalide [Déclaration est clôturé].");
            }

            var option = new TransactionOptions
            {
                IsolationLevel = IsolationLevel.ReadCommitted,
                Timeout        = TimeSpan.FromSeconds(15)
            };

            using (var scope = new TransactionScope(TransactionScopeOption.Required, option))
            {
                if (string.IsNullOrEmpty(numeroAutorisation))
                {
                    throw new InvalidOperationException(string.Format("Numéro autorisation invalide! [{0}]",
                                                                      numeroFacture));
                }

                if (string.IsNullOrEmpty(numeroFacture))
                {
                    throw new InvalidOperationException(
                              string.Format("Numéro facture invalide! N°Autorisation [{0}]", numeroAutorisation));
                }

                if (string.IsNullOrEmpty(nomPrenomClient))
                {
                    throw new InvalidOperationException(string.Format("Identifiant client invalide! [{0}]",
                                                                      numeroFacture));
                }

                if (string.IsNullOrEmpty(identifiantClient))
                {
                    throw new InvalidOperationException(string.Format("Identifiant client invalide! [{0}]",
                                                                      numeroFacture));
                }

                if (prixVenteHt <= 0)
                {
                    throw new InvalidOperationException(string.Format("Prix de vente HT invalide! [{0}]",
                                                                      numeroFacture));
                }

                if (montantDroitConsommation < 0)
                {
                    throw new InvalidOperationException(string.Format("Montant droit de consommation invalide! [{0}]",
                                                                      numeroFacture));
                }

                if (montantTva < 0)
                {
                    throw new InvalidOperationException(string.Format("Montant tva invalide! [{0}]",
                                                                      numeroFacture));
                }

                if (montantFodec < 0)
                {
                    throw new InvalidOperationException(string.Format("Montant fodec invalide! [{0}]",
                                                                      numeroFacture));
                }

                if (tauxFodec < 0)
                {
                    throw new InvalidOperationException(string.Format("Taux fodec invalide! [{0}]",
                                                                      numeroFacture));
                }

                if (tauxDroitConsommation < 0)
                {
                    throw new InvalidOperationException(string.Format("Taux  droit de consommation invalide! [{0}]",
                                                                      numeroFacture));
                }

                if (tauxTva < 0)
                {
                    throw new InvalidOperationException(string.Format("Taux tva invalide! [{0}]",
                                                                      numeroFacture));
                }

                var ligne = new LigneFc
                {
                    MontantDroitConsommation = montantDroitConsommation,
                    MontantFodec             = montantFodec,
                    MontantTva            = montantTva,
                    SocieteNo             = Societe.Id,
                    PrixVenteHt           = prixVenteHt,
                    TauxDroitConsommation = tauxDroitConsommation,
                    TauxFodec             = tauxFodec,
                    TauxTva            = tauxTva,
                    AdresseClient      = adresseClient,
                    DateAutorisation   = dateAutorisation,
                    DateFacture        = dateFacture,
                    IdentifiantClient  = identifiantClient,
                    NomPrenomClient    = nomPrenomClient,
                    NumeroAutorisation = numeroAutorisation,
                    NumeroFacture      = numeroFacture,
                    TypeClient         = typeClient,
                    DeclarationNo      = declaration.Id,
                    NumeroOrdre        = numeroOrdre
                };
                // create ligne facture en suspension
                var no = _ligneFcRepository.Create(ligne);
                if (no <= 0)
                {
                    throw new ApplicationException("Ajout du ligne facture en suspension invalide!");
                }

                scope.Complete();
                // valeur de retour
                return(no);
            }
        }
Пример #15
0
 public Client(TypeClient type)
 {
     Type = type;
 }
Пример #16
0
 public ClientObs(TypeClient type)
 {
     Type = type;
 }
Пример #17
0
        public static void Start()
        {
            if (Navigator.Manager.NotDefined(MethodInfo.GetCurrentMethod()))
            {
                TypeClient.Start();

                UserAssetsClient.Start();
                UserAssetsClient.RegisterExportAssertLink <DashboardEntity>();

                Navigator.AddSettings(new List <EntitySettings>()
                {
                    new EntitySettings <DashboardEntity>()
                    {
                        View = e => new DashboardEdit(), Icon = ExtensionsImageLoader.GetImageSortName("dashboard.png")
                    },

                    new EntitySettings <ValueUserQueryListPartEntity>()
                    {
                        View = e => new ValueUserQueryListPartEntityEdit()
                    },
                    new EntitySettings <LinkListPartEntity>()
                    {
                        View = e => new LinkListPartEdit()
                    },
                    new EntitySettings <UserQueryPartEntity>()
                    {
                        View = e => new UserQueryPartEdit()
                    },
                    new EntitySettings <UserChartPartEntity>()
                    {
                        View = e => new UserChartPartEdit()
                    }
                });

                PartViews.Add(typeof(UserQueryPartEntity), new PartView
                {
                    ViewControl    = () => new UserQueryPartView(),
                    IsTitleEnabled = () => Navigator.IsNavigable(typeof(UserQueryEntity), true),
                    OnTitleClick   = part =>
                    {
                        Navigator.Navigate(((UserQueryPartEntity)part).UserQuery);
                    },
                    FullScreen = (elem, part) =>
                    {
                        UserQueryClient.Explore(((UserQueryPartEntity)part).UserQuery, UserAssetsClient.GetCurrentEntity(elem));
                    }
                });

                PartViews.Add(typeof(UserChartPartEntity), new PartView
                {
                    ViewControl    = () => new UserChartPartView(),
                    IsTitleEnabled = () => Navigator.IsNavigable(typeof(UserChartEntity), true),
                    OnTitleClick   = part =>
                    {
                        Navigator.Navigate(((UserChartPartEntity)part).UserChart);
                    },
                    FullScreen = (elem, part) =>
                    {
                        ChartClient.View(((UserChartPartEntity)part).UserChart, UserAssetsClient.GetCurrentEntity(elem));
                    }
                });

                PartViews.Add(typeof(ValueUserQueryListPartEntity), new PartView
                {
                    ViewControl = () => new CountSearchControlPartView()
                });

                PartViews.Add(typeof(LinkListPartEntity), new PartView
                {
                    ViewControl = () => new LinkListPartView()
                });

                LinksClient.RegisterEntityLinks <DashboardEntity>((cp, ctrl) => new[]
                {
                    new QuickLinkAction(DashboardMessage.Preview, () => Navigate(cp, null))
                    {
                        IsVisible = DashboardPermission.ViewDashboard.IsAuthorized()
                    }
                });

                LinksClient.RegisterEntityLinks <Entity>((entity, ctrl) =>
                {
                    if (!DashboardPermission.ViewDashboard.IsAuthorized())
                    {
                        return(null);
                    }

                    return(Server.Return((IDashboardServer us) => us.GetDashboardsEntity(entity.EntityType))
                           .Select(cp => new DashboardQuickLink(cp, entity)).ToArray());
                });

                Navigator.Manager.OnGetEmbeddedWigets += (e, ctx) =>
                {
                    if (!DashboardPermission.ViewDashboard.IsAuthorized() || !(e is Entity))
                    {
                        return(null);
                    }

                    var dashboard = Server.Return((IDashboardServer s) => s.GetEmbeddedDashboard(e.GetType()));
                    if (dashboard == null)
                    {
                        return(null);
                    }

                    var control = new DashboardView {
                        DataContext = dashboard
                    }.Set(UserAssetsClient.CurrentEntityProperty, e);

                    return(new EmbeddedWidget
                    {
                        Control = control,
                        Position = dashboard.EmbeddedInEntity.Value == DashboardEmbedededInEntity.Top ? EmbeddedWidgetPostion.Top:
                                   dashboard.EmbeddedInEntity.Value == DashboardEmbedededInEntity.Bottom ? EmbeddedWidgetPostion.Bottom:
                                   throw new InvalidOperationException("Unexpected")
                    });
                };
            }
Пример #18
0
 IEnumerable <Lite <Entity> > EntityType_AutoCompleting(string text)
 {
     return(TypeClient.ViewableServerTypes().Where(t => t.CleanName.Contains(text, StringComparison.InvariantCultureIgnoreCase)).Select(t => t.ToLite()).Take(5));
 }
        // modifier ligne declaration
        public void UpdateLigne(
            int ligneNo,
            string numeroAutorisation,
            string numeroFacture,
            DateTime dateFacture,
            DateTime dateAutorisation,
            TypeClient typeIdentifiantClient,
            string identifiant,
            string nomPrenomClient,
            decimal montantFodec,
            decimal montantTva,
            decimal prixHorsTaxe,
            decimal montantConsommation,
            decimal tauxDroitConsommation,
            decimal tauxFodec,
            decimal tauxTva)
        {
            // tester si le l'exercice est cloturé
            if (Exercice.IsCloturer)
            {
                throw new InvalidOperationException("Exercice est cloturé");
            }
            if (prixHorsTaxe <= 0)
            {
                throw new InvalidOperationException(string.Format("Montant tva invalide!"));
            }

            if (montantConsommation < 0)
            {
                throw new InvalidOperationException(string.Format("Montant droit de consommation invalide! "));
            }

            if (montantTva < 0)
            {
                throw new InvalidOperationException(string.Format("Montant tva invalide!"));
            }

            if (montantFodec < 0)
            {
                throw new InvalidOperationException(string.Format("Montant fodec invalide! "));
            }

            if (tauxFodec < 0)
            {
                throw new InvalidOperationException(string.Format("Taux fodec invalide! "));
            }

            if (tauxDroitConsommation < 0)
            {
                throw new InvalidOperationException(string.Format("Taux  droit de consommation invalide!"));
            }

            if (tauxTva < 0)
            {
                throw new InvalidOperationException(string.Format("Taux tva invalide!"));
            }
            try
            {
                var option = new TransactionOptions
                {
                    IsolationLevel = IsolationLevel.ReadCommitted,
                    Timeout        = TimeSpan.FromSeconds(15)
                };
                using (var scope = new TransactionScope(TransactionScopeOption.Required, option))
                {
                    // charger la ligne declaration
                    var ligne = _ligneFcRepository.Get(ligneNo);
                    if (ligne == null)
                    {
                        throw new ArgumentNullException("ligne");
                    }
                    var declaration = _declarationRepository.GetDeclaration(ligne.DeclarationNo);
                    if (declaration == null)
                    {
                        throw new InvalidOperationException("Declaration invalide!");
                    }
                    ligne.NumeroAutorisation       = numeroAutorisation;
                    ligne.DateFacture              = dateFacture;
                    ligne.NumeroFacture            = numeroFacture;
                    ligne.IdentifiantClient        = identifiant;
                    ligne.TypeClient               = typeIdentifiantClient;
                    ligne.NomPrenomClient          = nomPrenomClient;
                    ligne.MontantTva               = montantTva;
                    ligne.MontantFodec             = montantFodec;
                    ligne.PrixVenteHt              = prixHorsTaxe;
                    ligne.MontantDroitConsommation = montantConsommation;
                    ligne.TauxDroitConsommation    = tauxDroitConsommation;
                    ligne.TauxFodec        = tauxFodec;
                    ligne.TauxTva          = tauxTva;
                    ligne.DateAutorisation = dateAutorisation;
                    // update ligne declaration
                    _ligneFcRepository.Update(ligne);
                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #20
0
        private void btnModifier_Click(object sender, EventArgs e)
        {
            int    codeParametrage = Convert.ToInt32(textcode.Text.Trim());
            string libelle         = textlibelle.Text.Trim();

            //
            // Modifier Livreur
            //
            if (LibelleForm.libelle == "Livreur")
            {
                Livreur liv = db.Livreurs.ToList <DAL.Livreur>().Where(w => w.CodeLivreur == codeParametrage).FirstOrDefault();
                if (liv == null)
                {
                    MessageBox.Show("Enregistrement n'existe pas", codeParametrage.ToString() + " " + libelle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    liv.Libelle = libelle;
                    GenericRepository <Livreur> livr = new GenericRepository <Livreur>(db);
                    livr.Update(liv);
                    MessageBox.Show("Enregistrement modifié avec succès", codeParametrage.ToString() + " " + libelle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            //
            //Modifier Moyen de Transport
            //
            if (LibelleForm.libelle == "Moyen de Transport")
            {
                MoyenTransport moy = db.MoyenTransports.ToList <DAL.MoyenTransport>().Where(w => w.CodeMoyenTransport == codeParametrage).FirstOrDefault();
                if (moy == null)
                {
                    MessageBox.Show("Enregistrement n'existe pas", codeParametrage.ToString() + " " + libelle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    moy.Libelle = libelle;
                    GenericRepository <MoyenTransport> Moys = new GenericRepository <MoyenTransport>(db);
                    Moys.Update(moy);
                    MessageBox.Show("Enregistrement modifié avec succès", codeParametrage.ToString() + " " + libelle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            //
            //Modifier Banque
            //

            if (LibelleForm.libelle == "Banque")
            {
                Banque ban = db.Banques.ToList <DAL.Banque>().Where(w => w.CodeBanque == codeParametrage).FirstOrDefault();
                if (ban == null)
                {
                    MessageBox.Show("Enregistrementn'existe pas", codeParametrage.ToString() + " " + libelle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    ban.Libelle = libelle;
                    GenericRepository <Banque> banques = new GenericRepository <Banque>(db);
                    banques.Update(ban);
                    MessageBox.Show("Enregistrement modifié avec succès", codeParametrage.ToString() + " " + libelle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            //
            //Modifier Mode de Réglements
            //
            if (LibelleForm.libelle == "Mode de Réglement")
            {
                ModeReglement mode = db.ModeReglements.ToList <DAL.ModeReglement>().Where(w => w.CodeModeReg == codeParametrage).FirstOrDefault();
                if (mode == null)
                {
                    MessageBox.Show("Enregistrement n'existe pas", codeParametrage.ToString() + " " + libelle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    mode.Libelle = libelle;
                    GenericRepository <ModeReglement> modeReg = new GenericRepository <ModeReglement>(db);
                    modeReg.Update(mode);
                    MessageBox.Show("Enregistrement modifié avec succès", codeParametrage.ToString() + " " + libelle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            //
            //Modifier Type Client
            //
            if (LibelleForm.libelle == "Type Client")
            {
                TypeClient typeCL = db.TypeClients.ToList <DAL.TypeClient>().Where(w => w.CodeTypeClient == codeParametrage).FirstOrDefault();
                if (typeCL == null)
                {
                    MessageBox.Show("Enregistrement n'existe pas", codeParametrage.ToString() + " " + libelle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    typeCL.Libelle = libelle;
                    GenericRepository <TypeClient> typeClient = new GenericRepository <TypeClient>(db);
                    typeClient.Update(typeCL);
                    MessageBox.Show("Enregistrement modifié avec succès", codeParametrage.ToString() + " " + libelle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            //
            //Modifier Familles
            //
            if (LibelleForm.libelle == "Liste Familles")
            {
                Famille fam = db.Familles.ToList <DAL.Famille>().Where(w => w.CodeFamille == codeParametrage).FirstOrDefault();
                if (fam == null)
                {
                    MessageBox.Show("Enregistrement n'existe pas", codeParametrage.ToString() + " " + libelle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    fam.LibelleFamille = libelle;
                    GenericRepository <Famille> fams = new GenericRepository <Famille>(db);
                    fams.Update(fam);
                    MessageBox.Show("Enregistrement modifié avec succès", codeParametrage.ToString() + " " + libelle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            //
            //Modifier Type production
            //
            if (LibelleForm.libelle == "Type de Production")
            {
                TypeProduction pro = db.TypeProductions.ToList <DAL.TypeProduction>().Where(w => w.CodeTypeProd == codeParametrage).FirstOrDefault();
                if (pro == null)
                {
                    MessageBox.Show("Enregistrement n'existe pas", codeParametrage.ToString() + " " + libelle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    pro.Libelle = libelle;
                    GenericRepository <TypeProduction> typeprod = new GenericRepository <TypeProduction>(db);
                    typeprod.Update(pro);
                    MessageBox.Show("Enregistrement modifié avec succès", codeParametrage.ToString() + " " + libelle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            //
            //Modifier Type Comptage
            //
            if (LibelleForm.libelle == "Type de Comptage")
            {
                TypeComptage com = db.TypeComptages.ToList <DAL.TypeComptage>().Where(w => w.CodeTypeCom == codeParametrage).FirstOrDefault();
                if (com == null)
                {
                    MessageBox.Show("Enregistrement n'existe pas", codeParametrage.ToString() + " " + libelle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    com.Libelle = libelle;
                    GenericRepository <TypeComptage> typecom = new GenericRepository <TypeComptage>(db);
                    typecom.Update(com);
                    MessageBox.Show("Enregistrement modifié avec succès", codeParametrage.ToString() + " " + libelle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            //
            //Modifier Colisage
            //
            if (LibelleForm.libelle == "Colisage")
            {
                Colisage col = db.Colisages.ToList <DAL.Colisage>().Where(w => w.CodeColisage == codeParametrage).FirstOrDefault();
                if (col == null)
                {
                    MessageBox.Show("Enregistrement n'existe pas", codeParametrage.ToString() + " " + libelle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    col.Libelle = libelle;
                    GenericRepository <Colisage> cols = new GenericRepository <Colisage>(db);
                    cols.Update(col);
                    MessageBox.Show("Enregistrement modifié avec succès", codeParametrage.ToString() + " " + libelle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            //
            //Modifier Unité
            //
            if (LibelleForm.libelle == "Unité")
            {
                Unite uni = db.Unites.ToList <DAL.Unite>().Where(w => w.CodeUnite == codeParametrage).FirstOrDefault();
                if (uni == null)
                {
                    MessageBox.Show("Enregistrement n'existe pas", codeParametrage.ToString() + " " + libelle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    uni.Libelle = libelle;
                    GenericRepository <Unite> unis = new GenericRepository <Unite>(db);
                    unis.Update(uni);
                    MessageBox.Show("Enregistrement modifié avec succès", codeParametrage.ToString() + " " + libelle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            Clear();
            frmCodeLibelle_Load(sender, e);
        }
Пример #21
0
            }                                       //Сокет

            public ClientInfo(TypeClient typeClient, string name, TcpClient tcpClient)
            {
                TypeClient = typeClient;
                Name       = name;
                TcpClient  = tcpClient;
            }
Пример #22
0
        public static void ExecuteManu(List <Client> clients, List <Account> accounts)
        {
            Console.WriteLine("Main Menu");
            Console.WriteLine();
            Console.WriteLine("1. Register Customer.");
            Console.WriteLine("2. Open Account.");
            Console.WriteLine("3. Deposit.");
            Console.WriteLine("4. Withdraw.");
            Console.WriteLine("5. Loan.");

            Console.WriteLine();
            Console.Write("Option: ");
            int n = int.Parse(Console.ReadLine());

            if (n == 1)
            {
                Console.WriteLine();
                Console.Write("How many customers do you want register? ");
                n = int.Parse(Console.ReadLine());
                for (int i = 1; i <= n; i++)
                {
                    Console.WriteLine();
                    Console.WriteLine($"Customer #{i} data: ");
                    Console.Write("Type: ");
                    TypeClient type = Enum.Parse <TypeClient>(Console.ReadLine());
                    Console.Write("Id: ");
                    int id = int.Parse(Console.ReadLine());
                    Console.Write("Name: ");
                    string name = Console.ReadLine();
                    Console.Write("Document: ");
                    string document = Console.ReadLine();
                    Console.Write("Loan Limit: $ ");
                    double loamLimit = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);
                    clients.Add(new Client(type, id, name, document, loamLimit, loamLimit));
                }
                Console.WriteLine();
                Console.WriteLine("** CUSTOMERS **");
                foreach (Client customer in clients)
                {
                    Console.WriteLine(customer);
                }
            }
            else if (n == 2)
            {
                Console.WriteLine();
                Console.WriteLine("Account Data:");
                Console.Write("Type Account (i-Individual / c-Company): ");
                char type = char.Parse(Console.ReadLine());
                if (type == 'i' || type == 'I')
                {
                    Console.WriteLine();
                    Console.WriteLine("** CUSTOMERS **");
                    foreach (Client customer in clients.FindAll(X => X.Type == TypeClient.Individual))
                    {
                        Console.WriteLine(customer.Id + ", " + customer.Name + ", $ " + customer.AvailableLoanLimit.ToString("F2"));
                    }
                }
                else
                {
                    Console.WriteLine();
                    Console.WriteLine("** CUSTOMERS **");
                    foreach (Client customer in clients.FindAll(X => X.Type == TypeClient.Company))
                    {
                        Console.WriteLine(customer.Id + ", " + customer.Name + ", $ " + customer.AvailableLoanLimit.ToString("F2"));
                    }
                }
                Console.WriteLine();
                Console.Write("Enter the customer id: ");
                int customerId = int.Parse(Console.ReadLine());

                Exceptions.ExceptionsClient(clients, accounts, type, customerId);

                Console.Write("Number Account: ");
                int numberAccount = int.Parse(Console.ReadLine());
                Console.Write("Initial Banlance: $ ");
                double initialBalance = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);
                if (type == 'i' || type == 'I')
                {
                    accounts.Add(new IndividualAccount(numberAccount, clients.Find(x => x.Id == customerId), initialBalance));
                }
                else
                {
                    accounts.Add(new CompanyAccount(numberAccount, clients.Find(x => x.Id == customerId), initialBalance));
                }
                Console.WriteLine();
                foreach (Account account in accounts)
                {
                    Console.WriteLine(account.Number + ", " + account.Holder.Name + ", $ " + account.Balance.ToString("F2"), CultureInfo.InvariantCulture);
                }
            }
            else if (n == 3)
            {
                Console.WriteLine();
                Console.WriteLine("** ACCOUNTS **");
                foreach (Account acc in accounts)
                {
                    Console.WriteLine(acc);
                }

                Console.WriteLine();
                Console.Write("Enter Account Number: ");
                int accountNumber = int.Parse(Console.ReadLine());

                Exceptions.ExceptionsAccount(clients, accounts, accountNumber);

                Console.Write("Deposit amount: $ ");
                double  depositAmount = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);
                Account accDep        = accounts.Find(x => x.Number == accountNumber);
                accDep.Deposit(depositAmount);
                Console.WriteLine();
                Console.WriteLine(accDep);
            }
            else if (n == 4)
            {
                Console.WriteLine();
                Console.WriteLine("** ACCOUNTS **");
                foreach (Account acc in accounts)
                {
                    Console.WriteLine(acc);
                }

                Console.WriteLine();
                Console.Write("Enter Account Number: ");
                int accountNumber = int.Parse(Console.ReadLine());

                Exceptions.ExceptionsAccount(clients, accounts, accountNumber);

                Console.Write("Withdraw amount: $ ");
                double  depositAmount = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);
                Account accWit        = accounts.Find(x => x.Number == accountNumber);
                accWit.WithDraw(depositAmount, withdrawelFee);
                Console.WriteLine();
                Console.WriteLine(accWit);
            }
            else if (n == 5)
            {
                Console.WriteLine();
                Console.WriteLine("** ACCOUNTS **");
                foreach (Account acc in accounts)
                {
                    Console.WriteLine(acc);
                }

                Console.WriteLine();
                Console.Write("Enter Account Number: ");
                int accountNumber = int.Parse(Console.ReadLine());

                Exceptions.ExceptionsAccount(clients, accounts, accountNumber);

                Console.Write("Loan amount: $ ");
                double  depositAmount = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);
                Account accLoan       = accounts.Find(x => x.Number == accountNumber);
                accLoan.Loan(depositAmount, loanFee);
                Console.WriteLine();
                Console.WriteLine(accLoan);
            }

            Console.WriteLine();
            Console.Write("Perform another operation? (s/n): ");
            char ch = char.Parse(Console.ReadLine());

            if (ch == 's' || ch == 'S')
            {
                Console.WriteLine();
                Menu.ExecuteManu(clients, accounts);
            }
            else
            {
                Console.WriteLine("End program...");
                Console.ReadLine();
            }
        }
 private void button_vendeur_Click(object sender, EventArgs e)
 {
     typeClientChoisi    = TypeClient.VENDEUR;
     buttonAcheteur.Font = new Font(buttonAcheteur.Font, FontStyle.Regular);
     buttonVendeur.Font  = new Font(buttonVendeur.Font, FontStyle.Bold);
 }