Example #1
0
        private void KetChuyen()
        {
            dgvKetChuyen.EndEdit();
            bdsKetChuyen.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 = Element.sysNgay_Ct1.Month;
            //frm.numThang2.Value = Element.sysNgay_Ct2.Month;

            //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);

            EpointProcessBox.setMaxValue(dgvKetChuyen.Rows.Count);

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

            foreach (DataRow dr in dtKetChuyen.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["MA_CT"]      = "TD";
                ht["CREATE_LOG"] = "30" + dteNgay_Ct2.Year.ToString() + ":120000:" + Element.sysUser_Id;
                ht["MA_DVCS"]    = Element.sysMa_DvCs;

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

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

                dr["Select"] = false;
            }

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