コード例 #1
0
        private void Employees_Load(object sender, EventArgs e)
        {
            SetComponentsByPermisions();

            this.dtDepartments             = Department.GetDepartmentsAsDataTable(this.cnConnection);
            this.dgvDepartments.DataSource = this.dtDepartments;

            this.dtCategories             = Category.GetCategoriesAsDataTable(this.cnConnection);
            this.dgvCategories.DataSource = this.dtCategories;

            this.ciCoInformation = FamSetting.GetCoInformation(this.cnConnection);

            this.tbName.Text          = this.ciCoInformation.strName;
            this.cbTypes.SelectedItem = this.ciCoInformation.strCoType;
            if (this.ciCoInformation.dtRegister.Year != 1)
            {
                this.dtpRegister.Value = this.ciCoInformation.dtRegister;
            }
            this.tbRegisterNumber.Text = this.ciCoInformation.strRegisterCode;
            this.tbCoID.Text           = this.ciCoInformation.strCoID;
            this.tbAddress.Text        = this.ciCoInformation.strAddress;
            this.tbPostalCode.Text     = this.ciCoInformation.strPostalCode;
            this.tbTell.Text           = this.ciCoInformation.strTell;
            this.tbFax.Text            = this.ciCoInformation.strFax;
            this.tbTaxID.Text          = this.ciCoInformation.strTaxID;
            this.tbProvince.Text       = this.ciCoInformation.strProvince;
            this.tbCity.Text           = this.ciCoInformation.strCity;
            this.tbWebSite.Text        = this.ciCoInformation.strWebSite;

            this.btmCoSave.Enabled = false;
        }
コード例 #2
0
 private void Management_Load(object sender, EventArgs e)
 {
     if (CheckApplicationStatus())
     {
         this.setSettings = new FamSetting(this.cnConnection, this.strXmlPath);
         this.setSettings.strAppVersion = "1.6.20";
         this.staVersion.Text           = this.setSettings.strAppVersion;
         this.Text += String.Format(" - {0}", FamSetting.GetCoInformation(this.cnConnection).strName);
     }
     else
     {
         this.menLogIn.Enabled = false;
     }
 }
コード例 #3
0
        private void butReport_Click(object sender, EventArgs e)
        {
            if (this.lisEmployeesColumns.Count == 0)
            {
                MessageBox.Show("هیج ستونی انتخاب نشده است.");
                return;
            }

            EmployeesReport erEmployeesReport = new EmployeesReport();

            erEmployeesReport.cnConnection = this.cnConnection;
            erEmployeesReport.usUser       = this.usUser;
            erEmployeesReport.setSettings  = this.setSettings;

            //Report
            StiReport srEmployees = new StiReport();

            srEmployees.Pages[0].PaperSize = System.Drawing.Printing.PaperKind.A4;
            //MessageBox.Show(srEmployees.Pages[0].PaperSize.ToString());
            //srEmployees.
            string strSColumnsName = "";

            for (int i = 0; i < this.lisEmployeesColumns.Count; i++)
            {
                if (i != 0)
                {
                    strSColumnsName += ", ";
                }

                strSColumnsName += this.lisEmployeesColumns[i].strName;
            }
            //DataBase
            StiSqlDatabase dbDataBase1 = new StiSqlDatabase();

            dbDataBase1.Alias            = "dbDataBase1";
            dbDataBase1.Name             = "dbDataBase1";
            dbDataBase1.ConnectionString = this.cnConnection.strConnectionStringPty;
            srEmployees.Dictionary.Databases.Add(dbDataBase1);
            //DataSource
            StiSqlSource dsDataSource = new StiSqlSource();

            dsDataSource.NameInSource = "dbDataBase1";
            dsDataSource.Alias        = "dsDataSource";
            dsDataSource.Name         = "dsDataSource";
            dsDataSource.SqlCommand   = Employee.GetSqlCommand(this.emSearch, strSColumnsName);
            for (int i = 0; i < this.lisEmployeesColumns.Count; i++)
            {
                dsDataSource.Columns.Add(this.lisEmployeesColumns[i].strName, this.lisEmployeesColumns[i].typType);
            }
            srEmployees.DataSources.Add(dsDataSource);
            //HeaderBand
            StiHeaderBand headerBand1 = new StiHeaderBand();

            headerBand1.Height = 0.5;
            headerBand1.Name   = "HeaderBand1";
            srEmployees.Pages[0].Components.Add(headerBand1);
            StiText headerText = new StiText(new RectangleD(5, 0.2, 9.6, 1));

            headerText.Text         = "کارکنان شرکت " + FamSetting.GetCoInformation(this.cnConnection).strName;
            headerText.HorAlignment = StiTextHorAlignment.Center;
            headerText.Name         = "headerText1";
            headerText.Font         = new Font("B Titr", 17);
            headerText.Brush        = new StiSolidBrush(Color.Transparent);
            headerBand1.Components.Add(headerText);
            //ColumnHeaderBand
            StiColumnHeaderBand columnHeaderBand1 = new StiColumnHeaderBand();

            columnHeaderBand1.Height = 0.5;
            columnHeaderBand1.Name   = "columnHeaderBand1";
            srEmployees.Pages[0].Components.Add(columnHeaderBand1);
            StiText[] stColumnHeaders = new StiText[this.lisEmployeesColumns.Count];
            double    douX            = 19;

            for (int i = 0; i < this.lisEmployeesColumns.Count; i++)
            {
                stColumnHeaders[i]               = new StiText(new RectangleD(douX - this.lisEmployeesColumns[i].douWidth, 1, this.lisEmployeesColumns[i].douWidth, 0.8));
                stColumnHeaders[i].Text          = this.lisEmployeesColumns[i].strCaption;
                stColumnHeaders[i].Name          = "ch" + this.lisEmployeesColumns[i].strName;
                stColumnHeaders[i].Border        = new StiBorder(StiBorderSides.All, Color.Black, 1, StiPenStyle.Solid);
                stColumnHeaders[i].Font          = new Font("B Titr", 12);
                stColumnHeaders[i].Brush         = new StiSolidBrush(Color.Gray);
                stColumnHeaders[i].HorAlignment  = StiTextHorAlignment.Center;
                stColumnHeaders[i].VertAlignment = StiVertAlignment.Center;
                columnHeaderBand1.Components.Add(stColumnHeaders[i]);
                douX -= this.lisEmployeesColumns[i].douWidth;
            }
            //DataBand
            StiDataBand dataBand1 = new StiDataBand();

            dataBand1.DataSourceName = "dsDataSource";
            dataBand1.Height         = 0.5;
            dataBand1.Name           = "dataBand1";
            srEmployees.Pages[0].Components.Add(dataBand1);
            StiText[] stDataText = new StiText[this.lisEmployeesColumns.Count];
            douX = 19;
            for (int i = 0; i < this.lisEmployeesColumns.Count; i++)
            {
                stDataText[i]               = new StiText(new RectangleD(douX - this.lisEmployeesColumns[i].douWidth, 0, this.lisEmployeesColumns[i].douWidth, 0.6));
                stDataText[i].Text          = "{dsDataSource." + this.lisEmployeesColumns[i].strName + "}";
                stDataText[i].Name          = "db" + this.lisEmployeesColumns[i].strName;
                stDataText[i].Font          = new Font("B Nazanin", 10);
                stDataText[i].Brush         = new StiSolidBrush(Color.Transparent);
                stDataText[i].HorAlignment  = StiTextHorAlignment.Center;
                stDataText[i].VertAlignment = StiVertAlignment.Center;
                stDataText[i].Border        = new StiBorder(StiBorderSides.All, Color.Black, 1, StiPenStyle.Solid);
                dataBand1.Components.Add(stDataText[i]);
                douX -= this.lisEmployeesColumns[i].douWidth;
            }
            //Render
            srEmployees.Dictionary.Synchronize();
            srEmployees.Compile();
            srEmployees.Render(false);
            //srEmployees.Save(@"c:\rpt\report3.mrt");

            erEmployeesReport.stvEmployees.Report = srEmployees;
            erEmployeesReport.ShowDialog();
        }