Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var id   = Request["ID"];
        var list = new List <PhieuXuatNhapSanPhamChiTiet>();

        using (var con = DAL.con())
        {
            if (string.IsNullOrEmpty(id))
            {
                Item    = PhieuGiatVayDal.SelectDraff(con);
                Item.Ma = Item.Ma == 0 ? 1 : Item.Ma + 1;
                Item.ID = Guid.NewGuid();
            }
            else
            {
                Item = PhieuGiatVayDal.SelectById(con, new Guid(id));
                list = PhieuXuatNhapSanPhamChiTietDal.SelectByPxnSpId(con, id);
            }
            Add.List = list;
            Add.Item = Item;;
        }
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var id    = Request["ID"];
        var khId  = Request["KH_ID"];
        var pdvId = Request["PDV_ID"];
        var ctvId = Request["CTV_ID"];
        var pgvId = Request["PGV_ID"];
        var pbhId = Request["PBH_ID"];

        using (var con = DAL.con())
        {
            if (string.IsNullOrEmpty(id))
            {
                Item = ThuChiDal.SelectByDraff(con, true);
                if (khId != null && khId.Length >= 36)
                {
                    khId = khId.Substring(khId.LastIndexOf(',') + 1);
                    var kh = KhachHangDal.SelectById(new Guid(khId), con);
                    Item.P_Ten = kh.Ten;
                    Item.P_ID  = kh.ID;
                }


                if (pdvId != null && pdvId.Length >= 36)
                {
                    pdvId = pdvId.Substring(pdvId.LastIndexOf(',') + 1);
                    var pdv = PhieuDichVuDal.SelectById(con, new Guid(pdvId));
                    Item.PDV_ID = pdv.ID;
                    Item.PDV_Ma = pdv.Ma;
                    var kh = KhachHangDal.SelectById(pdv.KH_ID, con);
                    Item.P_Ten = kh.Ten;
                    Item.P_ID  = kh.ID;
                }

                if (ctvId != null && ctvId.Length >= 36)
                {
                    ctvId = ctvId.Substring(ctvId.LastIndexOf(',') + 1);
                    var ctv = ChoThueVayDal.SelectById(con, new Guid(ctvId));
                    Item.CTV_ID = ctv.ID;
                    Item.CTV_Ma = ctv.Ma;
                    var kh = KhachHangDal.SelectById(ctv.KH_ID, con);
                    Item.P_Ten = kh.Ten;
                    Item.P_ID  = kh.ID;
                }

                if (pgvId != null && pgvId.Length >= 36)
                {
                    pgvId = pgvId.Substring(pgvId.LastIndexOf(',') + 1);
                    var pgv = PhieuGiatVayDal.SelectById(con, new Guid(pgvId));
                    Item.PGV_ID = pgv.ID;
                    Item.PGV_Ma = pgv.Ma;
                }
                if (pbhId != null && pbhId.Length >= 36)
                {
                    pbhId = pbhId.Substring(pgvId.LastIndexOf(',') + 1);
                    var pbh = PhieuBaoHongDal.SelectById(con, new Guid(pbhId));
                    Item.PBH_ID = pbh.ID;
                    Item.PBH_Ma = pbh.Ma;
                }
            }
            else
            {
                Item = ThuChiDal.SelectById(con, new Guid(id));
            }
            var logoStr = DanhMucDal.SelectByMa("BAOCAO-HEADER-THUCHI", con).Description;
            InPhieuChi.LogoStr = logoStr;
            var listLoai = DanhMucDal.SelectByLDMMa(con, "NDTC-CHI");
            InPhieuChi.ListLoai = listLoai;
            InPhieuChi.Item     = Item;
        }
    }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var logged = Security.IsAuthenticated();
        var Id     = Request["Id"];
        var IdNull = string.IsNullOrEmpty(Id);

        var q      = Request["q"];
        var refUrl = Request["refUrl"];

        if (!string.IsNullOrEmpty(refUrl))
        {
            refUrl = Server.UrlDecode(refUrl);
        }

        var CH_ID        = Request["CH_ID"];
        var Ma           = Request["Ma"];
        var Tien         = Request["Tien"];
        var NgayBatDau   = Request["NgayBatDau"];
        var NgayKetThuc  = Request["NgayKetThuc"];
        var NguoiXuat    = Request["NguoiXuat"];
        var NguoiNhap    = Request["NguoiNhap"];
        var NgayTao      = Request["NgayTao"];
        var NguoiTao     = Request["NguoiTao"];
        var NgayCapNhat  = Request["NgayCapNhat"];
        var NguoiCapNhat = Request["NguoiCapNhat"];
        var TrangThai    = Request["TrangThai"];

        switch (subAct)
        {
        case "save":
            #region Thêm khách hàng
            if (logged)
            {
                var item = PhieuGiatVayDal.SelectById(DAL.con(), new Guid(Id));
                IdNull = item.ID == Guid.Empty;
                if (!string.IsNullOrEmpty(NguoiXuat))
                {
                    item.NguoiXuat = Convert.ToInt32(NguoiXuat);
                }
                if (!string.IsNullOrEmpty(NguoiNhap))
                {
                    item.NguoiNhap = Convert.ToInt32(NguoiNhap);
                }
                if (!string.IsNullOrEmpty(CH_ID))
                {
                    item.CH_ID = new Guid(CH_ID);
                }

                if (!string.IsNullOrEmpty(Tien))
                {
                    item.Tien = Convert.ToDouble(Tien);
                }

                if (!string.IsNullOrEmpty(Ma))
                {
                    item.Ma = Convert.ToInt32(Ma);
                }
                if (!string.IsNullOrEmpty(TrangThai))
                {
                    item.TrangThai = Convert.ToInt32(TrangThai);
                }

                if (!string.IsNullOrEmpty(NgayBatDau))
                {
                    item.NgayBatDau = Convert.ToDateTime(NgayBatDau, new CultureInfo("vi-vn"));
                }
                if (!string.IsNullOrEmpty(NgayKetThuc))
                {
                    item.NgayKetThuc = Convert.ToDateTime(NgayKetThuc, new CultureInfo("vi-vn"));
                }

                if (IdNull)
                {
                    item.ID       = new Guid(Id);
                    item.NgayTao  = DateTime.Now;
                    item.NguoiTao = Security.UserId;
                }
                item.NgayCapNhat  = DateTime.Now;
                item.NguoiCapNhat = Security.UserId;

                if (IdNull)
                {
                    item = PhieuGiatVayDal.Insert(item);
                    #region log
                    LogDal.log(item, new Log()
                    {
                        Checked = false
                        ,
                        Info =
                            string.Format("{1} thêm mới phiếu giặt váy: {0}", item.MaStr,
                                          Security.Username)
                        ,
                        NgayTao = DateTime.Now
                        ,
                        Username = Security.Username
                        ,
                        PRowId = item.ID
                        ,
                        PTen = item.MaStr
                        ,
                        RequestIp = Request.UserHostAddress
                        ,
                        RawUrl = refUrl
                        ,
                        LLOG_ID = 1
                        ,
                        Ten = "Thêm"
                    });
                    #endregion
                }
                else
                {
                    item = PhieuGiatVayDal.Update(item);
                    #region log
                    LogDal.log(item, new Log()
                    {
                        Checked = false
                        ,
                        Info =
                            string.Format("{1} sửa phiếu giặt váy: {0}", item.MaStr,
                                          Security.Username)
                        ,
                        NgayTao = DateTime.Now
                        ,
                        Username = Security.Username
                        ,
                        PRowId = item.ID
                        ,
                        PTen = item.MaStr
                        ,
                        RequestIp = Request.UserHostAddress
                        ,
                        RawUrl = refUrl
                        ,
                        LLOG_ID = 2
                        ,
                        Ten = "Sửa"
                    });
                    #endregion
                }
                TimKiemDal.Add(item, item.ID);
                rendertext(item.ID.ToString());
            }
            break;

            #endregion
        case "remove":
            #region Xóa phiếu xuất nhập/ phiếu dịch vụ
            if (logged && !IdNull)
            {
                var item = PhieuGiatVayDal.SelectById(DAL.con(), new Guid(Id));
                if (item.NguoiTao == Security.UserId)
                {
                    PhieuGiatVayDal.DeleteById(new Guid(Id));
                    TimKiemDal.DeleteByPRowId(DAL.con(), item.ID);
                    #region log
                    LogDal.log(item, new Log()
                    {
                        Checked = false
                        ,
                        Info =
                            string.Format("{1} xóa phiếu giặt váy: {0}", item.MaStr,
                                          Security.Username)
                        ,
                        NgayTao = DateTime.Now
                        ,
                        Username = Security.Username
                        ,
                        PRowId = item.ID
                        ,
                        PTen = item.MaStr
                        ,
                        RequestIp = Request.UserHostAddress
                        ,
                        RawUrl = refUrl
                        ,
                        LLOG_ID = 3
                        ,
                        Ten = "Xóa"
                    });
                    #endregion
                    rendertext("1");
                }
                else
                {
                    rendertext("0");
                }
            }
            break;

            #endregion
        case "search":
            #region search
            var pg = PhieuGiatVayDal.pagerNormal(DAL.con(), null, false, "PGV_Ma desc", q, 10, null, null, null);
            rendertext(JavaScriptConvert.SerializeObject(pg.List), "text/javascript");
            break;

            #endregion
        default: break;
        }
    }