private void frm_BangGia_Load(object sender, EventArgs e)
        {
            try
            {
                LoadAllBangGia();
                //gan bang gia hien tai
                if (bangGia != null)
                {
                    LoadIndexBG();
                }
                else if (liBangGia.Count > 0)
                {
                    IndexBG = 0;
                    bangGia = liBangGia[IndexBG];
                }
                //hien thi thong tin bang gia hien tai
                LoadBangGiaInfor();
                //Thiet lap trang thai item
                setEDItems();
                setEDFunctions();
            }
            catch (Exception ex)
            {
#if DEBUG
                MessageBox.Show("Lỗi ngoại lệ: " + ex.ToString(), Declare.titleError, MessageBoxButtons.OK, MessageBoxIcon.Error);
#else
                MessageBox.Show("Lỗi ngoại lệ: " + ex.Message, Declare.titleError, MessageBoxButtons.OK, MessageBoxIcon.Error);
#endif
            }
        }
        private void btnTimBangGia_Click(object sender, EventArgs e)
        {
            if (liBangGia == null)
            {
                return;
            }
            bool found = false;

            for (int i = 0; i < liBangGia.Count; i++)
            {
                if (liBangGia[i].SoBangGia.Equals(txtSoBangGia.Text))
                {
                    found   = true;
                    IndexBG = i;
                    bangGia = liBangGia[i];
                    LoadBangGiaInfor();
                    break;
                }
            }
            if (!found)
            {
                MessageBox.Show("Không có bảng giá này");
                if (!Updating && bangGia != null)
                {
                    txtSoBangGia.Text = bangGia.SoBangGia;
                }
            }
        }
        private void btnTruoc_Click(object sender, EventArgs e)
        {
            try
            {
                if (IndexBG > 0)
                {
                    if (Updating)
                    {
                        if (MessageBox.Show("Dữ liệu đang cập nhật, bạn có muốn hủy bỏ không?", "Thông báo", MessageBoxButtons.YesNo) == DialogResult.No)
                        {
                            return;
                        }
                    }

                    IndexBG--;
                    IsAdded = false;
                    //IdBangGia = liBangGia[IndexBG].IdBangGia;
                    bangGia = liBangGia[IndexBG];
                    LoadBangGiaInfor();

                    Updating = false;
                    setEDItems();
                    setEDFunctions();
                }
            }
            catch (Exception ex)
            {
#if DEBUG
                MessageBox.Show("Lỗi thao tác\n" + ex.ToString(), Declare.titleError, MessageBoxButtons.OK, MessageBoxIcon.Error);
#else
                MessageBox.Show("Lỗi thao tác", Declare.titleError, MessageBoxButtons.OK, MessageBoxIcon.Error);
#endif
            }
        }
예제 #4
0
        private void DayGia2WebSite(BangGiaInfor bangGia)
        {
            List <BangGiaBanChiTietBCInfor> liBGiaCTiet = BangGiaDataProvider.Instance.GetAllBangGiaChiTietTon(bangGia.IdBangGia);

            string[]         arrTT = bangGia.ListIdTrungTam.Split(",".ToCharArray());
            DongBoGiaWebsite sync  = new DongBoGiaWebsite(/*bangGia.IdTrungTam*/ Common.IntValue(arrTT[0]), bangGia.NgayLap, liBGiaCTiet);

            sync.BangGiaSync();
        }
예제 #5
0
 private void gvListChungTu_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
 {
     if (gvListBangGia.FocusedRowHandle < 0)
     {
         return;
     }
     bangGia = (BangGiaInfor)gvListBangGia.GetRow(gvListBangGia.FocusedRowHandle);
     if (bangGia != null)
     {
         setEDFunctions();
         ShowInfors();
     }
 }
예제 #6
0
        private void btnTimBangGia_Click(object sender, EventArgs e)
        {
            BangGiaInfor bg = BangGiaDataProvider.Instance.GetBangGiaChuaDuyetInfor(txtSoBangGia.Text, nguoiDung.IdNhomNguoiDung);

            if (bg == null)
            {
                MessageBox.Show("Không có bảng giá này");
                txtSoBangGia.Text = bangGia.SoBangGia;
            }
            else
            {
                bangGia = bg;
                LoadBangGiaInfor();
            }
        }
예제 #7
0
        private void search()
        {
            frmCS_TimKiem_BangGia frm = new frmCS_TimKiem_BangGia(2);

            if (frm.ShowDialog() == DialogResult.OK && frm.BangGia != null)
            {
                bangGia = frm.BangGia;
                //hien thi thong tin bang gia hien tai
                LoadBangGiaInfor();
                //Thiet lap trang thai item
                Updating = true;
                setEDItems();
                setEDFunctions();
            }
        }
예제 #8
0
        private bool UpdateBangGia()
        {
            int truocUpdate = bangGia.DaDuyet;

            lblStatus.Text = "Đang duyệt bảng giá .....";
            Cursor.Current = Cursors.WaitCursor;
            try
            {
                if (ValidBangGiaInfor())
                {
                    ConnectionUtil.Instance.BeginTransaction();
                    //update header
                    UpdateBangGiaHeader();
                    //update detail
                    UpdateBangGiaDetails();
                    ConnectionUtil.Instance.CommitTransaction();

                    //dong bo gia website
                    bangGia = BangGiaDataProvider.Instance.GetBangGiaInfor(bangGia.IdBangGia);
                    if (truocUpdate == 0 && bangGia.DaDuyet == 1)//bang gia vua duoc duyet => day len website
                    {
                        if (MessageBox.Show("Bảng giá đã duyệt thành công. Bạn có muốn đẩy giá lên website không?", "Cảnh báo", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            lblStatus.Text = "Đang đồng bộ giá lên website .....";
                            DayGia2WebSite(bangGia);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Cập nhật bảng giá thành công!");
                    }
                    lblStatus.Text = "Đã duyệt xong bảng giá";

                    this.Close();
                }
            }
            catch (Exception)
            {
                ConnectionUtil.Instance.RollbackTransaction();
                throw;
            }
            Cursor.Current = Cursors.Default;
            return(false);
        }
예제 #9
0
        private void EditOrder(int rowHandle)
        {
            if (rowHandle < 0)
            {
                return;
            }
            BangGiaInfor ct = (BangGiaInfor)gvListBangGia.GetRow(rowHandle);

            if (DuyetBangGia)
            {
                frmCS_DuyetBangGia frm = new frmCS_DuyetBangGia(ct);
                frm.ShowDialog();
            }
            else
            {
                frmCS_LapBangGia frm = new frmCS_LapBangGia(ct);
                frm.ShowDialog();
            }
            btnTimkiem_Click(null, null);
        }
예제 #10
0
        private void gvListBangGia_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
        {
            BangGiaInfor bg = (BangGiaInfor)gvListBangGia.GetRow(e.RowHandle);

            if (bg != null)
            {
                if (e.Column.FieldName.Equals("DaDuyet"))
                {
                    if (bg.DaDuyet == (int)TinhTrangDuyetGia.DA_DUYET)
                    {
                        e.Appearance.BackColor = tsslDaPhanCong.BackColor;
                        e.Appearance.ForeColor = tsslDaPhanCong.ForeColor;
                    }
                    else if (bg.DaDuyet == (int)TinhTrangDuyetGia.TU_CHOI)
                    {
                        e.Appearance.BackColor = tsslHuyClr.BackColor;
                        e.Appearance.ForeColor = tsslHuyClr.ForeColor;
                    }
                }
            }
        }
        private void EditOrder(int rowHandle)
        {
            if (rowHandle < 0)
            {
                return;
            }
            BangGiaSearchInfor bgs = (BangGiaSearchInfor)gvListBangGia.GetRow(rowHandle);

            BangGia = new BangGiaInfor(bgs);
            if (KieuTimKiem > 0 && BangGia != null)
            {
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                this.DialogResult = DialogResult.None;
                frmCS_LapBangGia frm = new frmCS_LapBangGia(BangGia);
                frm.HideMenu();
                frm.ShowDialog();
            }
            //ChungTuBanHangInfor ctbh = BangGiaDataProvider.Instance.LoadBangGiaBan(ChungTuById(ct.IdChungTu));
        }
예제 #12
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            try
            {
                //Draft = 0;
                if (UpdateBangGia())
                {
                    LoadAllBangGia();
                    if (liBangGia.Count > 0)
                    {
                        if (IndexBG == liBangGia.Count)
                        {
                            IndexBG = liBangGia.Count - 1;
                        }
                        bangGia = liBangGia[IndexBG];
                    }
                    //hien thi thong tin bang gia hien tai
                    LoadBangGiaInfor();

                    Updating = false;
                    setEDItems();
                    setEDFunctions();
                    if (liBangGia.Count == 0)
                    {
                        txtNguoiLap.ResetText();
                        groupBox2.Text = "Thông tin chung:";
                    }
                }
            }
            catch (Exception ex)
            {
#if DEBUG
                MessageBox.Show("Lỗi thao tác\n" + ex.ToString(), Declare.titleError, MessageBoxButtons.OK, MessageBoxIcon.Error);
#else
                MessageBox.Show("Lỗi thao tác", Declare.titleError, MessageBoxButtons.OK, MessageBoxIcon.Error);
#endif
            }
        }
예제 #13
0
 public void DuyetBangGia(BangGiaInfor bangGia)
 {
     ExecuteCommand(Declare.StoreProcedureNamespace.spBangGiaDuyet, bangGia.IdBangGia);
 }
예제 #14
0
 public frmCS_Duyet_BangGia(BangGiaInfor bangGia)
 {
     InitializeComponent();
     Common.LoadStyle(this);
     this.bangGia = bangGia;
 }
예제 #15
0
 public void CapNhatNhomDuyetBangGia(BangGiaInfor bangGia)
 {
     ExecuteCommand(Declare.StoreProcedureNamespace.spBangGiaChiTietUpdateNhomDuyet, bangGia.IdBangGia);
 }
예제 #16
0
 public void CapNhatNhomDuyetBangGia(BangGiaInfor bangGia)
 {
     BangGiaDAO.Instance.CapNhatNhomDuyetBangGia(bangGia);
 }
예제 #17
0
 public void DuyetBangGia(BangGiaInfor bangGia)
 {
     BangGiaDAO.Instance.DuyetBangGia(bangGia);
 }
예제 #18
0
 public int InsertBangGia(BangGiaInfor bangGia)
 {
     return(BangGiaDAO.Instance.InsertBangGia(bangGia));
 }
예제 #19
0
 public void UpdateBangGiaDuyet(BangGiaInfor bangGia)
 {
     BangGiaDAO.Instance.UpdateBangGiaDuyet(bangGia);
 }
예제 #20
0
 public int InsertBangGia(BangGiaInfor bangGia)
 {
     ExecuteCommand(Declare.StoreProcedureNamespace.spBangGiaInsert, bangGia.IdBangGia, bangGia.SoBangGia,
                    bangGia.NgayLap, bangGia.NguoiLap, bangGia.GhiChu, bangGia.Draft, bangGia.NguoiTao, bangGia.ListIdTrungTam, bangGia.ListMaTrungTam);
     return(Common.IntValue(Parameters["p_IdBangGia"].Value));
 }
예제 #21
0
 public frmCS_DuyetBangGia()
 {
     InitializeComponent();
     Common.LoadStyle(this);
     bangGia = new BangGiaInfor();
 }
예제 #22
0
 public frmCS_LapBangGia_AddComment(BangGiaInfor bangGia)
 {
     InitializeComponent();
     Common.LoadStyle(this);
     this.bangGia = bangGia;
 }
예제 #23
0
 public void UpdateBangGiaDuyet(BangGiaInfor bangGia)
 {
     ExecuteCommand(Declare.StoreProcedureNamespace.spBangGiaUpdateDuyet, bangGia.IdBangGia, bangGia.DaDuyet,
                    bangGia.NgayLap, bangGia.NguoiLap, bangGia.GhiChu, bangGia.Draft, bangGia.NguoiCapNhat, bangGia.ListIdTrungTam, bangGia.ListMaTrungTam);
 }