示例#1
0
 private void btnAddPerson_Click(object sender, EventArgs e)
 {
     if (txtEmployeeNumber.Text == "")
     {
         MsgBoxUtil.MsgInfo("Employee Number Belum Diisi!!");
         return;
     }
     if (txtEmployeeName.Text == "")
     {
         MsgBoxUtil.MsgInfo("Employee Name Belum Diisi!!");
         return;
     }
     if (txtPassword.Text == "")
     {
         MsgBoxUtil.MsgInfo("Password Belum Diisi!!");
         return;
     }
     if (cmbGender.Text == "")
     {
         MsgBoxUtil.MsgInfo("Gender Belum Diisi!!");
         return;
     }
     if (MsgBoxUtil.MsgSave())
     {
         insertPEA();
     }
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (dt.Rows.Count == 0)
            {
                MsgBoxUtil.MsgError("Tidak Ada Data Yang Disimpan!!!");
            }
            else
            {
                try
                {
                    //foreach (DataRow row in dt.Rows)
                    //{

                    //    //delete data lama dlu jika ada
                    //    var sep = row["sep"].ToString();
                    //    string SQLText = "DELETE INACBG_RAW_DATA where sep =  '" + sep + "'";
                    //    clMain.DBConn.GeneralCommand(SQLText, ref xcmd);
                    //    xcmd.ExecuteNonQuery();
                    //}
                    //sqlTrans.Commit();
                    //sqlTrans.Dispose();
                    //sqlTrans = null;

                    deleteTempData();

                    BulkInsertDataTable("INACBG_RAW_DATA_TEMP", dt);

                    deleteSEPOld();


                    bool result = BulkInsertDataTable("INACBG_RAW_DATA", dt);

                    if (result)
                    {
                        MsgBoxUtil.MsgInfo("Save Data Berhasil");
                    }
                    else
                    {
                        MsgBoxUtil.MsgInfo("Data Gagal Disimpan");
                    }
                }
                catch (Exception ex)
                {
                    MsgBoxUtil.MsgError(ex.Message);
                    sqlTrans.Rollback();
                    sqlTrans.Dispose();
                }
            }
        }
        private void setColumnGrid()

        {
            this.GridAttendance.Columns.Add(new GridTextColumn()
            {
                MappingName = "attendance_id", HeaderText = "Attendance", Visible = false, Width = 100
            });
            this.GridAttendance.Columns.Add(new GridTextColumn()
            {
                MappingName = "Employee_Number", HeaderText = "Employee Number", Width = 120, AllowFiltering = true
            });
            this.GridAttendance.Columns.Add(new GridTextColumn()
            {
                MappingName = "Employee_Name", HeaderText = "Name", Width = 250, AllowFiltering = true
            });
            this.GridAttendance.Columns.Add(new GridTextColumn()
            {
                MappingName = "unit_name", HeaderText = "Unit", Width = 250, AllowFiltering = true
            });
            this.GridAttendance.Columns.Add(new GridTextColumn()
            {
                MappingName = "Date_attendance", HeaderText = "Date", Width = 120, AllowFiltering = true, Format = "dd-MM-yyyy"
            });
            this.GridAttendance.Columns.Add(new GridTextColumn()
            {
                MappingName = "Clock_in", HeaderText = "Clock In", Width = 120, AllowFiltering = true
            });
            this.GridAttendance.Columns.Add(new GridTextColumn()
            {
                MappingName = "Clock_out", HeaderText = "Clock Out", Width = 120, AllowFiltering = true
            });
            this.GridAttendance.Columns.Add(new GridTextColumn()
            {
                MappingName = "Duration", HeaderText = "Duration", Width = 120, AllowFiltering = true
            });

            this.GridAttendance.Columns.Add(new GridButtonColumn()
            {
                MappingName            = "Photo",
                HeaderText             = "Detail Photo",
                AllowDefaultButtonText = true,
                DefaultButtonText      = "View Photo",
                Width = 150
            });

            this.GridAttendance.CellButtonClick += GridAttendance_CellButtonClick;


            void GridAttendance_CellButtonClick(object sender, Syncfusion.WinForms.DataGrid.Events.CellButtonClickEventArgs e)
            {
                try
                {
                    var rowData = (e.Record as Syncfusion.WinForms.DataGrid.DataRow).RowData as DataRowView;
                    int id      = (int)rowData["attendance_id"];
                    if (id > 0)
                    {
                        FrmAttendancePhotoInquiry_New frmAttendancePhotoInquiry_new = new FrmAttendancePhotoInquiry_New(id);
                        frmAttendancePhotoInquiry_new.ShowDialog();
                        frmAttendancePhotoInquiry_new.Close();
                    }
                    else
                    {
                        MsgBoxUtil.MsgInfo("Data Absen Tidak Ditemukan");
                    }
                }
                catch (Exception ex)
                {
                    MsgBoxUtil.MsgInfo(ex.Message);
                }
            }
        }
        public void CariPasien(string NoReg)
        {
            string        SQL;
            SqlDataReader ObjReader;
            bool          vAda = true;
            SqlCommand    oCmd = default;

            SQL = SQLCariPasien(NoReg, false);
            if (clMain.DBConn.DBOpenConnection() == 0)
            {
                oCmd = new SqlCommand(SQL, clMain.DBConn.objConnection);
                // oCmd.Connection = clMain.clUtama.objConnection
                oCmd.CommandTimeout = 0;
                ObjReader           = oCmd.ExecuteReader(); // clMain.clUtama.GeneralQuery(SQL)
                oCmd.Dispose();
                if (ObjReader.HasRows)
                {
                    ObjReader.Read();
                    txtNoReg.Text        = ObjReader["vc_no_reg"].ToString();
                    txtNoRM.Text         = ObjReader["vc_no_rm"].ToString();
                    LblNama.Text         = ObjReader["vc_nama_p"].ToString();
                    LblAlamat.Text       = ObjReader["vc_alamat"].ToString();
                    LblKel.Text          = ObjReader["vc_kelurahan"].ToString();
                    LblKec.Text          = ObjReader["vc_kecamatan"].ToString();
                    LblKota.Text         = ObjReader["vc_kota"].ToString();
                    LblTahun.Text        = ObjReader["in_umurth"].ToString() + " Tahun";
                    LblBulan.Text        = ObjReader["in_umurbl"].ToString() + " Bulan";
                    LblHari.Text         = ObjReader["in_umurhr"].ToString() + " Hari";
                    LblJnsKel.Text       = ObjReader["vc_jenis_k"].ToString();
                    LblKelas.Text        = ObjReader["vc_kelas"].ToString();
                    LblKamar.Text        = ObjReader["vc_nama"].ToString();
                    LblKdDr.Text         = ObjReader["vc_nid"].ToString() + "  -" + ObjReader["vc_NAMA_KRY"].ToString();
                    LblRuang.Text        = ObjReader["vc_n_ruang"].ToString();
                    m_TglMasuk           = (DateTime)ObjReader["dt_tgl_msk"];
                    this.dtTglAwal.Value = m_TglMasuk;
                    lblPng.Text          = ObjReader["vc_n_png"].ToString();
                    LblKodePng.Text      = ObjReader["vc_k_png"].ToString();
                    m_KlasTrans          = ObjReader["vc_kd_gsklco"].ToString() + ObjReader["vc_k_kelas"].ToString();
                    if (Information.IsDBNull(ObjReader["bt_hak_akpn"]) == true)
                    {
                        m_Hak_AKPN = false;
                    }
                    else if ((bool)ObjReader["bt_hak_akpn"] == true)
                    {
                        m_Hak_AKPN = true;
                    }
                    else
                    {
                        m_Hak_AKPN = false;
                    }

                    if (Information.IsDBNull(ObjReader["dt_tgl_pul"]))
                    {
                        m_Pulang = false;
                    }
                    else if (ObjReader["dt_tgl_pul"].ToString() != "")
                    {
                        m_Pulang = true;
                    }
                    else
                    {
                        m_Pulang = false;
                    }

                    if (Information.IsDBNull(ObjReader["bt_print_pulang"]) == true)
                    {
                        m_KuitPrinted = false;
                    }
                    else if ((bool)ObjReader["bt_print_pulang"] == true)
                    {
                        m_KuitPrinted = true;
                    }
                    else
                    {
                        m_KuitPrinted = false;
                    }
                    // Mengambil Data Keubayar
                }
                else
                {
                    vAda = false;
                    MsgBoxUtil.MsgInfo("Data pasien tidak ditemukan !");
                }

                ObjReader.Close();
            }

            this.Refresh();
            if (vAda)
            {
                m_Bayar = GetKuitansiBayar(txtNoReg.Text);
                FillGridRincian();
                HitungTotal();
            }
        }