Exemplo n.º 1
0
        void btKet_Chuyen_Click(object sender, EventArgs e)
        {
            //KetChuyen
            frmKetChuyen_Run frm = new frmKetChuyen_Run();

            frm.Tag = "Ket_Chuyen";

            frm.numThang1.Value = Element.sysNgay_Ct1.Month;
            frm.numThang2.Value = Element.sysNgay_Ct2.Month;

            frm.Load();
            if (!frm.isAccept)
            {
                return;
            }

            dteNgay_Ct1 = Library.StrToDate("01/" + frm.numThang1.Value + "/" + Element.sysWorkingYear);
            dteNgay_Ct2 = Library.StrToDate("01/" + frm.numThang2.Value + "/" + Element.sysWorkingYear);
            dteNgay_Ct2 = dteNgay_Ct2.AddMonths(1).AddDays(-1);

            iKetchuyen = true;
            EpointProcessBox.Show(this);
        }
Exemplo n.º 2
0
        void frmDmKetChuyen_View_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Control && e.KeyCode == Keys.A)
            {
                for (int i = 0; i < dtKetChuyen.Rows.Count; i++)
                {
                    dtKetChuyen.Rows[i]["SELECT"] = true;
                }
            }

            else if (e.Control && e.KeyCode == Keys.U)
            {
                for (int i = 0; i < dtKetChuyen.Rows.Count; i++)
                {
                    dtKetChuyen.Rows[i]["SELECT"] = false;
                }
            }

            else if (!e.Control && e.KeyCode == Keys.F10)
            {
                //KetChuyen
                frmKetChuyen_Run frm = new frmKetChuyen_Run();
                frm.Tag = "Ket_Chuyen";

                frm.numThang1.Value = Element.sysNgay_Ct1.Month;
                frm.numThang2.Value = Element.sysNgay_Ct2.Month;

                frm.Load();
                if (!frm.isAccept)
                {
                    return;
                }

                dteNgay_Ct1 = Library.StrToDate("01/" + frm.numThang1.Value + "/" + Element.sysWorkingYear);
                dteNgay_Ct2 = Library.StrToDate("01/" + frm.numThang2.Value + "/" + Element.sysWorkingYear);
                dteNgay_Ct2 = dteNgay_Ct2.AddMonths(1).AddDays(-1);

                iKetchuyen = true;
                EpointProcessBox.Show(this);
            }
            else if (e.Control && e.KeyCode == Keys.F10)
            {
                //KetChuyen_Delete();
                frmKetChuyen_Run frm = new frmKetChuyen_Run();
                frm.Tag = "Ket_Chuyen";

                frm.numThang1.Value = Element.sysNgay_Ct1.Month;
                frm.numThang2.Value = Element.sysNgay_Ct2.Month;

                frm.Load();
                if (!frm.isAccept)
                {
                    return;
                }

                dteNgay_Ct1 = Library.StrToDate("01/" + frm.numThang1.Value + "/" + Element.sysWorkingYear);
                dteNgay_Ct2 = Library.StrToDate("01/" + frm.numThang2.Value + "/" + Element.sysWorkingYear);
                dteNgay_Ct2 = dteNgay_Ct2.AddMonths(1).AddDays(-1);

                iKetchuyen = false;

                EpointProcessBox.Show(this);
            }
            else if (e.KeyCode == Keys.Space)
            {
                ((DataRowView)bdsKetChuyen.Current).Row["Select"] = !(bool)((DataRowView)bdsKetChuyen.Current).Row["Select"];
            }
        }
Exemplo n.º 3
0
        private void KetChuyenPb()
        {
            dgvKetChuyenPb.EndEdit();
            bdsKetChuyenPb.EndEdit();

            if (Common.GetPartitionCurrent() != 0 && Common.GetPartitionCurrent() != Element.sysWorkingYear)
            {
                Common.MsgCancel("Phải chuyển về phân vùng dữ liệu " + Element.sysWorkingYear.ToString() + "!");
                return;
            }

            frmKetChuyen_Run frm = new frmKetChuyen_Run();

            frm.Tag = "Ket_Chuyen";

            frm.numThang1.Value = this.numThang1.Value;
            frm.numThang2.Value = this.numThang2.Value;

            frm.Load();

            if (!frm.isAccept)
            {
                return;
            }

            DateTime dteNgay_Ct1 = Library.StrToDate("01/" + frm.numThang1.Value + "/" + Element.sysWorkingYear);
            DateTime dteNgay_Ct2 = Library.StrToDate("01/" + frm.numThang2.Value + "/" + Element.sysWorkingYear);

            dteNgay_Ct2 = dteNgay_Ct2.AddMonths(1).AddDays(-1);

            if (!Common.CheckDataLocked(dteNgay_Ct1))
            {
                Common.MsgCancel("Dữ liệu đã khóa, liên hệ với nhà quản trị!");
                return;
            }

            foreach (DataRow dr in dtKetChuyenPb.Rows)
            {
                if ((bool)dr["SELECT"] == false)
                {
                    continue;
                }

                Hashtable ht = new Hashtable();
                ht["NGAY_CT1"]   = dteNgay_Ct1;
                ht["NGAY_CT2"]   = dteNgay_Ct2;
                ht["STT"]        = dr["Stt"];
                ht["TK"]         = dr["Tk"];
                ht["TK_DU_DEN"]  = dr["Tk_Du_Den"];
                ht["DIEN_GIAI"]  = dr["Dien_Giai"];
                ht["NO_CO_AUTO"] = dr["No_Co_Auto"];
                ht["PS_DU"]      = dr["Ps_Du"];
                ht["LOAI_KC"]    = dr["Loai_Kc"];
                ht["MA_CT"]      = "TD";
                ht["MA_DVCS"]    = Element.sysMa_DvCs;

                Common.ShowStatus(Languages.GetLanguage("In_Process") + (string)dr["Dien_Giai"]);

                //SQLExec.Execute("Sp_KetChuyen_Delete", ht, CommandType.StoredProcedure);

                if ((string)dr["Loai_Kc"] == "1")
                {
                    SQLExec.Execute("Sp_KetChuyenPb1", ht, CommandType.StoredProcedure);
                }
                else if ((string)dr["Loai_Kc"] == "2")
                {
                    SQLExec.Execute("Sp_KetChuyenPb2", ht, CommandType.StoredProcedure);
                }

                dr["Select"] = false;
            }

            Common.EndShowStatus();
            Common.MsgOk(Languages.GetLanguage("End_Process"));
        }