コード例 #1
0
 private bool check_100_phan_tram_phap_nhan(decimal ip_id_phong_ban, decimal ip_id_phap_nhan)
 {
     DS_DM_PHONG_BAN_PHAP_NHAN v_ds = new DS_DM_PHONG_BAN_PHAP_NHAN();
     US_DM_PHONG_BAN_PHAP_NHAN v_us = new US_DM_PHONG_BAN_PHAP_NHAN();
     v_us.FillDataset(v_ds, "where ID_PHONG_BAN = " + ip_id_phong_ban);
     switch(m_e) {
         case DataEntryFormMode.InsertDataState:
             decimal tong_phan_tram_insert = CIPConvert.ToDecimal(m_txt_ty_trong.Text);
             foreach(DataRow v_dr in v_ds.DM_PHONG_BAN_PHAP_NHAN.Rows) {
                 tong_phan_tram_insert = tong_phan_tram_insert + CIPConvert.ToDecimal(v_dr["TY_TRONG"].ToString());
             }
             if(tong_phan_tram_insert > 100) {
                 return false;
             }
             break;
         case DataEntryFormMode.UpdateDataState:
             decimal tong_phan_tram_update = 0;
             foreach(DataRow v_dr in v_ds.DM_PHONG_BAN_PHAP_NHAN.Rows) {
                 if(CIPConvert.ToDecimal(v_dr["ID_PHAP_NHAN"].ToString()) == ip_id_phap_nhan)
                     v_dr["TY_TRONG"] = m_txt_ty_trong.Text;
                 tong_phan_tram_update = tong_phan_tram_update + CIPConvert.ToDecimal(v_dr["TY_TRONG"].ToString());
             }
             if(tong_phan_tram_update > 100) {
                 return false;
             }
             break;
     }
     return true;
 }
コード例 #2
0
        private bool insert_data()
        {
            try
            {
                string v_str_file_name = m_txt_file_upload.Text.Split('\\')[m_txt_file_upload.Text.Split('\\').Length - 1];
                string v_str_save_file = ConfigurationSettings.AppSettings["DOMAIN"] + "/" + "FileUpload_Vanthu" + "/" + v_str_file_name.Replace(ConfigurationSettings.AppSettings["DOMAIN"] + "/" + "FileUpload_Vanthu" + "/","");
                if (!m_txt_file_upload.Text.Trim().Equals("") && !m_txt_file_upload.Text.Contains(ConfigurationSettings.AppSettings["DOMAIN"]))
                {
                    if (!HelpUtils.ftpTransfer(m_txt_file_upload.Text.Replace(v_str_file_name, ""), v_str_file_name)) return false;
                }

                US_GD_VAN_THU v_us_gd_van_thu = new US_GD_VAN_THU();
                if (m_dc_id_van_thu != 0) v_us_gd_van_thu = new US_GD_VAN_THU(m_dc_id_van_thu);

                if (m_tcd_ngay_tren_cv.getValue() == null) v_us_gd_van_thu.SetNGAY_THANG_TREN_CONG_VANNull();
                else
                    v_us_gd_van_thu.datNGAY_THANG_TREN_CONG_VAN = CIPConvert.ToDatetime(m_tcd_ngay_tren_cv.Text, "dd/MM/yyyy");

                if (m_tcd_ngay_nhap.getValue() == null) v_us_gd_van_thu.SetNGAY_LAPNull();
                else
                    v_us_gd_van_thu.datNGAY_LAP = CIPConvert.ToDatetime(m_tcd_ngay_nhap.Text, "dd/MM/yyyy");

                v_us_gd_van_thu.strSO_VA_KY_HIEU = m_txt_so_va_ky_hieu.Text.Trim();
                v_us_gd_van_thu.strTEN_LOAI_VA_TRICH_YEU_ND = m_txt_ten_loai.Text.Trim();

                US_DM_PHONG_BAN_PHAP_NHAN v_us_dm_phong_ban = new US_DM_PHONG_BAN_PHAP_NHAN();
                DS_DM_PHONG_BAN_PHAP_NHAN v_ds_dm_phong_ban = new DS_DM_PHONG_BAN_PHAP_NHAN();

                if (m_cbx_ban_luu.SelectedValue != null)
                {
                    v_us_dm_phong_ban.FillDataset(v_ds_dm_phong_ban,
                                                  " where id_phong_ban = " + m_cbx_ban_luu.SelectedValue);
                    v_us_gd_van_thu.dcID_NGUOI_NHAN_BAN_LUU = CIPConvert.ToDecimal(m_cbx_ban_luu.SelectedValue);
                    v_us_gd_van_thu.dcID_NOI_NGUOI_NHAN = CIPConvert.ToDecimal(m_cbx_ban_luu.SelectedValue);
                }
                else
                {
                    v_us_gd_van_thu.SetID_NGUOI_NHAN_BAN_LUUNull();
                    v_us_gd_van_thu.SetID_NOI_NGUOI_NHANNull();
                }

                if (v_ds_dm_phong_ban.Tables[0].Rows.Count > 0)
                    v_us_gd_van_thu.dcID_PHAP_NHAN = CIPConvert.ToDecimal(v_ds_dm_phong_ban.Tables[0].Rows[0][DM_PHONG_BAN_PHAP_NHAN.ID_PHAP_NHAN]);
                else v_us_gd_van_thu.SetID_PHAP_NHANNull();

                v_us_gd_van_thu.strGHI_CHU = m_txt_ghi_chu.Text.Trim();
                v_us_gd_van_thu.dcID_TRANG_THAI = CIPConvert.ToDecimal(m_cbx_trang_thai.SelectedValue);
                v_us_gd_van_thu.strNGUOI_LAP = m_txt_nguoi_nhap.Text.Trim();
                if (!m_txt_file_upload.Text.Trim().Equals(string.Empty))
                    v_us_gd_van_thu.strLINK_SCAN = v_str_save_file;
                else v_us_gd_van_thu.strLINK_SCAN = string.Empty;
                v_us_gd_van_thu.strSO_CV_DEN = m_txt_so_cv_den.Text.Trim();
                v_us_gd_van_thu.strNOI_GUI = m_txt_noi_gui.Text.Trim();
                v_us_gd_van_thu.dcID_LOAI_CONG_VAN = ID_LOAI_VAN_THU.CONG_VAN_DEN;
                v_us_gd_van_thu.strNOI_NHAN = m_cbx_ban_luu.Text.Trim();
                if (v_us_dm_phong_ban.dcID == -1)
                {
                    v_us_gd_van_thu.Insert();
                    US_CM_DM_TU_DIEN v_us = new US_CM_DM_TU_DIEN();
                    DS_CM_DM_TU_DIEN v_ds = new DS_CM_DM_TU_DIEN();
                    v_us.FillDataset(v_ds, "where ma_tu_dien='CV_DEN'");
                    if (v_ds.CM_DM_TU_DIEN.Count > 0)
                    {
                        v_us.DataRow2Me(v_ds.Tables[0].Rows[0]);
                        string v_str_so = v_ds.Tables[0].Rows[0][CM_DM_TU_DIEN.TEN_NGAN].ToString();
                        string v_str_nam = v_ds.Tables[0].Rows[0][CM_DM_TU_DIEN.TEN].ToString();
                        v_str_so = CIPConvert.ToStr(CIPConvert.ToDecimal(v_str_so) + 1, "0#");
                        m_txt_so_cv_den.Text = v_str_so + "/" + v_str_nam;
                        v_us.strTEN = v_str_nam;
                        v_us.strTEN_NGAN = v_str_so;
                        v_us.Update();
                    }
                }
                else
                {
                    v_us_dm_phong_ban.Update();
                }
                return true;
            }
            catch (Exception v_e)
            {
                CSystemLog_301.ExceptionHandle(v_e);
                return false;
            }
        }
コード例 #3
0
 private void dm_grid2us_object(US_DM_PHONG_BAN_PHAP_NHAN i_us
     , int i_grid_row)
 {
     DataRow v_dr;
     v_dr = (DataRow)m_grv_ty_trong.Rows[i_grid_row].UserData;
     m_obj_trans.GridRow2DataRow(i_grid_row, v_dr);
     i_us.DataRow2Me(v_dr);
 }
コード例 #4
0
 private void insert_grid_2_bd(decimal ip_phong_ban)
 {
     for (int i = 1; i < m_grv_ty_trong.Rows.Count; i++)
     {
         if (m_grv_ty_trong.Rows[i][(int)e_col_Number.TEN_PHAP_NHAN] == null) break;
         US_DM_PHONG_BAN_PHAP_NHAN v_us_pb_phap_nhan = new US_DM_PHONG_BAN_PHAP_NHAN();
         v_us_pb_phap_nhan.UseTransOfUSObject(m_us_dm_phong_ban);
         v_us_pb_phap_nhan.dcID_PHAP_NHAN = CIPConvert.ToDecimal(m_grv_ty_trong.Rows[i][(int)e_col_Number.TEN_PHAP_NHAN]);
         v_us_pb_phap_nhan.dcID_PHONG_BAN = ip_phong_ban;
         v_us_pb_phap_nhan.dcTY_TRONG = CIPConvert.ToDecimal(m_grv_ty_trong.Rows[i][(int)e_col_Number.TY_TRONG]);
         v_us_pb_phap_nhan.Insert();
     }
 }