Пример #1
0
        public override void Load()
        {
            //DataTable dtThang = SQLExec.ExecuteReturnDt("SELECT 0 Thang UNION SELECT DISTINCT MONTH(Ngay_Ct) AS Thang FROM HRSALARY WHERE YEAR(Ngay_Ct) = " + Element.sysWorkingYear.ToString());

            ////Gắn Ma_Bp vào ComboBox
            DataTable dtDmBp = SQLExec.ExecuteReturnDt("SP_HRM_GetDataCombobox 'KIPRANK_APPLYFOR'");

            //dtDmBp.Rows.Add(new string[] { "*", "Tất cả" });

            cboApplyFor.lstItem.BuildListView("Code:100,Label:250");
            cboApplyFor.lstItem.DataSource = dtDmBp;
            cboApplyFor.lstItem.Size       = new Size(320, cboApplyFor.lstItem.Items.Count * 30);
            cboApplyFor.lstItem.GridLines  = true;

            ////Gắn Ma_Bp vào ComboBox
            //DataTable dtKv = SQLExec.ExecuteReturnDt("SELECT '*' Ma_Kv, N'Tất cả' Ten_Kv UNION SELECT Ma_Kv, Ten_Kv FROM LIKHUVUC ORDER BY Ma_Kv");
            ////dtDmBp.Rows.Add(new string[] { "*", "Tất cả" });

            ////cboMa_Kv.lstItem.BuildListView("Ma_Kv:100,Ten_Kv:250");
            ////cboMa_Kv.lstItem.DataSource = dtKv;
            ////cboMa_Kv.lstItem.Size = new Size(320, cboMa_Kv.lstItem.Items.Count * 30);
            ////cboMa_Kv.lstItem.GridLines = true;

            this.Build();
            this.FillData();

            this.ShowBangLuong();

            this.Show();
        }
Пример #2
0
        void SetDvCs()
        {
            if (bdsDmDvCs.Position < 0)
            {
                return;
            }

            if (!lvDmDvCs.MoveDataSourceToCurrentRow())
            {
                return;
            }

            drCurrent = ((DataRowView)bdsDmDvCs.Current).Row;

            if (DataTool.SQLCheckExist("sys.Objects", "Name", "sp_CheckPermissionDvCs"))
            {
                Hashtable htPara = new Hashtable();
                htPara.Add("MEMBER_ID", Element.sysUser_Id);
                htPara.Add("MA_DVCS", (string)drCurrent["Ma_DvCs"]);

                DataTable dtPermissionDvCs = SQLExec.ExecuteReturnDt("sp_CheckPermissionDvCs", htPara, CommandType.StoredProcedure);

                if (dtPermissionDvCs.Rows.Count >= 1 && !(bool)(dtPermissionDvCs.Rows[0]["Allow_Access"]))
                {
                    EpointMessage.MsgCancel("Người dùng [" + Element.sysUser_Id + "] không được truy cập đơn vị [" + (string)drCurrent["Ten_DvCs"] + "]");
                    return;
                }
            }

            Common.SetSysMa_DvCs(((string)drCurrent["Ma_DvCs"]).Trim());

            this.Close();
        }
Пример #3
0
        void EnterValid()
        {
            Hashtable htPara = new Hashtable();

            htPara["THANG"]   = ((DataRowView)bdsBudgetTc.Current)["Thang"];
            htPara["NAM"]     = Element.sysWorkingYear;
            htPara["MA_DVCS"] = Element.sysMa_DvCs;

            dtBudgetTcDetail = SQLExec.ExecuteReturnDt("sp_GetBudgetTc", htPara, CommandType.StoredProcedure);

            bdsBudgetDetail.DataSource = dtBudgetTcDetail;
            dgvBudgetDetail.DataSource = bdsBudgetDetail;

            //splitContainer1.Panel1Collapsed = true;
            //splitContainer1.Panel2Collapsed = false;

            bdsSearch     = bdsBudgetDetail;
            ExportControl = dgvBudgetDetail;

            numTTien_Thu.Value    = Common.MaxDCValue(dtBudgetTcDetail, "Tien_Thu_Kh");
            numTTien_Chi.Value    = Common.SumDCValue(dtBudgetTcDetail, "Tien_Chi_Kh", "");
            numTTien_Thu_Nt.Value = Common.SumDCValue(dtBudgetTcDetail, "Tien_Thu_Kh_Nt", "");
            numTTien_Chi_Nt.Value = Common.SumDCValue(dtBudgetTcDetail, "Tien_Chi_Kh_Nt", "");


            ((DataRowView)bdsBudgetTc.Current).Row["Tien_Thu_Kh"]    = Common.MaxDCValue(dtBudgetTcDetail, "Tien_Thu_Kh");
            ((DataRowView)bdsBudgetTc.Current).Row["Tien_Chi_Kh"]    = Common.SumDCValue(dtBudgetTcDetail, "Tien_Chi_Kh", "");
            ((DataRowView)bdsBudgetTc.Current).Row["Tien_Thu_Kh_Nt"] = Common.SumDCValue(dtBudgetTcDetail, "Tien_Thu_Kh_Nt", "");
            ((DataRowView)bdsBudgetTc.Current).Row["Tien_Chi_Kh_Nt"] = Common.SumDCValue(dtBudgetTcDetail, "Tien_Chi_Kh_Nt", "");



            dgvBudgetDetail.Focus();
        }
Пример #4
0
        public override void Load(enuEdit enuNew_Edit, DataRow drEdit)
        {
            this.drEdit      = drEdit;
            this.enuNew_Edit = enuNew_Edit;
            this.Tag         = (char)enuNew_Edit + "," + this.Tag;

            //string strCreate_Log = Common.Show_Log((string)drEdit["Create_Log"]);
            //string strLastModify_Log = Common.Show_Log((string)drEdit["LastModify_Log"]);
            //string strLog = string.Empty;
            //strLog += strCreate_Log != string.Empty ? "Create: " + strCreate_Log : "";
            //strLog += strLastModify_Log != string.Empty ? "; Last Modify: " + strLastModify_Log : "";
            //this.ucNotice.SetText(strLog);

            Common.ScaterMemvar(this, ref drEdit);

            //Lay Ma_CbNv
            string    sqlMa_CbNv = "SELECT Ma_CbNv FROM L00MEMBER WHERE Member_ID = '" + Element.sysUser_Id + "'";
            DataTable dtMa_CbNv  = SQLExec.ExecuteReturnDt(sqlMa_CbNv);

            if (dtMa_CbNv != null)
            {
                foreach (DataRow drMa_CbNv in dtMa_CbNv.Rows)
                {
                    if (enuNew_Edit == enuEdit.New)
                    {
                        txtMa_CbNv.Text = drMa_CbNv["Ma_CbNv"].ToString();
                    }
                }
            }

            BindingLanguage();

            this.ShowDialog();
        }
Пример #5
0
        new public void Load(enuEdit enuNew_Edit, DataRow drEdit)
        {
            this.drEdit = drEdit;

            this.enuNew_Edit = enuNew_Edit;
            this.Text        = enuNew_Edit == enuEdit.New ? "Them moi Locate" : "Sua Locate";

            Common.ScaterMemvar(this, ref drEdit);

            LoadDicName();
            BindingLanguage();

            //Fill Combo
            string strMa_CCDC = (string)drEdit["Ma_CCDC"];

            dtStt_Ngia = SQLExec.ExecuteReturnDt("SELECT Stt AS Stt_NGia, Dien_Giai FROM ASCCDCNG WHERE Ma_CCDC = '" + strMa_CCDC + "'");
            //dtStt_Ngia.Rows.Add("*", "Tất cả");
            cboStt.lstItem.Width = 300;
            cboStt.lstItem.BuildListView("STT_NGIA:100,DIEN_GIAI:200");
            cboStt.lstItem.FillListView(dtStt_Ngia);

            if (dtStt_Ngia.Select("Stt_NGia = '" + cboStt.Text + "'").Length > 0)
            {
                lbtTen_CCDC_NGia.Text = (string)dtStt_Ngia.Select("Stt_NGia = '" + cboStt.Text + "'")[0]["Dien_Giai"];
            }
            else
            {
                lbtTen_CCDC_NGia.Text = "";
            }

            this.ShowDialog();
        }
Пример #6
0
        private void FillGroupUser(string strGroup_ID)
        {
            string strQuery =
                "SELECT T1.*, T2.Member_Name, T2.Is_Admin, T2.Member_ID_Allow " +
                " FROM SYSMEMBERNH T1 INNER JOIN SYSMEMBER T2 " +
                " ON T1.Member_ID = T2.Member_ID " +
                " WHERE T1.Member_Group_ID = '" + strGroup_ID + "'";

            //Ma_DvCs_Default
            if (DataTool.SQLCheckExist("INFORMATION_SCHEMA.COLUMNS", new string[] { "Table_Name", "Column_Name" }, new string[] { "SYSMEMBER", "Ma_DvCs_Default" }))
            {
                strQuery =
                    "SELECT T1.*, T2.Member_Name, T2.Is_Admin, T2.Member_ID_Allow, T2.Ma_DvCs_Default " +
                    " FROM SYSMEMBERNH T1 INNER JOIN SYSMEMBER T2 " +
                    " ON T1.Member_ID = T2.Member_ID " +
                    " WHERE T1.Member_Group_ID = '" + strGroup_ID + "'";
            }

            dtMemberGroup = SQLExec.ExecuteReturnDt(strQuery);

            bdsMemberGroup.DataSource = dtMemberGroup;
            lvUser.DataSource         = bdsMemberGroup;

            if (bdsMemberGroup.Count > 0)
            {
                lvUser.Items[0].Selected = true;
            }

            foreach (ListViewItem lvi in lvUser.Items)
            {
                lvi.ImageKey = "User";
            }
        }
Пример #7
0
        private void FillHanTt()
        {
            Hashtable htSQLPara = new Hashtable();

            htSQLPara.Add("NGAY_CT1", Library.StrToDate(dteNgay_Ct1.Text));
            htSQLPara.Add("NGAY_CT2", Library.StrToDate(dteNgay_Ct2.Text));
            htSQLPara.Add("MA_TUYEN", txtMa_Tuyen.Text);
            htSQLPara.Add("MA_PX", txtMa_Px.Text);
            htSQLPara.Add("TK", "1311");
            htSQLPara.Add("MA_DT", txtMa_Dt.Text);
            htSQLPara.Add("MA_CBNV_BH", txtMa_CbNV_BH.Text);
            htSQLPara.Add("MA_CBNV_GH", txtMa_CbNV_GH.Text);
            htSQLPara.Add("STT_PT", "");
            htSQLPara.Add("MA_DVCS", Element.sysMa_DvCs);
            this.dtCtHanTt = SQLExec.ExecuteReturnDt("[sp_AR_GetHanTt]", htSQLPara, CommandType.StoredProcedure);
            if (!this.dtCtHanTt.Columns.Contains("Modify"))
            {
                this.dtCtHanTt.Columns.Add(new DataColumn("Modify", typeof(bool)));
                this.dtCtHanTt.Columns["Modify"].DefaultValue = false;
            }
            this.bdsHanTt.DataSource  = this.dtCtHanTt;
            this.dgvHanTt0.DataSource = this.bdsHanTt;

            this.Tinh_Tong();
        }
Пример #8
0
        public static bool Is_Ma_Dvcs_Valid(string strMa_DvCs)
        {
            string    strKey = string.Empty, strKey_log = string.Empty, strKey_Lics = string.Empty;
            DataTable dtDmDvCs = new DataTable();

            dtDmDvCs = SQLExec.ExecuteReturnDt("SELECT * FROM SYSDMDVCS WHERE Ma_DvCs = '" + strMa_DvCs + "'");


            if (dtDmDvCs.Rows.Count > 0)
            {
                strKey_Lics = dtDmDvCs.Rows[0]["Key_Log"].ToString();

                if (dtDmDvCs.Columns.Contains("Date_Lics"))
                {
                    strKey = strMa_DvCs + dtDmDvCs.Rows[0]["Key_DVCS"].ToString() + dtDmDvCs.Rows[0]["Key_Module"].ToString() + ":" + dtDmDvCs.Rows[0]["Date_Lics"].ToString();
                }
                else
                {
                    strKey = strMa_DvCs + dtDmDvCs.Rows[0]["Key_DVCS"].ToString() + dtDmDvCs.Rows[0]["Key_Module"].ToString() + ":-1";
                }

                strKey_log = License.Encrypt(License.Encrypt(strKey));

                if (strKey_log == strKey_Lics)
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #9
0
        new public void Load(enuEdit enuNew_Edit, DataRow drEdit)
        {
            //this.drEdit = drEdit;
            //this.enuNew_Edit = enuNew_Edit;
            //this.Tag = (char)enuNew_Edit + ", " + this.Tag;
            this.cboFile_Type.DataSource    = SQLExec.ExecuteReturnDt("SELECT DISTINCT 'DOC' AS File_Type UNION ALL SELECT DISTINCT 'IMG' AS File_Type UNION ALL SELECT DISTINCT 'XLS' AS File_Type UNION ALL SELECT DISTINCT 'EXE' AS File_Type ");
            this.cboFile_Type.DisplayMember = "File_Type";
            this.cboFile_Type.ValueMember   = "File_Type";
            //Common.ScaterMemvar(this, ref drEdit);

            //this.ShowDialog();
            this.drEdit      = drEdit;
            this.enuNew_Edit = enuNew_Edit;
            this.Tag         = ((char)((ushort)enuNew_Edit)) + ", " + this.Tag;
            Common.ScaterMemvar(this, ref drEdit);
            if (enuNew_Edit == enuEdit.Edit)
            {
                //Edit: Disable Ma_Vt
                txtFile_Id.Enabled = false;

                this.cboFile_Type.Enabled = false;
                this.objFileContent       = Resource.LoadResource(this.drEdit["File_Id"].ToString());
                if (this.objFileContent != null)
                {
                    using (Stream stream = new MemoryStream())
                    {
                        new BinaryFormatter().Serialize(stream, this.objFileContent);
                        this.lblSize.Text = "(" + stream.Length.ToString() + ")";
                    }
                }
            }
            this.ShowImage();
            this.LoadDicName();
            this.ShowDialog();
        }
Пример #10
0
        private void FillData()
        {
            //Permission
            string[] strArrParameter_Name  = new string[] { "Member_ID", "Object_Type" };
            object[] objArrParameter_Value = new object[] { this.strMember_ID, "" };

            dtPermission = SQLExec.ExecuteReturnDt("Sp_GetPermission", strArrParameter_Name, objArrParameter_Value, CommandType.StoredProcedure);

            bdsPermission.DataSource = dtPermission;
            dgvPermission.DataSource = bdsPermission;

            //PermissionTk
            if (DataTool.SQLCheckExist("sys.Objects", "Name", "Sp_GetPermissionTk"))
            {
                strArrParameter_Name  = new string[] { "Member_ID", "Tk" };
                objArrParameter_Value = new object[] { this.strMember_ID, "" };

                dtPermissionTk = SQLExec.ExecuteReturnDt("Sp_GetPermissionTk", strArrParameter_Name, objArrParameter_Value, CommandType.StoredProcedure);

                bdsPermissionTk.DataSource = dtPermissionTk;
                dgvPermissionTk.DataSource = bdsPermissionTk;
            }

            //PermissionDvCs
            if (DataTool.SQLCheckExist("sys.Objects", "Name", "Sp_GetPermissionDvCs"))
            {
                strArrParameter_Name  = new string[] { "Member_ID", "Ma_DvCs" };
                objArrParameter_Value = new object[] { this.strMember_ID, "" };

                dtPermissionDvCs = SQLExec.ExecuteReturnDt("Sp_GetPermissionDvCs", strArrParameter_Name, objArrParameter_Value, CommandType.StoredProcedure);

                bdsPermissionDvCs.DataSource = dtPermissionDvCs;
                dgvPermissionDvCs.DataSource = bdsPermissionDvCs;
            }
        }
Пример #11
0
        void btCreateChamCong_Click(object sender, EventArgs e)
        {
            bool flag2 = true;

            if (DataTool.SQLCheckExist("HRCHAMCONGNGAY", new string[] { "TranDate", "Loai_Nc" }, new object[] { dteNgay_Ct.Text, txtLoai_NC.Text }))
            {
                string strMsg = (Element.sysLanguage == enuLanguageType.Vietnamese) ? "Ngày công đã tồn tại, Bạn có muốn tạo lại ?" : "Do you want to override exists data ?";
                flag2 = Common.MsgYes_No(strMsg);
            }

            if (flag2)
            {
                Hashtable htParameter = new Hashtable();

                htParameter.Add("NGAY_CT", Library.StrToDate(dteNgay_Ct.Text));
                htParameter.Add("LOAI_NC", txtLoai_NC.Text);
                htParameter.Add("MA_DVCS", Element.sysMa_DvCs);

                SQLExec.Execute("sp_HRM_TaoNgayCong", htParameter, CommandType.StoredProcedure);
                dtHRChamCong = SQLExec.ExecuteReturnDt("sp_HRM_LoadChamCong", htParameter, CommandType.StoredProcedure);
            }
            this.bdsHRChamCong.DataSource = dtHRChamCong;
            dgvHRChamCong.DataSource      = bdsHRChamCong;
            this.ExportControl            = dgvHRChamCong;
            bdsSearch = bdsHRChamCong;
        }
Пример #12
0
        public static DataTable SaveZaloResoure(int Ident00, string strFile_ID, string strFile_Name, string strMa_Nhom, string strCatalog, string strFile_Type, string strFile_Tag, object objFile_Content, DateTime dteNgay_Ky, string strNguoi_Ky, bool bDuyet, string strDescription, string strZaloLink, string strMa_Kv_List, string strMa_BP_List, string strTag_List)
        {
            DataTable dtUpdate;
            //string str;
            Hashtable htSQLPara = new Hashtable();

            htSQLPara.Add("IDENT00", Ident00);
            htSQLPara.Add("FILE_ID", strFile_ID);
            htSQLPara.Add("FILE_NAME", strFile_Name);
            htSQLPara.Add("MA_NHOM", strMa_Nhom);
            htSQLPara.Add("CATALOG", strCatalog);
            htSQLPara.Add("DESCRIPTION", strDescription);
            htSQLPara.Add("FILE_TYPE", strFile_Type);
            htSQLPara.Add("FILE_TAG", strFile_Tag);
            htSQLPara.Add("FILE_CONTENT", (objFile_Content == null) ? new byte[0] : ((byte[])objFile_Content));
            htSQLPara.Add("NGAY_KY", dteNgay_Ky);
            htSQLPara.Add("NGUOI_KY", strNguoi_Ky);
            htSQLPara.Add("DUYET", bDuyet);
            htSQLPara.Add("ZALOLINK", strZaloLink);
            htSQLPara.Add("MA_KV_LIST", strMa_Kv_List);
            htSQLPara.Add("MA_BP_LIST", strMa_BP_List);
            htSQLPara.Add("TAG_LIST", strTag_List);
            dtUpdate = SQLExec.ExecuteReturnDt("SP_HRM_SaveZaloResource", htSQLPara, CommandType.StoredProcedure);
            if (dtUpdate.Rows.Count > 0)
            {
                Ident00 = Convert.ToInt32(dtUpdate.Rows[0]["Ident00"]);
                string str = "UPDATE " + strTableName + " SET File_Content = @File_Content WHERE Ident00 =" + @Ident00;
                SQLExec.Execute(str, htSQLPara, CommandType.Text);
            }

            return(dtUpdate);
        }
Пример #13
0
        private void FillData()
        {
            //Lấy nội dung bảng lương
            Hashtable htPara = new Hashtable();

            htPara.Add("KPIID", cboKPI.Text);
            htPara.Add("USERID", Element.sysUser_Id);
            dsSalary = SQLExec.ExecuteReturnDs("KPI_KPIResult_GetById", htPara, CommandType.StoredProcedure);
            dtRatio  = SQLExec.ExecuteReturnDt("KPI_Ratio_GetById", htPara, CommandType.StoredProcedure);

            if (radioButton1.Checked)
            {
                dtKPISalary = dsSalary.Tables[0];
            }
            else if (radioButton2.Checked)
            {
                dtKPISalary = dsSalary.Tables[0];
            }
            else if (radioButton2.Checked)
            {
                dtKPISalary = dsSalary.Tables[1];
            }

            bdsKPISalary.DataSource = dtKPISalary;
            dgvKPISalary.DataSource = bdsKPISalary;
            this.ExportControl      = dgvKPISalary;
            bdsSearch              = bdsKPISalary;
            bdsRatio.DataSource    = dtRatio;
            dgvKPIRatio.DataSource = bdsRatio;
        }
Пример #14
0
        public override void Load()
        {
            ////Gắn Ma_Bp vào ComboBox
            DataTable dtKPIMaster = SQLExec.ExecuteReturnDt("SELECT KPIID,Descr FROM KPIMaster ORDER BY EndDate DESC");

            //dtDmBp.Rows.Add(new string[] { "*", "Tất cả" });

            cboKPI.lstItem.BuildListView("KPIID:100,Descr:250");
            cboKPI.lstItem.DataSource = dtKPIMaster;
            cboKPI.lstItem.Size       = new Size(320, cboKPI.lstItem.Items.Count * 50);
            cboKPI.lstItem.GridLines  = true;
            if (dtKPIMaster.Rows.Count > 0)
            {
                //cboKPI.SelectedIndex = cboKPI.Items.Count - 1;
                cboKPI.Text = dtKPIMaster.Rows[0][0].ToString();
            }


            this.Build();
            this.FillData();

            this.ShowBangLuong();

            this.Show();
        }
Пример #15
0
        private void FillData()
        {
            bdsViewCt = new BindingSource();

            DataRow drDmCt      = DataTool.SQLGetDataRowByID("SYSDMCT", "Ma_Ct", strMa_Ct);
            string  strTable_Ct = (string)drDmCt["Table_Ct"];
            string  strSelect   = " *, CAST(0 AS BIT) AS Chon";

            if (strMa_Ct == "LSX")
            {
                dtViewCt = SQLExec.ExecuteReturnDt("SELECT T1.*, T1.So_Luong AS So_Luong9, CAST (0 AS MONEY) AS Gia_Nt9, CAST (0 AS MONEY) Tien_Nt9, T2.Ngay_Ct, T2.So_Ct, CAST(0 AS BIT) AS Chon FROM MALSX T1 JOIN MACTLSX T2 ON T1.Stt = T2.Stt ORDER BY T2.Ngay_Ct, T2.So_Ct");
            }
            else
            {
                dtViewCt = DataTool.SQLGetDataTable(strTable_Ct, strSelect, strKey, "Ngay_Ct, So_Ct");
            }

            bdsViewCt.DataSource = dtViewCt;
            dgvViewCt.DataSource = bdsViewCt;

            bdsViewCt.Position = 0;

            foreach (DataGridViewColumn dgvc in dgvViewCt.Columns)
            {
                dgvc.ReadOnly = true;
            }

            dgvViewCt.Columns["Chon"].ReadOnly = false;

            //Uy quyen cho lop co so tim kiem
            bdsSearch = bdsViewCt;
        }
Пример #16
0
        private void FillData(string strKey)
        {
            //dtEmployee = SQLExec.ExecuteReturnDt("EXEC Sp_GetDmCbNv");
            dtEmployee             = HRMCommon.GetCustomerTable("MA_KV", this.cboFill.Text);
            bdsEmployee.DataSource = dtEmployee;
            tlDmCbNv.DataSource    = bdsEmployee;
            //bdsEmployee.Position = 0;

            //HOPDONG
            //dtHopDong = DataTool.SQLGetDataTable("HRHOPDONG", null, strKey, "Ngay_Begin, Ngay_End");
            dtHopDong             = SQLExec.ExecuteReturnDt("SELECT * FROM HRHOPDONG");
            bdsHopDong.DataSource = dtHopDong;
            dgvHopDong.DataSource = bdsHopDong;

            //HOPDONGPL
            //dtHopDongPL = DataTool.SQLGetDataTable("HRHOPDONGPL", null, strKey, "Ngay_Begin, Ngay_End");
            dtHopDongPL             = SQLExec.ExecuteReturnDt("SELECT * FROM HRHOPDONGPL");
            bdsHopDongPL.DataSource = dtHopDongPL;
            dgvHopDongPL.DataSource = bdsHopDongPL;

            //Tham số các khoản thu nhập
            string strSQLExec =
                "SELECT T1.*, T2.Ten_Tn, T2.Dvt FROM HRPARAVALUE0 T1 LEFT JOIN HRPARALIST T2 ON T1.Ma_Tn = T2.Ma_Tn " +
                " ORDER BY Ngay_Ap";

            //Uy quyen cho lop co so tim kiem
            bdsSearch     = bdsEmployee;
            ExportControl = tlDmCbNv;

            tlDmCbNv.Expand = (bool)SQLExec.ExecuteReturnValue("SELECT Expand FROM SYSZONE WHERE ZONE = '" + tlDmCbNv.strZone + "'");
        }
Пример #17
0
        public void FillData()
        {
            Hashtable ht = new Hashtable();

            ht.Add("MEMBER_ID", Element.sysUser_Id.ToString());
            ht.Add("NGAY_CT1", dteTu_Ngay.Text);
            ht.Add("NGAY_CT2", dteDen_Ngay.Text);
            ht.Add("MA_DVCS", Element.sysMa_DvCs);

            dtPmTb = SQLExec.ExecuteReturnDt("sp_GetPmTb", ht, CommandType.StoredProcedure);

            bdsPmTb.DataSource = dtPmTb;
            dgvPmTb.DataSource = bdsPmTb;

            if (bdsPmTb.Count >= 0)
            {
                bdsPmTb.Position = 0;
            }

            //Uy quyen cho lop co so tim kiem
            bdsSearch     = bdsPmTb;
            ExportControl = dgvPmTb;

            if (this.isLookup)
            {
                this.MoveToLookupValue();
            }
        }
Пример #18
0
        public override bool Save()
        {
            Common.GatherMemvar(this, ref this.drEdit);

            this.dtImport = SQLExec.ExecuteReturnDt("DECLARE @TVP_PXKDETAIL AS TVP_PXKDETAIL SELECT * FROM @TVP_PXKDETAIL");

            foreach (DataRow drEdit in dtEditCt.Rows)
            {
                DataRow drNew = dtImport.NewRow();
                Common.CopyDataRow(drEdit, drNew);
                dtImport.Rows.Add(drNew);
            }


            if (!FormCheckValid())
            {
                return(false);
            }

            if (enuNew_Edit == enuEdit.New)
            {
                TinhSoCtPXK();
            }

            //Luu xuong CSDL
            if (!DataTool.SQLUpdate(enuNew_Edit, "OM_PXK", ref drEdit))
            {
                return(false);
            }

            Save_PXKDetail(dtEditCt);
            return(true);
        }
Пример #19
0
        private void FillHanTtFromCongNo()
        {
            Hashtable htParameter = new Hashtable();

            if (dtNgay_Ct != DateTime.MinValue)
            {
                htParameter.Add("NGAY_CT1", dtNgay_Ct);
                htParameter.Add("NGAY_CT2", dtNgay_Ct);
            }
            else
            {
                htParameter.Add("NGAY_CT1", Library.StrToDate(frmFilter.dteNgay_Ct1.Text));
                htParameter.Add("NGAY_CT2", Library.StrToDate(frmFilter.dteNgay_Ct2.Text));
            }
            htParameter.Add("TK", frmFilter.txtTk.Text);
            htParameter.Add("MA_DT", frmFilter.txtMa_Dt.Text);
            htParameter.Add("MA_CT", frmFilter.txtMa_Ct.Text);
            htParameter.Add("DU_CUOI_ONLY", frmFilter.chkDu_Cuoi_Only.Checked);
            htParameter.Add("STT", this.strStt);
            htParameter.Add("MA_DVCS", Element.sysMa_DvCs);

            dtHanTt = SQLExec.ExecuteReturnDt("Sp_GetThanhToan", htParameter, CommandType.StoredProcedure);

            dgvHanTt.DataSource = bdsHanTt;
            bdsHanTt.DataSource = dtHanTt;
        }
Пример #20
0
        void FillData()
        {
            Hashtable htPara = new Hashtable();

            htPara.Add("NAM", Element.sysWorkingYear);
            htPara.Add("TK", strTk);
            htPara.Add("KIEU_TH", 1);
            htPara.Add("MA_DVCS", Element.sysMa_DvCs);

            dtBudget = SQLExec.ExecuteReturnDt("sp_GetBudgetDt", htPara, CommandType.StoredProcedure);

            //DataColumn dcNew = new DataColumn("TSO_LUONG_KH", typeof(double));
            //dcNew.Expression = "So_Luong_Kh01+So_Luong_Kh02+So_Luong_Kh03+So_Luong_Kh04+So_Luong_Kh05+So_Luong_Kh06+So_Luong_Kh07+So_Luong_Kh08+So_Luong_Kh09+So_Luong_Kh10+So_Luong_Kh11+So_Luong_Kh12";
            //dtBudget.Columns.Add(dcNew);

            //DataColumn dcNew2 = new DataColumn("TTIEN_KH", typeof(double));
            //dcNew.Expression = "Tien_Kh01+Tien_Kh02+Tien_Kh03+Tien_Kh04+Tien_Kh05+Tien_Kh06+Tien_Kh07+Tien_Kh08+Tien_Kh09+Tien_Kh10+Tien_Kh11+Tien_Kh12";
            //dtBudget.Columns.Add(dcNew);

            bdsBudget.DataSource = dtBudget;
            dgvBudget.DataSource = bdsBudget;

            bdsBudget.Sort = "Bold, TK, MA_VT";

            bdsSearch     = bdsBudget;
            ExportControl = dgvBudget;
        }
Пример #21
0
        public override void Load()
        {
            this.cboFile_Type.DataSource    = SQLExec.ExecuteReturnDt("SELECT DISTINCT '*' AS File_Type UNION SELECT File_Type FROM SYSRESOURCES ORDER BY 1");
            this.cboFile_Type.DisplayMember = "File_Type";
            this.cboFile_Type.ValueMember   = "File_Type";

            Init();
            Build();
            FillData();
            BindingLanguage();

            if (bdsResource != null)
            {
                //this.cboFile_Type.Enabled = false;
                DataRow drCurrent = ((DataRowView)bdsResource.Current).Row;
                this.objFileContent = Resource.LoadResource(drCurrent["File_Id"].ToString());
            }

            if (this.isLookup)
            {
                this.ShowDialog();
            }
            else
            {
                this.Show();
            }
        }
Пример #22
0
        private void Calc_PhanBo()
        {
            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;
            }

            DateTime dteNgay_Kh1 = Common.GetDate(Element.sysWorkingYear, Convert.ToInt16(numThang.Value), 1);

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

            if (this.FormCheckValid())
            {
                Hashtable htParameter = new Hashtable();

                htParameter.Add("THANG", this.numThang.Value);
                htParameter.Add("NAM", Element.sysWorkingYear);
                htParameter.Add("Ma_CCDC", this.txtMa_CCDC.Text.Trim());
                htParameter.Add("MA_NH_TS", this.txtMa_Nh_Ts.Text.Trim());
                htParameter.Add("TY_GIA", this.numTy_Gia.Value);
                htParameter.Add("MA_DVCS", Element.sysMa_DvCs);

                dtPhanBo = SQLExec.ExecuteReturnDt("sp_PhanBoCCDC", htParameter, CommandType.StoredProcedure);

                bdsPhanBo.DataSource = dtPhanBo;
            }
        }
Пример #23
0
        public static string Ten_Dvcs(string strMa_Dvcs)
        {
            //string ConnectingSringServer = License.ConnectingSringServer();

            DataTable dtDmDvCs = new DataTable();

            dtDmDvCs = SQLExec.ExecuteReturnDt("SELECT * FROM SYSDMDVCS WHERE Ma_DvCs = '" + strMa_Dvcs + "'");

            ModuleList = dtDmDvCs.Rows[0]["Key_Module"].ToString();

            if (dtDmDvCs.Rows.Count > 0)
            {
                string strKey = strMa_Dvcs + dtDmDvCs.Rows[0]["Key_DVCS"].ToString() + dtDmDvCs.Rows[0]["Key_Module"].ToString();


                if (dtDmDvCs.Columns.Contains("Date_Lics"))
                {
                    strKey = strMa_Dvcs + dtDmDvCs.Rows[0]["Key_DVCS"].ToString() + dtDmDvCs.Rows[0]["Key_Module"].ToString() + ":" + dtDmDvCs.Rows[0]["Date_Lics"].ToString();
                }
                else
                {
                    strKey = strMa_Dvcs + dtDmDvCs.Rows[0]["Key_DVCS"].ToString() + dtDmDvCs.Rows[0]["Key_Module"].ToString() + ":-1";
                }
                string strKey_log = Encrypt(Encrypt(strKey));
                //strKey_log = License.Encrypt(License.Encrypt(strKey));
                if (strKey_log == dtDmDvCs.Rows[0]["Key_Log"].ToString())
                {
                    return(dtDmDvCs.Rows[0]["Key_DVCS"].ToString());
                }
            }
            return("");
        }
Пример #24
0
        void FillData()
        {
            dtNam = SQLExec.ExecuteReturnDt("SELECT * FROM SYSNam WHERE Ma_DvCs = '" + Element.sysMa_DvCs + "' ORDER BY Nam");

            bdsNam.DataSource = dtNam;
            lvNam.DataSource  = bdsNam;
        }
Пример #25
0
        private void EditPXK(enuEdit enuNew_Edit)
        {
            if (bdsPXK.Position < 0 && enuNew_Edit == enuEdit.Edit)
            {
                return;
            }

            //Copy hang hien tai
            if (bdsPXK.Position >= 0)
            {
                Common.CopyDataRow(((DataRowView)bdsPXK.Current).Row, ref drCurrentPXK);
            }
            else
            {
                drCurrentPXK = dtPXK.NewRow();
            }

            frmGopPXK_Edit frmEdit = new frmGopPXK_Edit();

            frmEdit.strMa_Ct = this.strMa_Ct;
            frmEdit.Load(enuNew_Edit, drCurrentPXK);

            //Accept
            if (frmEdit.isAccept)
            {
                if (enuNew_Edit == enuEdit.New)
                {
                    if (bdsPXK.Position >= 0)
                    {
                        dtPXK.ImportRow(drCurrentPXK);
                    }
                    else
                    {
                        dtPXK.Rows.Add(drCurrentPXK);
                    }

                    bdsPXK.Position = bdsPXK.Find("Ma_PX", drCurrentPXK["Ma_PX"]);
                }
                else
                {
                    Common.CopyDataRow(drCurrentPXK, ((DataRowView)bdsPXK.Current).Row);
                }

                dtPXK.AcceptChanges();

                Hashtable ht = new Hashtable();
                ht.Add("NGAY_CT1", dteNgay_Ct1.Text);
                ht.Add("NGAY_CT2", dteNgay_Ct2.Text);
                ht.Add("MA_DVCS", Element.sysMa_DvCs);

                dtPXKDetail             = SQLExec.ExecuteReturnDt("sp_GetPhieuXuatKhoDetail", ht, CommandType.StoredProcedure);
                bdsPXKDetail.DataSource = dtPXKDetail;
                dgvPXDetail.DataSource  = bdsPXKDetail;
            }
            else
            {
                dtPXK.RejectChanges();
            }
        }
Пример #26
0
        private void SaveData(DataTable tbExcel, DataTable dtStruct, bool bIs_Overide)
        {
            string strTableName = "INDUDAU";
            int    num          = 0;

            if (dtStruct == null)
            {
                dtStruct = tbExcel.Clone();
            }
            dtStruct = DataTool.SQLGetDataTable(strTableName, "", "0=1", "");
            DataRow drNewRow = dtStruct.NewRow();

            foreach (DataRow drExcel in tbExcel.Rows)
            {
                try
                {
                    Common.CopyDataRow(drExcel, drNewRow);
                    Common.SetDefaultDataRow(ref drNewRow);
                    //drNewRow.AcceptChanges();
                    drNewRow["Stt"] = Common.GetNewStt("08", true);
                    bool flag  = false;
                    bool flag2 = false;

                    if (DataTool.SQLCheckExist(strTableName, new string[] { "Ma_DvCs", "Ma_Kho", "Ma_Vt" }, new object[] { Element.sysMa_DvCs, drNewRow["Ma_Kho"], drNewRow["Ma_Vt"] }))
                    {
                        if (!flag)
                        {
                            string strMsg = (Element.sysLanguage == enuLanguageType.Vietnamese) ? "Bạn có ghi đè dữ liệu đã tồn tại ?" : "Do you want to override exists data ?";
                            flag2 = Common.MsgYes_No(strMsg);
                            flag  = true;
                        }
                        if (flag2)
                        {
                            if (drNewRow.Table.Columns.Contains("Ident00"))
                            {
                                DataRow row3 = SQLExec.ExecuteReturnDt("SELECT * FROM " + strTableName + " WHERE Ma_DvCs = '" + Element.sysMa_DvCs + "' AND Ma_Kho = '" + drNewRow["Ma_Kho"].ToString() + "' AND Ma_Vt = '" + drNewRow["Ma_Vt"].ToString() + "'").Rows[0];
                                if (drNewRow != null)
                                {
                                    drNewRow["Ident00"] = row3["Ident00"];
                                }
                            }
                            DataTool.SQLUpdate(enuEdit.Edit, strTableName, ref drNewRow);
                            num++;
                        }
                    }
                    else
                    {
                        DataTool.SQLUpdate(enuEdit.New, strTableName, ref drNewRow);
                        num++;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Lỗi import code : " + (string)drExcel["Ma_Vt"] + "\n" + ex.ToString());
                    return;
                }
            }
        }
Пример #27
0
        public bool FormCheckValid()
        {
            bool   bvalid       = true;
            string strCheckSohd = "";

            if (txtNoi_Dung.Text.Trim() == string.Empty)
            {
                Common.MsgOk(Languages.GetLanguage("Noi_Dung") + " " +
                             Languages.GetLanguage("Not_Null"));
                return(false);
            }

            if (txtSo_Hd.Text.Trim() == string.Empty)
            {
                Common.MsgOk(Languages.GetLanguage("So_Hd") + " " +
                             Languages.GetLanguage("Not_Null"));
                return(false);
            }
            else
            {
                strCheckSohd = "SELECT  So_Hd FROM HRHOPDONG WHERE So_Hd ='" + txtSo_Hd.Text.Trim() + "' ";
                DataTable dtHd = SQLExec.ExecuteReturnDt(strCheckSohd);
                if (dtHd.Rows.Count == 0)
                {
                    MessageBox.Show("Số hợp đồng không tồn tại");
                    return(false);
                }
            }

            if (this.dteNgay_End.Text.Trim().Length == 10 && this.dteNgay_End.Text.Trim().Substring(this.dteNgay_End.Text.Length - 4, 4) != "1900")
            {
                DateTime dteNgay_Bd = Library.StrToDate(this.dteNgay_Begin.Text);
                DateTime dteNgay_Kt = Library.StrToDate(this.dteNgay_End.Text);
                if ((DateTime.Compare(dteNgay_Bd, dteNgay_Kt) > 0))
                {
                    MessageBox.Show("Ngày kết thúc không được nhỏ hơn ngày bắt đầu");
                    this.dteNgay_End.Select();
                    return(false);
                }
            }

            if (enuNew_Edit == enuEdit.New)
            {
                strCheckSohd = "SELECT  * FROM HRHOPDONGPL WHERE So_Pl ='" + txtSo_Pl.Text.Trim() + "' ";
            }
            else
            {
                strCheckSohd = "SELECT  * FROM HRHOPDONGPL WHERE So_Pl ='" + txtSo_Pl.Text.Trim() + "' AND Ident00 <> " + drEdit["Ident00"].ToString() + " ";
            }
            DataTable dtTemp = SQLExec.ExecuteReturnDt(strCheckSohd);

            if (dtTemp.Rows.Count > 0)
            {
                MessageBox.Show("Số phụ lục hợp đồng đã tồn tại");
                return(false);
            }
            return(bvalid);
        }
Пример #28
0
        public static DataTable GetCustomerTable(string strMa_Th, string strStatus)
        {
            Hashtable htPara = new Hashtable();

            htPara.Add("USERID", Element.sysUser_Id);
            htPara.Add("PARENTFIELDNAME", strMa_Th);
            htPara.Add("TRANG_THAI", strStatus);
            return(SQLExec.ExecuteReturnDt("HRM_GetDmCbNv_ParentName", htPara, CommandType.StoredProcedure));
        }
Пример #29
0
        public static DataTable getBirthDayEmployee()
        {
            Hashtable ht = new Hashtable();

            ht["LANGUAGE_TYPE"] = (char)Element.sysLanguage;
            ht["MA_DVCS"]       = Element.sysMa_DvCs;
            ht["STT"]           = 1;
            return(SQLExec.ExecuteReturnDt("sp_ViewReminder", ht, CommandType.StoredProcedure));
        }
Пример #30
0
        public void FillData()
        {
            string strKey = string.Empty;

            if (this.isLookup)
            {
                strKey = (this.strLookupKeyFilter == null ? string.Empty : this.strLookupKeyFilter);
            }
            else
            {
                strKey = (strMa_Nh_Dt == string.Empty ? string.Empty : "Ma_Nh_Dt = '" + strMa_Nh_Dt + "'");
            }

            //Kiểm tra đối tượng: dùng chung danh mục với CRM
            DataTable dtDoiTuongCheck = SQLExec.ExecuteReturnDt("SELECT TOP 0 * FROM LIDOITUONG WHERE 0 = 1");

            if (dtDoiTuongCheck.Columns.Contains("Deleted"))
            {
                strKey += (strKey == string.Empty ? string.Empty : " AND ") + "(Deleted <> 1)";
            }

            //Chỉ show những dữ liệu cần thiết có khai báo trong Zone, Column
            string strSQLExec   = @"
				DECLARE @_ColumnList NVARCHAR(1000) 
				SET @_ColumnList = ''
				SELECT @_ColumnList = @_ColumnList + ',' + Column_ID FROM SYSCOLUMN WHERE Zone = '"                 + dgvDoiTuong.strZone + @"'
				SELECT CASE WHEN LEN(@_ColumnList) > 0 THEN RIGHT(@_ColumnList, LEN(@_ColumnList)-1) ELSE '' END "                ;
            string strFieldList = SQLExec.ExecuteReturnValue(strSQLExec).ToString();

            if (strFieldList != string.Empty)
            {
                dtDoiTuong = DataTool.SQLGetDataTable("LIDOITUONG", strFieldList, strKey, "Ma_Dt");
            }
            else
            {
                dtDoiTuong = DataTool.SQLGetDataTable("LIDOITUONG", null, strKey, "Ma_Dt");
            }

            bdsDoiTuong.DataSource = dtDoiTuong;
            dgvDoiTuong.DataSource = bdsDoiTuong;

            //Vi tri mac dinh
            if (bdsDoiTuong.Count >= 0)
            {
                bdsDoiTuong.Position = 0;
            }

            //Uy quyen cho lop co so tim kiem
            bdsSearch = bdsDoiTuong;

            if (this.isLookup)
            {
                this.MoveToLookupValue();
            }

            dgvDoiTuong.Select();
        }