Пример #1
0
        private void buttonPrepareExport_Click(object sender, EventArgs e)
        {
            if (cbProcNames.Items.Count > 0)
            {
                List <ReportParamV2> paramList = new List <ReportParamV2>();

                Dictionary <string, string> parameters =
                    ServicesProvider.GetInstance().GetAccountingServices().SelectExportAccountingProcParams("ExportAccounting_" + cbProcNames.Text);

                if (parameters != null && parameters.Count > 0)
                {
                    foreach (var parameter in parameters)
                    {
                        ReportParamV2 reportParam;
                        string        paramName = parameter.Key.TrimStart('@');
                        if (paramName.Equals("branch_id", StringComparison.CurrentCultureIgnoreCase))
                        {
                            reportParam = new BranchParam(string.Empty);
                        }
                        else
                        {
                            string paramType = parameter.Value;
                            switch (paramType)
                            {
                            case "bit":
                                reportParam = new BoolParam(false);
                                break;

                            case "datetime":
                                reportParam = new DateParam(DateTime.Today);
                                break;

                            case "char":
                                reportParam = new CharParam(' ');
                                break;

                            case "nvarchar":
                            case "varchar":
                            case "text":
                                reportParam = new StringParam(string.Empty);
                                break;

                            case "int":
                                reportParam = new IntParam(1);
                                break;

                            case "float":
                                reportParam = new DoubleParam(1d);
                                break;

                            case "money":
                                reportParam = new DecimalParam(1m);
                                break;

                            default:
                                throw new NotImplementedException(string.Format("Sql type:{0} is not handled.", paramName));
                            }
                        }

                        reportParam.Label = paramName;
                        reportParam.Name  = paramName;
                        paramList.Add(reportParam);
                    }
                    ReportParamsForm frm = new ReportParamsForm(paramList, cbProcNames.Text);
                    frm.ShowDialog();
                }

                _dataTable =
                    ServicesProvider.GetInstance().GetAccountingServices().FindElementaryMvtsToExport(
                        "ExportAccounting_"
                        + cbProcNames.Text, paramList, out _idTable);

                _total = _dataTable.Rows.Count;

                _bwSelect = new BackgroundWorker {
                    WorkerSupportsCancellation = true
                };
                _bwSelect.DoWork += BwSelect_DoWork;

                ExportBookings_Load(this, null);
            }
        }
Пример #2
0
    void ParseConfig()
    {
        string[] lines = fontConfig[_materialIdx].text.Split(new string[] { "\r\n", "\n" }, System.StringSplitOptions.None);
        foreach (string line in lines)
        {
            if (line.IndexOf("base=") != -1)
            {
                string[] charParams = line.Split(new string[] {"base="}, System.StringSplitOptions.None);
                _baseHeight = int.Parse(charParams[1].Split(new string[] {" "}, System.StringSplitOptions.None)[0]);
            }

            if (line.IndexOf("char id=") != -1)
            {
                string[] charParams = line.Split(new string[] {" "}, System.StringSplitOptions.None);
                int id = int.Parse( charParams[1].Split(new string[] {"="}, System.StringSplitOptions.None)[1] );
                CharParam charParam = new CharParam();
                charParam.x = int.Parse( charParams[2].Split(new string[] {"="}, System.StringSplitOptions.None)[1] );
                charParam.y = int.Parse( charParams[3].Split(new string[] {"="}, System.StringSplitOptions.None)[1] );
                charParam.width = int.Parse( charParams[4].Split(new string[] {"="}, System.StringSplitOptions.None)[1] );
                charParam.height = int.Parse( charParams[5].Split(new string[] {"="}, System.StringSplitOptions.None)[1] );
                charParam.xoffset = int.Parse( charParams[6].Split(new string[] {"="}, System.StringSplitOptions.None)[1] );
                charParam.yoffset = int.Parse( charParams[7].Split(new string[] {"="}, System.StringSplitOptions.None)[1] );
                charParam.xadvance = int.Parse( charParams[8].Split(new string[] {"="}, System.StringSplitOptions.None)[1] );
                chars.Add(id, charParam);
            }
        }
    }