Exemplo n.º 1
0
        private void fThongKePhieu_Load(object sender, EventArgs e)
        {
            repoTenHang.DataSource = Local_Params.lstDanhMucHang;
            repoTenHang.DisplayMember = "TenHang";
            repoTenHang.ValueMember = "MaVatTu";

            oDonDatHangCT_Phieu obj = new oDonDatHangCT_Phieu();
            obj.TinhTrang = 0;

            gridMain.DataSource = ADonDatHangCT_Phieu.find(obj);
        }
 public static List<P_DonDatHang_CT_Phieu> find(oDonDatHangCT_Phieu obj)
 {
     using (var model = ModelConnector.Connector())
     {
         var list = from l in model.P_DonDatHang_CT_Phieu select l;
         if (!string.IsNullOrEmpty(obj.SoDonDatHang))
             list = list.Where(a => a.SoDonDatHang.Equals(obj.SoDonDatHang));
         if (!string.IsNullOrEmpty(obj.TinhTrang.ToString()))
             list = list.Where(a => a.TinhTrang==obj.TinhTrang);
         if (!string.IsNullOrEmpty(obj.TuNgay.ToString()))
             list = list.Where(a => a.TuNgay >= obj.TuNgay.Value);
         if (!string.IsNullOrEmpty(obj.DenNgay.ToString()))
             list = list.Where(a => a.DenNgay <= obj.DenNgay.Value);
         if (!string.IsNullOrEmpty(obj.TenHang))
             list = list.Where(a => a.TenHang == obj.TenHang);
         if (!string.IsNullOrEmpty(obj.TinhTrang.ToString()))
             list = list.Where(a => a.TinhTrang == obj.TinhTrang);
         //list = list.Where(a => a.IsDel == obj.IsDel);
         return list.ToList();
     }
 }
Exemplo n.º 3
0
        void load_DonDatHang()
        {
            dateNgayGiaoDich.DateTime = objPDonDatHang.NgayDatHang.Value;
            gridlk_DanhMucPhapNhan.EditValue = objPDonDatHang.DonViGoi;
            gridlk_DanhMucPhapNhanDatHang.EditValue = objPDonDatHang.DonViDat;
            txtSoDonHang.Text = objPDonDatHang.SoDonDatHang;
            txtSoHoaDon.Text = objPDonDatHang.SoHoaDon;
            chkLenhXuatKho.Checked = objPDonDatHang.IsSoPhieu.Value;
            chkLenhXuatKho.Enabled = objPDonDatHang.IsSoPhieu.Value == true ? false : true;
            path_folder = objPDonDatHang.FileLuuTru;
            if(chkLenhXuatKho.Checked==true)
            {
                oDonDatHangCT_Phieu ophieu = new oDonDatHangCT_Phieu() { SoDonDatHang = objPDonDatHang.SoDonDatHang};
                lstPDonDatHangCtPhieu = new List<P_DonDatHang_CT_Phieu>();
                lstPDonDatHangCtPhieu = ADonDatHangCT_Phieu.find(ophieu);
                DataTable dtphieu = commons.ToDataTable(lstPDonDatHangCtPhieu);
                dtphieu.Columns.Add("DVT", typeof(string));
                for (int i = 0; i < dtphieu.Rows.Count; i++)
                {
                    dtphieu.Rows[i]["DVT"] = ((P_DanhMucHang)repoTenHangPhieu.GetDataSourceRowByKeyValue(dtphieu.Rows[i]["TenHang"])).DVT;
                }

                gridMainPhieu.DataSource = dtphieu;
            }

            oDonDatHangCT ct= new oDonDatHangCT();
            ct.SoDonDatHang = objPDonDatHang.SoDonDatHang;
            DataTable dt = commons.ToDataTable(ADonDatHangCT.find(ct));
            dt.Columns.Add("HinhThucThanhToan").DefaultValue = "CK";
            gridMain.DataSource = dt;
        }
 List<P_DonDatHang_CT_Phieu> load()
 {
     objPhieu = new oDonDatHangCT_Phieu();
     if (chkDateF.Checked)
         objPhieu.TuNgay = Utils_DateTime.FromDate(dateF.DateTime);
     if (chkDateT.Checked)
         objPhieu.DenNgay = Utils_DateTime.ToDate(dateT.DateTime);
     if (chkState.Checked)
         objPhieu.TinhTrang = lkState.EditValue == null ? byte.Parse("0") : byte.Parse(lkState.EditValue.ToString());
     if (chkTenHang.Checked)
         objPhieu.TenHang = lkTenHang.EditValue == null ? "" : lkTenHang.EditValue.ToString();
     return ADonDatHangCT_Phieu.find(objPhieu);
 }