public void FillDataset_By_Ma_qd(DS_DM_QUYET_DINH op_ds, string ip_str_ma_qd) { CStoredProc v_sp = new CStoredProc("pr_DM_QUYET_DINH_By_Ma_qd"); v_sp.addNVarcharInputParam("@ip_str_ma_qd", ip_str_ma_qd); v_sp.fillDataSetByCommand(this, op_ds); }
public void FillDatasetByIdQD(DS_DM_QUYET_DINH op_ds_quyet_dinh, decimal i_dc_id_qd) { CStoredProc v_sp = new CStoredProc("pr_DM_QUYET_DINH_search_by_id_qd"); v_sp.addDecimalInputParam("@ID_QD", i_dc_id_qd); v_sp.fillDataSetByCommand(this, op_ds_quyet_dinh); }
public void FillDatasetByMaQuyetDinh(DS_DM_QUYET_DINH op_ds_dm_qd, string i_str_ma_qd) { CStoredProc v_sp = new CStoredProc("pr_DM_QUYET_DINH_search_by_ma_qd"); v_sp.addNVarcharInputParam("@STR_MA_QD", i_str_ma_qd); v_sp.fillDataSetByCommand(this, op_ds_dm_qd); }
private void init_members() { m_us_dm_quyet_dinh = new US_DM_QUYET_DINH(); m_ds_dm_quyet_dinh = new DS_DM_QUYET_DINH(); m_us_v_gd_luong_theo_qd = new US_V_GD_LUONG_THEO_QD(); m_ds_gd_luong_theo_qd = new DS_GD_LUONG_THEO_QD(); }
private bool is_exist_quyet_dinh(string ip_str_ma_quyet_dinh) { US_DM_QUYET_DINH v_us = new US_DM_QUYET_DINH(); DS_DM_QUYET_DINH v_ds = new DS_DM_QUYET_DINH(); v_us.FillDataset_By_Ma_qd(v_ds, ip_str_ma_quyet_dinh); if (v_ds.DM_QUYET_DINH.Rows.Count > 0) { return(true); } return(false); }
public US_DM_QUYET_DINH(decimal i_dbID) { pm_objDS = new DS_DM_QUYET_DINH(); 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_is_trung_ma_quyet_dinh() { DS_DM_QUYET_DINH v_ds = new DS_DM_QUYET_DINH(); US_DM_QUYET_DINH v_us = new US_DM_QUYET_DINH(); v_us.FillDataset_By_Ma_qd(v_ds, m_txt_ma_quyet_dinh.Text); if (m_b_check_quyet_dinh_save) { switch (m_e_form_mode) { case DataEntryFormMode.InsertDataState: if (v_ds.DM_QUYET_DINH.Count > 0) { return(true); } break; case DataEntryFormMode.SelectDataState: if (v_ds.DM_QUYET_DINH.Count > 0 && m_txt_ma_quyet_dinh.Text != m_us_v_gd_cong_tac.strMA_QUYET_DINH) { return(true); } break; case DataEntryFormMode.UpdateDataState: break; case DataEntryFormMode.ViewDataState: break; default: break; } } return(false); }
public static void load_data_to_cbo_quyet_dinh_by_loai_quyet_dinh( LOAI_QUYET_DINH ip_loai_quyet_dinh , DropDownList op_ddl_quyet_dinh) { decimal v_dc_id_don_vi = Person.get_id_don_vi(); DS_DM_QUYET_DINH v_ds = new DS_DM_QUYET_DINH(); US_DM_QUYET_DINH v_us = new US_DM_QUYET_DINH(); string v_str_querry = ""; if (ip_loai_quyet_dinh == LOAI_QUYET_DINH.GIAO_VON) v_str_querry = "where "// id_don_vi=" + v_dc_id_don_vi + " id_loai_quyet_dinh= " + ID_LOAI_QUYET_DINH.GIAO_VON; else if (ip_loai_quyet_dinh == LOAI_QUYET_DINH.GIAO_KE_HOACH) v_str_querry = "where "//id_don_vi=" + v_dc_id_don_vi + " id_loai_quyet_dinh= " + ID_LOAI_QUYET_DINH.GIAO_KE_HOACH; else if (ip_loai_quyet_dinh == LOAI_QUYET_DINH.TAT_CA) v_str_querry = "where";// id_don_vi=" + v_dc_id_don_vi; v_str_querry += " order by ngay_thang "; v_us.FillDataset(v_ds, v_str_querry); for (int v = 0; v < v_ds.DM_QUYET_DINH.Count; v++) { v_ds.Tables[0].Rows[v][DM_QUYET_DINH.NOI_DUNG] = v_ds.Tables[0].Rows[v][DM_QUYET_DINH.SO_QUYET_DINH] + " " + v_ds.Tables[0].Rows[v][DM_QUYET_DINH.NOI_DUNG]; v_ds.AcceptChanges(); } op_ddl_quyet_dinh.DataTextField = DM_QUYET_DINH.NOI_DUNG; op_ddl_quyet_dinh.DataValueField = DM_QUYET_DINH.ID; op_ddl_quyet_dinh.DataSource = v_ds.DM_QUYET_DINH; op_ddl_quyet_dinh.DataBind(); op_ddl_quyet_dinh.Items.Insert(0, new ListItem("---Chọn quyết định---", "-1")); }
/// <summary> /// Load danh sách các quyết định theo các tiêu chí vào DropDownList đơn vị /// </summary> /// <param name="ip_dc_id_don_vi"></param> /// <param name="ip_dc_id_loai_nhiem_vu"></param> /// <param name="ip_dc_id_cong_trinh"></param> /// <param name="ip_dc_id_du_an"></param> /// <param name="ip_dat_tu_ngay"></param> /// <param name="ip_dat_den_ngay"></param> /// <param name="ip_str_tu_khoa"></param> /// <param name="ip_e_tat_ca"></param> /// <param name="ip_obj_cbo_quyet_dinh"></param> public static void load_data_to_cbo_quyet_dinh( decimal ip_dc_id_don_vi , decimal ip_dc_id_loai_nhiem_vu , decimal ip_dc_id_cong_trinh , decimal ip_dc_id_du_an , DateTime ip_dat_tu_ngay , DateTime ip_dat_den_ngay , string ip_str_tu_khoa , eTAT_CA ip_e_tat_ca , string ip_str_proc , DropDownList ip_obj_cbo_quyet_dinh) { US_DM_QUYET_DINH v_us_dm_quyet_dinh = new US_DM_QUYET_DINH(); DS_DM_QUYET_DINH v_ds_dm_quyet_dinh = new DS_DM_QUYET_DINH(); DataSet v_ds = new DataSet(); DataTable v_dt = new DataTable(); v_ds.Tables.Add(v_dt); string v_str_user_name = HttpContext.Current.Session[SESSION.UserName].ToString(); v_ds_dm_quyet_dinh.EnforceConstraints = false; v_us_dm_quyet_dinh.get_ds_quyet_dinh( v_ds , ip_dc_id_don_vi , ip_dc_id_loai_nhiem_vu , ip_dc_id_cong_trinh , ip_dc_id_du_an , ip_dat_tu_ngay , ip_dat_den_ngay , ip_str_tu_khoa , ip_str_proc ); DataView v_dv_quyet_dinh = v_ds.Tables[0].DefaultView; ip_obj_cbo_quyet_dinh.DataSource = v_dv_quyet_dinh.ToTable(); ip_obj_cbo_quyet_dinh.DataTextField = DM_QUYET_DINH.SO_QUYET_DINH; ip_obj_cbo_quyet_dinh.DataValueField = DM_QUYET_DINH.ID; ip_obj_cbo_quyet_dinh.DataBind(); if (ip_e_tat_ca == eTAT_CA.YES) { ip_obj_cbo_quyet_dinh.Items.Insert(0, new ListItem(CONST_TONG.TONG, CONST_GIAO_DICH.ID_TAT_CA.ToString())); } }
private int getCountQuyetDinhCoSo(string ip_str_so_quyet_dinh) { DS_DM_QUYET_DINH v_ds = new DS_DM_QUYET_DINH(); US_DM_QUYET_DINH v_us = new US_DM_QUYET_DINH(); v_us.FillDataset(v_ds, "where " + DM_QUYET_DINH.SO_QUYET_DINH + " = N'" + ip_str_so_quyet_dinh + "'"); return v_ds.DM_QUYET_DINH.Count; }
//protected void m_grv_RowDataBound(object sender, GridViewRowEventArgs e) //{ // try // { // if (e.Row.RowType == DataControlRowType.Header) // { // for (int i = 6; i < e.Row.Cells.Count; i++) // { // US_DM_QUYET_DINH v_us_qd = new US_DM_QUYET_DINH(); // DS_DM_QUYET_DINH v_ds_qd = new DS_DM_QUYET_DINH(); // v_us_qd.FillDataset(v_ds_qd, "where " + DM_QUYET_DINH.SO_QUYET_DINH + " = N'" + e.Row.Cells[i].Text + "'"); // if (v_ds_qd.DM_QUYET_DINH.Count > 0) // { // e.Row.Cells[i].Text = "QĐ số " + v_ds_qd.Tables[0].Rows[0][DM_QUYET_DINH.SO_QUYET_DINH] + " ngày " + // CIPConvert.ToStr(v_ds_qd.Tables[0].Rows[0][DM_QUYET_DINH.NGAY_THANG], "dd/MM/yyyy"); // } // } // } // } // catch (Exception v_e) // { // CSystemLog_301.ExceptionHandle(this, v_e); // } //} protected void m_grv_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.Header) { for (int i = 0; i < e.Row.Controls.Count; i++) { var headerCell = e.Row.Controls[i] as DataControlFieldHeaderCell; if (headerCell != null) { US_DM_QUYET_DINH v_us_qd = new US_DM_QUYET_DINH(); DS_DM_QUYET_DINH v_ds_qd = new DS_DM_QUYET_DINH(); v_us_qd.FillDataset(v_ds_qd, "where " + DM_QUYET_DINH.SO_QUYET_DINH + " = N'" + headerCell.ContainingField.ToString().Trim() + "'"); if (v_ds_qd.DM_QUYET_DINH.Count > 0) { headerCell.Text = "QĐ số " + v_ds_qd.Tables[0].Rows[0][DM_QUYET_DINH.SO_QUYET_DINH] + " ngày " + CIPConvert.ToStr(v_ds_qd.Tables[0].Rows[0][DM_QUYET_DINH.NGAY_THANG], "dd/MM/yyyy"); } } } } else if (e.Row.RowType == DataControlRowType.DataRow) { if (m_grv.DataKeys[e.Row.RowIndex].Value.ToString().Trim().Equals("")) { e.Row.Font.Bold = true; } e.Row.Cells[1].Width = 200; for (int i = 7; i < e.Row.Controls.Count; i++) { Label v_lbl = new Label(); if (e.Row.Cells[i] == null) return; decimal v_i_so_tien = 0; bool v_b_is_number = decimal.TryParse(e.Row.Cells[i].Text, out v_i_so_tien); if (v_b_is_number) { v_lbl.Text = CIPConvert.ToStr(WebformControls.get_so_tien(e.Row.Cells[i].Text), "#,###,##"); } e.Row.Cells[i].Controls.Add(v_lbl); e.Row.Cells[i].CssClass = "csscurrency"; e.Row.Cells[i].Width = 80; } } } catch (Exception v_e) { CSystemLog_301.ExceptionHandle(this, v_e); } }
private List<decimal> getDanhSachQDGiaoVon() { DateTime v_dat_tu_ngay = CIPConvert.ToDatetime(m_txt_tu_ngay.Text, c_configuration.DEFAULT_DATETIME_FORMAT); DateTime v_dat_den_ngay = CIPConvert.ToDatetime(m_txt_den_ngay.Text, c_configuration.DEFAULT_DATETIME_FORMAT); List<decimal> v_lst = new List<decimal>(); US_DM_QUYET_DINH v_us = new US_DM_QUYET_DINH(); DS_DM_QUYET_DINH v_ds = new DS_DM_QUYET_DINH(); v_us.FillDatasetByLoaiQD(v_ds, v_dat_tu_ngay, v_dat_den_ngay, c_configuration.GIAO_VON, -1); for (int i = 0; i < v_ds.Tables[0].Rows.Count; i++) { v_lst.Add(CIPConvert.ToDecimal(v_ds.Tables[0].Rows[i][DM_QUYET_DINH.ID].ToString())); } return v_lst; }
private void save_data() { if (check_data_is_ok() == false) { return; } try { m_us.BeginTransaction(); #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) == false) { BaseMessages.MsgBox_Infor("File không tồn tại!"); return; } FileExplorer.DeleteFile(m_str_directory_to + m_str_link_old); break; } #endregion #region Xử lý quyết định form_to_us_quyet_dinh(); switch (m_e_quyet_dinh_mode) { case DataEntryFormMode.InsertDataState: if (is_exist_quyet_dinh(m_txt_ma_quyet_dinh.Text)) { BaseMessages.MsgBox_Error("Mã quyết định đã tồn tại."); m_txt_ma_quyet_dinh.Focus(); return; } m_us.Insert(); break; case DataEntryFormMode.UpdateDataState: if (!m_txt_ma_quyet_dinh.Text.Equals(m_str_ma_quyet_dinh_old)) { if (is_exist_quyet_dinh(m_txt_ma_quyet_dinh.Text)) { BaseMessages.MsgBox_Error("Mã quyết định đã tồn tại hoặc đang được dùng cho dự án khác."); m_txt_ma_quyet_dinh.Focus(); return; } } m_us.Update(); break; } #endregion m_us.CommitTransaction(); } catch (Exception) { if (m_us.is_having_transaction()) { m_us.Rollback(); } } form_2_us_nhan_vien(); US_DM_QUYET_DINH v_us_qd = new US_DM_QUYET_DINH(); DS_DM_QUYET_DINH v_ds_qd = new DS_DM_QUYET_DINH(); switch (m_e_form_mode) { case DataEntryFormMode.InsertDataState: // Insert nhân sự chuyen_trang_thai_ve_no(m_us.dcID_NHAN_SU); m_us.strTRANG_THAI_HIEN_TAI = "Y"; // Quyết định if (m_b_check_quyet_dinh_save) { form_to_us_quyet_dinh(); if (m_b_check_quyet_dinh_null) { m_us_quyet_dinh.Insert(); US_DM_QUYET_DINH v_us = new US_DM_QUYET_DINH(); DS_DM_QUYET_DINH v_ds = new DS_DM_QUYET_DINH(); v_us.FillDataset_By_Ma_qd(v_ds, m_us_quyet_dinh.strMA_QUYET_DINH); if (v_ds.DM_QUYET_DINH.Rows.Count != 0) { US_GD_QUYET_DINH_PHAP_NHAN v_us_qd_pn = new US_GD_QUYET_DINH_PHAP_NHAN(); v_us_qd_pn.dcID_PHAP_NHAN = CAppContext_201.getCurrentIDPhapnhan(); v_us_qd_pn.dcID_QUYET_DINH = CIPConvert.ToDecimal(v_ds_qd.Tables[0].Rows[0]["ID"]); v_us_qd_pn.Insert(); } } else { m_us_quyet_dinh.Update(); } v_us_qd.FillDataset_By_Ma_qd(v_ds_qd, m_us_quyet_dinh.strMA_QUYET_DINH); if (v_ds_qd.Tables[0].Rows.Count != 0) { m_us.dcID_QUYET_DINH = CIPConvert.ToDecimal(v_ds_qd.Tables[0].Rows[0]["ID"]); } } m_us.Insert(); break; case DataEntryFormMode.UpdateDataState: if (m_txt_ma_quyet_dinh.Text != "") { form_to_us_quyet_dinh(); if (m_b_check_quyet_dinh_save) { m_us_quyet_dinh.Insert(); } else { m_us_quyet_dinh.Update(); } v_us_qd.FillDataset_By_Ma_qd(v_ds_qd, m_us_quyet_dinh.strMA_QUYET_DINH); if (v_ds_qd.Tables[0].Rows.Count != 0) { m_us.dcID_QUYET_DINH = CIPConvert.ToDecimal(v_ds_qd.Tables[0].Rows[0]["ID"]); } } m_us.Update(); break; } BaseMessages.MsgBox_Infor("Dữ liệu đã được cập nhật"); this.Close(); }
public US_DM_QUYET_DINH() { pm_objDS = new DS_DM_QUYET_DINH(); pm_strTableName = c_TableName; pm_objDR = pm_objDS.Tables[pm_strTableName].NewRow(); }