Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var client = new ClientCode();

            // This way the client code can support the simple leaf
            // components...
            var leaf = new Leaf();

            Console.WriteLine("Client: I get a simple component:");
            client.ClientCompositeCode(leaf);

            // ...as well as the complex composites.
            var tree    = new CompositePattern.Composite();
            var branch1 = new CompositePattern.Composite();

            branch1.Add(new Leaf());
            branch1.Add(new Leaf());
            var branch2 = new CompositePattern.Composite();

            branch2.Add(new Leaf());
            tree.Add(branch1);
            tree.Add(branch2);
            Console.WriteLine("Client: Now I've got a composite tree:");
            client.ClientCompositeCode(tree);

            Console.Write("Client: I don't need to check the components classes even when managing the tree:\n");
            client.ClientCompositeCode2(tree, leaf);
        }
Exemplo n.º 2
0
 public void Refill(List <ClientCode> list, ClientCode selected = null)
 {
     listBox1.DataSource   = null;
     listBox1.DataSource   = list;
     listBox1.SelectedItem = selected;
     EnableButton();
 }
Exemplo n.º 3
0
        private static Type getReportWithClient(string ReportName)
        {
            string strClientCode = "/" + ClientCode.Replace("Star", "");

            if (CustomizedClient != "")
            {
                strClientCode = "/" + CustomizedClient.Replace("Star", "");
            }

            string strNameSpacePath = ReportName;

            if (!ReportName.Contains("SIMELockton"))
            {                                           //comment:Both Howden and HowdenSG using  same path for generating report
                if (strClientCode.Contains("HowdenSG")) // && (ReportName.Contains("DebitNoteRptGeneral")) || ReportName.Contains("Brokerage"))
                {
                    strClientCode = "/Howden";
                }
                if (!ReportName.Contains("Galaxy"))
                {
                    if (!ReportName.Contains(strClientCode))
                    {
                        strNameSpacePath = ReportName.Substring(0, ReportName.LastIndexOf("/")) + strClientCode + ReportName.Substring(ReportName.LastIndexOf("/"));
                    }
                }
            }
            string TypeName = "eProStarReports." + strNameSpacePath.Replace("/", ".");

            return(Type.GetType(TypeName));
        }
Exemplo n.º 4
0
        public ClientCodeRates GetRoomsBillableRate(Room room, ClientCode code)
        {
            SqlServerConnection conn = new SqlServerConnection();
            SqlDataReader       dr   = conn.SqlServerConnect("SELECT bs_idnt, bs_concept, bs_service, bs_amount, bs_description, ISNULL(cr_rate, bs_amount)x FROM Rooms INNER JOIN BillableService ON rm_service=bs_idnt LEFT OUTER JOIN ClientCodesRates ON bs_idnt=cr_service AND cr_code=" + code.Id + " WHERE rm_idnt=" + room.Id);

            if (dr.Read())
            {
                return new ClientCodeRates
                       {
                           Service = new BillableService
                           {
                               Id      = Convert.ToInt64(dr[0]),
                               Concept = new Concept {
                                   Id = Convert.ToInt64(dr[1])
                               },
                               Name        = dr[2].ToString(),
                               Amount      = Convert.ToDouble(dr[3]),
                               Description = dr[4].ToString()
                           },
                           Code   = code,
                           Amount = Convert.ToDouble(dr[5]),
                       }
            }
            ;

            return(new ClientCodeRates());
        }
Exemplo n.º 5
0
        private void ProcessSqlObjectAddCustomClientBegin()
        {
            if (treeView1.SelectedNode.Tag == null || !(treeView1.SelectedNode.Tag is ObjectWithClientSpecific objectAdd) || cbVersions.SelectedItem == null || !(cbVersions.SelectedItem is VersionObjectCounter versionObjectCounter))
            {
                return;
            }

            using var frm = new FCustomClient();
            Program.Settings.PositionLoad(frm);
            frm.Refill(ClientCode.List().Except(objectAdd.ClientCodeList()).ToList());
            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                currentObjectEdited = new ObjectToImport()
                {
                    VersionId     = versionObjectCounter.VersionId,
                    TypeObjectId  = objectAdd.TypeObjectId,
                    ObjectSchema  = objectAdd.ObjectSchema,
                    ObjectName    = objectAdd.ObjectName,
                    ObjectColumn  = objectAdd.ObjectColumn,
                    ObjectDeleted = false,
                    ObjectEmpty   = false,
                    ClientCodeId  = frm.ClientCode.ClientCodeId,
                    ObjectSql     = objectAdd.ObjectSql
                };

                BeginAddSqlObjectUpdateDisplay(EAction.SqlObjectAddCustomClientEnd, $"Ajout d'une implémentation pour {frm.ClientCode.ClientCodeName} de {objectAdd}");
            }

            Program.Settings.PositionSave(frm);
        }
Exemplo n.º 6
0
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            modUpdatePanel.Update();

            int objectID = -1;

            if (Gridview.SelectedDataKey != null)
            {
                objectID = Convert.ToInt16(Gridview.SelectedDataKey.Value.ToString());
            }
            List <ClientCode> selectedObject = _businesscode.GetClients($"WHERE Client_ID = {objectID}");

            if (objectID == -1)
            {
                if (tbName.Text != string.Empty)
                {
                    UserCode LoginUser = (UserCode)Session["authenticatedUser"];
                    UserCode user      = GetCurrentUser(LoginUser.ID);

                    ClientCode newObject = new ClientCode(0, tbName.Text, tbAdress.Text, tbPostalCode.Text, tbCity.Text, tbCountry.Text, tbContactPerson.Text, tbInvoiceInfo.Text, tbKindOfClient.Text, user.ID, DateTime.Now, DateTime.Now);
                    _businesscode.AddClient(newObject);

                    lbError.Text      = "User successfully created";
                    lbError.Visible   = true;
                    lbError.ForeColor = System.Drawing.Color.Green;

                    Load_content();
                    gvUpdatePanel.Update();
                }
                else
                {
                    lbError.Text    = "Please fill in all required fields";
                    lbError.Visible = true;
                }
            }
            else
            {
                if (tbName.Text != string.Empty)
                {
                    UserCode LoginUser = (UserCode)Session["authenticatedUser"];
                    UserCode user      = GetCurrentUser(LoginUser.ID);

                    ClientCode Object = new ClientCode(0, tbName.Text, tbAdress.Text, tbPostalCode.Text, tbCity.Text, tbCountry.Text, tbContactPerson.Text, tbInvoiceInfo.Text, tbKindOfClient.Text, user.ID, DateTime.Now, DateTime.Now);
                    _businesscode.UpdateClient(Object);

                    lbError.Text      = "User successfully updated";
                    lbError.Visible   = true;
                    lbError.ForeColor = System.Drawing.Color.Green;

                    Load_content();
                    gvUpdatePanel.Update();
                }
                else
                {
                    lbError.Text    = "Please fill in all required fields";
                    lbError.Visible = true;
                }
            }
        }
Exemplo n.º 7
0
        public static IEnumerable <ClientCodeRealtion> ConvertGridDataDbEnumerableObject(this DataGrid clientCodeDataGrid, int clientId)
        {
            var selectedList = new List <ClientCodeRealtion>();
            var cac          = ClientsAppContext.GetContextInstance();


            ItemCollection items = clientCodeDataGrid.Items;

            for (int i = 0; i < items.Count; i++)
            {
                var it = items[i];
                ClientCodeRealtion temp = it as ClientCodeRealtion;
                if (temp == null)
                {
                    break;
                }

                if (temp.ClientID == null)
                {
                    temp.ClientID = clientId;
                }

                var code = cac.GetAllCodes().Single(a => string.Equals(temp.Description, a.Description));
                temp.CodeID = code.ID;

                var mycheckbox = clientCodeDataGrid.Columns[4].GetCellContent(it) as CheckBox;
                if (mycheckbox.IsChecked.Value)
                {
                    temp.ToDelete = true;
                }
                selectedList.Add(temp);
            }

            cac.RemoveAllClientCodes(clientId);


            foreach (var ccrs in selectedList)
            {
                if (!ccrs.ToDelete)
                {
                    var temmpClientCode = new ClientCode()
                    {
                        client_ID   = ccrs.ClientID,
                        code_ID     = ccrs.CodeID,
                        CreatedTime = ccrs.AddedClientCodeRelationDate,
                    };
                    cac.AddClientCode(temmpClientCode);
                }
            }

            selectedList.RemoveAll(a => a.ToDelete);


            return(selectedList);
        }
Exemplo n.º 8
0
        static void Main(string[] args)
        {
            // The client code may have some of the subsystem's objects already
            // created. In this case, it might be worthwhile to initialize the
            // Facade with these objects instead of letting the Facade create
            // new instances.
            var subsystem1 = new Subsystem1();
            var subsystem2 = new Subsystem2();

            Facade.Facade facade = new Facade.Facade(subsystem1, subsystem2);
            ClientCode.ClientCodeFacade(facade);
        }
Exemplo n.º 9
0
 public Visit()
 {
     Id           = 0;
     Patient      = new Patient();
     Type         = new VisitType();
     ClientCode   = new ClientCode();
     SchemeNumber = "";
     Barcode      = "";
     MedicoLegal  = new Concept();
     CreatedOn    = DateTime.Now;
     CreatedBy    = new Users();
     Notes        = "";
 }
Exemplo n.º 10
0
        static void Main(string[] args)
        {
            LowHumidityScenario lowHumidityScenarioFactory = new LowHumidityScenario("Кухня");
            StandardScenario    standardFactory            = new StandardScenario("Гостинная");

            ClientCode kitchenCode = new ClientCode(lowHumidityScenarioFactory);

            Console.WriteLine(kitchenCode.HumiditySensor.GetValue());

            ClientCode livingRoomCode = new ClientCode(standardFactory);

            Console.WriteLine(livingRoomCode.HumiditySensor.GetValue());
        }
Exemplo n.º 11
0
            /// <summary>
            /// 其它组件添加客户端代码
            /// </summary>
            /// <param name="code"></param>
            internal static void AddClientCode(ClientCode code)
            {
                ClientCode cache;

                if (clientCodes.TryGetValue(code.Type, out cache))
                {
                    cache.Code             += code.Code;
                    cache.SegmentationCode += code.SegmentationCode;
                }
                else
                {
                    clientCodes.Add(code.Type, code);
                }
            }
Exemplo n.º 12
0
        public static string GetClientTypeString(ClientCode dt)
        {
            string ret;

            switch (dt)
            {
            case ClientCode.CC_MAP_INFO:
                ret = "FSOnMap";
                break;

            default:
                ret = "";
                break;
            }
            return(ret);
        }
Exemplo n.º 13
0
        public FEditBase()
        {
            InitializeComponent();

            cbAuthentification.Items.Clear();
            cbAuthentification.Items.Add("Autentification Windows");
            cbAuthentification.Items.Add("Autentification SQL Server");
            cbAuthentification.SelectedIndex = 0;

            cbClientCode.DataSource = null;
            cbClientCode.DataSource = ClientCode.List();

            FillUiFromObject();

            btOk.Enabled = ControlUI();
        }
Exemplo n.º 14
0
        static void Main(string[] args)
        {
            // The other part of the client code constructs the actual chain.
            var monkey   = new MonkeyHandler();
            var squirrel = new SquirrelHandler();
            var dog      = new DogHandler();

            monkey.SetNext(squirrel).SetNext(dog);

            // The client should be able to send a request to any handler, not
            // just the first one in the chain.
            Console.WriteLine("Chain: Monkey > Squirrel > Dog\n");
            ClientCode.ClientCoRCode(monkey);
            Console.WriteLine();

            Console.WriteLine("Subchain: Squirrel > Dog\n");
            ClientCode.ClientCoRCode(squirrel);
        }
Exemplo n.º 15
0
        public static void Insert(this ClientCodeRealtion cc)
        {
            ClientsAppContext cac = ClientsAppContext.GetContextInstance();

            Code code = cac.GetAllCodes().Single(a => string.Equals(cc.Description, a.Description));



            ClientCode clientcode = new ClientCode()
            {
                client_ID   = cc.ClientID,
                code_ID     = code.ID,
                Description = cc.Description,
                CreatedTime = DateTime.Now,
            };

            cac.AddClientCode(clientcode);
        }
Exemplo n.º 16
0
        private void LstChoice_DoubleClick(object sender, EventArgs e)
        {
            if (lstChoice.SelectedItems.Count == 1 && lstChoice.SelectedItems[0].Tag != null && lstChoice.SelectedItems[0].Tag is ObjectToImport import)
            {
                using var frm = new FChoixImport();
                Program.Settings.PositionLoad(frm);
                frm.SetObjectToImport(import, ClientCode.Name(baseClient.ClientCodeId));
                if (frm.ShowDialog(this) == DialogResult.OK)
                {
                    import.Status = frm.Choix;
                    lstChoice.SelectedItems[0].ForeColor        = (import.Status.IsChoice()) ? Color.Red : import.Status.IsChoice() ? Color.Red : Color.Green;
                    lstChoice.SelectedItems[0].Tag              = import;
                    lstChoice.SelectedItems[0].SubItems[1].Text = import.Status.Libelle();
                    EnableButtons();
                }

                Program.Settings.PositionSave(frm);
            }
        }
Exemplo n.º 17
0
        static void Main(string[] args)
        {
            var client = new ClientCode();

            var simple = new ConcreteComponent();

            Console.WriteLine("Client: I get a simple component:");
            client.ClientDecoratorCode(simple);
            Console.WriteLine();

            // ...as well as decorated ones.
            //
            // Note how decorators can wrap not only simple components but the
            // other decorators as well.
            var decorator1 = new ConcreteDecoratorA(simple);
            var decorator2 = new ConcreteDecoratorB(decorator1);

            Console.WriteLine("Client: Now I've got a decorated component:");
            client.ClientDecoratorCode(decorator2);
        }
Exemplo n.º 18
0
        static void Main(string[] args)
        {
            var poemFactory = new PoemFactory();

            poemFactory.Author    = "Edgar Allan Poe";
            poemFactory.Title     = "The Raven";
            poemFactory.Publisher = "The American Review";

            var researchFactory = new ResearchPaperFactory();

            researchFactory.Author    = "Charles Darwin";
            researchFactory.Title     = "On the Origin of Species";
            researchFactory.Publisher = "John Murray";

            ClientCode internetPortal = new ClientCode();

            Console.WriteLine("Publish POEM!");
            internetPortal.Publish(poemFactory);
            Console.WriteLine("Publish RESEARCH!");
            internetPortal.Publish(researchFactory);
        }
Exemplo n.º 19
0
        private void UpdateData()
        {
            List <int> ListDataIDs = GetSessionDataIDs();

            for (int i = 0; i <= 9; i++)
            {
                string[] input = new string[8];

                for (int i2 = 0; i2 <= 7; i2++)
                {
                    string tbName    = "tbEdit" + i.ToString() + i2.ToString();
                    var    container = Master.FindControl("Body");
                    var    txtBox    = container.FindControl(tbName);

                    switch (i2)
                    {
                    case 0:
                        if (((TextBox)txtBox).Text != "")
                        {
                            input[i2] = _businesscode.BeginUpperCase((((TextBox)txtBox).Text.ToString()));
                        }
                        else
                        {
                            goto track1;
                        }
                        break;

                    case 1:
                        input[i2] = _businesscode.BeginUpperCase((((TextBox)txtBox).Text.ToString()));
                        break;

                    case 2:
                        input[i2] = (((TextBox)txtBox).Text.ToString());
                        break;

                    case 3:
                        input[i2] = _businesscode.BeginUpperCase((((TextBox)txtBox).Text.ToString()));
                        break;

                    case 4:
                        input[i2] = _businesscode.BeginUpperCase((((TextBox)txtBox).Text.ToString()));
                        break;

                    case 5:
                        input[i2] = _businesscode.BeginUpperCase((((TextBox)txtBox).Text.ToString()));
                        break;

                    case 6:
                        input[i2] = (((TextBox)txtBox).Text.ToString());
                        break;

                    case 7:
                        input[i2] = _businesscode.BeginUpperCase((((TextBox)txtBox).Text.ToString()));
                        break;
                    }
                }

                UserCode LoginUser = (UserCode)Session["authenticatedUser"];
                UserCode user      = GetCurrentUser(LoginUser.ID);

                ClientCode client = new ClientCode(0, input[0], input[1], input[2], input[3], input[4], input[5], input[6], input[7], user.ID, DateTime.Now, DateTime.Now);
                _businesscode.UpdateClient(client);
track1:
                continue;
            }
        }
        private void AuthenticateWithServer(string url)
        {
            var initCodeRequest = new ClientCode();

            SendRequest(initCodeRequest);
        }
Exemplo n.º 21
0
    string  GetCmdText(int Step)        //fold00
    {
        AccCode     = AccCode.Trim();
        ClientCode  = ClientCode.Trim();
        CurrencyTag = CurrencyTag.Trim().ToUpper();
        string Result = " exec  dbo.Mega_Extract";

        switch (Step)
        {
        case    1: {
            Result += ";1  "
                      + "   @DateFrom=" + DateFrom.ToString()
                      + " , @DateInto=" + DateInto.ToString()
                      + " , @OverMode=" + (OverMode & 3).ToString()
                      + " , @OverDate=" + DateInto.ToString()
                      + " , @FlgTag=" + ((CurrencyTag == "") ? "0" : "1")
                      + " , @CbMode=" + ((CbMode) ? "2" : "1")
                      + " , @UserId=" + UserId.ToString()
                      + " , @ClientCode='" + ClientCode + "'"
                      + " , @BranchId=" + BranchId.ToString()
                      + " , @GroupId=" + GroupId.ToString()
                      + " , @AmountCode='" + __.GetCodeByMoniker(AccCode) + "%'"
                      + " , @CurrencyTag='" + ((CurrencyTag == "UAH") ? "" : CurrencyTag) + "'"
                      + " , @AllAmounts=" + ((AllAmounts) ? "1" : "0")
                      + " , @AmountMode= 0 , @IsExpected=0 "
            ;
            break;
        }

        case    2: {
            Result += ";4  "
                      + "   @DateFrom=" + DateFrom.ToString()
                      + " , @DateInto=" + DateInto.ToString()
                      + " , @OverMode=" + (OverMode & 3).ToString()
                      + " , @OverDate=" + DateInto.ToString()
                      + " , @AmountId=" + Accounts_ExtId.ToString()
                      + " , @ShowSubRate=1 , @Mode=1 , @Depth=1 "
            ;
            break;
        }

        case    3: {
            int Date = Amounts_LastDate;
            if (__.Month(Date) < __.Month(DateFrom))
            {
                Date = __.GetDate(__.Year(DateFrom) + "/" + __.Month(DateFrom).ToString("00") + "/01") - 1;
            }
            Result += ";5  "
                      + "   @DateFrom=" + (Date + 1).ToString()
                      + " , @DateInto=" + Amounts_DateInto.ToString()
                      + " , @AmountId=" + Accounts_RootId.ToString()
                      + " , @SortMode=" + (SortMode & 7).ToString()
                      + " , @IsRight=0 , @IsExpected=0 "
            ;
            break;
        }

        case    4: {
            Result += (((DateFrom == DateInto) && (DateFrom == TODAY)) ? ";6 " : ";5 ")
                      + "   @DateFrom=" + DateFrom.ToString()
                      + " , @DateInto=" + DateInto.ToString()
                      + " , @AmountId=" + Accounts_ExtId.ToString()
                      + " , @SortMode=" + (SortMode & 7).ToString()
                      + " , @IsRight=0 , @IsExpected=0 "
            ;
            break;
        }
        }
        return(Result);
    }    //FOLD00