コード例 #1
0
        private void rptThiNghiemBind()
        {
            lblIDThiNghiem.Text = Request.QueryString["ID"];
            lblSoCot.Text       = countCol().ToString();
            int ID = Convert.ToInt32(lblIDThiNghiem.Text);

            DAO.clsThiNghiemDAO TNDAO        = new DAO.clsThiNghiemDAO();
            DataRow             rowThiNghiem = TNDAO.getThiNghiemByID(ID);

            lblID_ThiNghiem.Text = ID.ToString();
            lblTenThiNghiem.Text = DAO.clsLoaiThiNghiemDAO.getTenThiNghiemByID(Convert.ToInt32(rowThiNghiem["ID_LoaiThiNghiem"])).Rows[0][0].ToString();
            lblXuatXu.Text       = rowThiNghiem["XuatXu"].ToString();
            int ID_LoaiThiNghiem = Convert.ToInt32(rowThiNghiem["ID_LoaiThiNghiem"]);

            rptCot.DataSource = DAO.clsCotThiNghiem_Mapping.getCotByIDLoai(ID_LoaiThiNghiem);
            rptCot.DataBind();
            if (Session["VaiTro"].ToString() == "1")
            {
                rptThiNghiem.DataSource = DAO.clsNhapLieuDAO.selectNhapLieuByIDTN(ID);
            }
            else
            {
                rptThiNghiem.DataSource = DAO.clsNhapLieuDAO.selectNhapLieuByIDTN_IDND(ID, Convert.ToInt32(Session["ID"]));
            }
            rptThiNghiem.DataBind();
            if (rptThiNghiem.Items.Count == 0)
            {
                lblPhanCong.Visible = true;
                btnCapNhat.Visible  = false;
            }
        }
コード例 #2
0
 //private void DacTinh_DCD_DNCN_EditView()
 //{
 //    DacTinh_DCD = new DataView(DacTinh);
 //    DacTinh_DCD.RowFilter = "ID_LoaiThiNghiem=1";
 //    DacTinh_DCD.Sort = "ChiSo ASC";
 //    DacTinh_DCD.AllowEdit = true;
 //    foreach (DataRowView item in DacTinh_DCD)
 //    {
 //        item.BeginEdit();
 //        item["PhuongPhap"] = (item["PhuongPhap"].ToString()).Replace("<br/>", " ");
 //        item.EndEdit();
 //    }
 //    DacTinh_DNCN = new DataView(DacTinh);
 //    DacTinh_DNCN.RowFilter = "ID_LoaiThiNghiem=2";
 //    DacTinh_DNCN.Sort = "ChiSo ASC";
 //    DacTinh_DNCN.AllowEdit = true;
 //    foreach (DataRowView item in DacTinh_DNCN)
 //    {
 //        item.BeginEdit();
 //        item["PhuongPhap"] = (item["PhuongPhap"].ToString()).Replace("<br/>", " ");
 //        item.EndEdit();
 //    }
 //}
 protected void Application_Start(object sender, EventArgs e)
 {
     DacTinh = DAO.clsDacTinhDAO.getList();
     //DacTinh_DCD_DNCN_EditView();
     DAO.clsThiNghiemDAO TNDAO = new DAO.clsThiNghiemDAO();
     numbMaxRow_ThiNghiem = TNDAO.getNumbMaxPage();
 }
コード例 #3
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            DAO.clsThiNghiemDAO TNDAO = new DAO.clsThiNghiemDAO();
            string key = DAO.clsString.convertToUnSign3(txtSearch.Text);

            Response.Redirect("SearchThiNghiem.aspx?q=" + key);
        }
コード例 #4
0
        public int countCol()
        {
            int ID = Convert.ToInt32(Request.QueryString["ID"]);

            DAO.clsThiNghiemDAO TNDAO        = new DAO.clsThiNghiemDAO();
            DataRow             rowThiNghiem = TNDAO.getThiNghiemByID(ID);
            int ID_LoaiThiNghiem             = Convert.ToInt32(rowThiNghiem["ID_LoaiThiNghiem"]);

            return(DAO.clsCotThiNghiem_Mapping.countCot(ID_LoaiThiNghiem));
        }
コード例 #5
0
        protected void btnTaoThiNghiem_Click(object sender, EventArgs e)
        {
            DAO.clsPhanQuyenDAO PQDAO  = new DAO.clsPhanQuyenDAO();
            DataRow             tbl_ND = PQDAO.getQuyen(Convert.ToInt32(Session["ID"]));

            if (tbl_ND["VaiTro"].ToString() == "1" || tbl_ND["TaoThiNghiem"].ToString() == "1")
            {
                DTO.clsThiNghiemDTO TN = new DTO.clsThiNghiemDTO();
                int flag = 0;
                TN.XuatXu       = txtXuatXu.Text;
                TN.SearchXuatXu = DAO.clsString.convertToUnSign3(txtXuatXu.Text);
                DateTime a, b, c;
                if (DateTime.TryParseExact(txtNgayLayMau.Text, "d/M/yyyy", null, DateTimeStyles.None, out a) &&
                    DateTime.TryParseExact(txtNgayNhanMau.Text, "d/M/yyyy", null, DateTimeStyles.None, out b) &&
                    DateTime.TryParseExact(txtNgayThuMau.Text, "d/M/yyyy", null, DateTimeStyles.None, out c))
                {
                    TN.NgayLayMau  = a;
                    TN.NgayNhanMau = b;
                    TN.NgayThuMau  = c;
                }
                else
                {
                    flag = 1;
                }
                TN.LyDoThiNghiem    = txtLyDoThiNghiem.Text;
                TN.PhuTrachLayMau   = txtPhuTrachLayMau.Text;
                TN.GhiChu           = txtGhiChu.Text;
                TN.ID_LoaiThiNghiem = Convert.ToInt32(ddlLoaiThiNghiem.SelectedValue);
                TN.Created_at       = DateTime.Now;
                TN.Created_by       = Session["TenHienThi"].ToString();
                if (flag == 0)
                {
                    DAO.clsThiNghiemDAO TNDAO = new DAO.clsThiNghiemDAO();
                    TN.ID = TNDAO.lastID() + 1;
                    if (DAO.clsThiNghiemDAO.addThiNghiem(TN))
                    {
                        // Thêm list NhapLieu
                        DAO.clsNhapLieuDAO NLDAO = new DAO.clsNhapLieuDAO();
                        NLDAO.insertNhapLieu(TN.ID, TN.ID_LoaiThiNghiem);
                        //
                        Response.Write("<script>alert(\"Thêm Thành Công\");</script>");
                        Global.numbMaxRow_ThiNghiem = TNDAO.getNumbMaxPage();
                        rptThiNghiemBind();
                    }
                }
                else
                {
                    Response.Write("<script>alert(\"Sai Định Dạng\");</script>");
                }
            }
            else
            {
                Response.Write("<script>alert(\"Bạn không có quyền\");</script>");
            }
        }
コード例 #6
0
        private void Pagination()
        {
            int numbItem    = 10;
            int curPage     = 1;
            int numbMaxPage = 1;
            int fromRowPrevious;

            if (Global.numbMaxRow_ThiNghiem != 0)
            {
                if (Global.numbMaxRow_ThiNghiem % numbItem == 0)
                {
                    numbMaxPage = Global.numbMaxRow_ThiNghiem / numbItem;
                }
                else
                {
                    numbMaxPage = Global.numbMaxRow_ThiNghiem / numbItem + 1;
                }
            }
            if (Request.QueryString["page"] != null)
            {
                curPage = Convert.ToInt32(Request.QueryString["page"]);
            }
            if (curPage < 1)
            {
                curPage = 1;
            }
            if (curPage > numbMaxPage)
            {
                curPage = numbMaxPage;
            }
            fromRowPrevious = curPage * numbItem;
            if (Global.numbMaxRow_ThiNghiem % numbItem > 0 && curPage == numbMaxPage)
            {
                numbItem        = Global.numbMaxRow_ThiNghiem % numbItem;
                fromRowPrevious = Global.numbMaxRow_ThiNghiem;
            }
            //button
            btn_previous.Enabled = true;
            btn_next.Enabled     = true;
            if (curPage == 1)
            {
                btn_previous.Enabled = false;
            }
            if (curPage == numbMaxPage)
            {
                btn_next.Enabled = false;
            }
            lblSoTrang.Text = curPage + "/" + numbMaxPage;
            // bind data
            DAO.clsThiNghiemDAO TNDAO = new DAO.clsThiNghiemDAO();
            rptThiNghiem.DataSource = TNDAO.getListDSThiNghiemPaging(numbItem, fromRowPrevious);
            rptThiNghiem.DataBind();
        }
コード例 #7
0
        private void lblThiNghiemBind()
        {
            DAO.clsThiNghiemDAO TNDAO = new DAO.clsThiNghiemDAO();
            DataRow             t     = TNDAO.getThiNghiemByID(Convert.ToInt32(Request.QueryString["ID"]));

            lbl_kqxuatxu.Text = t["XuatXu"].ToString();
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB");
            lbl_kqngaylaymau.Text     = Convert.ToDateTime(t["NgayLayMau"]).ToString("d/M/yyyy");
            lbl_kqngaynhanmau.Text    = Convert.ToDateTime(t["NgayNhanMau"]).ToString("d/M/yyyy");
            lbl_kqngaythumau.Text     = Convert.ToDateTime(t["NgayThuMau"]).ToString("d/M/yyyy");
            lbl_kqlydothinghiem.Text  = t["LyDoThiNghiem"].ToString();
            lbl_kqphutrachlaymau.Text = t["PhuTrachLayMau"].ToString();
            lbl_kqghichu.Text         = t["GhiChu"].ToString();
        }
コード例 #8
0
        private void rptDCDBind()
        {
            lblSoCot.Text = countCol().ToString();
            int ID = Convert.ToInt32(Request.QueryString["ID"]);

            DAO.clsThiNghiemDAO TNDAO        = new DAO.clsThiNghiemDAO();
            DataRow             rowThiNghiem = TNDAO.getThiNghiemByID(ID);
            int ID_LoaiThiNghiem             = Convert.ToInt32(rowThiNghiem["ID_LoaiThiNghiem"]);

            lbl_DCD_title4.Text = DAO.clsLoaiThiNghiemDAO.getTenThiNghiemByID(ID_LoaiThiNghiem).Rows[0][0].ToString();
            rptCot.DataSource   = DAO.clsCotThiNghiem_Mapping.getCotByIDLoai(ID_LoaiThiNghiem);
            rptCot.DataBind();
            rptThiNghiem.DataSource = DAO.clsNhapLieuDAO.selectNhapLieuByIDTN(ID);
            rptThiNghiem.DataBind();
        }
コード例 #9
0
 protected void rptThiNghiem_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "btn_Sua")
     {
         Label id            = e.Item.FindControl("mazic_lblID") as Label;
         Label loaithinghiem = e.Item.FindControl("mazic_lblLoaiThiNghiem") as Label;
         Response.Redirect("SuaThiNghiem.aspx?ID=" + id.Text + "&ID_LoaiThiNghiem=" + loaithinghiem.Text);
     }
     if (e.CommandName == "btn_Khoa")
     {
         Label id       = e.Item.FindControl("mazic_lblID") as Label;
         Label quyensua = e.Item.FindControl("mazic_lblQuyenSua") as Label;
         int   quyen    = Convert.ToInt32(quyensua.Text) == 1 ? 0 : 1;
         DAO.clsThiNghiemDAO.updateQuyen(Convert.ToInt32(id.Text), quyen);
         rptThiNghiemBind();
     }
     if (e.CommandName == "btn_Xoa")
     {
         Label id = e.Item.FindControl("mazic_lblID") as Label;
         DAO.clsThiNghiemDAO.updateTrangThai(Convert.ToInt32(id.Text), 0);
         DAO.clsThiNghiemDAO TNDAO = new DAO.clsThiNghiemDAO();
         Global.numbMaxRow_ThiNghiem = TNDAO.getNumbMaxPage();
         rptThiNghiemBind();
     }
     if (e.CommandName == "btn_Copy")
     {
         Label idCopy              = e.Item.FindControl("mazic_lblID") as Label;
         Label loaithinghiem       = e.Item.FindControl("mazic_lblLoaiThiNghiem") as Label;
         DAO.clsThiNghiemDAO TNDAO = new DAO.clsThiNghiemDAO();
         int ID = TNDAO.lastID() + 1;
         if (DAO.clsThiNghiemDAO.insertCopy(ID, Convert.ToInt32(idCopy.Text), Session["TenHienThi"].ToString()))
         {
             // Thêm list NhapLieu
             DAO.clsNhapLieuDAO NLDAO = new DAO.clsNhapLieuDAO();
             NLDAO.insertNhapLieu(ID, Convert.ToInt32(loaithinghiem.Text));
             //
             Global.numbMaxRow_ThiNghiem = TNDAO.getNumbMaxPage();
             rptThiNghiemBind();
         }
         Global.numbMaxRow_ThiNghiem = TNDAO.getNumbMaxPage();
         rptThiNghiemBind();
     }
     if (e.CommandName == "btn_XuatBaoCao")
     {
         DAO.clsThiNghiemDAO.updateBaoCao(Convert.ToInt32(e.CommandArgument));
         rptThiNghiemBind();
     }
 }
コード例 #10
0
        private void rptThiNghiemBind()
        {
            string key = DAO.clsString.convertToUnSign3(Request.QueryString["q"].ToString()).ToLower();

            DAO.clsThiNghiemDAO TNDAO = new DAO.clsThiNghiemDAO();
            DateTime            a, b;

            if (DateTime.TryParseExact(Request.QueryString["q"].ToString(), "d/M/yyyy", null, DateTimeStyles.None, out a))
            {
                b = a.AddDays(1);
                rptThiNghiem.DataSource = TNDAO.getListSearchDSThiNghiemByDate(a, b);
            }
            else
            {
                rptThiNghiem.DataSource = TNDAO.getListSearchDSThiNghiemByString(key);
            }
            rptThiNghiem.DataBind();
        }
コード例 #11
0
        private void rptDNCNBind(int id)
        {
            DAO.clsThiNghiemDAO TNDAO = new DAO.clsThiNghiemDAO();
            DataRow             TN    = TNDAO.getThiNghiemByID(id);

            if (TN["QuyenSua"].ToString() == "0" && Session["VaiTro"].ToString() != "1")
            {
                Server.Transfer("index.aspx");
                return;
            }
            else
            {
                lblID_ThiNghiem.Text = id.ToString();
                if (TN["ID_LoaiThiNghiem"].ToString() == "1")
                {
                    lblTenThiNghiem.Text = "Dầu cách điện";
                }
                else
                {
                    lblTenThiNghiem.Text = "Dầu nhớt công nghiệp";
                }
                lblXuatXu.Text = TN["XuatXu"].ToString();
                DAO.clsPhanQuyenDAO PQDAO   = new DAO.clsPhanQuyenDAO();
                DataRow             tblND   = PQDAO.getQuyen(Convert.ToInt32(Session["ID"]));
                DAO.clsNhapLieuDAO  NLDAO   = new DAO.clsNhapLieuDAO();
                DataTable           tblDNCN = new DataTable();
                tblDNCN = NLDAO.selectNhapLieu_DNCN(id);
                DataView view = new DataView(tblDNCN);
                if (tblND["VaiTro"].ToString() != "1")
                {
                    string   filter = "ID_DacTinh IN (0,";
                    string[] arr    = tblND["NhapLieu_DNCN"].ToString().Split(' ');
                    for (int i = 0; i < arr.Length - 1; i++)
                    {
                        filter = filter + arr[i] + ",";
                    }
                    filter        += ")";
                    view.RowFilter = filter;
                }
                rptDNCN.DataSource = view;
                rptDNCN.DataBind();
            }
        }
コード例 #12
0
        private void form_ThiNghiemBind(int ID, int ID_LoaiThiNghiem)
        {
            string t = DAO.clsLoaiThiNghiemDAO.getTenThiNghiemByID(ID_LoaiThiNghiem).Rows[0][0].ToString();

            txtTenLoaiThiNghiem.Text = t;
            DAO.clsThiNghiemDAO TNDAO = new DAO.clsThiNghiemDAO();
            var rowThiNghiem          = TNDAO.getThiNghiemByID(ID);

            if (rowThiNghiem["QuyenSua"].ToString() == "0" && Session["VaiTro"].ToString() != "1")
            {
                btnSuaThiNghiem.Visible = false;
            }
            txtXuatXu.Text = rowThiNghiem["XuatXu"].ToString();
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB");
            txtNgayLayMau.Text     = Convert.ToDateTime(rowThiNghiem["NgayLayMau"]).ToString("d/M/yyyy");
            txtNgayNhanMau.Text    = Convert.ToDateTime(rowThiNghiem["NgayNhanMau"]).ToString("d/M/yyyy");
            txtNgayThuMau.Text     = Convert.ToDateTime(rowThiNghiem["NgayThuMau"]).ToString("d/M/yyyy");
            txtLyDoThiNghiem.Text  = rowThiNghiem["LyDoThiNghiem"].ToString();
            txtPhuTrachLayMau.Text = rowThiNghiem["PhuTrachLayMau"].ToString();
            txtGhiChu.Text         = rowThiNghiem["GhiChu"].ToString();
        }