Example #1
0
        public void FillDatasetSearchByMaHopDong(DS_GD_HOP_DONG op_ds, string ip_str_ma_hop_dong)
        {
            CStoredProc v_sp = new CStoredProc("pr_GD_HOP_DONG_Search_by_ma_hop_dong");

            v_sp.addNVarcharInputParam("@MA_HOP_DONG", ip_str_ma_hop_dong);
            v_sp.fillDataSetByCommand(this, op_ds);
        }
Example #2
0
        public void FillDataSet_Search_like_ma_hop_dong(DS_GD_HOP_DONG op_ds, string ma_hop_dong)
        {
            CStoredProc v_sp = new CStoredProc("GD_HOP_DONG_Search_like_ma_hop_dong");

            v_sp.addNVarcharInputParam("@MA_HOP_DONG", ma_hop_dong);
            v_sp.fillDataSetByCommand(this, op_ds);
        }
Example #3
0
        public void FillDataSet_Search_by_trang_thai_hop_dong(DS_GD_HOP_DONG op_ds, string trang_thai_hop_dong, decimal id_nhan_su)
        {
            CStoredProc v_sp = new CStoredProc("pr_V_GD_HOP_DONG_LAO_DONG_by_trang_thai_hop_dong");

            v_sp.addNVarcharInputParam("@trang_thai_hop_dong", trang_thai_hop_dong);
            v_sp.addDecimalInputParam("@id_nhan_su", id_nhan_su);
            v_sp.fillDataSetByCommand(this, op_ds);
        }
 private bool check_loai_hd_dang_su_dung(decimal ip_id_loai_hd)
 {
     US_GD_HOP_DONG v_us = new US_GD_HOP_DONG();
     DS_GD_HOP_DONG v_ds = new DS_GD_HOP_DONG();
     v_us.FillDataset(v_ds, "where id_loai_hop_dong =" + ip_id_loai_hd);
     if (v_ds.Tables[0].Rows.Count == 0)
         return false;
     return true;
 }
 public US_GD_HOP_DONG(decimal i_dbID)
 {
     pm_objDS = new DS_GD_HOP_DONG();
     pm_strTableName = c_TableName;
     IMakeSelectCmd v_objMkCmd = new CMakeAndSelectCmd(pm_objDS, c_TableName);
     v_objMkCmd.AddCondition("ID", i_dbID, eKieuDuLieu.KieuNumber, eKieuSoSanh.Bang);
     SqlCommand v_cmdSQL;
     v_cmdSQL = v_objMkCmd.getSelectCmd();
     this.FillDatasetByCommand(pm_objDS, v_cmdSQL);
     pm_objDR = getRowClone(pm_objDS.Tables[pm_strTableName].Rows[0]);
 }
 private bool check_hd_dang_su_dung(decimal ip_id_chuc_vu)
 {
     US_GD_HOP_DONG v_us_hd = new US_GD_HOP_DONG();
     DS_GD_HOP_DONG v_ds_hd = new DS_GD_HOP_DONG();
     v_us_hd.FillDataset(v_ds_hd, "where id_chuc_vu =" + ip_id_chuc_vu);
     if (v_ds_hd.Tables[0].Rows.Count == 0)
     {
         return false;
     }
     else return true;
 }
Example #7
0
        public US_GD_HOP_DONG(decimal i_dbID)
        {
            pm_objDS        = new DS_GD_HOP_DONG();
            pm_strTableName = c_TableName;
            IMakeSelectCmd v_objMkCmd = new CMakeAndSelectCmd(pm_objDS, c_TableName);

            v_objMkCmd.AddCondition("ID", i_dbID, eKieuDuLieu.KieuNumber, eKieuSoSanh.Bang);
            SqlCommand v_cmdSQL;

            v_cmdSQL = v_objMkCmd.getSelectCmd();
            this.FillDatasetByCommand(pm_objDS, v_cmdSQL);
            pm_objDR = getRowClone(pm_objDS.Tables[pm_strTableName].Rows[0]);
        }
        private bool check_trung_ma_hop_dong(string ip_str_ma_hop_dong)
        {
            DS_GD_HOP_DONG v_ds = new DS_GD_HOP_DONG();

            m_us.FillDatasetSearchByMaHopDong(v_ds, ip_str_ma_hop_dong);
            decimal count_ma_hop_dong = v_ds.GD_HOP_DONG.Count;

            if (count_ma_hop_dong > 0)
            {
                return(true);
            }
            return(false);
        }
        private void grid2us_object(int i_grid_row)
        {
            DataRow v_dr = (DataRow)m_fg.Rows[i_grid_row].UserData;

            if (v_dr == null)
            {
                return;
            }
            DS_GD_HOP_DONG v_ds = new DS_GD_HOP_DONG();
            US_GD_HOP_DONG v_us = new US_GD_HOP_DONG();

            v_us.FillDatasetSearchByMaHopDong(v_ds, v_dr.ItemArray[4].ToString());

            m_us_gd_hop_dong = new US_GD_HOP_DONG((decimal)v_ds.Tables[0].Rows[0]["ID"]);
            //m_obj_trans.GridRow2DataRow(i_grid_row,v_dr);
            //i_us.DataRow2Me(v_dr);
        }
        private decimal find_id_hop_by_ma_hop_dong(string ip_str_ma_nv)
        {
            US_GD_HOP_DONG v_us = new US_GD_HOP_DONG();
            DS_GD_HOP_DONG v_ds = new DS_GD_HOP_DONG();

            v_us.FillDataset(v_ds);

            string v_str_filter = "MA_HOP_DONG = '" + ip_str_ma_nv + "'";
            DataRow[] v_dr = v_ds.GD_HOP_DONG.Select(v_str_filter);

            if (v_dr.Count() == 0)
            {
                return -1;
            }
            else
            {
                return CIPConvert.ToDecimal(v_dr.First()["ID"].ToString());
            }
        }
 public US_GD_HOP_DONG()
 {
     pm_objDS = new DS_GD_HOP_DONG();
     pm_strTableName = c_TableName;
     pm_objDR = pm_objDS.Tables[pm_strTableName].NewRow();
 }
        //check validate data
        private bool check_ma_hd()
        {
            DS_GD_HOP_DONG v_ds = new DS_GD_HOP_DONG();
            US_GD_HOP_DONG v_us = new US_GD_HOP_DONG();

            v_us.FillDataset(v_ds);

            string v_str_filter = "";
            v_str_filter = "MA_HOP_DONG = '" + m_txt_ma_hd.Text + "'";

            DataRow[] v_dr = v_ds.GD_HOP_DONG.Select(v_str_filter);

            if (v_dr.Count() != 0)
            {
                m_txt_ma_hd.BackColor = Color.Bisque;
                //  m_lbl_kiem_tra_ma_hd.Visible = true;
                //  m_lbl_kiem_tra_ma_hd.Text = "Đã có mã này rồi...";
                MessageBox.Show("Đã có mã này rồi!");
                return true;
            }
            else
            {
                m_txt_ma_hd.BackColor = Color.White;
                // m_lbl_kiem_tra_ma_hd.Visible = false;
                return false;
            }
        }
Example #13
0
 public US_GD_HOP_DONG()
 {
     pm_objDS        = new DS_GD_HOP_DONG();
     pm_strTableName = c_TableName;
     pm_objDR        = pm_objDS.Tables[pm_strTableName].NewRow();
 }
 private bool check_ma_hd_da_ton_tai(string ip_str_ma_hd)
 {
     if (m_us_gd_hd.strMA_HOP_DONG != ip_str_ma_hd)
     {
         US_GD_HOP_DONG v_us = new US_GD_HOP_DONG();
         DS_GD_HOP_DONG v_ds = new DS_GD_HOP_DONG();
         v_us.FillDataset(v_ds, "where MA_HOP_DONG = '" + ip_str_ma_hd + "'");
         if (v_ds.Tables[0].Rows.Count != 0)
             return true;
     }
     return false;
 }
 private DataTable load_data_to_ma_hd()
 {
     US_GD_HOP_DONG v_us = new US_GD_HOP_DONG();
     DS_GD_HOP_DONG v_ds_hd = new DS_GD_HOP_DONG();
     v_us.FillDataset(v_ds_hd);
     return v_ds_hd.Tables[0];
 }
        //Insert, update, delete
        private decimal find_id_hd(decimal ip_dc_id_nv)
        {
            US_GD_HOP_DONG v_us = new US_GD_HOP_DONG();
            DS_GD_HOP_DONG v_ds = new DS_GD_HOP_DONG();

            v_us.FillDataset(v_ds);

            string v_str_filter = "ID_NHAN_VIEN = " + ip_dc_id_nv + " AND DA_XOA = 'N'";
            DataRow[] v_dr = v_ds.GD_HOP_DONG.Select(v_str_filter);

            if (v_dr.Count() == 0)
            {
                return -1;
            }
            else
            {
                return CIPConvert.ToDecimal(v_dr.First()["ID"].ToString());
            }
        }
        private decimal find_id_loai_hop_dong_cua_nhan_vien(decimal ip_dc_id_gd_hd)
        {
            US_GD_HOP_DONG v_us = new US_GD_HOP_DONG();
            DS_GD_HOP_DONG v_ds = new DS_GD_HOP_DONG();

            v_us.FillDataset(v_ds);

            string v_str_filter = "ID = " + ip_dc_id_gd_hd + " AND DA_XOA = 'N'";
            DataRow[] v_dr = v_ds.GD_HOP_DONG.Select(v_str_filter);

            if (v_dr.Count() == 0)
            {
                return -1;
            }
            else
            {
                return CIPConvert.ToDecimal(v_dr.First()["ID_LOAI_HOP_DONG"].ToString());
            }
        }
        private void save_data()
        {
            if (check_data_is_ok() == false)
            {
                return;
            }

            #region Xử lý file đính kèm
            switch (m_e_file_mode)
            {
            case DataEntryFileMode.UploadFile:
                // Kiểm tra file đã tồn tại trên server hay chưa
                if (FileExplorer.IsExistedFile(m_str_directory_to + FileExplorer.fileName))
                {
                    BaseMessages.MsgBox_Infor("Tên file đã tồn tại. Vui lòng đổi tên khác");
                    return;
                }

                // Nếu đã chọn file
                if (m_lbl_file_name.Text != "")
                {
                    // Upload server có sử dụng user và pass
                    if (m_str_user_name != "")
                    {
                        FileExplorer.UploadFile(m_str_domain, m_str_directory_to, m_str_user_name, m_str_password);
                    }
                    // Upload không sử dụng user và pass
                    else
                    {
                        FileExplorer.UploadFile(m_str_domain, m_str_directory_to);
                    }
                }
                break;

            case DataEntryFileMode.EditFile:
                // Nếu ko up lên file mới sẽ bỏ qua bước này
                if (m_str_link_old != m_lbl_file_name.Text)
                {
                    // Kiểm tra file vừa upload đã tồn tại hay chưa
                    if (FileExplorer.IsExistedFile(m_str_directory_to + FileExplorer.fileName))
                    {
                        BaseMessages.MsgBox_Infor("Tên file đã tồn tại. Vui lòng đổi tên khác");
                        return;
                    }

                    // Xóa file cũ
                    if (FileExplorer.IsExistedFile(m_str_directory_to + m_str_link_old))
                    {
                        FileExplorer.DeleteFile(m_str_directory_to + m_str_link_old);
                    }

                    // Upload file mới lên
                    if (m_str_user_name != "")
                    {
                        FileExplorer.UploadFile(m_str_domain, m_str_directory_to, m_str_user_name, m_str_password);
                    }
                    else
                    {
                        FileExplorer.UploadFile(m_str_domain, m_str_directory_to);
                    }
                }
                break;

            case DataEntryFileMode.DeleteFile:
                // Kiểm tra file có tồn tại hay không
                if (FileExplorer.IsExistedFile(m_str_directory_to + m_str_link_old))
                {
                    FileExplorer.DeleteFile(m_str_directory_to + m_str_link_old);
                }
                break;
            }
            #endregion

            form_2_us_object();
            switch (m_e_form_mode)
            {
            case DataEntryFormMode.InsertDataState:
                if (check_trung_ma_hop_dong(m_txt_ma_hop_dong.Text))
                {
                    BaseMessages.MsgBox_Error("Mã hợp đồng đã tồn tại.");
                    m_txt_ma_hop_dong.Focus();
                    return;
                }
                DS_GD_HOP_DONG ds_gd_hd = new DS_GD_HOP_DONG();
                US_GD_HOP_DONG us_gd_hd = new US_GD_HOP_DONG();
                us_gd_hd.FillDataSet_Search_by_trang_thai_hop_dong(ds_gd_hd, "Y", m_us.dcID_NHAN_SU);
                var v_i_total_record = ds_gd_hd.Tables[0].Rows.Count;
                if (v_i_total_record > 0)
                {
                    foreach (var item in ds_gd_hd.GD_HOP_DONG)
                    {
                        us_gd_hd.dcID = item.ID;
                        us_gd_hd.Upload_trang_thai_hop_dong(us_gd_hd);
                    }
                }
                m_us.Insert();
                break;

            case DataEntryFormMode.UpdateDataState:
                US_GD_HOP_DONG v_us_gd_hop_dong = new US_GD_HOP_DONG(m_str_id_hop_dong_old);
                if (!m_txt_ma_hop_dong.Text.Equals(v_us_gd_hop_dong.strMA_HOP_DONG))
                {
                    if (check_trung_ma_hop_dong(m_txt_ma_hop_dong.Text))
                    {
                        BaseMessages.MsgBox_Error("Mã hợp đồng đã tồn tại.");
                        m_txt_ma_hop_dong.Focus();
                        return;
                    }
                }
                m_us.Update();
                break;
            }
            f701_v_hop_dong_lao_dong.m_str_ma_hop_dong = m_txt_ma_hop_dong.Text;
            BaseMessages.MsgBox_Infor("Dữ liệu đã được cập nhật");
            this.Close();
        }
 public decimal GetHopDongHienTaiCuaNV(string ip_id_nv)
 {
     CStoredProc v_cstore = new CStoredProc("pr_HD_theo_nv_GetThoiDiemHienTai");
     DS_GD_HOP_DONG v_ds = new DS_GD_HOP_DONG();
     v_cstore.addDecimalInputParam("@id_nv", ip_id_nv);
     v_cstore.fillDataSetByCommand(this, v_ds);
     if (v_ds.Tables[0].Rows.Count == 0)
         return 0;
     return decimal.Parse(v_ds.Tables[0].Rows[0][0].ToString());
 }
        private decimal find_id_gd_hop_dong_by_id_nhan_vien(decimal ip_dc_id_nv)
        {
            try
            {
                US_GD_HOP_DONG v_us = new US_GD_HOP_DONG();
                DS_GD_HOP_DONG v_ds = new DS_GD_HOP_DONG();

                v_us.FillDataset(v_ds);

                string v_str_filter = "ID_NHAN_VIEN = " + ip_dc_id_nv + " AND DA_XOA = 'N'";
                DataRow[] v_dr = v_ds.GD_HOP_DONG.Select(v_str_filter);

                if (v_dr.Count() == 0)
                {
                    return -1;
                }
                else
                {
                    return CIPConvert.ToDecimal(v_dr.First()["ID"].ToString());
                }
            }
            catch (Exception v_e)
            {
                throw v_e;
            }
        }