Example #1
0
        void loadEmployee()
        {
            int       dID = TextUtils.ToInt(cboDepartment.EditValue);
            DataTable dt  = TextUtils.GetDataTableFromSP("spGetEmployeeByDepartmentID", new string[] { "@DepartmentID" }, new object[] { dID });

            grdDetail.DataSource = dt;
        }
Example #2
0
        private void dtpEndDate_ValueChanged(object sender, EventArgs e)
        {
            string    statrtDate = dtpFromDate.Value.ToString("yyyy-MM-dd 00:00");
            string    endDate    = dtpEndDate.Value.ToString("yyyy-MM-dd 23:59");
            DataTable dt         = TextUtils.GetDataTableFromSP("spGetOrderTestlerByDate", new string[] { "@StartDate", "@EndDate" }, new object[] { statrtDate, endDate });

            grdData.DataSource = dt;
        }
Example #3
0
        void loadDetail()
        {
            int masterID = TextUtils.ToInt(grvData.GetFocusedRowCellValue("ID"));

            if (masterID == 0)
            {
                return;
            }

            DataTable dt = TextUtils.GetDataTableFromSP("spGetUserGroupLink", new string[] { "@UserID", "@UserGroupID" }, new object[] { 0, masterID });

            grdDetail.DataSource = dt;
        }
Example #4
0
 public void UpdateShelf(string ArticleID, int SL)
 {
     try
     {
         DataTable dt = TextUtils.GetDataTableFromSP("spLoadSLShelf", new string[] { "@ArticleID" }, new object[] { ArticleID });
         if (dt.Rows.Count > 0)
         {
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 ShelfModel shelfModel = new ShelfModel();
                 shelfModel             = (ShelfModel)ShelfBO.Instance.FindByAttribute("ShelfCode", TextUtils.ToString(dt.Rows[i]["Shelf"]).Trim())[0];
                 shelfModel.ShelfNumber = shelfModel.ShelfNumber - TextUtils.ToInt(dt.Rows[i]["SL"]);
                 ShelfBO.Instance.Update(shelfModel);
             }
         }
     }
     catch (Exception)
     {
     }
 }
Example #5
0
        private void frmListOrder_Load(object sender, EventArgs e)
        {
            if (!Directory.Exists(_pathTester))
            {
                Directory.CreateDirectory(_pathTester);
            }
            string[] arrFile = Directory.GetFiles(_pathTester);
            if (arrFile.Length > 0)
            {
                for (int i = 0; i < arrFile.Length; i++)
                {
                    File.Delete(arrFile[i]);
                }
            }

            string statrtDate = dtpFromDate.Value.ToString("yyyy-MM-dd 00:00");
            string endDate    = dtpEndDate.Value.ToString("yyyy-MM-dd 23:59");

            DataTable dt = TextUtils.GetDataTableFromSP("spGetOrderTestlerByDate", new string[] { "@StartDate", "@EndDate" }, new object[] { statrtDate, endDate });

            grdData.DataSource = dt;
        }
        void loadPermission()
        {
            try
            {
                if (cboUserGroup.SelectedIndex < 0)
                {
                    return;
                }
                int userGroupID = TextUtils.ToInt(cboUserGroup.SelectedValue);
                int catID       = TextUtils.ToInt(treeData.FocusedNode.GetValue(colIDTree));
                if (catID == 0)
                {
                    return;
                }

                DataTable dt = TextUtils.GetDataTableFromSP("spGetUserGroupPermission",
                                                            new string[] { "@UserGroupID", "@FormAndFunctionGroupID" },
                                                            new object[] { userGroupID, catID });
                grdData.DataSource = dt;
            }
            catch
            {
            }
        }
Example #7
0
        private void getReport()
        {
            //check valid period time
            if (DateTime.Parse(dtpFrom.Text) > DateTime.Parse(dtpTo.Text))
            {
                MessageBox.Show("Khoảng thời gian không hợp lệ", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            this.Enabled = false;

            //get data report
            string from = new DateTime(dtpFrom.Value.Year, dtpFrom.Value.Month, dtpFrom.Value.Day, 0, 0, 0).ToString("yyyy-MM-dd HH:mm:ss");
            string to   = new DateTime(dtpTo.Value.Year, dtpTo.Value.Month, dtpTo.Value.Day, 23, 59, 59).ToString("yyyy-MM-dd HH:mm:ss");
            string Hyp  = txtHyp.Text;
            string Gear = txtGear.Text;
            string Lot  = txtLot.Text;

            System.Data.DataTable dtReport = TextUtils.GetDataTableFromSP("spGetReportTester",
                                                                          new string[] { "@BeginDate", "@ToDate", "@Hyp", "@Gear", "@LotGiaCong" },
                                                                          new object[] { from, to, Hyp, Gear, Lot });

            if (dtReport != null)
            {
                grvData.Columns.Clear();
                GridColumn colQtyLap = new GridColumn();
                for (int i = 0; i < dtReport.Columns.Count; i++)
                {
                    GridColumn col = new GridColumn();
                    switch (dtReport.Columns[i].Caption)
                    {
                    case "DateReport":
                        col.Caption = "Ngày/ Tháng/ Năm";
                        col.Name    = "colDateReport";
                        break;

                    case "WorkerCode":
                        col.Caption = "Người thao tác";
                        col.Name    = "colWorkerCode";
                        break;

                    case "LotGiaCong":
                        col.Caption = "Lot gia công";
                        col.Name    = "colLot";
                        break;

                    case "HypCode":
                        col.Caption = "Mã HYP";
                        col.Name    = "colHyp";
                        break;

                    case "GearCode":
                        col.Caption = "Mã Gear";
                        col.Name    = "colGear";
                        break;

                    case "QtyLap":
                        col.Caption = "Số lần Láp";
                        col.Name    = "colQtyLap";
                        colQtyLap   = col;
                        break;

                    default:
                        col.Caption = dtReport.Columns[i].Caption;
                        col.Name    = "col" + (i + 1);
                        break;
                    }
                    if (col.Name.Equals("colQtyLap"))
                    {
                        continue;
                    }
                    col.VisibleIndex = i + 1;
                    col.FieldName    = dtReport.Columns[i].Caption;
                    grvData.Columns.Add(col);
                }
                colQtyLap.VisibleIndex = grvData.Columns.Count + 1;
                colQtyLap.FieldName    = "QtyLap";
                grvData.Columns.Add(colQtyLap);
            }

            grdReport.DataSource = dtReport;
        }
Example #8
0
        private void getReport()
        {
            if (cbbType.SelectedIndex < 0)
            {
                MessageBox.Show("Bạn chưa chọn loại báo cáo!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            //check valid period time
            if (DateTime.Parse(dtpFrom.Text) > DateTime.Parse(dtpTo.Text))
            {
                MessageBox.Show("Khoảng thời gian không hợp lệ", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            pgbExport.Visible = true;
            pgbExport.Style   = ProgressBarStyle.Marquee;
            pgbExport.Left    = this.Width / 2;
            pgbExport.Top     = this.Height / 2;
            this.Enabled      = false;

            //get data report
            string from = new DateTime(dtpFrom.Value.Year, dtpFrom.Value.Month, dtpFrom.Value.Day, 0, 0, 0).ToString("yyyy-MM-dd HH:mm:ss");
            string to   = new DateTime(dtpTo.Value.Year, dtpTo.Value.Month, dtpTo.Value.Day, 23, 59, 59).ToString("yyyy-MM-dd HH:mm:ss");
            string productStepCode;
            string productGroupCode;

            if (cbbProductStepCode.SelectedIndex != 0)
            {
                productStepCode = cbbProductStepCode.Text;
            }
            else
            {
                productStepCode = string.Empty;
            }
            if (cbbGroupProductCode.SelectedIndex != 0)
            {
                productGroupCode = cbbGroupProductCode.SelectedValue.ToString();
            }
            else
            {
                productGroupCode = string.Empty;
            }
            int Type = cbbType.SelectedIndex;

            System.Data.DataTable dtReport = TextUtils.GetDataTableFromSP("spGetAndonReport",
                                                                          new string[] { "@StartDate", "@EndDate", "@ProductStepCode", "@ProductGroupCode", "@Type" },
                                                                          new object[] { from, to, productStepCode, productGroupCode, Type });
            int totalDelay     = 0;
            int totalRisk      = 0;
            int totalTimeDelay = 0;
            int totalTimeRisk  = 0;

            totalRisk  = TextUtils.ToInt(dtReport.Compute("Count(Type)", "Type = 2"));
            totalDelay = TextUtils.ToInt(dtReport.Compute("Count(Type)", "Type = 1"));

            totalTimeDelay = TextUtils.ToInt(dtReport.Compute("Sum(DelayTime)", "Type = 1"));
            totalTimeRisk  = TextUtils.ToInt(dtReport.Compute("Sum(RiskTime)", "Type = 2"));

            grdReport.DataSource = dtReport;

            txtTotalDelay.Text = totalDelay.ToString();
            txtTotalRisk.Text  = totalRisk.ToString();
            txtTimeDelay.Text  = totalTimeDelay.ToString();
            txtTimeRisk.Text   = totalTimeRisk.ToString();
        }