コード例 #1
0
        private void LoadData(int id)
        {
            try
            {
                this.currentDonHang = (from t in dts.Qldh_DonHangs where t.ID == id select t).FirstOrDefault();
                if (this.currentDonHang != null)
                {
                    //ltTitle.Text = "Chỉnh sửa phiếu kiểm tra vật tư nhập: " + this.currentDonHang.MaHieuPhieuNhap;
                    if (this.currentDonHang.Xoa.HasValue && this.currentDonHang.Xoa.Value)
                    {
                        Response.Redirect(Util.SERVER_NAME + "/Business/QuanLySanXuat/Default.aspx?page=cd", false);
                    }

                    this.lblMaDonHang.Text = this.currentDonHang.MaHieuDonHang;

                    this.CurrentTinhTrang = this.currentDonHang.TinhTrang.HasValue ? this.currentDonHang.TinhTrang.Value : 0;
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.StackTrace);
                Response.Write(ex.Message);
            }
        }
コード例 #2
0
        private void LoadData(int id)
        {
            try
            {
                xRPDataContext dts = new xRPDataContext();
                this.currentDonHang = (from t in dts.Qldh_DonHangs where t.ID == id select t).FirstOrDefault();
                if (this.currentDonHang != null)
                {
                    ltPrint.Text = "<li class=\"menu-item icon-only\" id=\"btn-print\"><input type=\"button\" class=\"menu-bar-item-button icon-printer\" id=\"btnPrint\" title=\"In dữ liệu\" /></li>";
                    //ltTitle.Text = "Chỉnh sửa phiếu kiểm tra vật tư nhập: " + this.currentDonHang.MaHieuPhieuNhap;
                    if (this.currentDonHang.Xoa.HasValue && this.currentDonHang.Xoa.Value)
                    {
                        Response.Redirect(Util.SERVER_NAME + "/Administrator/QuanLyDonHang/DonHang/Default.aspx?page=dsdonhang", false);
                    }
                    //btnCancel.Visible = this.currentDonHang.Xoa.HasValue && this.currentDonHang.Xoa.Value;
                    pnChiTietVatTu.Visible = true;

                    this.txtMaDonHang.Text     = this.currentDonHang.MaHieuDonHang;
                    this.txtNgayDatHang.Value  = string.Format("{0:dd/MM/yyyy}", this.currentDonHang.NgayDatHang);
                    this.txtNgayGiaoHang.Value = string.Format("{0:dd/MM/yyyy}", this.currentDonHang.NgayGiaoHang);

                    this.slcTenKhachHang.Value = this.currentDonHang.MaKhachHang.HasValue ? this.currentDonHang.MaKhachHang.Value.ToString() : "";
                    if (this.currentDonHang.MaKhachHang.HasValue)
                    {
                        this.slcTenKhachHang.Value = this.currentDonHang.MaKhachHang.Value.ToString();
                        var kh = dts.Qldh_KhachHangs.Where(t => t.ID == this.currentDonHang.MaKhachHang.Value).FirstOrDefault();
                        if (kh != null)
                        {
                            this.txtTenKhachHang.Text = kh.MaHieuKhachHang.Trim() + " - " + kh.TenKhachHang;
                        }
                    }
                    this.CurrentTinhTrang = this.currentDonHang.TinhTrang.HasValue ? this.currentDonHang.TinhTrang.Value : 0;
                    this.txtGhiChu.Text   = this.currentDonHang.GhiChu;
                    if (this.currentDonHang.MaKhachHang.HasValue)
                    {
                        this.MaKhachHang = this.currentDonHang.MaKhachHang.Value.ToString();
                    }


                    List <xRPDAL.Sp_Qldh_MatHang_SelectResult> dshh = new xRPDataContext().Sp_Qldh_MatHang_Select(2, (int?)null, currentDonHang.ID, 0, (int?)null, "").ToList();
                    bool canDelete = true;
                    foreach (var x in dshh)
                    {
                        if (x.TinhTrang != 0)
                        {//Co hang hoa da duoc xu ly
                            canDelete = false;
                        }
                    }
                    //ltDelete.Text = canDelete ? "<li class=\"menu-item icon-only\" id=\"btn-delete\"><input type=\"button\" class=\"menu-bar-item-button icon-printer\" id=\"btnDelete\" title=\"Xóa đơn hàng\" /></li>" : "";
                    ltUndoProcess.Text = !canDelete ? "<li class=\"menu-item icon-only\" id=\"btn-undoprocess\"><input type=\"button\" class=\"menu-bar-item-button icon-printer\" id=\"btnUndoProcess\" title=\"Hủy xử lý\" /></li>" : "";
                }
                else
                {
                    this.txtNgayDatHang.Value  = string.Format("{0:dd/MM/yyyy}", DateTime.Now);
                    this.txtNgayGiaoHang.Value = string.Format("{0:dd/MM/yyyy}", DateTime.Now);
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.StackTrace);
                Response.Write(ex.Message);
            }
        }