public HumanResourceDept(List <AttendanceDept> attendance)
 {
     InitializeComponent();
     attendanceDept = attendance;
     DisplayUI();
     attendanceDept = null;
     ClearMemory.CleanMemory();
 }
Beispiel #2
0
    public static DataTable getInfos(string companyId, string departId, string searchString)
    {
        DataSet ds = null;

        if (string.IsNullOrEmpty(departId))
        {
            ds = UserInfoSrv.getInfos(companyId);
        }
        else
        {
            ds = UserInfoSrv.getInfos(companyId, departId);
        }
        DataTable dt = null;

        if (ds != null)
        {
            DataTable dtUsing = UserInfoProcess(ds);
            if (string.IsNullOrEmpty(searchString))//搜索字符为空时,不搜索,直接返回
            {
                return(dtUsing);
            }
            else
            {
                dt = dtUsing.Clone();
                foreach (DataRow row in dtUsing.Rows)
                {
                    if (row["employeeCode"].ToString().Trim().Contains(searchString) ||
                        PinYinHelper.IsEqual(row["userName"].ToString(), searchString)
                        //|| PinYinHelper.IsEqual(row["fullName"].ToString(), searchString)
                        || row["userName"].ToString().Trim().Contains(searchString)
                        //|| row["fullName"].ToString().Trim().Contains(searchString))
                        )
                    {
                        //row["passWord"] = "******";
                        dt.Rows.Add(row.ItemArray);
                        dt.Rows[dt.Rows.Count - 1]["passWord"] = "******";
                        continue;
                    }
                }
            }
        }
        ClearMemory.Clear(ds);
        return(dt);
    }
Beispiel #3
0
 //清内存
 private void timer3_Tick(object sender, EventArgs e)
 {
     ClearMemory.Clear();
 }
        public void IntializeforTableLayout(List <List <AttendanceDept> > attendanceDepts, int Start)
        {
            layoutMain.Visible = false;
            layoutMain.Controls.Clear();
            layoutMain.ColumnStyles.Clear();
            layoutMain.RowStyles.Clear();

            layoutMain.ColumnCount = 1;
            layoutMain.RowCount    = 2;
            float Percerntwidth  = (float)(100 / layoutMain.ColumnCount);
            float Percerntheight = (float)(100 / layoutMain.RowCount);

            for (int i = 0; i < layoutMain.ColumnCount - 1; i++)
            {
                layoutMain.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, Percerntwidth));
            }
            layoutMain.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100 - (Percerntwidth * (layoutMain.ColumnCount - 1))));
            for (int i = 0; i < layoutMain.RowCount - 1; i++)
            {
                layoutMain.RowStyles.Add(new RowStyle(SizeType.Percent, Percerntheight));
            }
            layoutMain.RowStyles.Add(new RowStyle(SizeType.Percent, 100 - Percerntheight * (layoutMain.RowCount - 1)));
            if (attendanceDepts == null)
            {
                return;
            }
            int count = Start;

            if (count < ListAttendance.Count)
            {
                ResourceDept1.Dispose();


                GC.SuppressFinalize(ResourceDept1);
                ResourceDept1 = null;
                // HumanResourceDept.attendanceDept = ListAttendance[count];
                ResourceDept1 = new HumanResourceDept(ListAttendance[count]);

                ClearMemory.CleanMemory();
                ResourceDept1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                              | System.Windows.Forms.AnchorStyles.Left)
                                                                             | System.Windows.Forms.AnchorStyles.Right)));
                //   HumanResourceDept.attendanceDept = ListAttendance[count];


                layoutMain.Controls.Add(ResourceDept1, 0, 0);
            }

            count++;
            if (count < ListAttendance.Count)
            {
                ResourceDept2.Dispose();
                GC.SuppressFinalize(ResourceDept2);
                ResourceDept2 = null;

                ClearMemory.CleanMemory();
                ResourceDept2        = new HumanResourceDept(ListAttendance[count]);
                ResourceDept2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                              | System.Windows.Forms.AnchorStyles.Left)
                                                                             | System.Windows.Forms.AnchorStyles.Right)));
                // HumanResourceDept.attendanceDept = ListAttendance[count];

                layoutMain.Controls.Add(ResourceDept2, 0, 1);
            }
            //  count++;
            //for (int i = 0; i < layoutMain.ColumnCount; i++)
            //{
            //    for (int j = 0; j < layoutMain.RowCount; j++)
            //    {

            //        if (count < attendanceDepts.Count)
            //        {

            //            //  ResourceDept = new HumanResourceDept(attendanceDepts[count]);
            //       //     ResourceDept.attendanceDept = attendanceDepts[count];
            //            ResourceDept.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            //    | System.Windows.Forms.AnchorStyles.Left)
            //    | System.Windows.Forms.AnchorStyles.Right)));
            //            layoutMain.Controls.Add(ResourceDept, i, j);


            //        //    count++;
            //        }
            //    }
            //}

            layoutMain.Visible = true;



            ResourceDept = null;
            ClearMemory.CleanMemory();
        }
        public static void DrawingChart(string[] LabelArray, double[] ValueArrayTotal, double[] AbsenceNumber, double[] IndirectNumber, ref CartesianChart chart)
        {
            try
            {
                double YmaxValue = 0;
                double YminValue = 0;
                YminValue = ValueArrayTotal.Min() == 0?1: ValueArrayTotal.Min();
                YmaxValue = ValueArrayTotal.Max();
                chart.Series.Clear();
                chart.AxisX.Clear();
                chart.AxisY.Clear();
                chart.Controls.Clear();
                List <String>        lables           = new List <string>();
                ChartValues <double> valuesTotal      = new ChartValues <double>();
                ChartValues <double> ValueabsenceQty  = new ChartValues <double>();
                ChartValues <double> ValueIndirectQty = new ChartValues <double>();

                for (int i = 0; i < LabelArray.Length; i++)
                {
                    lables.Add(LabelArray[i]);
                    valuesTotal.Add(ValueArrayTotal[i]);
                    ValueabsenceQty.Add(AbsenceNumber[i]);
                    ValueIndirectQty.Add(IndirectNumber[i]);
                }
                chart.Series = new SeriesCollection
                {
                    new ColumnSeries
                    {
                        Title      = "Employees",
                        Values     = valuesTotal,
                        DataLabels = true,
                        Fill       = System.Windows.Media.Brushes.Green,
                        ScalesYAt  = 0,
                        FontSize   = 8
                    }
                };
                chart.Series.Add(
                    new ColumnSeries
                {
                    Title      = "Absence",
                    Values     = ValueabsenceQty,
                    DataLabels = true,
                    Fill       = System.Windows.Media.Brushes.Red,
                    ScalesYAt  = 0,
                    FontSize   = 8
                });
                chart.Series.Add(
                    new ColumnSeries
                {
                    Title      = "Indirect",
                    Values     = ValueIndirectQty,
                    DataLabels = true,
                    Fill       = System.Windows.Media.Brushes.LightBlue,
                    ScalesYAt  = 0,
                    FontSize   = 8
                }
                    );

                chart.DefaultLegend.Margin   = new Thickness(15);
                chart.DefaultLegend.FontSize = 20;
                chart.LegendLocation         = LegendLocation.Top;


                //x axis labels
                chart.AxisX.Add(new Axis
                {
                    Title    = "Dept",
                    Labels   = lables,
                    Unit     = 1,
                    FontSize = 12,

                    FontFamily = new System.Windows.Media.FontFamily("Times New Roman"),
                    Foreground = System.Windows.Media.Brushes.Black,
                    Separator  = new LiveCharts.Wpf.Separator
                    {
                        Step      = 1,
                        IsEnabled = false //disable it to make it invisible.
                    },
                    LabelsRotation = 0,
                });


                //y axis label
                chart.AxisY.Add(new Axis
                {
                    Title          = "People Number",
                    LabelFormatter = value => value.ToString("N0"),
                    FontSize       = 10,

                    FontFamily = new System.Windows.Media.FontFamily("Times New Roman"),

                    Foreground = System.Windows.Media.Brushes.Black,
                    MaxValue   = YmaxValue * 1.2,
                    MinValue   = 0,
                    Width      = 5,
                    Position   = AxisPosition.LeftBottom
                });

                LabelArray       = null;
                lables           = null;
                valuesTotal      = null;
                ValueabsenceQty  = null;
                ValueIndirectQty = null;
            }
            catch (Exception ex)
            {
                SystemLog.Output(SystemLog.MSG_TYPE.Err, "Drawing chart ", ex.Message);
            }

            ClearMemory.CleanMemory();
        }
 internal static void OnClearMemory()
 {
     ClearMemory?.Invoke();
     ClearMemory = null;
 }