当前位置: 首页>>代码示例>>C#>>正文


C# Functions.Count方法代码示例

本文整理汇总了C#中Functions.Count方法的典型用法代码示例。如果您正苦于以下问题:C# Functions.Count方法的具体用法?C# Functions.Count怎么用?C# Functions.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Functions的用法示例。


在下文中一共展示了Functions.Count方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Invoice

        public Invoice()
        {
            InitializeComponent();

            StartPosition = FormStartPosition.CenterScreen; //center form

            this.FormClosing += Invoice_FormClosing; // set close event

            
            var vm = (char)253;
            var svm = (char)252;


            string hostName = "den-vm-dg02"; // replace with your host or leverage a config file or similar approach
            int hostPort = 9000;
            string userName = "DM";
            string userPassword = "";
            Boolean x = false;
            string Account = "acme";
            string subroutine = "get_invoice.sub";
            int args = 0;
            string InvoiceSelection = formargs.InvoiceSelection;

            Pick D3 = new rocketsoftware.MVSP.Pick();
            Functions func = new Functions();
            x = D3.Connect(hostName, hostPort, userName, userPassword);
            if (x)
            {
                bool acctstat = D3.Logto(Account, ""); //Move to the correct account
                if (acctstat)
                {

                    args = 2;
                    Pick.mvSubroutine mysub = new Pick.mvSubroutine(subroutine, args, D3);

                    mysub.SetArgs(0, InvoiceSelection);
                    mysub.SetArgs(1, "");
                    mysub.MvCall(); // call get_invoice.sub
                 
                   if (D3.statusCode != 0)
                    {
                        MessageBox.Show("Unable to execute:" + D3.ruleModule, "Subroutine Failure", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        Environment.Exit(0);
                    }

                    else
                    {

                       string InvoiceResult =  mysub.GetArgs(1);

                        AccountNo.Text =    func.Extract(InvoiceResult, 1);
                        BillTo.Text =   func.Extract(InvoiceResult, 2);
                        BillAddr.Text = func.Extract(InvoiceResult, 3);
                        var BillCity =  func.Extract(InvoiceResult, 4);
                        var BillState = func.Extract(InvoiceResult, 5);
                        var BillZip =   func.Extract(InvoiceResult, 6);
                        Bill_CityStateZip.Text = BillCity + ", " + BillState + " " + BillZip;

                        Contact.Text =      func.Extract(InvoiceResult, 7);
                        InvoiceNo.Text =    func.Extract(InvoiceResult, 8);
                        ShipTo.Text =       func.Extract(InvoiceResult, 9);
                        ShipAddr.Text =     func.Extract(InvoiceResult, 10);

                        var ShipCity =      func.Extract(InvoiceResult, 11);
                        var ShipState =     func.Extract(InvoiceResult, 12);
                        var ShipZip =       func.Extract(InvoiceResult, 13);
                        Ship_CityStateZip.Text = ShipCity + ", " + ShipState + " " + ShipZip;

                        SalesRep.Text =     func.Extract(InvoiceResult, 15,1);
                        RepPhone.Text =     func.Extract(InvoiceResult, 16,2);
                        Ordered.Text =      func.Extract(InvoiceResult, 17);
                        Invoiced.Text =     func.Extract(InvoiceResult, 18);
                        Terms.Text =        func.Extract(InvoiceResult, 19);
                        Note.Text =         func.Extract(InvoiceResult, 20);
                        Gross.Text =        func.Extract(InvoiceResult, 21);
                        Discount.Text =     func.Extract(InvoiceResult, 22);
                        Net.Text =          func.Extract(InvoiceResult, 23);
                        
                       //declare the strings needed to do the deletes of the mv attributes that are not part of the line items so we can get an accurate count

                        string LineResults1 = "";
                        string LineResults2 = "";
                        int mvLineCount = 7;
                        
                        
                        LineResults1 = func.Delete(InvoiceResult, 15);
                        LineResults2 = func.Delete(LineResults1, 15);
                        int vmCount = func.Dcount(LineResults2, vm);
                        int svmCount = func.Count(LineResults2, svm); // find out how many actual line items we have
                        int itemCount = vmCount / mvLineCount;
                       
                       //Get Each Line Item
                         for(int i = 0; i <= itemCount; i++) {

                             dataGridView1.Rows.Add();

                             dataGridView1.Rows[i].Cells[0].Value = i + 1; // LineQty
                             dataGridView1.Rows[i].Cells[1].Value = func.Extract(InvoiceResult, 24, i + 1); // Line Qty
                             dataGridView1.Rows[i].Cells[2].Value = func.Extract(InvoiceResult, 25, i + 1); // Product Number
                             dataGridView1.Rows[i].Cells[3].Value = func.Extract(InvoiceResult, 26, i + 1); // Description
//.........这里部分代码省略.........
开发者ID:Dorien-Gardner,项目名称:multivalue-lab,代码行数:101,代码来源:invoice.cs

示例2: CustList

        public CustList()
        {

            InitializeComponent();
            StartPosition = FormStartPosition.CenterScreen; //center form
            this.FormClosing += CustList_FormClosing;

            // retrieve search arguments from previous customer search form

            string custName = formargs.Selection[0];
            string custAddress = formargs.Selection[1];
            string custPhone = formargs.Selection[2];
            string custTerrNo = formargs.Selection[3];

            var am = (char)254;
            var vm = (char)253;

            // assign connection values and create variables to use
            string hostName = "den-vm-dg02"; // replace with your host or leverage a config file or similar approach
            int hostPort = 9000;
            string userName = "DM";
            string userPassword = "";
            Boolean x = false;
            string subroutine = "";
            int args = 0;
            String Account = "acme";

            Pick D3 = new rocketsoftware.MVSP.Pick(); // make an instance of the D3 class
            Functions func = new Functions(); // make an instance of the Functions Class
            x = D3.Connect(hostName, hostPort, userName, userPassword); // connect to D3 and check status
            if (x)
            {
                bool acctstat = D3.Logto(Account, ""); //Move to the correct account
                if (acctstat)
                {
                    //Prepare to call the subroutine that gets the customer lists
                    subroutine = "cust_lookup.sub";
                    args = 5;
                    Pick.mvSubroutine mysub = new Pick.mvSubroutine(subroutine, args, D3);

                    mysub.SetArgs(0, custName); // set the required arguments into the array for the arguments of the subroutine
                    mysub.SetArgs(1, custAddress);
                    mysub.SetArgs(2, custPhone);
                    mysub.SetArgs(3, custTerrNo);
                    mysub.SetArgs(4, "");

                    mysub.MvCall();
                    string custResults = mysub.GetArgs(4); // gets the return values from the subroutine

                    int amCount = func.Count(custResults, am); // counts the number of items we have
                    int vmCount = func.Dcount(custResults, vm);
                    int itemCount = vmCount / amCount; //determine how many items we retreived


                    for (int v = 0; v < itemCount; v++) // need to add 1 to the amCount to allow for the loop going enogh times for all items
                    {
                        dataGridView1.Rows.Add(); // add row so we can insert into

                        // map results into the form's datagrid
                        dataGridView1.Rows[v].Cells[0].Value = func.Extract(custResults, 1, v + 1);     //AccountNo
                        dataGridView1.Rows[v].Cells[1].Value = func.Extract(custResults, 2, v + 1);     //Customer Name
                        dataGridView1.Rows[v].Cells[2].Value = func.Extract(custResults, 3, v + 1);     //Address
                        dataGridView1.Rows[v].Cells[3].Value = func.Extract(custResults, 4, v + 1);     //City
                        dataGridView1.Rows[v].Cells[4].Value = func.Extract(custResults, 5, v + 1);     //State
                        dataGridView1.Rows[v].Cells[5].Value = func.Extract(custResults, 6, v + 1);     // Zip
                        dataGridView1.Rows[v].Cells[6].Value = func.Extract(custResults, 7, v + 1);     // Phone
                    }

                    D3.CloseConnection(); //close out the connection to D3
                }
                else
                {
                    MessageBox.Show(Account + ": Not Found", "Invalid Account", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    Environment.Exit(0);
                }
            }
            else
            {
                MessageBox.Show("Unable to connect to D3", "Connection Failure", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                Environment.Exit(0);

            }


        }
开发者ID:Dorien-Gardner,项目名称:multivalue-lab,代码行数:85,代码来源:CustList.cs

示例3: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            var vm = (char)253;
            var svm = (char)252;


            string hostName = "den-vm-dg02"; // replace with your host or leverage a config file or similar approach
            int hostPort = 9000;
            string userName = "DM";
            string userPassword = "";
            Boolean x = false;
            string Account = "acme";
            string subroutine = "get_invoice.sub";
            int args = 0;
            string InvoiceSelection = Request.QueryString["param"];

            Pick D3 = new rocketsoftware.MVSP.Pick();
            Functions func = new Functions();
            x = D3.Connect(hostName, hostPort, userName, userPassword);
            if (x)
            {
                bool acctstat = D3.Logto(Account, ""); //Move to the correct account
                if (acctstat)
                {

                    args = 2;
                    Pick.mvSubroutine mysub = new Pick.mvSubroutine(subroutine, args, D3);

                    mysub.SetArgs(0, InvoiceSelection);
                    mysub.SetArgs(1, "");
                    mysub.MvCall(); // call get_invoice.sub

                    string InvoiceResult = mysub.GetArgs(1);

                    tbl_AccountID.Text = func.Extract(InvoiceResult, 1);
                    tbl_BillTo.Text = func.Extract(InvoiceResult, 2);
                    tbl_BillToAddr.Text = func.Extract(InvoiceResult, 3);
                    var BillCity = func.Extract(InvoiceResult, 4);
                    var BillState = func.Extract(InvoiceResult, 5);
                    var BillZip = func.Extract(InvoiceResult, 6);
                    tbl_BillToCSZ.Text = BillCity + ", " + BillState + " " + BillZip;

                    tbl_Contact.Text = func.Extract(InvoiceResult, 7);
                    tbl_InvoiceID.Text = func.Extract(InvoiceResult, 8);
                    tbl_ShipTo.Text = func.Extract(InvoiceResult, 9);
                    tbl_ShipToAddr.Text = func.Extract(InvoiceResult, 10);

                    var ShipCity = func.Extract(InvoiceResult, 11);
                    var ShipState = func.Extract(InvoiceResult, 12);
                    var ShipZip = func.Extract(InvoiceResult, 13);
                    tbl_ShipToCSZ.Text = ShipCity + ", " + ShipState + " " + ShipZip;

                    tbl_SalesRep.Text = func.Extract(InvoiceResult, 15, 1);
                    tbl_RepPhone.Text = func.Extract(InvoiceResult, 16, 2);
                    tbl_Ordered.Text = func.Extract(InvoiceResult, 17);
                    tbl_Invoiced.Text = func.Extract(InvoiceResult, 18);
                    tbl_Terms.Text = func.Extract(InvoiceResult, 19);
                    tbl_Note.Text = func.Extract(InvoiceResult, 20);
                    tbl_Gross.Text = func.Extract(InvoiceResult, 21);
                    tbl_Discount.Text = func.Extract(InvoiceResult, 22);
                    tbl_Net.Text = func.Extract(InvoiceResult, 23);

                    //declare the strings needed to do the deletes of the mv attributes that are not part of the line items so we can get an accurate count

                    string LineResults1 = "";
                    string LineResults2 = "";
                    int mvLineCount = 7;


                    LineResults1 = func.Delete(InvoiceResult, 15);
                    LineResults2 = func.Delete(LineResults1, 15);
                    int vmCount = func.Dcount(LineResults2, vm);
                    int svmCount = func.Count(LineResults2, svm); // find out how many actual line items we have
                    int itemCount = vmCount / mvLineCount;

                    //Create dataTable
                    
                    DataTable dt = new DataTable(); //map results into a dataTable that can be then bound to the dataGrid
                    // Create the Headers for the DataTable that needs to mapped so that the DataGrid can bind to it.
                    dt.Columns.Add("Ln", typeof(string));
                    dt.Columns.Add("Qty", typeof(string));
                    dt.Columns.Add("ItemId", typeof(string));
                    dt.Columns.Add("Description", typeof(string));
                    dt.Columns.Add("UnitPrice", typeof(string));
                    dt.Columns.Add("ExtPrice", typeof(Int32));
                    dt.Columns.Add("Disc", typeof(string));
                    dt.Columns.Add("Ext", typeof(Int32));   
                   
                    //Get Each Line Item
                    for (int i = 0; i <= itemCount; i++)
                    {

                        dt.Rows.Add();

                        dt.Rows[dt.Rows.Count - 1]["Ln"] = i + 1; // LineQty
                        dt.Rows[dt.Rows.Count - 1]["Qty"] =         func.Extract(InvoiceResult, 24, i + 1); // Line Qty
                        dt.Rows[dt.Rows.Count - 1]["ItemId"] =       func.Extract(InvoiceResult, 25, i + 1); // Product Number
                        dt.Rows[dt.Rows.Count - 1]["Description"] = func.Extract(InvoiceResult, 26, i + 1); // Description
                        dt.Rows[dt.Rows.Count - 1]["UnitPrice"] =  decimal.Parse(func.Extract(InvoiceResult, 27, i + 1)); // List or Unit Price
                        dt.Rows[dt.Rows.Count - 1]["ExtPrice"] =   decimal.Parse(func.Extract(InvoiceResult, 28, i + 1)); // Total Gross 
//.........这里部分代码省略.........
开发者ID:Dorien-Gardner,项目名称:multivalue-lab,代码行数:101,代码来源:Invoice.aspx.cs

示例4: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                // retrieve search arguments from previous customer search form

                string custName = (string)(Session["CustName"]);
                string custAddress = (string)(Session["CustAddr"]);
                string custPhone = (string)(Session["CustPhone"]);
                string custTerrNo = (string)(Session["CustTerr"]);

                var am = (char)254;
                var vm = (char)253;

                // assign connection values and create variables to use
                string hostName = "den-vm-dg02"; // replace with your host or leverage a config file or similar approach
                int hostPort = 9000;
                string userName = "DM";
                string userPassword = "";
                Boolean x = false;
                string subroutine = "";
                int args = 0;
                String Account = "acme";

                Pick D3 = new rocketsoftware.MVSP.Pick(); // make an instance of the D3 class
                Functions func = new Functions(); // make an instance of the Functions Class
                x = D3.Connect(hostName, hostPort, userName, userPassword); // connect to D3 and check status
                if (x)
                {
                    bool acctstat = D3.Logto(Account, ""); //Move to the correct account
                    //if (acctstat)
                    // {
                    //Prepare to call the subroutine that gets the customer lists
                    subroutine = "cust_lookup.sub";
                    args = 5;
                    Pick.mvSubroutine mysub = new Pick.mvSubroutine(subroutine, args, D3);

                    mysub.SetArgs(0, custName); // set the required arguments into the array for the arguments of the subroutine
                    mysub.SetArgs(1, custAddress);
                    mysub.SetArgs(2, custPhone);
                    mysub.SetArgs(3, custTerrNo);
                    mysub.SetArgs(4, "");

                    mysub.MvCall();
                    string custResults = mysub.GetArgs(4); // gets the return values from the subroutine

                    int amCount = func.Count(custResults, am); // counts the number of items we have
                    if (amCount != 0)
                    {
                        int vmCount = func.Dcount(custResults, vm);
                        int itemCount = vmCount / amCount; //determine how many items we retreived

                        DataTable dt = new DataTable(); //map results into a dataTable that can be then bound to the dataGrid
                        // Create the Headers for the DataTable
                        dt.Columns.Add("Account#", typeof(string));
                        dt.Columns.Add("Name", typeof(string));
                        dt.Columns.Add("Address", typeof(string));
                        dt.Columns.Add("City", typeof(string));
                        dt.Columns.Add("State", typeof(string));
                        dt.Columns.Add("Zip", typeof(string));
                        dt.Columns.Add("Phone", typeof(string));


                        for (int v = 0; v < itemCount + 1; v++) // need to add 1 to the amCount to allow for the loop going enough times for all items
                        {

                            dt.Rows.Add();

                            dt.Rows[dt.Rows.Count - 1]["Account#"] = func.Extract(custResults, 1, v + 1);
                            dt.Rows[dt.Rows.Count - 1]["Name"] = func.Extract(custResults, 2, v + 1);
                            dt.Rows[dt.Rows.Count - 1]["Address"] = func.Extract(custResults, 3, v + 1);
                            dt.Rows[dt.Rows.Count - 1]["City"] = func.Extract(custResults, 4, v + 1);
                            dt.Rows[dt.Rows.Count - 1]["State"] = func.Extract(custResults, 5, v + 1);
                            dt.Rows[dt.Rows.Count - 1]["Zip"] = func.Extract(custResults, 6, v + 1);
                            dt.Rows[dt.Rows.Count - 1]["Phone"] = func.Extract(custResults, 7, v + 1);

                        }

                        Grid_CustList.DataSource = dt;
                        Grid_CustList.DataBind();
                        Session["dt_table"] = dt;

                    }
                    else { lbl_STATUS.Text = custResults; btn_NewSearch.Visible = false; } // show error and hide controls

                    D3.CloseConnection(); //close out the connection to D3

                }

            }

        }
开发者ID:Dorien-Gardner,项目名称:multivalue-lab,代码行数:93,代码来源:CustList.aspx.cs


注:本文中的Functions.Count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。