Пример #1
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 + "'");
            }

            //Hùng 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)";
            }

            //HÙNG 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;

            if (bdsDoiTuong.Count >= 0)
            {
                bdsDoiTuong.Position = 0;                //Vi tri mac dinh
            }
            //Uy quyen cho lop co so tim kiem
            bdsSearch = bdsDoiTuong;

            if (this.isLookup)
            {
                this.MoveToLookupValue();
            }
        }
Пример #2
0
        public void Export_Excel()
        {
            string    strTable   = SQLExec.ExecuteReturnValue("SELECT File_Import FROM SYSDMTABLE WHERE Table_Name0 = '" + strTableName + "'").ToString();
            DataTable dtResource = SQLExec.ExecuteReturnDt("SELECT * FROM SYSResources WHERE Catalog = '" + strTable + "'");
            DataRow   drResource;

            if (dtResource.Rows.Count > 0)
            {
                drResource = dtResource.Rows[0];
                object objFile = Resource.LoadResource(drResource["File_Id"].ToString());
            }
        }
Пример #3
0
        void LoadDicName()
        {
            //Khu vực
            if (txtMa_Kv.Text.Trim() != string.Empty)
            {
                lbtTen_Kv.Text = (string)SQLExec.ExecuteReturnValue("SELECT Ten_Kv FROM LIKHUVUC WHERE Ma_Kv = '" + txtMa_Kv.Text + "'");
            }
            else
            {
                lbtTen_Kv.Text = string.Empty;
            }

            //SP_Used
            if (txtSP_Used.Text.Trim() != string.Empty)
            {
                lbtSP_Used.Text = (string)SQLExec.ExecuteReturnValue("SELECT Type_Name FROM LIKHAC WHERE Type = 'SP_USED' AND Type_ID = '" + txtSP_Used.Text + "'");
            }
            else
            {
                lbtSP_Used.Text = string.Empty;
            }

            //Von_CSH
            if (txtVon_CSH.Text.Trim() != string.Empty)
            {
                lbtVon_CSH.Text = (string)SQLExec.ExecuteReturnValue("SELECT Type_Name FROM LIKHAC WHERE Type = 'VON_CSH' AND Type_ID = '" + txtVon_CSH.Text + "'");
            }
            else
            {
                lbtVon_CSH.Text = string.Empty;
            }

            //Nganh_Nghe
            if (txtNganh_Nghe.Text.Trim() != string.Empty)
            {
                lbtNganh_Nghe.Text = (string)SQLExec.ExecuteReturnValue("SELECT Type_Name FROM LIKHAC WHERE Type = 'NGANH_NGHE' AND Type_ID = '" + txtNganh_Nghe.Text + "'");
            }
            else
            {
                lbtNganh_Nghe.Text = string.Empty;
            }

            //Quy_Mo
            if (txtQuy_Mo.Text.Trim() != string.Empty)
            {
                lbtQuy_Mo.Text = (string)SQLExec.ExecuteReturnValue("SELECT Type_Name FROM LIKHAC WHERE Type = 'QUY_MO' AND Type_ID = '" + txtQuy_Mo.Text + "'");
            }
            else
            {
                lbtQuy_Mo.Text = string.Empty;
            }
        }
Пример #4
0
 private void Cong_So_Ct_Auto()
 {
     if (enuNew_Edit == enuEdit.New || enuNew_Edit == enuEdit.Copy)
     {
         Hashtable htSo_Ct = new Hashtable();
         htSo_Ct.Add("MA_CT", strMa_Ct);
         htSo_Ct.Add("NGAY_CT", Convert.ToDateTime(drCurrent["Ngay_Ct"]).ToShortDateString());
         htSo_Ct.Add("MA_TTE", drCurrent["Ma_TTe"].ToString());
         htSo_Ct.Add("MA_DVCS", Element.sysMa_DvCs);
         drEditPh["So_Ct"] = drCurrent["So_Ct"] = Convert.ToString(SQLExec.ExecuteReturnValue("sp_Cong_So_Ct_Auto", htSo_Ct, CommandType.StoredProcedure));
         txtSo_Ct.Text     = drCurrent["So_Ct"].ToString();
     }
 }
Пример #5
0
        private void FillData()
        {
            dtLanguages             = DataTool.SQLGetDataTable("SYSLANGUAGE", null, null, null);
            bdsLanguages.DataSource = dtLanguages;

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

            tlLanguages.DataSource = bdsLanguages;
            bdsLanguages.Position  = 0;

            tlLanguages.Expand = (bool)SQLExec.ExecuteReturnValue("SELECT Expand FROM SYSZONE WHERE ZONE = '" + tlLanguages.strZone + "'");
        }
Пример #6
0
        public override void Load()
        {
            strMa_CbNv = (string)SQLExec.ExecuteReturnValue("SELECT ISNULL(MAX(Ma_CbNv), '') FROM SYSMEMBER WHERE Member_ID = '" + Element.sysUser_Id + "'");
            int iIndex = 0;

            cboKieu_Nhom.SelectedIndex = 0;

            this.Build();
            this.FillData("");
            this.BindingData();

            this.Show();
        }
Пример #7
0
 //Load attach file
 public static object LoadResource(int Ident00)
 {
     if (Ident00 != 0)
     {
         Hashtable htSQLPara = new Hashtable();
         htSQLPara.Add("IDENT00", Ident00);
         object obj2 = SQLExec.ExecuteReturnValue("SELECT File_Content FROM " + strTableName + " WHERE Ident00 = @Ident00 ", htSQLPara, CommandType.Text);
         if (((obj2 != null) && (obj2 != DBNull.Value)) && (((byte[])obj2).Length > 0))
         {
             return(obj2);
         }
     }
     return(null);
 }
Пример #8
0
        public override bool FormCheckValid()
        {
            bool bvalid = true;

            if (txtMa_Dt.Text.Trim() == string.Empty)
            {
                Common.MsgCancel(Languages.GetLanguage("Ma_Dt") + " " +
                                 Languages.GetLanguage("Not_Null"));
                return(false);
            }

            if (txtTen_Dt.Text.Trim() == string.Empty)
            {
                Common.MsgCancel(Languages.GetLanguage("Ten_Dt") + " " +
                                 Languages.GetLanguage("Not_Null"));
                return(false);
            }

            if (txtMa_Nh_Dt.Text.Trim() == string.Empty)
            {
                Common.MsgCancel(Languages.GetLanguage("Ma_Nh_Dt") + " " +
                                 Languages.GetLanguage("Not_Null"));
                return(false);
            }

            if (txtMa_So_Thue.Text.Trim() != string.Empty)
            {
                object objMa_Dt = SQLExec.ExecuteReturnValue("SELECT Ma_Dt FROM LIDOITUONG WHERE Ma_So_Thue = '" +
                                                             txtMa_So_Thue.Text + "' AND Ma_Dt <> '" + (string)drEdit["Ma_Dt"] + "'");

                if (!(objMa_Dt == null || DBNull.Value == null))
                {
                    objMa_Dt = SQLExec.ExecuteReturnValue("SELECT Ma_So_Thue FROM LIDOITUONG WHERE Ma_Dt = '" + txtMa_Dt.Text + "'");

                    if (this.enuNew_Edit == enuEdit.Edit && (objMa_Dt == null || DBNull.Value == null) && txtMa_So_Thue.Text == (string)drEdit["Ma_So_Thue", DataRowVersion.Original])
                    {
                        return(true);
                    }
                    if ((string)Parameters.GetParaValue("IS_MASOTHUE") == "1")
                    {
                        string strMsg = Element.sysLanguage == enuLanguageType.Vietnamese ? "Mã số thuế {"
                                        + txtMa_So_Thue.Text + "} đã tồn tại trong Danh mục đối tượng" : "Tax Code {" + txtMa_So_Thue.Text + "} has existed in the Object list";
                        Common.MsgCancel(strMsg);
                        this.ActiveControl = txtMa_So_Thue;
                        return(false);
                    }
                }
            }
            return(bvalid);
        }
Пример #9
0
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);

            //Kiểm tra khóa số dư
            string strSQLExec =
                "SELECT TOP 1 Locked_Sdv FROM SYSNAM " +
                " WHERE Nam = " + Element.sysWorkingYear + " AND Ma_DvCs = '" + Element.sysMa_DvCs + "'";

            if ((bool)SQLExec.ExecuteReturnValue(strSQLExec))
            {
                this.btgAccept.btAccept.Enabled = false;
            }
        }
Пример #10
0
 //Load attach file
 public static object LoadResource(string strFile_ID)
 {
     if (strFile_ID != null)
     {
         Hashtable htSQLPara = new Hashtable();
         htSQLPara.Add("FILE_ID", strFile_ID);
         object obj2 = SQLExec.ExecuteReturnValue("SELECT File_Content FROM SYSResources WHERE File_Id = @File_Id ", htSQLPara, CommandType.Text);
         if (((obj2 != null) && (obj2 != DBNull.Value)) && (((byte[])obj2).Length > 0))
         {
             return(obj2);
         }
     }
     return(null);
 }
Пример #11
0
        public override void Delete()
        {
            if (bdsViewPh.Position < 0)
            {
                return;
            }

            DataRow drCurrent = ((DataRowView)bdsViewPh.Current).Row;

            if (!Common.CheckDataLocked((DateTime)drCurrent["Ngay_Ct"]))
            {
                return;
            }

            if (!Element.sysIs_Admin)
            {
                string strCreate_User = (string)drCurrent["Create_Log"];

                if (strCreate_User != string.Empty && strCreate_User.Substring(14) != Element.sysUser_Id)
                {
                    string strUser_Allow = (string)SQLExec.ExecuteReturnValue("SELECT Member_ID_Allow FROM SYSMEMBER WHERE Member_ID = '" + Element.sysUser_Id + "'") + ",";

                    if (!strUser_Allow.Contains("*,"))                     //Được phép sửa tất cả
                    {
                        if (!strUser_Allow.Contains(strCreate_User.Substring(14) + ","))
                        {
                            Common.MsgCancel("Không được xóa chứng từ do " + strCreate_User.Substring(14) + " lập, liên hệ với Admin!");
                            return;
                        }
                    }
                }
            }

            if (!Common.MsgYes_No(Languages.GetLanguage("SURE_DELETE"), "N"))
            {
                return;
            }

            string strMa_Ct = ((string)drCurrent["Ma_Ct"]).Trim();
            string strStt   = ((string)drCurrent["Stt"]).Trim();

            if (Voucher.SQLDeleteCt(strStt, strMa_Ct))
            {
                SQLExec.Execute("DELETE GLTHANHTOANCT WHERE STT_PT = '" + strStt + "'");
                SQLExec.Execute("DELETE GLTHANHTOAN WHERE STT = '" + strStt + "'");

                bdsViewPh.RemoveAt(bdsViewPh.Position);
                dtViewPh.AcceptChanges();
            }
        }
Пример #12
0
        void numGiam_Tru_Validating(object sender, CancelEventArgs e)
        {
            //Giam_Tru_CN: Lay tu tham so trong HRPARAVALUE
            //Giam_Tru_GD: Lay tu tham so trong HRPARAVALUE
            double Giam_Tru_CN = 0;
            double Giam_Tru_GD = 0;

            Giam_Tru_CN = Convert.ToDouble(SQLExec.ExecuteReturnValue("SELECT Muc_Ap FROM HRPARAVALUE WHERE Ma_Tn = 'GIAM_TRU_CN'"));
            Giam_Tru_GD = Convert.ToDouble(SQLExec.ExecuteReturnValue("SELECT Muc_Ap FROM HRPARAVALUE WHERE Ma_Tn = 'GIAM_TRU_GD'"));

            //Cong thuc: Tien_Giam_Tru = Giam_Tru_CN + (Giam_Tru_GD * So_Nguoi_Giam_Tru)
            numTien_Giam_Tru.Value = Giam_Tru_CN + (Giam_Tru_GD * numGiam_Tru.Value);
            //Thu nhap quy doi phai chiu thue
            numTn_Tinh_Thue.Value = numTn_Chiu_Thue.Value - numTien_Giam_Tru.Value;
        }
Пример #13
0
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);
            this.dgvEditCt1.ClearSelection(); //Chi co tac dung sau khi show form

            if (this.enuNew_Edit == enuEdit.Edit)
            {
                if (!Common.CheckDataLocked((DateTime)drEdit["Ngay_Ct"]))
                {
                    this.dteNgay_Ct.Enabled         = false;
                    this.btgAccept.btAccept.Enabled = false;
                }

                if (!Element.sysIs_Admin)
                {
                    string strCreate_User = (string)this.drEdit["User_Crtd"];

                    if (strCreate_User != string.Empty && strCreate_User != Element.sysUser_Id)
                    {
                        string strUser_Allow = (string)SQLExec.ExecuteReturnValue("SELECT Member_ID_Allow FROM SYSMEMBER WHERE Member_ID = '" + Element.sysUser_Id + "'") + ",";

                        if (!strUser_Allow.Contains("*,")) //Được phép sửa tất cả
                        {
                            if (!strUser_Allow.Contains(strCreate_User + ","))
                            {
                                this.btgAccept.btAccept.Enabled = false;
                                return;
                            }
                        }
                    }
                }


                if (Voucher.CheckDataLockedCtHanTtPXK(drEdit["Ma_PX"].ToString()))
                {
                    btAddHD.Enabled                 = false;
                    btCheckStock.Enabled            = false;
                    this.btgAccept.btAccept.Enabled = false;
                }

                this.btgAccept.btAccept.Enabled = Common.CheckPermission((string)drDmCt["Object_ID"], enuPermission_Type.Allow_Edit);
            }
            else if (this.enuNew_Edit == enuEdit.New)
            {
                this.btgAccept.btAccept.Enabled = Common.CheckPermission((string)drDmCt["Object_ID"], enuPermission_Type.Allow_New);
            }
        }
Пример #14
0
        private void FillData()
        {
            dtZone    = DataTool.SQLGetDataTable("SYSZONE", "*", null, "Zone");
            dtColumns = DataTool.SQLGetDataTable("SYSCOLUMN", "*", null, "Zone,Stt,Column_ID");

            bdsZone.DataSource    = dtZone;
            bdsColumns.DataSource = dtColumns;

            tlZone.DataSource     = bdsZone;
            bdsZone.Position      = 0;
            dgvColumns.DataSource = bdsColumns;

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

            tlZone.Expand = (bool)SQLExec.ExecuteReturnValue("SELECT Expand FROM SYSZONE WHERE ZONE = '" + tlZone.strZone + "'");
        }
Пример #15
0
        void cbo_TextChanged(object sender, EventArgs e)
        {
            if (txtMa_CbNv.Text.Trim() == string.Empty || cboType_Changed.Text.Trim() == string.Empty)
            {
                return;
            }
            {
                txtValue_New.KeyFilter = cboType_Changed.Text;

                Hashtable htParameter = new Hashtable();
                htParameter.Add("MA_CBNV", txtMa_CbNv.Text);
                htParameter.Add("TYPECHANGED", cboType_Changed.Text.Trim());
                string strValue_Current = SQLExec.ExecuteReturnValue("HRM_GetCurentValueByType", htParameter, CommandType.StoredProcedure).ToString();

                txtValue_Current.Text = strValue_Current;
            }
        }
Пример #16
0
        new public void Load(int iThang, string strMa_Bp, string strMa_CbNv)
        {
            this.iThang     = iThang;
            this.strMa_Bp   = strMa_Bp;
            this.strMa_CbNv = strMa_CbNv;

            if (iNgayCong1 > 0)
            {
                this.numNgay_Cong1.Value = iNgayCong1;
            }
            else
            {
                this.numNgay_Cong1.Value = 26;
            }
            //Ngầm định tháng đích tạo bảng lương
            if (iThang == 12)
            {
                this.numThang1.Value = 1;
                this.numNam1.Value   = Element.sysWorkingYear + 1;
            }
            else
            {
                this.numThang1.Value = iThang + 1;
                this.numNam1.Value   = Element.sysWorkingYear;
            }

            DateTime dNgay_Ct = Library.StrToDate("1/" + this.numThang1.Value.ToString().Trim() + "/" + this.numNam1.Value.ToString().Trim());

            string Sql = @"SELECT Muc_Ap 
						FROM HRPARAVALUE
						WHERE Ma_Tn +CAST(Ngay_Ap AS VARCHAR(50)) IN
						  (
							  SELECT  Ma_Tn + CAST(MAX(Ngay_Ap) AS VARCHAR(50))
								  FROM HRPARAVALUE
								  WHERE Ngay_Ap <= '"                                 + Library.DateToStr(dNgay_Ct) + @"'
								  GROUP BY Ma_Tn
						  )
							AND(Ma_Tn IN(SELECT Ma_Tn FROM HRPARALIST WHERE Is_Input = 1)) AND Ma_Tn = 'NGAYCONG1'"                            ;

            iNgayCong1 = Convert.ToInt32(SQLExec.ExecuteReturnValue(Sql));

            this.Text = "Tạo bảng lương mới";

            this.ShowDialog();
        }
Пример #17
0
        private bool Save()
        {
            string    strSQLExec = string.Empty;
            Hashtable htPara;

            //Lưu phần Checked vào GLVOUCHER
            if (chkDuyet.Enabled)
            {
                htPara = new Hashtable();
                htPara.Add("DUYET", chkDuyet.Checked);
                htPara.Add("DUYET_LOG", txtDuyet_Log.Text);
                htPara.Add("STT", drEdit["Stt"]);

                strSQLExec = "UPDATE GLVOUCHER SET Duyet = @Duyet, Duyet_Log = @Duyet_Log WHERE Stt = @Stt";

                if (SQLExec.Execute(strSQLExec, htPara, CommandType.Text))
                {
                    drEdit["Duyet"]     = chkDuyet.Checked;
                    drEdit["Duyet_Log"] = txtDuyet_Log.Text;
                }

                //Sync Data
                string Is_Sync = Convert.ToString(SQLExec.ExecuteReturnValue("SELECT Parameter_Value FROM SYSPARAMETER WHERE Parameter_ID = 'SYNC_BEGIN'"));
                if (Is_Sync == "1")
                {
                    SqlConnection sqlCon = SQLExecSync1.GetNewSQLConnectionSync1();
                    if (sqlCon.State != ConnectionState.Open)
                    {
                        SQLExec.Execute("UPDATE SYSPARAMETER SET Parameter_Value = 0 WHERE Parameter_ID = 'SYNC_BEGIN'");
                        string strMsg = Element.sysLanguage == enuLanguageType.Vietnamese ? "Quá trình đồng bộ đang bị gián đoạn. Vui lòng chờ trong ít phút !" : "The synchronization process is interrupted. Please wait a few minutes !";
                        Common.MsgCancel(strMsg);
                    }
                    else
                    {
                        if (SQLExecSync1.Execute(strSQLExec, htPara, CommandType.Text))
                        {
                            drEdit["Duyet"]     = chkDuyet.Checked;
                            drEdit["Duyet_Log"] = txtDuyet_Log.Text;
                        }
                    }
                }
            }

            return(true);
        }
Пример #18
0
        public override void Delete()
        {
            DataRow drCurrent = ((DataRowView)bdsPXK.Current).Row;

            if (!Common.CheckDataLocked(dte_Ngay))
            {
                EpointMessage.MsgOk("Ngày dữ liệu đã bị khóa !");
                return;
            }

            if (!Common.CheckPermission(this.Object_ID, enuPermission_Type.Allow_Delete))
            {
                EpointMessage.MsgOk("Không có quyền xóa được phiếu xuất kho!");
                return;
            }

            if (!Element.sysIs_Admin)
            {
                string strCreate_User = (string)drCurrent["Create_Log"];

                if (strCreate_User != string.Empty && strCreate_User.Substring(14) != Element.sysUser_Id)
                {
                    string strUser_Allow = (string)SQLExec.ExecuteReturnValue("SELECT Member_ID_Allow FROM SYSMEMBER WHERE Member_ID = '" + Element.sysUser_Id + "'") + ",";

                    if (!strUser_Allow.Contains("*,")) //Được phép sửa tất cả
                    {
                        if (!strUser_Allow.Contains(strCreate_User.Substring(14) + ","))
                        {
                            Common.MsgCancel("Không được xóa chứng từ do " + strCreate_User.Substring(14) + " lập, liên hệ với Admin!");
                            return;
                        }
                    }
                }
            }


            if (dgvPXK.Focused)
            {
                DeletePXK();
            }
            else if (dgvPXDetail.Focused)
            {
                DeletePXKDetail();
            }
        }
Пример #19
0
        public void Load(enuEdit enuNew_Edit, DataRow drEdit)
        {
            this.drEdit      = drEdit;
            this.enuNew_Edit = enuNew_Edit;

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

            Common.ScaterMemvar(this, ref drEdit);

            string strMa_Tte_List = (string)SQLExec.ExecuteReturnValue("SELECT Parameter_Value FROM SYSParameter WHERE Parameter_ID = 'MA_TTE_LIST'");

            enuMa_Tte.InputMask = strMa_Tte_List.Replace(" ", "");

            BindingLanguage();
            LoadDicName();

            this.ShowDialog();
        }
Пример #20
0
        private void BindingPicture()
        {
            object objPic = SQLExec.ExecuteReturnValue("SELECT Hinh FROM HRUNGTUYEN WHERE Ma_CbNv = '" + strMa_CbNv + "'");

            Byte[] bytePic = (Byte[])objPic;

            if (objPic != DBNull.Value && bytePic.Length != 0)
            {
                byte[]     barrImg     = bytePic;
                string     strFileName = Convert.ToString(DateTime.Now.ToFileTime());
                FileStream fs          = new FileStream(strFileName, FileMode.CreateNew, FileAccess.Write);
                fs.Write(barrImg, 0, barrImg.Length);
                fs.Flush();
                fs.Close();
                picHinh.Image    = Image.FromFile(strFileName);
                picHinh.SizeMode = PictureBoxSizeMode.Zoom;
            }
        }
Пример #21
0
        void btExport_Click(object sender, EventArgs e)
        {
            BindingSource bdsExport = new BindingSource();

            dgvExport.bSortMode = false;
            dgvExport.strZone   = "DoiTuong";
            dgvExport.BuildGridView();

            Hashtable htExport = new Hashtable();

            //Mac dinh Ma_Data --> theo tham so he thong
            if ((string)Parameters.GetParaValue("AUTO_DEFAULT_MA_DATA") == "1")
            {
                htExport["MA_DVCS"] = "*";
            }
            else
            {
                htExport["MA_DVCS"] = Element.sysMa_Data;
            }

            //Mac dinh Ma_Data --> theo SYSDMDVCS_DEFAULTLIST
            string strMa_Data = Convert.ToString(SQLExec.ExecuteReturnValue("SELECT Ma_DvCs FROM SYSDMDVCS_DEFAULTLIST WHERE Ma_Dm ='" + this.Object_ID + "'"));

            if (strMa_Data == "*")
            {
                htExport["MA_DVCS"] = strMa_Data;
            }

            DataTable dtExport = new DataTable();

            dtExport             = SQLExec.ExecuteReturnDt("sp_ExportList_DoiTuong", htExport, CommandType.StoredProcedure);
            bdsExport.DataSource = dtExport;
            dgvExport.DataSource = bdsExport;

            string strTitle = ((Control)ExportControl).FindForm().Text;

            if (strTitle.Contains(","))
            {
                strTitle = strTitle.Split(',')[0];
            }

            ExportList(dgvExport, strTitle);
        }
Пример #22
0
        void FillTree()
        {
            dtModule = SQLExec.ExecuteReturnDt("SELECT * FROM SYSMODULE ORDER BY Stt");
            dtMenu   = SQLExec.ExecuteReturnDt("SELECT * FROM SYSMENU ORDER BY Stt");

            bdsModule            = new BindingSource();
            bdsModule.DataSource = dtModule;

            bdsMenu            = new BindingSource();
            bdsMenu.DataSource = dtMenu;

            tlModule.DataSource = bdsModule;
            tlModule.ExpandAll();

            tlMenu.DataSource = bdsMenu;

            tlModule.Expand = (bool)SQLExec.ExecuteReturnValue("SELECT Expand FROM SYSZONE WHERE ZONE = '" + tlModule.strZone + "'");
            tlMenu.Expand   = (bool)SQLExec.ExecuteReturnValue("SELECT Expand FROM SYSZONE WHERE ZONE = '" + tlMenu.strZone + "'");
        }
Пример #23
0
        void txtMa_Sp_Validating(object sender, CancelEventArgs e)
        {
            string strValue = txtMa_Sp.Text.Trim();
            bool   bRequire = false;

            //Kiem tra whether tai khoan theo doi san pham
            object objTk_Sp = SQLExec.ExecuteReturnValue(
                "SELECT TOP 1 Tk_Sp FROM LITAIKHOAN " +
                "WHERE Tk LIKE ('" + txtTk_No.Text + "%') OR Tk LIKE ('" + txtTk_Co.Text + "%')" +
                "ORDER BY Tk_Sp DESC");

            if (objTk_Sp != null && (bool)objTk_Sp)
            {
                bRequire = (bool)objTk_Sp;
            }

            frmSanPham frmLookup = new frmSanPham();
            DataRow    drLookup  = Lookup.ShowLookup(frmLookup, "LISANPHAM", "Ma_Sp", strValue, bRequire, "");

            if (bRequire && drLookup == null)
            {
                e.Cancel = true;
            }

            if (drLookup == null)
            {
                lbtTen_Sp.Text = string.Empty;
                lbtTen_Sp.Text = string.Empty;
            }
            else
            {
                txtMa_Sp.Text  = ((string)drLookup["Ma_Sp"]).Trim();
                lbtTen_Sp.Text = ((string)drLookup["Ten_Sp"]).Trim();
            }

            dicName.SetValue(lbtTen_Sp.Name, lbtTen_Sp.Text);

            if ((((txtTextLookup)sender).AutoFilter != null) && ((txtTextLookup)sender).AutoFilter.Visible)
            {
                ((txtTextLookup)sender).AutoFilter.Visible = false;
                this.SelectNextControl(this.ActiveControl, true, true, true, true);
            }
        }
Пример #24
0
        public void FillData()
        {
            dtViTri             = DataTool.SQLGetDataTable("HRVITRI", null, this.strLookupKeyFilter, null);
            bdsViTri.DataSource = dtViTri;

            //Uy quyen cho lop co so tim kiem
            bdsSearch     = bdsViTri;
            ExportControl = tlViTri;

            tlViTri.DataSource = bdsViTri;
            bdsViTri.Position  = 0;

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

            tlViTri.Expand = (bool)SQLExec.ExecuteReturnValue("SELECT Expand FROM SYSZONE WHERE ZONE = '" + tlViTri.strZone + "'");
        }
Пример #25
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;

            //BHXH
            dtBHXH             = DataTool.SQLGetDataTable("HRBHXH", null, strKey, "Ngay_Begin, Ngay_Tang_BH");
            bdsBHXH.DataSource = dtBHXH;
            dgvBHXH.DataSource = bdsBHXH;

            //BHYT
            dtBHYT             = DataTool.SQLGetDataTable("HRBHYT", null, strKey, "Ngay_Begin, Ngay_End");
            bdsBHYT.DataSource = dtBHYT;
            dgvBHYT.DataSource = bdsBHYT;

            //TyLe
            string strSQLExec1 =
                "SELECT T1.*, T2.Ten_Tn, T2.Dvt FROM HRPARAVALUE0 T1 LEFT JOIN HRPARALIST T2 ON T1.Ma_Tn = T2.Ma_Tn " +
                " WHERE T1.Ma_Tn LIKE 'BH%' OR T1.Ma_Tn LIKE 'KP%' ORDER BY Ngay_Ap";

            dtTyLe             = SQLExec.ExecuteReturnDt(strSQLExec1);
            bdsTyLe.DataSource = dtTyLe;
            dgvTyLe.DataSource = bdsTyLe;

            //TroCap
            string strSQLExec2 =
                "SELECT T1.*, T2.Ten_Tn, T2.Dvt FROM HRPARAVALUE0 T1 LEFT JOIN HRPARALIST T2 ON T1.Ma_Tn = T2.Ma_Tn " +
                " WHERE T1.Ma_Tn LIKE 'PHUCAP%' ORDER BY Ngay_Ap";

            dtTroCap             = SQLExec.ExecuteReturnDt(strSQLExec2);
            bdsTroCap.DataSource = dtTroCap;
            dgvTroCap.DataSource = bdsTroCap;

            //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 + "'");
        }
Пример #26
0
        public void FillData()
        {
            dtBoPhan             = DataTool.SQLGetDataTable("LIBOPHAN", null, this.strLookupKeyFilter, null);
            bdsBoPhan.DataSource = dtBoPhan;

            //Uy quyen cho lop co so tim kiem
            bdsSearch     = bdsBoPhan;
            ExportControl = tlBoPhan;

            tlBoPhan.DataSource = bdsBoPhan;
            bdsBoPhan.Position  = 0;

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

            tlBoPhan.Expand = (bool)SQLExec.ExecuteReturnValue("SELECT Expand FROM SYSZONE WHERE ZONE = '" + tlBoPhan.strZone + "'");
            tlBoPhan.Select();
        }
Пример #27
0
        public void FillData()
        {
            dtResource = DataTool.SQLGetDataTable("ZALORESOURCES", null, this.strLookupKeyFilter, null);

            bdsResource.DataSource = dtResource;

            //Uy quyen cho lop co so tim kiem
            bdsSearch     = bdsResource;
            ExportControl = tlResource;

            tlResource.DataSource = bdsResource;
            bdsResource.Position  = 0;

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

            tlResource.Expand = (bool)SQLExec.ExecuteReturnValue("SELECT Expand FROM SYSZONE WHERE ZONE = '" + tlResource.strZone + "'");
        }
Пример #28
0
        void CheckTable()
        {
            foreach (DataRow dr in dtChechTable.Rows)
            {
                if (!(bool)dr["Select"])
                {
                    continue;
                }

                string strSqlExec = @"	USE Master ; 
									DBCC CHECKTABLE ('"                                     + Element.sysDatabaseName + ".dbo." + (string)dr["Table_Name0"] + @"'); 
									USE "                                     + Element.sysDatabaseName;

                SQLExec.ExecuteReturnValue(strSqlExec);
                Common.ShowStatus("Đang kiểm tra bảng: " + (string)dr["Description"] + " (" + (string)dr["Table_Name0"] + ")");
            }

            EpointMessage.MsgOk(Epoint.Systems.Librarys.Languages.GetLanguage("End_Process", Element.sysLanguage));
            Common.EndShowStatus();
        }
Пример #29
0
        public void FillData()
        {
            dtDmDvCs_DefaultList             = DataTool.SQLGetDataTable("SYSDMDVCS_DEFAULTLIST", null, this.strLookupKeyFilter, null);
            bdsDmDvCs_DefaultList.DataSource = dtDmDvCs_DefaultList;

            //Uy quyen cho lop co so tim kiem
            bdsSearch     = bdsDmDvCs_DefaultList;
            ExportControl = tlDmDvCs_DefaultList;

            tlDmDvCs_DefaultList.DataSource = bdsDmDvCs_DefaultList;
            bdsDmDvCs_DefaultList.Position  = 0;

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

            tlDmDvCs_DefaultList.Expand = (bool)SQLExec.ExecuteReturnValue("SELECT Expand FROM SYSZONE WHERE ZONE = '" + tlDmDvCs_DefaultList.strZone + "'");
            tlDmDvCs_DefaultList.Select();
        }
Пример #30
0
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);

            if (!Element.Is_Running)
            {
                return;
            }
            //Kiem tra Permission
            switch (this.enuNew_Edit)
            {
            case enuEdit.New:
                this.btgAccept.btAccept.Enabled = Common.CheckPermission(this.Object_ID, enuPermission_Type.Allow_New);
                break;

            case enuEdit.Edit:
                this.btgAccept.btAccept.Enabled = Common.CheckPermission(this.Object_ID, enuPermission_Type.Allow_Edit);
                break;

            default:
                break;
            }

            //Mac dinh Ma_Data --> theo tham so he thong
            if ((string)Parameters.GetParaValue("AUTO_DEFAULT_MA_DATA") == "1")
            {
                this.ucMa_Data.cboMa_Data.Text = "*";
            }
            else
            {
                this.ucMa_Data.cboMa_Data.Text = Element.sysMa_Data;
            }

            //Mac dinh Ma_Data --> theo SYSDMDVCS_DEFAULTLIST
            string strMa_Data = Convert.ToString(SQLExec.ExecuteReturnValue("SELECT Ma_DvCs FROM SYSDMDVCS_DEFAULTLIST WHERE Ma_Dm ='" + this.Object_ID + "'"));

            if (strMa_Data == "*")
            {
                this.ucMa_Data.cboMa_Data.Text = strMa_Data;
            }
        }