text stringlengths 10 2.72M |
|---|
package com.tencent.mm.plugin.appbrand.ui;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.os.Environment;
import com.tencent.mm.compatible.util.h;
import com.tencent.mm.plugin.appbrand.p;
import com.tencent.mm.plugin.webview.ui.tools.WebViewUI;
import com.tencent.mm.ui.ak;
import java.io.File;
import java.io.FileInputStream;
import java.util.Properties;
public final class AppBrandNearbyWebViewUI extends WebViewUI {
private static Boolean dgC = null;
public final void onCreate(Bundle bundle) {
if (getIntent() != null) {
getIntent().putExtra("forceHideShare", true);
getIntent().putExtra("disable_bounce_scroll", true);
getIntent().putExtra("show_long_click_popup_menu", false);
getIntent().putExtra("key_load_js_without_delay", true);
}
super.onCreate(bundle);
setResult(-1);
}
public final void setMMTitle(String str) {
super.setMMTitle(str);
nS(-16777216);
}
protected final void initView() {
super.initView();
}
protected final void ant() {
super.ant();
lF(-855310);
}
protected final int anu() {
if (VERSION.SDK_INT >= 23 && (!h.Ae() || !Af())) {
ak.g(getWindow());
return -855310;
} else if (VERSION.SDK_INT >= 21) {
return p.feh;
} else {
return super.anu();
}
}
public static boolean Af() {
Throwable th;
FileInputStream fileInputStream;
if (dgC == null) {
FileInputStream fileInputStream2;
try {
fileInputStream2 = new FileInputStream(new File(Environment.getRootDirectory(), "build.prop"));
try {
Properties properties = new Properties();
properties.load(fileInputStream2);
dgC = Boolean.valueOf(properties.getProperty("ro.miui.ui.version.name", "").contains("V8"));
try {
fileInputStream2.close();
} catch (Exception e) {
}
} catch (Exception e2) {
try {
dgC = Boolean.valueOf(false);
if (fileInputStream2 != null) {
try {
fileInputStream2.close();
} catch (Exception e3) {
}
}
return dgC.booleanValue();
} catch (Throwable th2) {
th = th2;
fileInputStream = fileInputStream2;
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (Exception e4) {
}
}
throw th;
}
}
} catch (Exception e5) {
fileInputStream2 = null;
dgC = Boolean.valueOf(false);
if (fileInputStream2 != null) {
try {
fileInputStream2.close();
} catch (Exception e32) {
}
}
return dgC.booleanValue();
} catch (Throwable th3) {
th = th3;
fileInputStream = null;
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (Exception e42) {
}
}
throw th;
}
}
return dgC.booleanValue();
}
protected final boolean anv() {
return true;
}
}
|
package com.e6soft.bpm.model;
import java.io.Serializable;
import com.e6soft.core.model.Model;
public class FlownodeAction implements Serializable,Model<String> {
private static final long serialVersionUID = 1L;
private String id;
private Integer actionPosition;
private Integer synType;
private String nodeId;
private Integer actionStatus;
private String actionId;
public void setId (String id){
this.id = id;
}
public void setActionPosition (Integer actionPosition){
this.actionPosition = actionPosition;
}
public void setSynType (Integer synType){
this.synType = synType;
}
public void setNodeId (String nodeId){
this.nodeId = nodeId;
}
public void setActionStatus (Integer actionStatus){
this.actionStatus = actionStatus;
}
public void setActionId (String actionId){
this.actionId = actionId;
}
public String getId (){
return this.id;
}
public Integer getActionPosition (){
return this.actionPosition;
}
public Integer getSynType (){
return this.synType;
}
public String getNodeId (){
return this.nodeId;
}
public Integer getActionStatus (){
return this.actionStatus;
}
public String getActionId (){
return this.actionId;
}
}
|
package com.zznode.opentnms.isearch.model.bo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ConstBusiness {
//客户层速率对应表
public static Map<Integer,Integer> rateMap = new HashMap<Integer,Integer>();
//oduk速率对应表
public static Map<Integer,Integer> odukMap = new HashMap<Integer,Integer>();
//客户层速率对应描述
public static Map<Integer,String> rateDescMap = new HashMap<Integer,String>();
public static Map<String,Class<? extends ODU>> odumap = new HashMap<String,Class<? extends ODU>>();
public static Set<String> passedProtectedCardSet = new HashSet<String>();
public static List<Integer> odu0rateList = new ArrayList<Integer>();
public static List<Integer> odu1rateList = new ArrayList<Integer>();
public static List<Integer> odu2rateList = new ArrayList<Integer>();
public static List<Integer> odu3rateList = new ArrayList<Integer>();
public static List<Integer> odu4rateList = new ArrayList<Integer>();
public static List<Integer> ochrateList = new ArrayList<Integer>();
public static String routeType_zl = "5";
public static String routeType_zxl = "4";
public static String routeType_xl = "3";
public static String routeType_other = "0";
public static String routeType_zxlwl = "1";
static{
rateMap.put(50, 0);
rateMap.put(65, 0);
rateMap.put(73, 0);
rateMap.put(74, 0);
rateMap.put(75, 0);
rateMap.put(87, 0);
rateMap.put(97, 0);
rateMap.put(89, 0);
rateMap.put(8005, 0);
rateMap.put(8021, 0);
rateMap.put(8022, 0);
rateMap.put(76, 2); //2.5G
rateMap.put(77, 3); //10G
rateMap.put(113, 3);//10G
rateMap.put(8008, 3);//10G
rateMap.put(8009, 3);//10G
rateMap.put(78, 4);//40G
rateMap.put(115, 4);//40G
rateMap.put(8043, 5);//100G
odukMap.put(8031, 1);//odu0
odukMap.put(10105, 1);//odu0
odukMap.put(104, 2);//odu1
odukMap.put(107, 2);//otu1
odukMap.put(105, 3);//odu2
odukMap.put(108, 3);//otu2
odukMap.put(106, 4);//odu3
odukMap.put(109, 4);//otu3
odukMap.put(8041, 5);//odu4
odukMap.put(8042, 5);//otu4
odukMap.put(40, 6);//och
rateDescMap.put(50, "GE");
rateDescMap.put(65, "GE");
rateDescMap.put(73, "155M");
rateDescMap.put(74, "622M");
rateDescMap.put(75, "1.25G");
rateDescMap.put(87, "GE");
rateDescMap.put(97, "FE");
rateDescMap.put(89, "1.25G");
rateDescMap.put(8005, "");
rateDescMap.put(8021, "");
rateDescMap.put(8022, "");
rateDescMap.put(76, "2.5G"); //2.5G
rateDescMap.put(77, "10G"); //10G
rateDescMap.put(113, "10GE");
rateDescMap.put(8008,"10GE");
rateDescMap.put(8009,"10GE");
rateDescMap.put(78, "40G");//40G
rateDescMap.put(115, "40GE");
rateDescMap.put(8043, "100G");//100G
odu0rateList.add(8031); // LR_OCH_Data_Unit_0
odu0rateList.add(10105); // LR_OCH_Data_Unit_0
odu1rateList.add(104); // LR_OCH_Data_Unit_1
odu1rateList.add(107); // LR_OCH_Data_Unit_1
odu2rateList.add(105); // LR_OCH_Data_Unit_2
odu2rateList.add(108); // LR_OCH_Data_Unit_2
odu3rateList.add(106); // LR_OCH_Data_Unit_3
odu3rateList.add(109); // LR_OCH_Data_Unit_3
odu4rateList.add(8041);
odu4rateList.add(8042);
ochrateList.add(40);
/**
odumap.put("/dsr=1", DSR_1.class);
odumap.put("/dsr=2", DSR_2.class);
odumap.put("/odu0=1", ODU0_1.class);
odumap.put("/odu0=2", ODU0_2.class);
odumap.put("/odu1=1", ODU1_1.class);
odumap.put("/odu1=2", ODU1_2.class);
odumap.put("/odu1=3", ODU1_3.class);
odumap.put("/odu1=4", ODU1_4.class);
odumap.put("/odu2=1", ODU2_1.class);
odumap.put("/och=1/odu3=1/odu2=1", ODU2_1.class);
odumap.put("/odu2=2", ODU2_2.class);
odumap.put("/och=1/odu3=1/odu2=2", ODU2_2.class);
odumap.put("/odu2=3", ODU2_3.class);
odumap.put("/och=1/odu3=1/odu2=3", ODU2_3.class);
odumap.put("/odu2=4", ODU2_4.class);
odumap.put("/och=1/odu3=1/odu2=4", ODU2_4.class);
odumap.put("/odu3=1", ODU3_1.class);
odumap.put("/och=1/otu3=1", ODU3_1.class);
odumap.put("/odu3=2", ODU3_2.class);
odumap.put("/och=1/otu3=2", ODU3_2.class);
*/
passedProtectedCardSet.add("DCP");
passedProtectedCardSet.add("12DCP");
}
public static ODU getOduByCtp( String ctp ){
Pattern p = null ;
Matcher m = null ;
p = Pattern.compile(".*/dsr=(\\d*)", Pattern.CASE_INSENSITIVE);
m = p.matcher(ctp);
if( m.matches() ){
DSR dsr = new DSR();
dsr.setIndex(Integer.valueOf(m.group(1)));
return dsr ;
}
p = Pattern.compile(".*/odu0=(\\d*)", Pattern.CASE_INSENSITIVE);
m = p.matcher(ctp);
if( m.matches() ){
ODU0 odu0 = new ODU0();
odu0.setIndex(Integer.valueOf(m.group(1)));
return odu0 ;
}
p = Pattern.compile(".*/odu1=(\\d*)", Pattern.CASE_INSENSITIVE);
m = p.matcher(ctp);
if( m.matches() ){
ODU1 odu1 = new ODU1();
//特殊处理/odu1=1015这种情况
int index = Integer.valueOf(m.group(1)).intValue();
if( index > 1000 ){
index = index - 1000;
}
odu1.setIndex( index );
return odu1 ;
}
p = Pattern.compile(".*/o[dt]u2=(\\d*)", Pattern.CASE_INSENSITIVE);
m = p.matcher(ctp);
if( m.matches() ){
ODU2 odu2 = new ODU2();
odu2.setIndex(Integer.valueOf(m.group(1)));
return odu2 ;
}
p = Pattern.compile(".*/o[dt]u3=(\\d*)", Pattern.CASE_INSENSITIVE);
m = p.matcher(ctp);
if( m.matches() ){
ODU3 odu3 = new ODU3();
odu3.setIndex(Integer.valueOf(m.group(1)));
return odu3 ;
}
p = Pattern.compile(".*/o[dt]u4=(\\d*)", Pattern.CASE_INSENSITIVE);
m = p.matcher(ctp);
if( m.matches() ){
ODU4 odu4 = new ODU4();
odu4.setIndex(Integer.valueOf(m.group(1)));
return odu4 ;
}
p = Pattern.compile(".*/och=(\\d*)", Pattern.CASE_INSENSITIVE);
m = p.matcher(ctp);
if( m.matches() ){
OCH och = new OCH();
och.setIndex(Integer.valueOf(m.group(1)));
return och ;
}
return null ;
}
public static void main(String[] args) {
Pattern p = Pattern.compile(".*/o[dt]u2=(\\d*)", Pattern.CASE_INSENSITIVE);
String ww = "/frequency=195.850/odu2=1/10ge=1";
Matcher m = p.matcher(ww);
if( m.matches() ){
System.out.println( m.group(1) );
}
}
}
|
package leetcode;
import java.util.ArrayList;
/**
* @Author: Mr.M
* @Date: 2019-03-28 20:08
* @Description:
**/
public class T933最近的请求次数 {
static ArrayList<Integer> arraylist = new ArrayList<>();
public static int ping(int t) {
int num = 0;
// int l = arraylist.size();
for (int i = 0; i <arraylist.size(); i++) {
if (arraylist.get(i) >= t - 3000) {
num++;
} else {
arraylist.remove(i);
// i=0;
i=-1;
}
}
arraylist.add(t);
return num + 1;
}
public static void main(String[] args) {
System.out.println(ping(1178));
System.out.println(ping(1483));
System.out.println(ping(1563));
System.out.println(ping(4054));
System.out.println(ping(4152));
}
}
|
package com.cucumber.Runner;
import org.junit.runner.RunWith;
import com.github.mkolisnyk.cucumber.runner.ExtendedCucumberOptions;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(features = "@Reports1/FailedScenario.txt", glue = {"com\\cumber\\StepDefinition","hooks"}, monochrome = true, dryRun = false, strict = true,
plugin={"json:Reportjson/reports.json","com.cucumber.listener.ExtentCucumberFormatter:Reports/CucumberReports.html","rerun:Reports1/FailedScenario.txt"})
public class TestRunner {
} |
package com.mxfit.mentix.menu3.Utils;
import com.mxfit.mentix.menu3.MainActivity;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import static com.mxfit.mentix.menu3.GlobalValues.*;
public class SaveFileCalendar {
private Calendar c;
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
private Date currentDate;
final MainActivity activity = MainActivity.instance;
public SaveFileCalendar(){
c = Calendar.getInstance();
}
private String convertToString(int days)
{
currentDate = new Date();
c.setTime(currentDate);
c.add(Calendar.DATE, days);
return sdf.format(c.getTime());
}
public void setPushupsDate()
{
if(PUdateCount < 3)
{
lastPushupDate = convertToString(2);
PUdateCount++;
} else {
lastPushupDate = convertToString(3);
PUdateCount = 0;
}
}
public void setSitupsDate()
{
if(SUdateCount < 3)
{
lastSitupDate = convertToString(2);
SUdateCount++;
} else {
lastSitupDate = convertToString(3);
SUdateCount = 0;
}
}
public Date WhichDateFirst(ArrayList<String> date){
if(date.size() == 0) return null;
Date [] dates = new Date[date.size()];
for(int i = 0; i<date.size(); i++)
dates[i] = toDate(date.get(i));
Arrays.sort(dates);
return dates[0];
}
public void setDayDate(boolean wasPushups)
{
if(PUdateCount < 4)
{
if(wasPushups)
{
lastRunDate = convertToString(1);
if(PUdateCount != 3)
{
lastPushupDate = convertToString(2);
} else {
lastPushupDate = convertToString(3);
}
} else {
lastPushupDate = convertToString(1);
if(PUdateCount != 3)
{
lastRunDate = convertToString(2);
} else {
lastRunDate = convertToString(3);
}
}
PUdateCount++;
} else {
if(wasPushups)
{
lastRunDate = convertToString(2);
lastPushupDate = convertToString(3);
} else {
lastRunDate = convertToString(3);
lastPushupDate = convertToString(2);
}
PUdateCount = 0;
}
}
public void checkDayDate()
{
if(lastPushupDate != null && lastRunDate != null) {
Date date1 = toDate(lastPushupDate);
Date date2 = toDate(lastRunDate);
Date date3 = toDate(getToday());
boolean firstPushups = false;
if (date1.before(date2)) {
firstPushups = true;
}
if(firstPushups && date1.before(date3))
{
lastPushupDate = convertToString(date3);
lastRunDate = convertToString(1);
} else if (!firstPushups && date2.before(date3))
{
lastRunDate = convertToString(date3);
lastPushupDate = convertToString(1);
}
}
}
public void checkPushupsDate()
{
if(lastPushupDate != null) {
Date date1 = toDate(lastPushupDate);
Date date2 = toDate(getToday());
if (date1.before(date2)) {
lastPushupDate = convertToString(date2);
}
}
}
public void setRunningDate()
{
if(RdateCount < 3)
{
lastRunDate = convertToString(2);
RdateCount++;
} else {
lastRunDate = convertToString(3);
RdateCount = 0;
}
}
public void checkRunningDate()
{
if(lastRunDate != null) {
Date date1 = toDate(lastRunDate);
Date date2 = toDate(getToday());
if (date1.before(date2)) {
lastRunDate = convertToString(date2);
}
}
}
private String convertToString(Date date)
{
currentDate = date;
c.setTime(currentDate);
return sdf.format(c.getTime());
}
private String getToday()
{
currentDate = new Date();
return sdf.format(currentDate);
}
private Date toDate(String Date)
{
try{
c.setTime(sdf.parse(Date));
}catch(ParseException e){
e.printStackTrace();
}
return c.getTime();
}
}
|
package br.com.beblue.lojadisco.entidade;
import javax.persistence.*;
import java.math.BigDecimal;
import java.util.List;
@Entity
@SequenceGenerator(name = "SEQUENCE_ENTITY", sequenceName = "DISCO_SEQ", allocationSize = 1)
public class Disco extends EntidadeAbstrata{
@Column(name = "SPOTIFY_ID")
private String spotifyID;
@Column
private String nome;
@Column(name = "DT_LANCAMENTO")
private String dataLancamento;
@Column(name = "PRECISAO_DT_LANC")
private String precisaoDataLancamento;
@Column(name = "TOTAL_FAIXAS")
private Integer totalFaixas;
@Column
private BigDecimal valor;
@Column(name = "URL_IMAGEM")
private String urlImagem;
@ManyToMany
@JoinTable(name = "GENERO_DISCO", joinColumns = {@JoinColumn(name = "DISCO_ID")},
inverseJoinColumns = {@JoinColumn(name = "GENERO_ID")})
private List<Genero> generos;
@ManyToMany
@JoinTable(name = "ARTISTA_DISCO", joinColumns = {@JoinColumn(name = "DISCO_ID")},
inverseJoinColumns = {@JoinColumn(name = "ARTISTA_ID")})
private List<Artista> artistas;
public String getSpotifyID() {
return spotifyID;
}
public void setSpotifyID(String spotifyID) {
this.spotifyID = spotifyID;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getDataLancamento() {
return dataLancamento;
}
public void setDataLancamento(String dataLancamento) {
this.dataLancamento = dataLancamento;
}
public String getPrecisaoDataLancamento() {
return precisaoDataLancamento;
}
public void setPrecisaoDataLancamento(String precisaoDataLancamento) {
this.precisaoDataLancamento = precisaoDataLancamento;
}
public Integer getTotalFaixas() {
return totalFaixas;
}
public void setTotalFaixas(Integer totalFaixas) {
this.totalFaixas = totalFaixas;
}
public BigDecimal getValor() {
return valor;
}
public void setValor(BigDecimal valor) {
this.valor = valor;
}
public String getUrlImagem() {
return urlImagem;
}
public void setUrlImagem(String urlImagem) {
this.urlImagem = urlImagem;
}
public List<Genero> getGeneros() {
return generos;
}
public void setGeneros(List<Genero> generos) {
this.generos = generos;
}
public List<Artista> getArtistas() {
return artistas;
}
public void setArtistas(List<Artista> artistas) {
this.artistas = artistas;
}
}
|
package com.tencent.mm.plugin.subapp.ui.voicetranstext;
import com.tencent.mm.g.a.kg;
import com.tencent.mm.sdk.b.b;
import com.tencent.mm.sdk.b.c;
import com.tencent.mm.sdk.platformtools.ag;
import com.tencent.mm.sdk.platformtools.x;
class VoiceTransTextUI$5 extends c<kg> {
final /* synthetic */ VoiceTransTextUI ouz;
VoiceTransTextUI$5(VoiceTransTextUI voiceTransTextUI) {
this.ouz = voiceTransTextUI;
this.sFo = kg.class.getName().hashCode();
}
public final /* synthetic */ boolean a(b bVar) {
kg kgVar = (kg) bVar;
x.i("MicroMsg.VoiceTransTextUI", "receive notify, process----> may be pass.");
if (VoiceTransTextUI.n(this.ouz) != null && !VoiceTransTextUI.m(this.ouz) && (kgVar instanceof kg) && kgVar.bUD.bUE == VoiceTransTextUI.n(this.ouz).oug) {
x.i("MicroMsg.VoiceTransTextUI", "");
if (VoiceTransTextUI.o(this.ouz)) {
x.i("MicroMsg.VoiceTransTextUI", "has new result! but need wait. so, wait.");
VoiceTransTextUI.p(this.ouz);
} else {
new ag(this.ouz.getMainLooper()).post(new 1(this));
}
}
return false;
}
}
|
package com.cinema_ticketing_sys.bought_seat.controller;
import com.cinema_ticketing_sys.bought_seat.entity.BoughtSeat;
import com.cinema_ticketing_sys.bought_seat.service.BoughtSeatService;
import com.cinema_ticketing_sys.movie.entity.Movie;
import com.cinema_ticketing_sys.movie_cutting.entity.MovieCutting;
import com.cinema_ticketing_sys.movie_cutting.service.MovieCuttingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
/**
* Created by huitianrui on 2017/5/29.
*/
@Controller
@RequestMapping("/cuttings")
@Transactional
public class BoughtSeatController {
@Autowired
private BoughtSeatService boughtSeatService;
@Autowired
private MovieCuttingService movieCuttingService;
@RequestMapping(value = "/{cuttingId}/order")
public String saveBoughtSeat(@PathVariable String cuttingId, HttpServletRequest request,
ModelMap modelMap) {
String rows = request.getParameter("rows");
String cols = request.getParameter("cols");
String tickets = request.getParameter("tickets");
String[] rows_para = rows.split(",");
String[] cols_para = cols.split(",");
List<BoughtSeat> boughtSeats = new ArrayList<>();
for (int i = 0; i < rows_para.length; i++) {
MovieCutting movieCutting = movieCuttingService.findCuttingById(Integer.parseInt(cuttingId));
BoughtSeat boughtSeat = new BoughtSeat();
int seatId = (Integer.parseInt(rows_para[i]) - 1) * 10 + Integer.parseInt(cols_para[i]);
int row = Integer.parseInt(rows_para[i]);
int col = Integer.parseInt(cols_para[i]);
boughtSeat.setRow(row);
boughtSeat.setCol(col);
boughtSeats.add(boughtSeat);
boughtSeatService.createNewBoughtSeat(seatId, row, col, movieCutting);
}
MovieCutting updatedMovieCutting = movieCuttingService.findCuttingById(Integer.parseInt(cuttingId));
Movie movie = updatedMovieCutting.getMovie();
modelMap.addAttribute("movie", movie);
modelMap.addAttribute("cutting", updatedMovieCutting);
modelMap.addAttribute("tickets", tickets);
double totalPrice = Integer.parseInt(tickets) * movie.getPrice();
modelMap.addAttribute("totalPrice", totalPrice);
modelMap.addAttribute("seats", boughtSeats);
return "orderDetails";
}
}
|
package LC200_400.LC250_300;
public class LC275_H_Index2 {
public int hIndex(int[] citations) {
return -1;
}
}
|
package com.hallauniv.parse.Town;
import java.util.ArrayList;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
import com.hallauniv.parse.Town.DataGetterSettersTown.menu;
import com.hallauniv.parse.Town.DataGetterSettersTown.townData;
import com.hallauniv.parse.Town.DataGetterSettersTown.values;
public class DataHandlerTown extends DefaultHandler {
private ArrayList<Object> dataList;
private DataGetterSettersTown data = null;
private townData tdata=null;
private menu mdata=null;
private ArrayList<values> fdatalist;
private values fdata=null;
public ArrayList<Object> getData()
{
return dataList;
}
boolean bStart = false;
boolean bName = false;
boolean bPhone = false;
boolean bAddress = false;
boolean bMenu = false;
boolean bType = false;
boolean bValues = false;
boolean bFoods = false;
boolean bFoodName = false;
boolean bPrice = false;
boolean bTime = false;
@Override
public void startDocument() throws SAXException {
dataList = new ArrayList<Object>();
}
@Override
public void endDocument() throws SAXException {
// Nothing to do
}
public void startElement(String uri, String localName, String qName,
Attributes attributes) throws SAXException {
if(qName.equalsIgnoreCase("foodarray")){
bStart = true;
}
if(qName.equalsIgnoreCase("food")){ //food class 로 xml문서가 시작된다.
data = new DataGetterSettersTown();
}
if(bStart){ //문서가 진행되고 있다면 아래로 진행된다.
if(qName.equalsIgnoreCase("name")){
bName=true;
}
if(qName.equalsIgnoreCase("phone")){
bPhone = true;
}
if(qName.equalsIgnoreCase("address")){
tdata=data.new townData();
bAddress =true;
}
if(qName.equalsIgnoreCase("menu")){
mdata=data.new menu();
bMenu = true;
}
if(bMenu){
if(qName.equalsIgnoreCase("type")){
bType = true;
}
if(qName.equalsIgnoreCase("foods")){
fdatalist=new ArrayList<values>();
bFoods = true;
}
if(qName.equalsIgnoreCase("values")){
fdata=data.new values();
bValues = true;
}
if(bValues){
if(qName.equalsIgnoreCase("foodname")){
bFoodName = true;
}
if(qName.equalsIgnoreCase("price")){
bPrice = true;
}
}
}
if(qName.equalsIgnoreCase("time")){
bTime = true;
}
}
}
/**
* This will be called when the tags of the XML end.
**/
@Override
public void endElement(String uri, String localName, String qName)
throws SAXException {
if(qName.equalsIgnoreCase("foodarray")){
bStart = false;
}
if(bStart){
if(qName.equalsIgnoreCase("food")){ // /food로 문서가 끝난다.
dataList.add((DataGetterSettersTown)data); //데이터를 리스트에 추가해준다.
}
if(qName.equalsIgnoreCase("foods")){
mdata.foodvalues=fdatalist;
tdata.mMenu=mdata;
bFoods = false;
}
if(qName.equalsIgnoreCase("values"))
{
if(bFoods){
fdatalist.add(fdata);
bValues = false;
}
}
if(qName.equalsIgnoreCase("menu")){
bMenu = false;
}
if(qName.equalsIgnoreCase("time"))
{
data.setData(tdata);
bTime=false;
}
}
}
/**
* This is called to get the tags value
**/
@Override
public void characters(char[] ch, int start, int length)
throws SAXException {
String str=(new String(ch,start,length));
if(bName){
data.setName(str);
bName=false;
}
if(bPhone){
data.setPhone(str);
bPhone=false;
}
if(bAddress){
tdata.mAddress=str;
bAddress=false;
}
if(bType){
mdata.type=str;
bType=false;
}
if(bFoodName){
fdata.foodname=str;
bFoodName=false;
}
if(bPrice){
fdata.price=str;
bPrice=false;
}
if(bTime){
tdata.mTime=str;
}
}
}
|
package iaas.uni.stuttgart.de.srs.data;
import iaas.uni.stuttgart.de.srs.model.ObservedObject;
import iaas.uni.stuttgart.de.srs.model.Situation;
import iaas.uni.stuttgart.de.srs.model.Subscription;
import java.util.List;
/**
* @author Kalman Kepes - kepeskn@studi.informatik.uni-stuttgart.de
*
*/
public class MainResourceDAO {
private final List<ObservedObject> objs;
private final List<Situation> sits;
private final List<Subscription> subs;
public MainResourceDAO() {
this.objs = ObservedObjectDataSource.getInstance().objects;
this.sits = SituationDataSource.getInstance().situations;
this.subs = SubscriptionsSingleton.getInstance().subscriptions;
}
public List<ObservedObject> getObjs() {
return objs;
}
public List<Situation> getSits() {
return sits;
}
public List<Subscription> getSubs() {
return subs;
}
}
|
package com.supconit.kqfx.web.service.time;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.tempuri.dag_xsd.Service_wsdl.ServiceLocator;
import org.tempuri.dag_xsd.Service_wsdl.ServiceStub;
import com.supconit.kqfx.web.fxzf.avro.redis_ConfigInfo;
import com.supconit.kqfx.web.fxzf.avro.redis.WriteRedisService;
import com.supconit.kqfx.web.fxzf.warn.daos.ConfigDao;
import com.supconit.kqfx.web.fxzf.warn.entities.Config;
import com.supconit.kqfx.web.util.SysConstants;
import com.supconit.kqfx.web.util.XmlAnalysisUtil;
/**
* 定时请求webservice来获取对应的时间信息
* @author dell
*
*/
@Component("TIME_WEB_SERVICE")
public class TimeWebServiceImpl {
private static final Logger logger = LoggerFactory
.getLogger(TimeWebServiceImpl.class);
@Autowired
private WriteRedisService writeRedisService;
@Autowired
private ConfigDao configDao;
@Value("${WebService.time}")
private String url;
public void synSystemTime(){
try {
String key = SysConstants.PARAMETER1;
String time = url;
ServiceLocator serviceLocator = new ServiceLocator();
java.net.URL wsdl= new java.net.URL(url);
ServiceStub serviceStub = new ServiceStub(wsdl,serviceLocator);
/**
* 调用webservice的接口
*/
String xmlResult = serviceStub.synTime();
time = XmlAnalysisUtil.getMesssage(xmlResult);
String flag = XmlAnalysisUtil.getCode(xmlResult);
//<!—CODE为非0时,MESSAGE 字段为失败的原因,CODE为0时为空-->
if(flag.equals("0")){
time = XmlAnalysisUtil.getTime(xmlResult);
logger.info("===接口获取的时间:"+time+"===");
writeRedisService.writeSynTime(key, time+"000");
Config config=configDao.getByCode(SysConstants.DOWN_FLOW);
redis_ConfigInfo configInfo = new redis_ConfigInfo();
if(config!=null){
configInfo.setDOWNFLOW(String.valueOf(100-config.getValue()));
}
configInfo.setSSystemtime(time+"000");
configInfo.setParameter2("0");
configInfo.setParameter3("0");
configInfo.setParameter4("0");
configInfo.setParameter5("0");
writeRedisService.WriteKeyToRedis(SysConstants.SYSTEM_PARAMETER,configInfo );
logger.info("-----------同步时间接口调用成功--------------");
}else{
logger.info("-----------同步时间接口调用失败--------------");
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
|
package gr.athena.innovation.fagi.model;
import gr.athena.innovation.fagi.specification.SpecificationConstants;
import java.util.Objects;
/**
* Class representing a link between two terms of a corresponding pair of literals, along with their weight.
*
* @author nkarag
*/
public class CommonSpecialTerm {
private String term;
private final double weight = SpecificationConstants.Evaluation.COMMON_SPECIAL_TERM_WEIGHT;
@Override
public int hashCode() {
int hash = 7;
hash = 97 * hash + Objects.hashCode(this.term);
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final CommonSpecialTerm other = (CommonSpecialTerm) obj;
if (!Objects.equals(this.term, other.term)) {
return false;
}
return true;
}
/**
* Return the current term.
*
* @return the term.
*/
public String getTerm() {
return term;
}
/**
* Set the term.
*
* @param term the term.
*/
public void setTerm(String term) {
this.term = term;
}
/**
* Return the weight value.
*
* @return the weight.
*/
public double getWeight() {
return weight;
}
}
|
package com.tunisiana.tutorials.dao;
import java.io.Serializable;
import java.util.List;
/**
* Interface containing all the reusable Dao methods
*
* @author oussama.zoghlami.ext
*
* @param <T>
* @param <Id>
*/
public interface GenericDao<T, Id extends Serializable> {
/**
* Get an entity by its id
*
* @param id
* @return
*/
public T getById(Id id);
/**
* get all a class entities
*
* @return
*/
public List<T> getAll();
/**
* save an entity
*
* @param entity
*/
public void save(T entity);
/**
* update an entity
*
* @param entity
*/
public void update(T entity);
/**
* save/update an entity
*
* @param entity
* @return
*/
public T saveOrUpdate(T entity);
/**
* delete an entity
*
* @param entity
*/
public void delete(T entity);
/**
* delete an entity by its id
*
* @param id
*/
public void deleteById(Id id);
/**
* load a class entities located between a given start and end rows
*
* @param startRow
* @param maxRows
* @return
*/
public List<T> getByRows(int startRow, int maxRows);
/**
* get the total number of a class entities
*
* @return
*/
public int getTotalRows();
} |
package de.zarncke.lib.lang;
/**
* A processor of elements.
*/
public abstract class ObjectProcessor implements Processor
{
public ObjectProcessor()
{
}
public void process(Object element, Object state)
{
}
}
|
package br.com.alcoolgasolina;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
private EditText precoAlcool;
private EditText precoGasolina;
private Button btnCalcular;
private TextView resultado;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//recuperar dos itens
precoAlcool = (EditText) findViewById(R.id.edPrecoAlcool);
precoGasolina = (EditText) findViewById(R.id.edPrecoGasolina);
btnCalcular = (Button) findViewById(R.id.button);
resultado = (TextView) findViewById(R.id.tvResultado);
btnCalcular.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String txtPrecoAlcool = precoAlcool.getText().toString();
String txtPrecoGasoina = precoGasolina.getText().toString();
//conversão para numeros
Double valorAlcool = Double.parseDouble(txtPrecoAlcool);
Double valorGasolina = Double.parseDouble(txtPrecoGasoina);
double res = valorAlcool / valorGasolina;
if (res <= 0.7){
resultado.setText("É melhor usar o alcool");
}else{
resultado.setText("É melhor usar Gasolina");
}
}
});
}
}
|
package factory.design.pattern.example;
import java.util.ArrayList;
import java.util.Date;
public class TravelFacade
{
private HotelBooker bookHotel;
private FlightBooker bookFlight;
TravelFacade(){
this.bookHotel=new HotelBooker();
this.bookFlight=new FlightBooker();
}
public ArrayList<String> getFlightsAndHotels(String source,String destination,Date date)
{
System.out.println("Searching Flights from "+source+ " to "+destination+" on "+date );
ArrayList<Flight> flights = bookFlight.getFlights(source,destination,date);
System.out.println("Searching Hotels availability in "+destination+" on "+date);
ArrayList<Hotel> hotels = bookHotel.getHotelNames(destination,date);
//process and return
return null;
}
}
|
package polydungeons.entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.ai.goal.LookAroundGoal;
import net.minecraft.entity.ai.goal.LookAtEntityGoal;
import net.minecraft.entity.ai.goal.WanderAroundFarGoal;
import net.minecraft.entity.attribute.DefaultAttributeContainer;
import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.entity.boss.BossBar;
import net.minecraft.entity.boss.ServerBossBar;
import net.minecraft.entity.mob.HostileEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.world.World;
public class BiglinEntity extends HostileEntity {
private final ServerBossBar bossBar;
protected BiglinEntity(EntityType<? extends HostileEntity> entityType, World world) {
super(entityType, world);
this.setHealth(this.getMaxHealth());
this.getNavigation().setCanSwim(true);
this.bossBar = (ServerBossBar)(new ServerBossBar(
this.getDisplayName(),
BossBar.Color.PURPLE,
BossBar.Style.PROGRESS)
).setThickenFog(true);
}
public static DefaultAttributeContainer.Builder createBiglinAttributes() {
return HostileEntity.createHostileAttributes()
.add(EntityAttributes.GENERIC_MAX_HEALTH, 100.0d)
.add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0.5d)
.add(EntityAttributes.GENERIC_FOLLOW_RANGE, 32.0d)
;
}
@Override
protected void initGoals() {
this.goalSelector.add(5, new LookAtEntityGoal(this, PlayerEntity.class, 16.0f));
this.goalSelector.add(6, new WanderAroundFarGoal(this, 1.0d));
this.goalSelector.add(7, new LookAroundGoal(this));
}
@Override
protected void initDataTracker() {
super.initDataTracker();
}
}
|
package com.base;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.ApplicationPidFileWriter;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
import nz.net.ultraq.thymeleaf.LayoutDialect;
import nz.net.ultraq.thymeleaf.decorators.strategies.GroupingStrategy;
/**
* Hello world!
*
*/
@SpringBootApplication
@EnableScheduling
public class StartCRMApp
{
public static void main( String[] args )
{
//SpringApplication.run(StartCRMApp.class,args);
SpringApplication app = new SpringApplication(StartCRMApp.class);
app.addListeners(new ApplicationPidFileWriter());
app.run(args);
}
@Bean
public LayoutDialect layoutDialect() {
return new LayoutDialect(new GroupingStrategy());
}
}
|
package string;
import org.junit.Test;
/**
* @Author: MLY
* @Description:
* @Date: Created in 10:35 2020/2/24
* @Modified By:
*/
//给定两个字符串形式的非负整数 num1 和num2 ,计算它们的和。
//
// 注意:
//
//
// num1 和num2 的长度都小于 5100.
// num1 和num2 都只包含数字 0-9.
// num1 和num2 都不包含任何前导零。
// 你不能使用任何內建 BigInteger 库, 也不能直接将输入的字符串转换为整数形式。
//
// Related Topics 字符串
public class LC415_AddString {
public String addStrings(String num1, String num2) {
StringBuilder ret = new StringBuilder("");
int i = num1.length() - 1, j = num2.length() - 1, carry = 0;
while (i >= 0 || j >= 0) {
int n1 = i >= 0 ? num1.charAt(i) - '0' : 0;
int n2 = j >= 0 ? num2.charAt(j) - '0' : 0;
int tmp = n1 + n2 + carry;
carry = tmp / 10;
ret.append(tmp % 10);
i--;
j--;
}
if (carry == 1) ret.append(1);
return ret.reverse().toString();
}
@Test
public void testAddString() {
System.out.println(addStrings("347", "658"));
}
}
|
package wzd.pageModel.pi;
public class TurnkeyOrder {
private int id;
private int seqId;
private String fids;
private String ipn;
private String tpn;
private String status;
private String serialNumber;
private String createdUserName;
private String lid;
private String fabSite;
private int page;
private int rows;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public int getRows() {
return rows;
}
public void setRows(int rows) {
this.rows = rows;
}
public String getSerialNumber() {
return serialNumber;
}
public void setSerialNumber(String serialNumber) {
this.serialNumber = serialNumber;
}
public int getSeqId() {
return seqId;
}
public void setSeqId(int seqId) {
this.seqId = seqId;
}
public String getIpn() {
return ipn;
}
public void setIpn(String ipn) {
this.ipn = ipn;
}
public String getFids() {
return fids;
}
public void setFids(String fids) {
this.fids = fids;
}
public String getLid() {
return lid;
}
public void setLid(String lid) {
this.lid = lid;
}
public String getCreatedUserName() {
return createdUserName;
}
public void setCreatedUserName(String createdUserName) {
this.createdUserName = createdUserName;
}
public String getFabSite() {
return fabSite;
}
public void setFabSite(String fabSite) {
this.fabSite = fabSite;
}
public String getTpn() {
return tpn;
}
public void setTpn(String tpn) {
this.tpn = tpn;
}
}
|
package mude.srl.ssc.service.payload.exception;
public final class ApiHandleNotUniqueException extends OdooException
{
/**
*
*/
private static final long serialVersionUID = -2489985407504215791L;
static final String MESSAGE = "API Handle: must be unique - that value has been taken.";
ApiHandleNotUniqueException()
{
super( MESSAGE );
}
}
|
package thsst.calvis.editor.view;
import thsst.calvis.configuration.model.engine.CalvisFormattedInstruction;
import thsst.calvis.MainApp;
import javafx.application.Platform;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.geometry.Point2D;
import javafx.scene.Node;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.CustomMenuItem;
import javafx.scene.control.Label;
import javafx.scene.input.KeyCode;
import org.fxmisc.richtext.*;
import org.fxmisc.undo.UndoManager;
import java.nio.file.Path;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by Jennica on 04/02/2016.
*/
public class TextEditor extends AssemblyComponent {
private CodeArea codeArea;
private Pattern lineByLinePattern;
// Existing autocomplete entries
private SortedSet<String> entries;
// Popup used to select an entry
private ContextMenu entriesPopup;
private static final String PAREN_PATTERN = "\\(|\\)";
private static final String BRACE_PATTERN = "\\{|\\}";
private static final String BRACKET_PATTERN = "\\[|\\]";
private static final String STRING_PATTERN = "\"([^\"\\\\]|\\\\.)*\"";
private static final String COMMENT_PATTERN = ";[^\n]*";
private static String[] INSTRUCTION_KEYWORDS;
private static String[] REGISTER_KEYWORDS;
private static String[] MEMORY_KEYWORDS;
private static String INSTRUCTION_PATTERN;
private static String REGISTER_PATTERN;
private static String MEMORY_PATTERN;
private static String SECTION_DATA_PATTERN;
private static Pattern PATTERN;
public TextEditor() {
this.codeArea = new CodeArea();
codeArea.getStyleClass().add("code-area");
codeArea.getStylesheets().add(TextEditor.class.getResource("/css/text-editor.css").toExternalForm());
codeArea.setUseInitialStyleForInsertion(true);
codeArea.setWrapText(true);
codeArea.setParagraphGraphicFactory(LineNumberFactory.get(codeArea));
codeArea.richChanges().subscribe(change -> {
codeArea.setStyleSpans(0, computeHighlighting(codeArea.getText()));
});
codeArea.setOnKeyReleased(event -> {
try {
String text = codeArea.getText();
int caretPosition = codeArea.getCaretPosition();
int caretColumn = codeArea.getCaretColumn();
text = text.replaceAll("[\\t\\n\\r\\f\\v]", " ");
int wordCount = 0;
for ( int i = caretPosition - 1; i > 0; i-- ) {
if ( text.substring(i, caretPosition - wordCount).equals(" ") )
break;
wordCount++;
}
int afterEnter = 0;
for ( int i = caretPosition - 1; i > 0; i-- ) {
if ( codeArea.getText(i, caretPosition - afterEnter).equals("\n") )
break;
afterEnter++;
}
if ( !event.getCode().equals(KeyCode.UP) && !event.getCode().equals(KeyCode.DOWN) &&
!event.getCode().equals(KeyCode.LEFT) && !event.getCode().equals(KeyCode.RIGHT)
&& !event.getCode().equals(KeyCode.ENTER) && !event.getCode().equals(KeyCode.TAB) ) {
// Check if the current character is whitespace; start autocomplete after the whitespace
//
// if ( caretPosition > 1 && codeArea.getText(caretPosition - wordCount - 1, caretPosition - wordCount).equals(" ") )
// this.autocomplete(codeArea.getText(caretPosition - wordCount, caretPosition), caretPosition - wordCount, caretPosition);
// else if( caretPosition > 1 && codeArea.getText(caretPosition - afterEnter - 1, caretPosition - afterEnter).equals("\n") )
// this.autocomplete(codeArea.getText(caretPosition - afterEnter, caretPosition), caretPosition - wordCount, caretPosition);
if( caretPosition > 1 && text.substring(caretPosition-wordCount-1, caretPosition-wordCount).equals(" "))
this.autocomplete(text.substring(caretPosition-wordCount, caretPosition), caretPosition-wordCount, caretPosition);
else
this.autocomplete(codeArea.getText(0, caretPosition), 0, caretPosition);
}
// } else if ( event.getCode().equals(KeyCode.ENTER) ) {
// this.autocomplete(codeArea.getText(caretPosition-afterEnter, caretPosition), caretPosition-1, caretPosition);
// }
} catch ( Exception e ) {
e.printStackTrace();
}
});
}
// 'path' property
private final ObjectProperty<Path> path = new SimpleObjectProperty<>();
public Path getPath() {
return path.get();
}
public void setPath(Path path) {
this.path.set(path);
}
public ObjectProperty<Path> pathProperty() {
return path;
}
/**
* Method for configuring the highlighted keywords within the text thsst.calvis.editor
*/
private void setCodeEnvironment() {
INSTRUCTION_KEYWORDS = this.sysCon.getKeywordBuilder().getInstructionKeywords();
INSTRUCTION_PATTERN = "\\b(" + String.join("|", INSTRUCTION_KEYWORDS) + ")\\b";
REGISTER_KEYWORDS = this.sysCon.getKeywordBuilder().getRegisterKeywords();
REGISTER_PATTERN = "\\b(" + String.join("|", REGISTER_KEYWORDS) + ")\\b";
MEMORY_KEYWORDS = this.sysCon.getKeywordBuilder().getMemoryKeywords();
MEMORY_PATTERN = "\\b(" + String.join("|", MEMORY_KEYWORDS) + ")\\b";
SECTION_DATA_PATTERN = "\\b(SECTION .DATA)\\b";
PATTERN = Pattern.compile(
"(?<INSTRUCTIONPATTERN>" + INSTRUCTION_PATTERN + ")"
+ "|(?<REGISTERPATTERN>" + REGISTER_PATTERN + ")"
+ "|(?<MEMORYPATTERN>" + MEMORY_PATTERN + ")"
+ "|(?<SECTIONDATAPATTERN>" + SECTION_DATA_PATTERN + ")"
+ "|(?<PAREN>" + PAREN_PATTERN + ")"
+ "|(?<BRACE>" + BRACE_PATTERN + ")"
+ "|(?<BRACKET>" + BRACKET_PATTERN + ")"
+ "|(?<STRING>" + STRING_PATTERN + ")"
+ "|(?<COMMENT>" + COMMENT_PATTERN + ")"
);
}
private static StyleSpans<Collection<String>> computeHighlighting(String text) {
Matcher matcher = PATTERN.matcher(text);
int lastKwEnd = 0;
StyleSpansBuilder<Collection<String>> spansBuilder
= new StyleSpansBuilder<>();
while ( matcher.find() ) {
String styleClass = matcher.group("INSTRUCTIONPATTERN") != null ? "instruction"
: matcher.group("REGISTERPATTERN") != null ? "register"
: matcher.group("MEMORYPATTERN") != null ? "memory"
: matcher.group("SECTIONDATAPATTERN") != null ? "section"
: matcher.group("PAREN") != null ? "paren"
: matcher.group("BRACE") != null ? "brace"
: matcher.group("BRACKET") != null ? "bracket"
: matcher.group("STRING") != null ? "string"
: matcher.group("COMMENT") != null ? "comment"
: null;
/* never happens */
assert styleClass != null;
spansBuilder.add(Collections.emptyList(), matcher.start() - lastKwEnd);
spansBuilder.add(Collections.singleton(styleClass), matcher.end() - matcher.start());
lastKwEnd = matcher.end();
}
spansBuilder.add(Collections.emptyList(), text.length() - lastKwEnd);
return spansBuilder.create();
}
private void setCodeAutocomplete() {
this.entries = new TreeSet<>();
this.entriesPopup = new ContextMenu();
this.entries.addAll(Arrays.asList(this.sysCon.getKeywordBuilder().getInstructionKeywords()));
this.entries.addAll(Arrays.asList(this.sysCon.getKeywordBuilder().getRegisterKeywords()));
this.codeArea.setPopupWindow(entriesPopup);
this.codeArea.setPopupAlignment(PopupAlignment.SELECTION_BOTTOM_CENTER);
this.codeArea.setPopupAnchorOffset(new Point2D(4, 4));
}
private void autocomplete(String text, int start, int end) {
text = text.replaceAll("[\\t\\n\\r\\f\\v]", "");
if ( text.length() == 0 || this.entries.contains(text) ) {
this.entriesPopup.hide();
} else {
LinkedList<String> searchResult = new LinkedList<>();
searchResult.addAll(this.entries.subSet(text, text + Character.MAX_VALUE));
if ( searchResult.size() > 0 ) {
this.populatePopupItems(searchResult, start, end);
if ( !entriesPopup.isShowing() ) {
this.entriesPopup.show(MainApp.primaryStage);
}
} else {
this.entriesPopup.hide();
}
}
}
private void populatePopupItems(List<String> searchResult, int start, int end) {
List<CustomMenuItem> menuItems = new LinkedList<>();
// If you'd like more entries, modify this line.
int maxEntries = 10;
int count = Math.min(searchResult.size(), maxEntries);
for ( int i = 0; i < count; i++ ) {
final String result = searchResult.get(i);
Label entryLabel = new Label(result);
CustomMenuItem item = new CustomMenuItem(entryLabel, true);
item.setOnAction((event) -> {
// TODO: Replace the word being completed in the codeArea
this.codeArea.replaceText(start, end, result.toUpperCase());
this.entriesPopup.hide();
});
menuItems.add(item);
}
this.entriesPopup.getItems().clear();
this.entriesPopup.getItems().addAll(menuItems);
}
public void setCodeAreaText(String text) {
this.codeArea.replaceText(text);
}
public Node getCodeArea() {
return codeArea;
}
public String getCodeAreaText() {
return codeArea.getText();
}
public UndoManager getUndoManager() {
return codeArea.getUndoManager();
}
public void undo() {
codeArea.getUndoManager().undo();
}
public void redo() {
codeArea.getUndoManager().redo();
}
public void cut() {
codeArea.cut();
}
public void copy() {
codeArea.copy();
}
public void paste() {
codeArea.paste();
}
public void requestFocus() {
Platform.runLater(() -> codeArea.requestFocus());
}
@Override
public void update(CalvisFormattedInstruction currentInstruction, int lineNumber) {
String currentLine = currentInstruction.toString();
if ( currentLine != null ) {
String codeAreaText = this.codeArea.getText();
Matcher matcher = this.lineByLinePattern.matcher(codeAreaText);
HashMap<Integer, int[]> findHighlightRanges = new HashMap<>();
// c represents matched
int c = 0;
while ( matcher.find() ) {
if ( !matcher.toMatchResult().group().contains(";") ) {
int[] arrRange = new int[2];
arrRange[0] = matcher.start();
arrRange[1] = matcher.end();
findHighlightRanges.put(c, arrRange);
c++;
}
}
int[] range = findHighlightRanges.get(lineNumber);
if ( range != null ) {
// this.codeArea.selectLine();
this.codeArea.selectRange(range[0], range[1]);
this.codeArea.redo();
}
} else {
// this.codeArea.selectRange(0, 0);
this.codeArea.deselect();
this.redo();
}
}
@Override
public void refresh() {
this.codeArea.selectRange(0, 0);
this.redo();
}
@Override
public void build() {
this.setCodeEnvironment();
String[] arr = this.sysCon.getKeywordBuilder().getInstructionKeywords();
String expression = String.join("|", arr);
expression = "((.*)\\b(" + expression + ")\\b(.*)(?=;))|((.*)\\b(" + expression + ")\\b(.*))";
this.lineByLinePattern = Pattern.compile("(?<FIND>" + expression + ")");
this.setCodeAutocomplete();
}
}
|
package com.santander.bi.dtos;
import java.sql.Timestamp;
/**
* Clase DTO especializada para contener los datos de Catalogos .<br>
*
* @version 0.1
* @author Christian Solorio Alonso
*
*/
public class CatalogoDTO {
private Integer idCatalogo;
private String nombreCatalogo;
private String descripcion;
//Seguimiento
private Timestamp fechaCreacion;
private Timestamp fechaModificacion;
private String idUsuarioModifica;
private String idUsuarioCreacion;
private String habilitado;
public Timestamp getFechaCreacion() {
return fechaCreacion;
}
public void setFechaCreacion(Timestamp fechaCreacion) {
this.fechaCreacion = fechaCreacion;
}
public Timestamp getFechaModificacion() {
return fechaModificacion;
}
public void setFechaModificacion(Timestamp fechaModificacion) {
this.fechaModificacion = fechaModificacion;
}
public String getIdUsuarioModifica() {
return idUsuarioModifica;
}
public void setIdUsuarioModifica(String idUsuarioModifica) {
this.idUsuarioModifica = idUsuarioModifica;
}
public String getIdUsuarioCreacion() {
return idUsuarioCreacion;
}
public void setIdUsuarioCreacion(String idUsuarioCreacion) {
this.idUsuarioCreacion = idUsuarioCreacion;
}
public String getHabilitado() {
return habilitado;
}
public void setHabilitado(String habilidado) {
this.habilitado = habilidado;
}
public Integer getIdCatalogo() {
return idCatalogo;
}
public void setIdCatalogo(Integer idCatalogo) {
this.idCatalogo = idCatalogo;
}
public String getNombreCatalogo() {
return nombreCatalogo;
}
public void setNombreCatalogo(String nombreCatalogo) {
this.nombreCatalogo = nombreCatalogo;
}
public String getDescripcion() {
return descripcion;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
}
|
public class ex2{
public static void main(String[] args) {
// TODO Auto-igenerated method stub
String a = args[0];
System.out.print(a);
}
}
|
/*
* Sonar PHP Plugin
* Copyright (C) 2010 Sonar PHP Plugin
* dev@sonar.codehaus.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
package org.sonar.plugins.php.phpunit;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.io.File;
import java.util.Arrays;
import org.apache.commons.configuration.Configuration;
import org.apache.maven.project.MavenProject;
import org.junit.Test;
import org.sonar.api.resources.Java;
import org.sonar.api.resources.Project;
import org.sonar.api.resources.ProjectFileSystem;
import org.sonar.plugins.php.api.Php;
public class PhpUnitSensorTest {
private static final String COVERAGE_REPORT_FILE_PROPERTY_KEY = PhpUnitConfiguration.PHPUNIT_COVERAGE_REPORT_FILE_PROPERTY_KEY;
private static final String SHOULD_RUN_PROPERTY_KEY = PhpUnitConfiguration.PHPUNIT_SHOULD_RUN_PROPERTY_KEY;
private static final String REPORT_FILE_RELATIVE_PATH_PROPERTY_KEY = PhpUnitConfiguration.PHPUNIT_REPORT_FILE_RELATIVE_PATH_PROPERTY_KEY;
private static final String DEFAULT_REPORT_FILE_NAME = PhpUnitConfiguration.PHPUNIT_DEFAULT_REPORT_FILE_NAME;
private static final String REPORT_FILE_NAME_PROPERTY_KEY = PhpUnitConfiguration.PHPUNIT_REPORT_FILE_NAME_PROPERTY_KEY;
private Project project;
private Configuration config;
/**
* Sould not launch on non php project.
*/
@Test
public void shouldNotLaunchOnNonPhpProject() {
Project project = mock(Project.class);
when(project.getLanguage()).thenReturn(Java.INSTANCE);
PhpUnitConfiguration configuration = mock(PhpUnitConfiguration.class);
ProjectFileSystem fs = mock(ProjectFileSystem.class);
when(project.getFileSystem()).thenReturn(fs);
String defaultReportFilePath = PhpUnitConfiguration.PHPUNIT_DEFAULT_REPORT_FILE_PATH;
when(fs.getBuildDir()).thenReturn(new File(defaultReportFilePath));
when(configuration.getReportFileNameKey()).thenReturn("punit.summary.xml");
when(configuration.getCoverageReportFile()).thenReturn(new File("punit.summary.xml"));
Configuration config = mock(Configuration.class);
when(config.getString(REPORT_FILE_RELATIVE_PATH_PROPERTY_KEY, defaultReportFilePath)).thenReturn("reports");
when(project.getConfiguration()).thenReturn(config);
PhpUnitExecutor executor = mock(PhpUnitExecutor.class);
PhpUnitResultParser parser = mock(PhpUnitResultParser.class);
PhpUnitCoverageResultParser parser2 = mock(PhpUnitCoverageResultParser.class);
PhpUnitSensor sensor = new PhpUnitSensor(executor, parser, parser2);
when(executor.getConfiguration()).thenReturn(configuration);
assertEquals(false, sensor.shouldExecuteOnProject(project));
when(project.getLanguage()).thenReturn(Php.PHP);
// when(configuration.isShouldRun()).thenReturn(false);
when(executor.getConfiguration()).thenReturn(configuration);
assertEquals(false, sensor.shouldExecuteOnProject(project));
}
/**
* Sould not launch on non php project.
*/
@Test
public void shouldNotLaunchWhenConfiguredSoOnPhpProject() {
init();
when(project.getLanguage()).thenReturn(Php.PHP);
when(config.getBoolean(SHOULD_RUN_PROPERTY_KEY, Boolean.getBoolean(PhpUnitConfiguration.PHPUNIT_DEFAULT_SHOULD_RUN))).thenReturn(false);
ProjectFileSystem fs = mock(ProjectFileSystem.class);
when(project.getFileSystem()).thenReturn(fs);
when(fs.getBuildDir()).thenReturn(new File(PhpUnitConfiguration.PHPUNIT_DEFAULT_REPORT_FILE_PATH));
PhpUnitExecutor executor = mock(PhpUnitExecutor.class);
PhpUnitResultParser parser = mock(PhpUnitResultParser.class);
PhpUnitCoverageResultParser parser2 = mock(PhpUnitCoverageResultParser.class);
PhpUnitSensor sensor = new PhpUnitSensor(executor, parser, parser2);
PhpUnitConfiguration configuration = mock(PhpUnitConfiguration.class);
when(executor.getConfiguration()).thenReturn(configuration);
assertEquals(false, sensor.shouldExecuteOnProject(project));
}
private void init() {
project = mock(Project.class);
config = mock(Configuration.class);
when(config.getString(REPORT_FILE_NAME_PROPERTY_KEY, DEFAULT_REPORT_FILE_NAME)).thenReturn("punit.summary.xml");
when(config.getString(REPORT_FILE_RELATIVE_PATH_PROPERTY_KEY, PhpUnitConfiguration.PHPUNIT_DEFAULT_REPORT_FILE_PATH))
.thenReturn("/log");
String file = "phpunit.coverage.xml";
when(config.getString(COVERAGE_REPORT_FILE_PROPERTY_KEY, PhpUnitConfiguration.PHPUNIT_DEFAULT_COVERAGE_REPORT_FILE)).thenReturn(file);
when(config.getBoolean(SHOULD_RUN_PROPERTY_KEY, Boolean.getBoolean(PhpUnitConfiguration.PHPUNIT_DEFAULT_SHOULD_RUN))).thenReturn(true);
when(project.getConfiguration()).thenReturn(config);
MavenProject mavenProject = mock(MavenProject.class);
ProjectFileSystem fs = mock(ProjectFileSystem.class);
when(project.getFileSystem()).thenReturn(fs);
when(fs.getBuildDir()).thenReturn(new File(PhpUnitConfiguration.PHPUNIT_DEFAULT_REPORT_FILE_PATH));
when(project.getPom()).thenReturn(mavenProject);
when(project.getFileSystem()).thenReturn(fs);
when(fs.getSourceDirs()).thenReturn(Arrays.asList(new File("C:\\projets\\PHP\\Monkey\\sources\\main")));
when(fs.getTestDirs()).thenReturn(Arrays.asList(new File("C:\\projets\\PHP\\Monkey\\sources\\test")));
}
}
|
package com.TestCases;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import com.GenericMethods.GenericMethods;
import cucumber.api.java.en.Given;
public class Tc_02_Dressesmenudis extends GenericMethods{
@Given("Dresses menu opened and menus are present")
public static void dressesmenu()
{
//Verify options under dresses menu
System.out.println("\n"+"validating whether all the dresses option causual dresses, evening dresses,summer dresses");
//Create a string array with options which we want to verify under dresses menu
String[] menuoptions= {"Casual Dresses", "Evening Dresses", "Summer Dresses"};
int menuoptionslength= menuoptions.length;
// get menu options display on the application
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
List<WebElement> app_options = driver.findElements(By.xpath("//div[@id='categories_block_left']/div/ul/li"));
int applength = app_options.size();
//compare the options displayed on the application with the string list
for (int i = 0; i<menuoptionslength;i++)
{
boolean status = false;
for (WebElement option: app_options)
{
String item = option.getText().trim();
if(menuoptions[i].equalsIgnoreCase(item))
{
System.out.println(menuoptions[i]+ "option is present under Dresses menu");
status = true;
break;
}
}
if(status ==false)
System.out.println(menuoptions[i]+ "option is missing under Dresses menu");
}
}
}
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package exercicio1_avaliativo;
import java.util.Scanner;
/**
*
* @author User
*/
public class Exercicio1_avaliativo {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
double PC, Alt, I, sexo;
System.out.println("Informe o seu sexo digitando 1 para homem e 2 para mulher ");
sexo = entrada.nextDouble();
System.out.println("Digite sem peso corporal em kg: ");
PC = entrada.nextDouble();
System.out.println("Digite sua altura em cm: ");
Alt = entrada.nextDouble();
System.out.println("Digite sua idade em anos: ");
I = entrada.nextDouble();
if (sexo == 1)
{
double result = 66.47 + (13.75 * PC) + (5 * Alt) - (6.76 * I);
System.out.println("O resultado de seu gasto energetico é: "+result);
}
else
if (sexo == 2)
{
double result = 655.1 + (9.56 * PC) + (1.85 * Alt) - (4.67 * I);
System.out.println("O resultado de seu gasto energetico é:"+result);
}
}
}
|
package com.bee.sample.ch5.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.bee.sample.ch5.entity.User;
import com.bee.sample.ch5.service.UserService;
@Controller
public class UserController {
@Autowired
UserService userService;
@RequestMapping("/user/{id}")
public @ResponseBody
User say(@PathVariable Long id) {
User user = userService.geUserById(id);
return user;
}
}
|
package shared.model;
public class SingleSearchResult
{
private int batchID;
private String imageURL;
private int recordNum;
private int fieldID;
/**
* Constructor
* @param batchID
* @param imageURL
* @param recordNum
* @param fieldID
*/
public SingleSearchResult(int batchID, String imageURL, int recordNum, int fieldID)
{
this.batchID = batchID;
this.imageURL = imageURL;
this.recordNum = recordNum;
this.fieldID = fieldID;
}
/**
* @return the batchID
*/
public int getBatchID()
{
return batchID;
}
/**
* @return the imageURL
*/
public String getImageURL()
{
return imageURL;
}
/**
* @return the recordNum
*/
public int getRecordNum()
{
return recordNum;
}
/**
* @return the fieldID
*/
public int getFieldID()
{
return fieldID;
}
}
|
package io.github.gronnmann.utils.coinflipper.input;
import java.util.HashMap;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.scheduler.BukkitRunnable;
import io.github.gronnmann.coinflipper.CoinFlipper;
import io.github.gronnmann.coinflipper.customizable.ConfigVar;
import io.github.gronnmann.coinflipper.customizable.Message;
import io.github.gronnmann.coinflipper.hook.HookManager;
import io.github.gronnmann.coinflipper.hook.HookManager.HookType;
import io.github.gronnmann.coinflipper.hook.HookProtocolLib;
import io.github.gronnmann.utils.coinflipper.Debug;
import io.github.gronnmann.utils.coinflipper.GeneralUtils;
import io.github.gronnmann.utils.coinflipper.input.InputData.InputType;
import io.github.gronnmann.utils.signinput.coinflipper.SignInputEvent;
public class InputManager implements Listener{
protected static HashMap<String, InputData> inputData = new HashMap<>();
private static final int TIMEOUT = 60*20;
public static void setupListeners() {
Bukkit.getPluginManager().registerEvents(new InputManager(), CoinFlipper.getMain());
BooleanChooser.getInstance().setup();
Bukkit.getPluginManager().registerEvents(BooleanChooser.getInstance(), CoinFlipper.getMain());
SoundChooser.getInstance().setup();
Bukkit.getPluginManager().registerEvents(SoundChooser.getInstance(), CoinFlipper.getMain());
}
public static void requestInput(String player, InputData data) {
requestInput(player, data, true);
}
public static void requestInput(String player, InputData data, boolean closeInventory) {
inputData.put(player, data);
Player p = Bukkit.getPlayer(player);
if (p == null)return;
if (closeInventory) {
p.closeInventory();
}
if (data.getType() == InputType.BOOLEAN) {
BooleanChooser.getInstance().openEditor(p, data);
}else if (data.getType() == InputType.SOUND) {
SoundChooser.getInstance().refresh(((ConfigVar)data.getExtraData("CVAR")).getValue().toString());
SoundChooser.getInstance().openEditor(p, (Inventory) data.getExtraData("RETURN_INVENTORY"), "CoinFlipper " + data.getExtraData("CVAR"));
}
Debug.print("Using PL: " + HookManager.getManager().isHooked(HookType.ProtocolLib));
Debug.print("Sign input: " + ConfigVar.SIGN_INPUT.getBoolean());
if (!(data.getType() == InputType.BOOLEAN || data.getType() == InputType.SOUND)) {
if (HookManager.getManager().isHooked(HookType.ProtocolLib) && ConfigVar.SIGN_INPUT.getBoolean()
&& CoinFlipper.versionId <= 12){
Debug.print("sign");
HookProtocolLib.getHook().openSignInput(p);
}
}
new InputTimeout(p.getName(), data.getCreated()).runTaskLaterAsynchronously(CoinFlipper.getMain(), TIMEOUT);
}
public static boolean removeInputByPlayerAndID(String player, String id) {
return inputData.remove(player, id);
}
public static boolean removeInput(String player) {
return (inputData.remove(player) == null);
}
public static boolean isEditing(String player, String id) {
if (inputData.get(player) != null && inputData.get(player).getId().equals(id)) {
return true;
}
return false;
}
public static InputData getData(String player) {
return inputData.get(player);
}
@EventHandler
public void signInput(SignInputEvent e) {
if (!HookManager.getManager().isHooked(HookType.ProtocolLib) && ConfigVar.SIGN_INPUT.getBoolean())return;
Player p = e.getPlayer();
if (!inputData.containsKey(p.getName()))return;
String input = e.getLine(0);
if (!processInput(p.getName(), input)) {
HookProtocolLib.getHook().openSignInput(e.getPlayer());
}
}
@EventHandler (priority = EventPriority.LOWEST)
public void chatInput(AsyncPlayerChatEvent e) {
Player p = e.getPlayer();
if (!inputData.containsKey(p.getName()))return;
InputData data = inputData.get(p.getName());
if (data.getType() == InputType.BOOLEAN || data.getType() == InputType.SOUND)return;
e.setCancelled(true);
new BukkitRunnable() {
@Override
public void run() {
processInput(p.getName(), e.getMessage());
}
}.runTask(CoinFlipper.getMain());
}
protected static boolean processInput(String player, String input) {
InputData data = inputData.get(player);
if (data == null)return false;
Player processed = Bukkit.getPlayer(player);
if (processed == null) return false;
Debug.print("Processing: " + player + ", input: " + input + ", type: " + data.getType().toString());
input = ChatColor.stripColor(input);
Object dataHolder = null;
if (input.equals(data.getExitString())) {
PlayerInputEvent event = new PlayerInputEvent(processed, data, dataHolder, true);
Bukkit.getPluginManager().callEvent(event);
return false;
}
if (data.getType() == InputType.STRING || data.getType() == InputType.TEXT) {
if (input.length() < 1) {
processed.sendMessage(Message.INPUT_EMPTY.getMessage());
return false;
}
if (data.getType() == InputType.TEXT) {
input = input.replace(" ", "_");
}
dataHolder = input;
}else if (data.getType() == InputType.INTEGER || data.getType() == InputType.DOUBLE) {
if (data.getType() == InputType.INTEGER) {
if (!GeneralUtils.isInt(input)) {
processed.sendMessage(Message.INPUT_NOTNUM.getMessage());
return false;
}else {
dataHolder = Integer.parseInt(input);
}
}else if (data.getType() == InputType.DOUBLE) {
if (!GeneralUtils.isDouble(input)) {
processed.sendMessage(Message.INPUT_NOTNUM.getMessage());
return false;
}else {
dataHolder = Double.parseDouble(input);
}
}
Double asDouble = Double.parseDouble(dataHolder.toString());
if (data.hasMax() && data.getMax() < asDouble) {
processed.sendMessage(Message.ERROR_OVER_MAX.getMessage());
return false;
}
if (data.hasMin() && asDouble < data.getMin()) {
processed.sendMessage(Message.ERROR_UNDER_MIN.getMessage());
return false;
}
}else if (data.getType() == InputType.BOOLEAN) {
if (!GeneralUtils.isBoolean(input)) {
processed.sendMessage(Message.INPUT_NOTBOOLEAN.getMessage());
return false;
}
dataHolder = Boolean.parseBoolean(input);
}
else if (data.getType() == InputType.SOUND) {
try {
Sound snd = Sound.valueOf(input);
dataHolder = snd;
}catch(Exception e) {
processed.sendMessage(Message.INPUT_NOTSOUND.getMessage());
return false;
}
}
PlayerInputEvent event = new PlayerInputEvent(processed, data, dataHolder);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled())return false;
inputData.remove(player);
return true;
}
@EventHandler
public void stopMemoryLeak(PlayerQuitEvent e) {
inputData.remove(e.getPlayer().getName());
}
}
class InputTimeout extends BukkitRunnable{
private String key;
private long createdId;
public InputTimeout(String key, long createdId) {
this.key = key;
this.createdId = createdId;
}
public void run() {
if (!(InputManager.inputData.containsKey(key) && InputManager.inputData.get(key).getCreated() == createdId))return;
InputManager.inputData.remove(key);
Player t = Bukkit.getPlayer(key);
if (t != null) {
t.sendMessage(ChatColor.RED + "Input timed out.");
}
}
} |
package com.qunchuang.carmall.graphql.mutation;
import cn.wzvtcsoft.bosdomain.persist.CoreObject;
import com.qunchuang.carmall.graphql.IGraphQlTypeMapper;
import graphql.language.Field;
import com.qunchuang.carmall.graphql.query.CollectionJpaDataFetcher;
import com.qunchuang.carmall.graphql.query.QueryFilter;
import com.qunchuang.carmall.graphql.query.enums.QueryFilterCombinator;
import com.qunchuang.carmall.graphql.query.enums.QueryFilterOperator;
import graphql.schema.DataFetchingEnvironment;
import graphql.schema.GraphQLInputType;
import org.springframework.util.StringUtils;
import javax.persistence.EntityManager;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class MutationDataFetcher extends CollectionJpaDataFetcher {
protected MutationMetaInfo mutationMetaInfo;
public MutationDataFetcher(EntityManager entityManager, IGraphQlTypeMapper graphQlTypeMapper, MutationMetaInfo mutationMetaInfo) {
super(entityManager, mutationMetaInfo.getEntityType(), graphQlTypeMapper);
this.mutationMetaInfo = mutationMetaInfo;
}
@Override
public Object getResult(DataFetchingEnvironment environment, QueryFilter queryFilter) {
Field field = environment.getFields().iterator().next();
Map<String, Object> nameArgMaps = new HashMap<>();
field.getArguments().stream()
//过滤掉不需要的输入参数。
.filter(realArg -> this.mutationMetaInfo.getGraphQLArgument(realArg.getName()) != null)
.forEach(realArg ->
nameArgMaps.put(realArg.getName(), convertValue(environment,
(GraphQLInputType) this.mutationMetaInfo.getGraphQLArgument(realArg.getName()).getType(),
realArg.getValue(), 0)));
Object returnValue = this.mutationMetaInfo.invoke(nameArgMaps);
//说明返回的是简单类型,或是包装简单类型后的集合类型。
if (this.entityType == null) {
return returnValue;
} else if (returnValue == null) {
return null;
//说明返回类型要么是实体类型,要么是实体类型的集合类型
} else {
//说明返回的是拿到主键
if (CoreObject.class.isAssignableFrom(returnValue.getClass())) {
String id = ((CoreObject) returnValue).getId();
queryFilter = new QueryFilter("id", QueryFilterOperator.EQUEAL, id, QueryFilterCombinator.AND, queryFilter);
return super.getForEntity(environment, queryFilter);
//实体类型的集合类型
} else if (Collection.class.isAssignableFrom(returnValue.getClass())) {
Collection entityCollection = ((Collection) returnValue);
List<String> idList = (List<String>) entityCollection.stream().map(entity -> ((CoreObject) entity).getId()).collect(Collectors.toList());
String idString = StringUtils.collectionToDelimitedString(idList, ",", "'", "'");
//设置分页和过滤条件
queryFilter = new QueryFilter("id", QueryFilterOperator.IN, idString, QueryFilterCombinator.AND, queryFilter);
return super.getResult(environment, queryFilter);
} else {
throw new RuntimeException("返回不是 mutation 中不允许出现该类型");
}
}
}
}
|
package Lab01.Zad5;
public class Shop {
Tax tax = null;
public Shop(Tax tax){
this.tax = tax;
}
public void setTax(Tax tax)
{
this.tax = tax;
}
}
|
package com.box.androidsdk.content.requests;
import com.box.androidsdk.content.models.BoxSession;
import com.box.androidsdk.content.models.BoxVoid;
/**
* Abstract class that represents a request to delete a BoxItem.
*
* @param <R> type of BoxRequest that is being created.
*/
public abstract class BoxRequestItemDelete<R extends BoxRequest<BoxVoid,R>> extends BoxRequest<BoxVoid, R> {
protected String mId;
/**
* Constructs an item delete request with the default parameters.
*
* @param id id of the Box item to delete.
* @param requestUrl URL of the delete endpoint.
* @param session the authenticated session that will be used to make the request with.
*/
public BoxRequestItemDelete(String id, String requestUrl, BoxSession session) {
super(BoxVoid.class, requestUrl, session);
mId = id;
mRequestMethod = Methods.DELETE;
}
/**
* Gets the id of the item to delete.
*
* @return id of the item to delete.
*/
public String getId() {
return mId;
}
/**
* Sets the if-match header for the request.
* The item will only be deleted if the specified etag matches the most current etag for the item.
*
* @param etag etag to set in the if-match header.
* @return the request with the updated if-match header.
*/
@Override
public R setIfMatchEtag(String etag) {
return super.setIfMatchEtag(etag);
}
/**
* Returns the currently set etag for the if-match header of the request.
*
* @return etag currently set in the if-match header.
*/
@Override
public String getIfMatchEtag() {
return super.getIfMatchEtag();
}
}
|
package org.lxy.el;
/**
* @author menglanyingfei
* @date 2017-3-15
*/
public class ELDemo1 {
/**
* @param args
*/
public static String sayHello(String name) {
return "hello " + name;
}
}
|
package net.jqwik;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.util.List;
import com.pholser.junit.quickcheck.From;
import com.pholser.junit.quickcheck.Property;
import com.pholser.junit.quickcheck.When;
import com.pholser.junit.quickcheck.generator.GenerationStatus;
import com.pholser.junit.quickcheck.generator.Generator;
import com.pholser.junit.quickcheck.generator.GeneratorConfiguration;
import com.pholser.junit.quickcheck.generator.InRange;
import com.pholser.junit.quickcheck.generator.Size;
import com.pholser.junit.quickcheck.generator.ValuesOf;
import com.pholser.junit.quickcheck.random.SourceOfRandomness;
import org.junit.gen5.api.Assertions;
import org.junit.gen5.api.Test;
import org.junit.gen5.engine.EngineDiscoveryRequest;
import org.junit.gen5.engine.TestDescriptor;
import org.junit.gen5.engine.UniqueId;
import org.junit.gen5.engine.discovery.ClassSelector;
import org.junit.gen5.engine.discovery.MethodSelector;
import org.junit.gen5.launcher.main.TestDiscoveryRequestBuilder;
import org.opentest4j.AssertionFailedError;
import net.jqwik.api.Assumptions;
class EngineExecutionTests extends AbstractEngineTests{
@Test
void executeSingleProperty() {
EngineDiscoveryRequest discoveryRequest = TestDiscoveryRequestBuilder.request().select(
MethodSelector.forMethod(NoParamsProperties.class, "succeedingProperty")).build();
TestDescriptor engineDescriptor = engine.discover(discoveryRequest, UniqueId.forEngine(engine.getId()));
RecordingExecutionListener engineListener = executeEngine(engineDescriptor);
Assertions.assertEquals(1, engineListener.countPropertiesStarted(), "Started");
Assertions.assertEquals(1, engineListener.countPropertiesSuccessful(), "Successful");
}
@Test
void propertiesWithoutParams() {
EngineDiscoveryRequest discoveryRequest = TestDiscoveryRequestBuilder.request().select(
ClassSelector.forClass(NoParamsProperties.class)).build();
TestDescriptor engineDescriptor = engine.discover(discoveryRequest, UniqueId.forEngine(engine.getId()));
Assertions.assertEquals(8, engineDescriptor.allDescendants().size());
RecordingExecutionListener engineListener = executeEngine(engineDescriptor);
Assertions.assertEquals(6, engineListener.countPropertiesStarted(), "Started");
Assertions.assertEquals(3, engineListener.countPropertiesSuccessful(), "Successful");
Assertions.assertEquals(2, engineListener.countPropertiesFailed(), "Failed");
Assertions.assertEquals(1, engineListener.countPropertiesAborted(), "Aborted");
Assertions.assertEquals(1, engineListener.countPropertiesSkipped(), "Skipped");
}
@Test
void propertiesWithUnmodifiedParams() {
EngineDiscoveryRequest discoveryRequest = TestDiscoveryRequestBuilder.request().select(
ClassSelector.forClass(UnmodifiedParamsProperties.class)).build();
TestDescriptor engineDescriptor = engine.discover(discoveryRequest, UniqueId.forEngine(engine.getId()));
Assertions.assertEquals(6, engineDescriptor.allDescendants().size());
RecordingExecutionListener engineListener = executeEngine(engineDescriptor);
Assertions.assertEquals(5, engineListener.countPropertiesStarted(), "Started");
Assertions.assertEquals(2, engineListener.countPropertiesSuccessful(), "Successful");
Assertions.assertEquals(3, engineListener.countPropertiesFailed(), "Failed");
}
@Test
void checkForPropertyVerificationFailure() throws NoSuchMethodException {
Method failingMethod = UnmodifiedParamsProperties.class.getDeclaredMethod("shrinking",
new Class[] { int.class });
EngineDiscoveryRequest discoveryRequest = TestDiscoveryRequestBuilder.request().select(
MethodSelector.forMethod(UnmodifiedParamsProperties.class, failingMethod)).build();
TestDescriptor engineDescriptor = engine.discover(discoveryRequest, UniqueId.forEngine(engine.getId()));
RecordingExecutionListener engineListener = executeEngine(engineDescriptor);
RecordingExecutionListener.ExecutionEvent failingEvent = engineListener.filterEvents(
event -> event.type == RecordingExecutionListener.ExecutionEventType.Failed).findFirst().get();
Assertions.assertEquals("shrinking", failingEvent.descriptor.getName());
PropertyVerificationFailure verificationFailure = (PropertyVerificationFailure) failingEvent.exception;
Assertions.assertEquals(0, verificationFailure.getArgs()[0], "Shrinked value");
}
@Test
void diverseParameterTypes() {
EngineDiscoveryRequest discoveryRequest = TestDiscoveryRequestBuilder.request().select(
ClassSelector.forClass(DiverseProperties.class)).build();
TestDescriptor engineDescriptor = engine.discover(discoveryRequest, UniqueId.forEngine(engine.getId()));
RecordingExecutionListener engineListener = executeEngine(engineDescriptor);
Assertions.assertEquals(5, engineListener.countPropertiesStarted(), "Started");
Assertions.assertEquals(4, engineListener.countPropertiesSuccessful(), "Successful");
Assertions.assertEquals(1, engineListener.countPropertiesFailed(), "Failed");
}
private static class NoParamsProperties {
@Property
String skipBecauseItDoesNotReturnBoolean() {
return "a string";
}
@Property
boolean succeedingProperty() {
return true;
}
@Property
boolean failingProperty() {
return false;
}
@Property
void succeedingVoid() {
}
@Property
void failingVoid() {
throw new AssertionFailedError("failing property");
}
@Property
static void succeedingStatic() {
}
@Property
void shouldBeSkipped() {
Assumptions.assume(false);
}
}
private static class UnmodifiedParamsProperties {
@Property
boolean succeeding(int aNumber) {
return true;
}
@Property
boolean failingWithTwo(int first, int second) {
return first > second;
}
@Property
boolean succeedingWithTwo(int first, int second) {
Assumptions.assume(first > second);
return first > second;
}
@Property
boolean shrinking(int aNumber) {
return aNumber > 0;
}
@Property
void failingWithVoid(int first, int second) {
throw new AssertionFailedError();
}
}
private static class DiverseProperties {
@Property(trials = 10)
void positiveIntegers(@From(IntegralGenerator.class) @Positive int i) {
}
@Property(trials = 10)
void restrictedListOfIntegers(@Size(max = 5) List<@InRange(min = "0", max = "9") Integer> digits) {
}
@Property(trials = 10)
static boolean allBinaryValues(@ValuesOf boolean aBoolean) {
return true;
}
@Property(shrink = false)
boolean doNotShrink(BigDecimal aNumber) {
return aNumber.compareTo(BigDecimal.ONE) == 1;
}
@Property(trials = 1, shrink = false)
boolean withFixedSeed(@When(seed = 42L) long aNumber) {
return aNumber == 4631121966219677515L;
}
}
@Target({ PARAMETER, FIELD, ANNOTATION_TYPE, TYPE_USE })
@Retention(RUNTIME)
@GeneratorConfiguration
@interface Positive {
// ...
}
public static class IntegralGenerator extends Generator<Integer> {
private Positive positive;
public IntegralGenerator() {
super(Integer.class);
}
@Override
public Integer generate(SourceOfRandomness random, GenerationStatus status) {
int value = random.nextInt();
return positive != null ? Math.abs(value) : value;
}
public void configure(Positive positive) {
this.positive = positive;
}
}
}
|
package com.mahesh.android;
import java.io.IOException;
import java.io.InputStream;
import org.andengine.engine.camera.Camera;
import org.andengine.engine.options.EngineOptions;
import org.andengine.engine.options.ScreenOrientation;
import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
import org.andengine.entity.scene.IOnAreaTouchListener;
import org.andengine.entity.scene.ITouchArea;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.scene.background.Background;
import org.andengine.entity.sprite.ButtonSprite;
import org.andengine.entity.sprite.Sprite;
import org.andengine.entity.sprite.ButtonSprite.OnClickListener;
import org.andengine.entity.text.Text;
import org.andengine.entity.text.TextOptions;
import org.andengine.entity.util.FPSLogger;
import org.andengine.input.touch.TouchEvent;
import org.andengine.opengl.font.Font;
import org.andengine.opengl.font.FontFactory;
import org.andengine.opengl.texture.ITexture;
import org.andengine.opengl.texture.bitmap.BitmapTexture;
import org.andengine.opengl.texture.region.ITextureRegion;
import org.andengine.opengl.texture.region.TextureRegionFactory;
import org.andengine.opengl.vbo.VertexBufferObjectManager;
import org.andengine.ui.activity.SimpleBaseGameActivity;
import org.andengine.util.HorizontalAlign;
import org.andengine.util.adt.io.in.IInputStreamOpener;
import org.andengine.util.debug.Debug;
import android.content.Intent;
import android.graphics.Typeface;
import android.widget.Toast;
/**
* (c) 2010 Nicolas Gramlich
* (c) 2011 Zynga
*
* @author Nicolas Gramlich
* @since 11:54:51 - 03.04.2010
*/
public class MainActivity extends SimpleBaseGameActivity {
// ===========================================================
// Constants
// ===========================================================
private static final int CAMERA_WIDTH = 720;
private static final int CAMERA_HEIGHT = 480;
// ===========================================================
// Fields
// ===========================================================
private Font mFont;
private ITexture mTexture;
private ITextureRegion mFaceTextureRegion;
// ===========================================================
// Constructors
// ===========================================================
// ===========================================================
// Getter & Setter
// ===========================================================
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public EngineOptions onCreateEngineOptions() {
final Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
return new EngineOptions(true, ScreenOrientation.LANDSCAPE_SENSOR, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
}
@Override
public void onCreateResources() {
this.mFont = FontFactory.create(this.getFontManager(), this.getTextureManager(), 256, 256, Typeface.create(Typeface.DEFAULT, Typeface.BOLD), 32);
this.mFont.load();
try {
this.mTexture = new BitmapTexture(this.getTextureManager(), new IInputStreamOpener() {
@Override
public InputStream open() throws IOException {
return getAssets().open("gfx/play.png");
}
});
this.mTexture.load();
this.mFaceTextureRegion = TextureRegionFactory.extractFromTexture(this.mTexture);
} catch (IOException e) {
Debug.e(e);
}
}
@Override
public Scene onCreateScene() {
this.mEngine.registerUpdateHandler(new FPSLogger());
final Scene scene = new Scene();
scene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));
final VertexBufferObjectManager vertexBufferObjectManager = this.getVertexBufferObjectManager();
final Text titleText = new Text(250, 40, this.mFont, "Calliards", new TextOptions(HorizontalAlign.LEFT), vertexBufferObjectManager);
final Text centerText = new Text(50, 90, this.mFont, "OBJECTIVE : To use burst the numbered \n balls in sequence.", new TextOptions(HorizontalAlign.LEFT), vertexBufferObjectManager);
final Text leftText = new Text(50, 170, this.mFont, "Tap the screen to get your stryker.\nLorem ipsum dolor sit amat...", new TextOptions(HorizontalAlign.LEFT), vertexBufferObjectManager);
final Text rightText = new Text(50, 300, this.mFont, "Use swipe gestures to direct your stryker!\nLorem ipsum dolor sit amat...", new TextOptions(HorizontalAlign.LEFT), vertexBufferObjectManager);
scene.attachChild(titleText);
scene.attachChild(centerText);
scene.attachChild(leftText);
scene.attachChild(rightText);
/* Calculate the coordinates for the face, so its centered on the camera. */
final float centerX = (CAMERA_WIDTH - this.mFaceTextureRegion.getWidth()) / 2;
final float centerY = (CAMERA_HEIGHT - this.mFaceTextureRegion.getHeight()) / 2;
/* Create the face and add it to the scene. */
final Sprite btnPlay = new Sprite(centerX, centerY, this.mFaceTextureRegion, this.getVertexBufferObjectManager()){
@Override
public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
Intent intent = new Intent();
intent.setClass(MainActivity.this,CalliardsActivity.class);
startActivity(intent);
return true;
}
};
scene.attachChild(btnPlay);
scene.registerTouchArea(btnPlay);
return scene;
}
// ===========================================================
// Methods
// ===========================================================
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
|
package com.beiyelin.commonwx.cpportal.handler;
import com.beiyelin.common.utils.JsonUtils;
import com.beiyelin.commonwx.common.api.WxConsts;
import com.beiyelin.commonwx.common.session.WxSessionManager;
import com.beiyelin.commonwx.cp.api.WxCpService;
import com.beiyelin.commonwx.cp.bean.WxCpXmlMessage;
import com.beiyelin.commonwx.cp.bean.WxCpXmlOutMessage;
import com.beiyelin.commonwx.cpportal.builder.TextBuilder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* * @author Binary Wang(https://github.com/binarywang)
*/
@Component
@Slf4j
public class MsgHandler extends AbstractHandler {
@Override
public WxCpXmlOutMessage handle(WxCpXmlMessage wxMessage,
Map<String, Object> context, WxCpService weixinService,
WxSessionManager sessionManager) {
if (!wxMessage.getMsgType().equals(WxConsts.XmlMsgType.EVENT)) {
//TODO 可以选择将消息保存到本地
}
//TODO 组装回复消息
String content = "收到信息内容:" + JsonUtils.toJson(wxMessage);
return new TextBuilder().build(content, wxMessage, weixinService);
}
}
|
package soumyavn.java.CheckoutSimulation;
import java.util.*;
import java.io.*;
public class Store {
public static int registerCount;
public static int currentTime;
public static ArrayList<Register> registers= new ArrayList<Register>();
public static ArrayList<Customer> customers=new ArrayList<Customer>();
public static void main(String[] args) {
int tempTime;
currentTime=0;
try{
//sort customers based on arrival and properties
if (readFile()==1)
{
Collections.sort(customers);
//Create register list
for(int i=0;i<registerCount;i++)
{
if(i==registerCount-1)
registers.add(i, new Register(true));
else
registers.add(i,new Register(false));
}
registerCount=registers.size();
//Get each register's waitline status at the time of customer arrival
for(int i=0;i<customers.size();i++)
{
for(int j=0;j<registerCount;j++)
{
registers.get(j).checkoutProcess(customers.get(i).arrivalTime);
}
currentTime=customers.get(i).arrivalTime;
customers.get(i).findRegister();
}
//Computing the total time taken to process
tempTime=registers.get(0).timeToProcess;
for(int i=1;i<registerCount;i++)
{
if(registers.get(i).timeToProcess>tempTime)
tempTime= registers.get(i).timeToProcess;
}
currentTime=currentTime+tempTime;
System.out.println("Finished at: t=" + currentTime + " minutes");
}
}
catch(Exception e)
{
System.out.println("Error on File");
}
}
public static int readFile()
{
String input;
System.out.println("Enter File path");
Scanner sc = new Scanner(System.in);
input=sc.nextLine();
sc.close();
File f= new File(input);
return(processInput(f));
}
public static int processInput(File f)
{
char customerType;
int arrivalTime;
int cartTotal;
try
{
Scanner sc=new Scanner(f);
registerCount=sc.nextInt();
//Create customer objects and add them to the list
while(sc.hasNextLine())
{
customerType=sc.next().charAt(0);
arrivalTime= sc.nextInt();
cartTotal=sc.nextInt();
if(customerType=='A'||customerType=='B')
customers.add(new Customer(customerType,arrivalTime,cartTotal));
else
{
sc.close();
throw new InputMismatchException();
}
}
sc.close();
return 1;
}
catch(InputMismatchException ex) {
System.out.println( "Error on file format" );
return 0;
}
catch(FileNotFoundException ex) {
System.out.println( "Unable to open file" );
return 0;
}
}
}
|
package com.paleimitations.schoolsofmagic.common.spells;
import com.paleimitations.schoolsofmagic.common.data.capabilities.magic_data.IMagicData;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Util;
import net.minecraft.util.text.StringTextComponent;
import java.util.function.Predicate;
public class SpellRequirement {
public final Predicate<IMagicData> requirement;
public final StringTextComponent failMessage;
public SpellRequirement(Predicate<IMagicData> requirement, StringTextComponent failMessage) {
this.requirement = requirement;
this.failMessage = failMessage;
}
public boolean test(PlayerEntity player, IMagicData data) {
if(requirement.test(data))
return true;
else {
player.sendMessage(failMessage, Util.NIL_UUID);
return false;
}
}
}
|
package uriSchemeHandler;
public class RealURLProtocolHandlerFactory {
public static RealURISchemeHandler produce(final String osName) {
final String osLowerCase = osName.toLowerCase();
if(osLowerCase.contains("linux")){
return new LinuxURISchemeHandler();
}
if(osLowerCase.contains("windows")){
return new WindowsURISchemeHandler();
}
//For use wit osx
//http://ss64.com/osx/lsregister.html
//http://krypted.com/mac-os-x/lsregister-associating-file-types-in-mac-os-x/
throw new RuntimeException("OS not supported");
}
}
|
import java.io.*;
import java.util.*;
public class CopyFile1 {
public static void main(String args[]) throws IOException {
Scanner s=new Scanner(System.in);
int n=s.nextInt();
int temp=n;
int rem=0,sum=0,i=1,g=1;
while(n!=0)
{
rem=n%10;
sum=sum+rem*rem*rem;
n=n/10;
}
if(sum==temp)
System.out.println(temp+" is amstrong number");
else
System.out.println(temp+" is not amstrong number");
}
}
|
package com.koreait.mybatis;
import java.sql.Date;
public class CDto {
private int c_idx, b_idx;
private String writer, content, pw, ip;
private Date reg_date;
public CDto() { }
public int getC_idx() {
return c_idx;
}
public void setC_idx(int c_idx) {
this.c_idx = c_idx;
}
public int getB_idx() {
return b_idx;
}
public void setB_idx(int b_idx) {
this.b_idx = b_idx;
}
public String getWriter() {
return writer;
}
public void setWriter(String writer) {
this.writer = writer;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getPw() {
return pw;
}
public void setPw(String pw) {
this.pw = pw;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public Date getReg_date() {
return reg_date;
}
public void setReg_date(Date reg_date) {
this.reg_date = reg_date;
}
}
|
/*
* Copyright 2019, E-Kohei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.norana.numberplace.ui.fragment;
import androidx.annotation.NonNull;
import androidx.lifecycle.Lifecycle;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.Fragment;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.LayoutInflater;
import com.norana.numberplace.R;
import com.norana.numberplace.databinding.LevelSelectFragmentBinding;
import com.norana.numberplace.ui.activity.MainActivity;
import com.norana.numberplace.ui.adapter.LevelListAdapter;
import com.norana.numberplace.ui.callback.LevelClickCallback;
/**
* Fragment which shows levels of sudoku the user can solve
*/
public class LevelSelectFragment extends Fragment{
private LevelSelectFragmentBinding mBinding;
private LevelListAdapter mListAdapter;
private final LevelClickCallback mLevelClickCallback =
new LevelClickCallback(){
@Override
public void onClick(int stringId){
String level = "";
switch (stringId){
case R.string.menu_legend:
level = "Legend"; break;
case R.string.menu_master:
level = "Master"; break;
case R.string.menu_medium:
level = "Medium"; break;
case R.string.menu_beginner:
level = "Beginner"; break;
default:
level = "Newbie";
}
if (getLifecycle().getCurrentState()
.isAtLeast(Lifecycle.State.STARTED)){
((MainActivity) requireActivity())
.startPlaySudokuActivity(level);
}
}
};
public LevelSelectFragment(){
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater,
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState){
// inflate this data binding layout
mBinding = DataBindingUtil.inflate(inflater,
R.layout.level_select_fragment, container, false);
// Create and set the adapter for the RecyclerView
mListAdapter = new LevelListAdapter(mLevelClickCallback);
mBinding.levelList.setAdapter(mListAdapter);
return mBinding.getRoot();
}
}
|
/*
* Represent undirected edge on graph
*
* Author: Gilang Kusuma Jati (gilang.k@samsung.com), SRIN
*
*/
package datastructurefromlib;
public class UndirectedEdge implements Comparable<UndirectedEdge>
{
private int v;
private int w;
private double weight;
public UndirectedEdge(int v, int w, double weight)
{
if (v < 0)
throw new IndexOutOfBoundsException("Vertex name must be a nonnegative integer");
if (w < 0)
throw new IndexOutOfBoundsException("Vertex name must be a nonnegative integer");
if (Double.isNaN(weight))
throw new IllegalArgumentException("Weight is NaN");
this.v = v;
this.w = w;
this.weight = weight;
}
// returns the weight of the edge.
public double getWeight()
{
return weight;
}
// returns either endpoint of the edge.
public int either()
{
return v;
}
public int other(int vertex)
{
if (vertex == v)
return w;
else if (vertex == w)
return v;
else
throw new IllegalArgumentException("Illegal endpoint");
}
public int compareTo(UndirectedEdge other)
{
if (this.getWeight() < other.getWeight())
return -1;
else if (this.getWeight() > other.getWeight())
return +1;
else
return 0;
}
public String toString()
{
return String.format("%d-%d %.5f", v, w, weight);
}
} |
package ch.fhnw.edu.cpib.ast;
import ch.fhnw.edu.cpib.ast.interfaces.IFactor;
import ch.fhnw.edu.cpib.errors.*;
import ch.fhnw.edu.cpib.scanner.Literal;
import ch.fhnw.edu.cpib.scanner.enumerations.LRValue;
import ch.fhnw.edu.cpib.scanner.enumerations.Types;
import ch.fhnw.edu.cpib.vm.ICodeArray.CodeTooSmallError;
import ch.fhnw.edu.cpib.vm.IInstructions;
import java.util.HashMap;
import java.util.stream.Collectors;
public class LiteralFactor extends AstNode implements IFactor {
private Literal literal;
private Types castType;
public LiteralFactor(Literal literal) {
this.literal = literal;
}
@Override public void saveNamespaceInfo(HashMap<String, TypeIdent> localStoresNamespace)
throws AlreadyDeclaredError, AlreadyInitializedError {
this.localVarNamespace = localStoresNamespace;
}
@Override public void doScopeChecking() throws NotDeclaredError {
}
@Override public void doTypeCasting(Types type) {
if (type != null) {
this.castType = type;
}
literal.doTypeCasting(type);
}
@Override public LRValue getLRValue() {
return LRValue.RVALUE;
}
@Override public Types getType() {
if (castType != null) {
// type is casted
return castType;
}
// otherwise get real type
return literal.getType();
}
@Override public void doTypeChecking() throws TypeCheckingError {
//
}
@Override public void doInitChecking(boolean globalProtected)
throws NotInitializedError, AlreadyInitializedError, GlobalProtectedInitializationError,
CannotAssignToConstError {
//
}
@Override public void addInstructionToCodeArray(HashMap<String, Integer> localLocations, boolean simulateOnly)
throws CodeTooSmallError {
// Add the value on top of stack
if (!simulateOnly) {
try {
if(castType == null) {
if (literal.getType() == Types.BOOL) {
codeArray.put(codeArrayPointer, new IInstructions.LoadImBool(literal.getBoolValue()));
} else if (literal.getType() == Types.INT64) {
codeArray.put(codeArrayPointer, new IInstructions.LoadImInt(literal.getIntValue()));
} else if (literal.getType() == Types.NAT64) {
codeArray.put(codeArrayPointer, new IInstructions.LoadImNat(literal.getNatValue()));
} else {
throw new RuntimeException("Unknown type!");
}
} else if (castType == Types.BOOL) {
codeArray.put(codeArrayPointer, new IInstructions.LoadImBool(literal.getBoolValue()));
} else if (castType == Types.INT64) {
codeArray.put(codeArrayPointer, new IInstructions.LoadImInt(literal.getIntValue()));
} else if (castType == Types.NAT64) {
codeArray.put(codeArrayPointer, new IInstructions.LoadImNat(literal.getNatValue()));
} else {
throw new RuntimeException("Unknown type!");
}
} catch (Exception ex) {
}
}
codeArrayPointer++;
}
@Override public String toString(String indent) {
String nameIndent = indent;
String argumentIndent = indent + " ";
String s = "";
s += nameIndent + this.getClass().getName() + "\n";
if (localVarNamespace != null)
s += argumentIndent + "[localStoresNamespace]: " + localVarNamespace.keySet().stream()
.map(Object::toString).collect(Collectors.joining(",")) + "\n";
s += argumentIndent + "<literal>: " + literal.toString() + "\n";
return s;
}
}
|
package com.yixin.dsc.dto.match;
import java.util.List;
/**
* 订单痕迹表
* Package : com.yixin.dsc.entity.kepler
*
* @author YixinCapital -- wangwenlong
* 2018年8月24日 下午4:17:19
*
*/
public class DscMatchResultDetail2AlixDTO{
/**
* 资方Code
*/
private String capitalCode;
/**
* 资方name
*/
private String capitalName;
/**
* 是否准入成功
*/
private Boolean successFlag;
/**
* 触碰资方规则List
*/
List<DscMatchFailRecord2AlixDto> matchFailRecordLis;
public String getCapitalCode() {
return capitalCode;
}
public void setCapitalCode(String capitalCode) {
this.capitalCode = capitalCode;
}
public String getCapitalName() {
return capitalName;
}
public void setCapitalName(String capitalName) {
this.capitalName = capitalName;
}
public Boolean getSuccessFlag() {
return successFlag;
}
public void setSuccessFlag(Boolean successFlag) {
this.successFlag = successFlag;
}
public List<DscMatchFailRecord2AlixDto> getMatchFailRecordLis() {
return matchFailRecordLis;
}
public void setMatchFailRecordLis(List<DscMatchFailRecord2AlixDto> matchFailRecordLis) {
this.matchFailRecordLis = matchFailRecordLis;
}
}
|
/* First created by JCasGen Thu Dec 03 22:20:17 CET 2015 */
package de.unidue.langtech.teaching.rp.type;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.JCasRegistry;
import org.apache.uima.jcas.cas.TOP_Type;
import org.apache.uima.jcas.tcas.Annotation;
/**
* Updated by JCasGen Thu Dec 03 22:20:17 CET 2015
* XML source: C:/Users/Onur/git/research-project/de.unidue.langtech.teaching.rp.os/src/main/resources/desc/type/TimerAnnotation.xml
* @generated */
public class TimerAnnotation extends Annotation {
/** @generated
* @ordered
*/
@SuppressWarnings ("hiding")
public final static int typeIndexID = JCasRegistry.register(TimerAnnotation.class);
/** @generated
* @ordered
*/
@SuppressWarnings ("hiding")
public final static int type = typeIndexID;
/** @generated
* @return index of the type
*/
@Override
public int getTypeIndexID() {return typeIndexID;}
/** Never called. Disable default constructor
* @generated */
protected TimerAnnotation() {/* intentionally empty block */}
/** Internal - constructor used by generator
* @generated
* @param addr low level Feature Structure reference
* @param type the type of this Feature Structure
*/
public TimerAnnotation(int addr, TOP_Type type) {
super(addr, type);
readObject();
}
/** @generated
* @param jcas JCas to which this Feature Structure belongs
*/
public TimerAnnotation(JCas jcas) {
super(jcas);
readObject();
}
/** @generated
* @param jcas JCas to which this Feature Structure belongs
* @param begin offset to the begin spot in the SofA
* @param end offset to the end spot in the SofA
*/
public TimerAnnotation(JCas jcas, int begin, int end) {
super(jcas);
setBegin(begin);
setEnd(end);
readObject();
}
/**
* <!-- begin-user-doc -->
* Write your own initialization here
* <!-- end-user-doc -->
*
* @generated modifiable
*/
private void readObject() {/*default - does nothing empty block */}
//*--------------*
//* Feature: startTime
/** getter for startTime - gets
* @generated
* @return value of the feature
*/
public long getStartTime() {
if (TimerAnnotation_Type.featOkTst && ((TimerAnnotation_Type)jcasType).casFeat_startTime == null)
jcasType.jcas.throwFeatMissing("startTime", "de.unidue.langtech.teaching.rp.type.TimerAnnotation");
return jcasType.ll_cas.ll_getLongValue(addr, ((TimerAnnotation_Type)jcasType).casFeatCode_startTime);}
/** setter for startTime - sets
* @generated
* @param v value to set into the feature
*/
public void setStartTime(long v) {
if (TimerAnnotation_Type.featOkTst && ((TimerAnnotation_Type)jcasType).casFeat_startTime == null)
jcasType.jcas.throwFeatMissing("startTime", "de.unidue.langtech.teaching.rp.type.TimerAnnotation");
jcasType.ll_cas.ll_setLongValue(addr, ((TimerAnnotation_Type)jcasType).casFeatCode_startTime, v);}
//*--------------*
//* Feature: endTime
/** getter for endTime - gets
* @generated
* @return value of the feature
*/
public long getEndTime() {
if (TimerAnnotation_Type.featOkTst && ((TimerAnnotation_Type)jcasType).casFeat_endTime == null)
jcasType.jcas.throwFeatMissing("endTime", "de.unidue.langtech.teaching.rp.type.TimerAnnotation");
return jcasType.ll_cas.ll_getLongValue(addr, ((TimerAnnotation_Type)jcasType).casFeatCode_endTime);}
/** setter for endTime - sets
* @generated
* @param v value to set into the feature
*/
public void setEndTime(long v) {
if (TimerAnnotation_Type.featOkTst && ((TimerAnnotation_Type)jcasType).casFeat_endTime == null)
jcasType.jcas.throwFeatMissing("endTime", "de.unidue.langtech.teaching.rp.type.TimerAnnotation");
jcasType.ll_cas.ll_setLongValue(addr, ((TimerAnnotation_Type)jcasType).casFeatCode_endTime, v);}
//*--------------*
//* Feature: name
/** getter for name - gets The name of the timer.
Used to automatically determine whether this is an upstream or downstream timer.
* @generated
* @return value of the feature
*/
public String getName() {
if (TimerAnnotation_Type.featOkTst && ((TimerAnnotation_Type)jcasType).casFeat_name == null)
jcasType.jcas.throwFeatMissing("name", "de.unidue.langtech.teaching.rp.type.TimerAnnotation");
return jcasType.ll_cas.ll_getStringValue(addr, ((TimerAnnotation_Type)jcasType).casFeatCode_name);}
/** setter for name - sets The name of the timer.
Used to automatically determine whether this is an upstream or downstream timer.
* @generated
* @param v value to set into the feature
*/
public void setName(String v) {
if (TimerAnnotation_Type.featOkTst && ((TimerAnnotation_Type)jcasType).casFeat_name == null)
jcasType.jcas.throwFeatMissing("name", "de.unidue.langtech.teaching.rp.type.TimerAnnotation");
jcasType.ll_cas.ll_setStringValue(addr, ((TimerAnnotation_Type)jcasType).casFeatCode_name, v);}
}
|
package MonteCarlo;
public class StockGenerator extends StockPath {
protected Option option;
protected double lastprice;
public StockGenerator(Option option) {
this.option = option;
}
/**
* For an European option, we only need to know the price of the closing
* date. We need only one random variable to get that price using the
* Geometric Brownian Formula.
*/
public double getPrices(float normalvar) {
lastprice = option.initialPrice * Math
.exp((option.getInterestRate() - option.getvolatility() * option.getvolatility() / 2) * option.period
+ option.getvolatility() * Math.sqrt(option.period) * normalvar);
return lastprice;
}
}
|
package pl.cwanix.opensun.agentserver.packets.s2c.character;
import org.apache.commons.lang3.ArrayUtils;
import pl.cwanix.opensun.agentserver.packets.AgentServerPacketOPCode;
import pl.cwanix.opensun.commonserver.packets.Packet;
import pl.cwanix.opensun.commonserver.packets.annotations.OutgoingPacket;
import pl.cwanix.opensun.utils.datatypes.FixedLengthField;
@SuppressWarnings("checkstyle:MagicNumber")
@OutgoingPacket(category = AgentServerPacketOPCode.Character.CATEGORY, operation = AgentServerPacketOPCode.Character.Err.CREATE_CHAR)
public class S2CErrCreateCharPacket implements Packet {
private final FixedLengthField errorCode;
public S2CErrCreateCharPacket() {
errorCode = new FixedLengthField(4);
}
@Override
public Object[] getOrderedFields() {
return ArrayUtils.toArray(errorCode);
}
}
|
package stream_ornekler;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.stream.Stream;
public class Stream06_Files {
public static void main(String[] args) throws IOException {
// File islemleri yaparken Java 'ya dosyayi bulamazsam' diye hata verir.
// Bunun onune gecebilmek icin throws IOException eklememiz gerekir.
Stream<String> satirlar = Files.lines(Path.of("src/stream_ornekler/mars.txt"));
// Dosyamizi stream e cevirdik. (marsimiz string oldugu icin data type string olmali)
satirlar.forEach(System.out::println);
System.out.println("=======================================");
// satirlar.map(String :: toUpperCase).forEach(System.out::println);
// Exception in thread "main" java.lang.IllegalStateException: stream has already been operated
// Stream akan su gibi dusunmek lazm su akar gider ve giden su bir daha bulunamaz
// Dolayisiyla 13. satirda for each koydugumuzda stream'i kullandik bitti
// Artik ayni sekilde ona erisemeyiz icinde ki veriler Garbage Collector tarafindan silinms oldu
// Yeniden tanimlama yapmamiz gerekiyor
// Her defasinda bu sekilde path almak ugrastiricidir.
// Path'imizi bir string olarak tanimlayip kullanabiliriz.
// Genel kullanim bu sekildedir
String path = "src/stream_ornekler/mars.txt";
// dogrudan stream'i alip bu sekilde kullanabiliriz
// Files'in tum elemanlarini buyuk harfle yazdiralim
Files.lines(Path.of(path)).
map(t->t.toUpperCase()).
forEach(System.out::println);
System.out.println("=======================================");
// Dosyadan sadece ilk satiri okuyarak Buyuk Harf olarak konsola yazdiralim
Files.lines(Path.of(path)).
limit(1).
map(String::toUpperCase).
map(t->t.toUpperCase()).
forEach(System.out::println);
System.out.println("=======================================");
// Sadece 3 ve 4. satirlari almak istiyoruz
//Files.lines(Path.of(path)).limit(4).skip(2).forEach(System.out::println);
Files.lines(Path.of(path)).
skip(2).
limit(2).
map(t->t.toUpperCase()).
forEach(System.out::println);
System.out.println("=======================================");
// "Bu" kelimesi(kucuk veya buyuk) mars icinde kac adet geciyor yazdiralim
System.out.println(Files.lines(Path.of(path)).
map(t->t.toLowerCase()).
filter(t-> t.contains("bu")).count());
System.out.println("=======================================");
// Dosyada ki tum farkli kelimeleri alt alta yazdiralim
// Her satiri bir eleman olarak kabul ediyor. Ama biz her satir degil her kelime
// uzerinde islem yapmak istiyoruz.
// Kelimeleri boldugumuzde Nested gibi bir yapi olusur.
// kelimeler satir elemanlarinin alt elemanlaridir.. Flatmap methodu
Files.lines(Path.of(path)).
map(t->t.toLowerCase().split(" ")).
flatMap(Arrays::stream).// parantez icine donusturmek istedigimiz turu yaziyoruz.
// Arrays classindan stream turune cevirmek istiyorum
// kelimelrden olusan tek bir liste olusturmus olduk
// tum elemanlar tren gibi siralandi ve duzlesti
distinct().
forEach(System.out::println);
System.out.println("=======================================");
// Kelimeler icerisinde M veya m harfi olanlari sayalim ve sonucu konsola yazdiralim
long mSayisi = Files.lines(Path.of(path)).
map(t->t.toLowerCase().split("")).
flatMap(Arrays::stream).
filter(t->t.contains("m")).
count();
System.out.println("M harfinin sayisi " + mSayisi);
System.out.println("=======================================");
// Boşluk ve noktalama işaretleri hariç dosyada kaç adet karakter kullanıldığını
// hesaplayarak sonucu konsola yazdıran uygulamayı yazınız.
// \\W "a-z" & "A-Z" & "8-9" & "_" haric tum karakterler demektir
System.out.println(Files.lines(Path.of(path)).
map(t->t.replace("_",""). // _ gorursek onu sil demis olduk
replaceAll("\\W","").split("")).
flatMap(Arrays::stream).
count());
}
}
|
package tests;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import pages.Accessorials;
import pages.Login;
import utilities.CommonFunctions;
import utilities.ExceptionalHandlingFunctions;
import utilities.PropertyFileUtility;
public class AccessorialsTest {
WebDriver driver;
Login loginToApplication;
Accessorials accessorialDetails;
PropertyFileUtility propertyValue = new PropertyFileUtility("./Files/"+"/DataFile.properties");
CommonFunctions utilityfunctions = new CommonFunctions(driver);
@BeforeMethod
public void start()
{
System.setProperty("webdriver.chrome.driver", "./ExternalFiles/"+"/chromedriver.exe");
driver=new ChromeDriver();
driver.manage().window().maximize();
driver.navigate().to(propertyValue.getValue("TestingURL"));
loginToApplication=new Login(driver);
loginToApplication.LoginToApplication(propertyValue.getValue("loginUserName"),propertyValue.getValue("loginPassword"));
}
@Test
public void accessorialsCheckBoxValidation() throws Exception
{
try {
Thread.sleep(4000);
accessorialDetails = new Accessorials(driver);
//Test to verify the accessorial check boxes when Checked
accessorialDetails.setAccessorials();
Assert.assertTrue(driver.findElement(By.xpath("//label[contains(text(),'Notify Before Delivery')]/preceding::input[@type='checkbox'][1]")).isSelected());
Assert.assertTrue(driver.findElement(By.xpath("//label[contains(text(),'Construction Site Pickup')]/preceding::input[@type='checkbox'][1]")).isSelected());
Assert.assertTrue(driver.findElement(By.xpath("//label[contains(text(),'Construction Site Delivery')]/preceding::input[@type='checkbox'][1]")).isSelected());
Assert.assertTrue(driver.findElement(By.xpath("//label[contains(text(),'Lift Gate Service Pickup')]/preceding::input[@type='checkbox'][1]")).isSelected());
Assert.assertTrue(driver.findElement(By.xpath("//label[contains(text(),'Lift Gate Service Delivery')]/preceding::input[@type='checkbox'][1]")).isSelected());
Assert.assertTrue(driver.findElement(By.xpath("//label[contains(text(),'Limited Access Pickup')]/preceding::input[@type='checkbox'][1]")).isSelected());
Assert.assertTrue(driver.findElement(By.xpath("//label[contains(text(),'Limited Access Delivery')]/preceding::input[@type='checkbox'][1]")).isSelected());
Assert.assertTrue(driver.findElement(By.xpath("//label[contains(text(),'Residential Pickup')]/preceding::input[@type='checkbox'][1]")).isSelected());
Assert.assertTrue(driver.findElement(By.xpath("//label[contains(text(),'Residential Delivery')]/preceding::input[@type='checkbox'][1]")).isSelected());
Assert.assertTrue(driver.findElement(By.xpath("//label[contains(text(),'Hazardous Material')]/preceding::input[@type='checkbox'][1]")).isSelected());
// Assert.assertTrue(driver.findElement(By.xpath("//label[contains(text(),'Insurance')]/preceding::input[@type='checkbox'][1]")).isSelected());
System.out.println("Validated for all the accessorial items checkbox; gets selected when checked by the user. ");
//Test to verify the accessorial check boxes when Unchecked
accessorialDetails.setAccessorials();
Assert.assertFalse(driver.findElement(By.xpath("//label[contains(text(),'Notify Before Delivery')]/preceding::input[@type='checkbox'][1]")).isSelected());
Assert.assertFalse(driver.findElement(By.xpath("//label[contains(text(),'Construction Site Pickup')]/preceding::input[@type='checkbox'][1]")).isSelected());
Assert.assertFalse(driver.findElement(By.xpath("//label[contains(text(),'Construction Site Delivery')]/preceding::input[@type='checkbox'][1]")).isSelected());
Assert.assertFalse(driver.findElement(By.xpath("//label[contains(text(),'Lift Gate Service Pickup')]/preceding::input[@type='checkbox'][1]")).isSelected());
Assert.assertFalse(driver.findElement(By.xpath("//label[contains(text(),'Lift Gate Service Delivery')]/preceding::input[@type='checkbox'][1]")).isSelected());
Assert.assertFalse(driver.findElement(By.xpath("//label[contains(text(),'Limited Access Pickup')]/preceding::input[@type='checkbox'][1]")).isSelected());
Assert.assertFalse(driver.findElement(By.xpath("//label[contains(text(),'Limited Access Delivery')]/preceding::input[@type='checkbox'][1]")).isSelected());
Assert.assertFalse(driver.findElement(By.xpath("//label[contains(text(),'Residential Pickup')]/preceding::input[@type='checkbox'][1]")).isSelected());
Assert.assertFalse(driver.findElement(By.xpath("//label[contains(text(),'Residential Delivery')]/preceding::input[@type='checkbox'][1]")).isSelected());
Assert.assertFalse(driver.findElement(By.xpath("//label[contains(text(),'Hazardous Material')]/preceding::input[@type='checkbox'][1]")).isSelected());
//Assert.assertFalse(driver.findElement(By.xpath("//label[contains(text(),'Insurance')]/preceding::input[@type='checkbox'][1]")).isSelected());
System.out.println("Validated for all the accessorial items checkbox; gets unselected when unchecked by the user.");
}
catch (Exception e) {
System.out.println(e);
Assert.fail();
ExceptionalHandlingFunctions.captureScreenShot(driver, Thread.currentThread().getStackTrace()[1].getMethodName());
ExceptionalHandlingFunctions.writeTOLog(e.getMessage(),Thread.currentThread().getStackTrace()[1].getMethodName());
}
}
@AfterMethod
public void close()
{
driver.close();
}
}
|
package com.xxw.pattern.factory;
import com.xxw.pattern.factory.entity.Mouse;
/**
* @author xiongxianwei
* 2020/6/5 0005
*/
public interface MouseFactory {
Mouse createMouse();
}
|
package com.udacity.gradle.builditbigger.paid;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.Toast;
import com.example.Joker;
import com.example.androidjokelibrary.AndroidLibActivity;
import com.udacity.gradle.builditbigger.EndpointsAsyncTask;
import com.udacity.gradle.builditbigger.R;
/**
* A simple {@link Fragment} subclass.
*/
public class MainActivityFragment extends Fragment implements EndpointsAsyncTask.EndpointResponseInterface {
private ProgressBar progressBar;
Button buttonJoke;
public MainActivityFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_main_activity, container, false);
buttonJoke = (Button) root.findViewById(R.id.buttonJoke);
progressBar = (ProgressBar) root.findViewById(R.id.progressBar);
progressBar.setVisibility(View.INVISIBLE);
buttonJoke.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v) {
new EndpointsAsyncTask(MainActivityFragment.this).execute();
progressBar.setVisibility(View.VISIBLE);
}
}
);
return root;
}
@Override
public void onResponse(boolean isSuccess, String result) {
progressBar.setVisibility(View.INVISIBLE);
if (isSuccess) {
Intent displayIntent = new Intent(getActivity(), AndroidLibActivity.class);
displayIntent.putExtra("jokeToDisplay", result);
startActivity(displayIntent);
Toast.makeText(getActivity(), result, Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getActivity(), getResources().getString(R.string.error) + result, Toast.LENGTH_LONG).show();
}
}
}
|
import java.util.Stack;
/**
*
* Question - sort stack
* Created by Yu Zheng on 9/21/2015
*
* idea: just use a temp to store the unsort stack top element, and transfer element
* from sort stack to unsort stack, if the sort stack top element less than the temp,
* just insert the element into the sort stack
*
*/
public class Solution05 {
public static Stack<Integer> sortstack(Stack<Integer> unsort) {
Stack<Integer> sort = new Stack<Integer>();
while(!unsort.empty()) {
int temp = unsort.pop();
while(!sort.empty() && sort.peek() < temp) {
unsort.push(sort.pop());
}
sort.push(temp);
}
return sort;
}
public static void main(String [] args) {
Stack<Integer> a = new Stack<Integer>();
a.push(3);
a.push(1);
a.push(2);
a.push(4);
a = sortstack(a);
System.out.println(a.pop());
System.out.println(a.pop());
System.out.println(a.pop());
System.out.println(a.pop());
}
}
|
package com.eluniversal.test.core.petitions;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import com.eluniversal.test.core.catalogs.PetitionParams;
import com.eluniversal.test.core.catalogs.Server;
import com.eluniversal.test.core.entities.News;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
public class AsyncPetition extends AsyncTask<Petition, Void, Object>
{
@Override
public Object doInBackground(Petition... params)
{
if (params != null)
{
Petition petition = params[0];
String json = new String();
Object objResult = null;
String petitionUri = Server.getUri();
Object obj = petition.getBeans();
try
{
switch (petition.getEntity())
{
case entertainment:
petitionUri += "espectaculos/";
if (petition.containsParam(PetitionParams.pageNumber))
petitionUri += petition.get(PetitionParams.pageNumber) + "";
if (petition.containsParam(PetitionParams.pageSize))
petitionUri += "/" + petition.get(PetitionParams.pageSize);
objResult = new News();
break;
case image:
String imageUri = null;
URL url;
if (petition.containsParam(PetitionParams.imageUri))
imageUri = (String)petition.get(PetitionParams.imageUri);
try
{
url = new URL(imageUri);
InputStream is = url.openConnection().getInputStream();
final Bitmap bmp = BitmapFactory.decodeStream(is);
return bmp;
/*if (bmp != null)
{
return Bitmap.createScaledBitmap(
bmp,
THUMBNAIL_SIZE,
THUMBNAIL_SIZE,
false);
}*/
}
catch (MalformedURLException e)
{
e.printStackTrace();
}
catch (IOException ex)
{
ex.printStackTrace();
}
break;
default:
break;
}
HttpURLConnection connection = createURLConnection(petitionUri, petition, json);
InputStream inputStream = new BufferedInputStream(connection.getInputStream());
String jsonResult = JsonBuilder.convertInputStreamToString(inputStream);
if (jsonResult != null)
{
if (jsonResult.contains("errorId") || jsonResult.contains("errorCode") || jsonResult.isEmpty())
return null;
objResult = JsonBuilder.parseEntity(jsonResult, objResult);
return objResult;
}
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
}
return null;
}
@Override
public void onPostExecute(Object obj)
{
}
private HttpURLConnection createURLConnection(String petitionUri, Petition petition, String json) throws Exception
{
HttpURLConnection httpURLConnection = null;
OutputStream outputStream = null;
try
{
URL url = new URL(petitionUri);
httpURLConnection = (HttpURLConnection)url.openConnection();
switch (petition.getFunction())
{
case add:
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setRequestProperty("Content-Type", "application/json");
httpURLConnection.setRequestProperty("Accept", "application/json");
outputStream = httpURLConnection.getOutputStream();
outputStream.write(json.getBytes("UTF-8"));
outputStream.close();
break;
case query:
case detail:
httpURLConnection.setRequestMethod("GET");
break;
case modify:
httpURLConnection.setRequestMethod("PUT");
httpURLConnection.setRequestProperty("Content-Type", "application/json");
httpURLConnection.setRequestProperty("Accept", "application/json");
outputStream = httpURLConnection.getOutputStream();
outputStream.write(json.getBytes("UTF-8"));
outputStream.close();
break;
default:
httpURLConnection.setRequestMethod("GET");
break;
}
}
catch (MalformedURLException e)
{
e.printStackTrace();
return null;
}
return httpURLConnection;
}
}
|
package com.mx.profuturo.bolsa.model.recruitment.dto.form;
public class SERMRStageForm extends BasicForm {
}
|
package org.sbbs.app.demo.dao;
import org.sbbs.app.demo.model.DemoEntity;
import org.sbbs.base.dao.IBaseDAO;
public interface DemoEntityDao extends IBaseDAO<DemoEntity, Long> {
}
|
package org.wikipedia.wikidata;
import org.wikipedia.ApiTask;
import org.mediawiki.api.json.Api;
import org.mediawiki.api.json.ApiResult;
import org.mediawiki.api.json.RequestBuilder;
import org.json.JSONObject;
import android.text.TextUtils;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* Retrieves descriptions for given language and IDs from Wikidata.
*/
public class WikidataDescriptionsTask extends ApiTask<Map<String, String>> {
private final String language;
private final List<String> idList;
public WikidataDescriptionsTask(Api api, String language, List<String> idList) {
super(LOW_CONCURRENCY, api);
this.language = language;
this.idList = idList;
}
@Override
public RequestBuilder buildRequest(Api api) {
return api.action("wbgetentities")
.param("props", "descriptions")
.param("languages", language)
.param("ids", TextUtils.join("|", idList));
}
@Override
public Map<String, String> processResult(ApiResult result) throws Throwable {
Map<String, String> map = new HashMap<String, String>();
JSONObject data = result.asObject();
JSONObject entities = data.getJSONObject("entities");
Iterator<String> keys = entities.keys();
while (keys.hasNext()) {
String key = keys.next();
JSONObject entity = entities.getJSONObject(key);
JSONObject descriptions = entity.optJSONObject("descriptions");
if (descriptions != null && descriptions.has(language)) {
JSONObject langEntry = descriptions.getJSONObject(language);
String value = langEntry.optString("value");
//Capitalise the first letter of the description, for style
value = value.substring(0, 1).toUpperCase() + value.substring(1);
map.put(key, value);
}
}
return map;
}
}
|
package com.rsm.yuri.projecttaxilivredriver.main.di;
//import androidx.core.app.Fragment;
//import androidx.core.app.FragmentManager;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import com.rsm.yuri.projecttaxilivredriver.domain.FirebaseAPI;
import com.rsm.yuri.projecttaxilivredriver.lib.base.EventBus;
import com.rsm.yuri.projecttaxilivredriver.main.MainInteractor;
import com.rsm.yuri.projecttaxilivredriver.main.MainInteractorImpl;
import com.rsm.yuri.projecttaxilivredriver.main.MainPresenter;
import com.rsm.yuri.projecttaxilivredriver.main.MainPresenterImpl;
import com.rsm.yuri.projecttaxilivredriver.main.MainRepository;
import com.rsm.yuri.projecttaxilivredriver.main.MainRepositoryImpl;
import com.rsm.yuri.projecttaxilivredriver.main.SessionInteractor;
import com.rsm.yuri.projecttaxilivredriver.main.SessionInteractorImpl;
import com.rsm.yuri.projecttaxilivredriver.main.ui.MainView;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
/**
* Created by yuri_ on 15/01/2018.
*/
@Module
public class MainModule {
private MainView view;
private Fragment[] fragments;
private FragmentManager fragmentManager;
public MainModule(MainView view, FragmentManager fragmentManager, Fragment[] fragments){
this.view = view;
this.fragments = fragments;
this.fragmentManager = fragmentManager;
}
@Provides
@Singleton
MainView providesMainView(){
return this.view;
}
@Provides @Singleton
Fragment[] providesFragmentArray(){
return this.fragments;
}
@Provides
@Singleton
FragmentManager providesFragmentManager(){
return fragmentManager;
}
@Provides
@Singleton
MainPresenter providesMainPresenter(EventBus eventBus, MainView mainView, MainInteractor mainInteractor, SessionInteractor sessionInteractor) {
return new MainPresenterImpl(eventBus, mainView, mainInteractor, sessionInteractor);
}
@Provides @Singleton
MainInteractor providesMainInteractor(MainRepository repository) {
return new MainInteractorImpl(repository);
}
@Provides @Singleton
SessionInteractor providesSessionInteractor(MainRepository repository) {
return new SessionInteractorImpl(repository);
}
@Provides @Singleton
MainRepository providesMainRepository(FirebaseAPI firebase, EventBus eventBus) {
return new MainRepositoryImpl(eventBus, firebase);
}
}
|
package com.tan.wanandroid.common.baseadapter;
import android.view.View;
/**
*
*/
public interface OnItemLongClickListener<T> {
public void onLongClick(View view, T t, int position);
}
|
package com.mperezi.springtasksapp.domain;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import java.io.Serializable;
import java.time.LocalDateTime;
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Task implements Serializable {
@Id
@GeneratedValue
private Long id;
private String title;
@Lob
private String notes;
private boolean finished;
@CreationTimestamp
private LocalDateTime createdAt;
@UpdateTimestamp
private LocalDateTime updatedAt;
} |
/*
* Copyright (c) 2013 M-Way Solutions GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jenkinsci.plugins.relution_publisher.configuration.global;
import hudson.Extension;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;
import java.util.ArrayList;
import java.util.List;
import jenkins.model.GlobalConfiguration;
/**
* Saves and restores the global configuration used by the plugin.
*/
@Extension
public class StoreConfiguration extends GlobalConfiguration {
public final static String KEY_STORES = "stores";
public final static String KEY_PROXY_URL = "proxyHost";
public final static String KEY_PROXY_PORT = "proxyPort";
private final List<Store> stores = new ArrayList<Store>();
private String proxyHost;
private int proxyPort;
/**
* Initializes a new instance of the {@link StoreConfiguration} class.
*/
@DataBoundConstructor
public StoreConfiguration() {
this.load();
}
private void addStores(final JSONArray storesJsonArray) {
for (int n = 0; n < storesJsonArray.size(); n++) {
final JSONObject store = storesJsonArray.getJSONObject(n);
this.addStore(store);
}
}
private void addStore(final JSONObject storeJsonObject) {
final Store store = new Store(storeJsonObject);
this.stores.add(store);
}
/**
* This human readable name is used in the configuration screen.
*/
@Override
public String getDisplayName() {
return "";
}
@Override
public boolean configure(final StaplerRequest req, final JSONObject json) throws FormException {
System.out.println(json.toString());
this.stores.clear();
final Object jsonEntity = json.get(KEY_STORES);
if (jsonEntity instanceof JSONArray) {
final JSONArray stores = (JSONArray) jsonEntity;
this.addStores(stores);
} else if (jsonEntity instanceof JSONObject) {
final JSONObject store = (JSONObject) jsonEntity;
this.addStore(store);
}
this.proxyHost = json.getString(KEY_PROXY_URL);
this.proxyPort = json.optInt(KEY_PROXY_PORT, 0);
this.save();
return false;
}
/**
* Gets the list of {@link Store}s configured for this publisher.
*/
public List<Store> getStores() {
return this.stores;
}
/**
* Gets the store with the specified identifier.
* @param storeId A store's {@link Store#getIdentifier() identifier}.
* @return The {@link Store} with the specified id, or <code>null</code> if no such store
* exists.
*/
public Store getStore(final String storeId) {
if (this.stores == null) {
return null;
}
for (final Store store : this.stores) {
if (store.getIdentifier().equals(storeId)) {
return store;
}
}
return null;
}
/**
* Gets the host name of the proxy server to use.
*/
public String getProxyHost() {
return this.proxyHost;
}
/**
* Sets the host name of the proxy server to use.
* @param proxyHost A host name.
*/
public void setProxyHost(final String proxyHost) {
this.proxyHost = proxyHost;
}
/**
* Gets the port number of the proxy server to use.
*/
public int getProxyPort() {
return this.proxyPort;
}
/**
* Sets the port number of the proxy server to use.
* @param proxyPort A port number.
*/
public void setProxyPort(final int proxyPort) {
this.proxyPort = proxyPort;
}
}
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
package org.apache.clerezza.dataset;
import org.apache.clerezza.Graph;
import org.apache.clerezza.IRI;
import org.apache.clerezza.ImmutableGraph;
import org.apache.clerezza.implementation.in_memory.SimpleGraph;
import org.apache.clerezza.implementation.graph.WriteBlockedGraph;
import org.apache.clerezza.dataset.security.TcAccessController;
import org.apache.clerezza.sparql.*;
import org.apache.clerezza.sparql.query.*;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.component.ComponentContext;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.component.annotations.ReferenceCardinality;
import org.osgi.service.component.annotations.ReferencePolicy;
import java.security.AccessControlException;
import java.util.*;
/**
* This class extends <code>TcProviderMultiplexer</code>, delegating the actual provision and creation of
* Graphs or MGraphs to registered <code>WeightedTcProvider</code>s. The class attempts to satisfy the
* request using the registered <code>WeightedTcProvider</code> in decreasing order of weight. If multiple
* providers have the same weight the lexicographical order of the fully qualified class name determines
* which one is used, namely the one that occurs earlier. If a call to a registered provider causes an
* <code>IllegalArgumentException</code>,
* <code>NoSuchEntityException</code> or
* <code>UnsupportedOperationException</code> then the call is delegated to the
* next provider.
*
* Only one instance of this class should exist in a system, the public no
* argument constructor is meant for initialization by dependency injection
* systems such as OSGi-DS. Applications should use the static
* <code>getInstance()</code> method if they aren't using a framework that
* injects them the instance.
*
* This class returns
* <code>Graph</code>s a subtype of
* <code>Graph</code> that allows read/write locks.
*
* This class also registers all Graphs as services with the property
* 'name' indicating there name.
*
* Security checks are done when a Graph is retrieved. The returned
* Graph will do no further security checks. Because of this it
* should not be passed to a context where different access control applies. If
* an Graph is retrieved without having write permission the returned graph
* will be read-only.
*
* If a Graphs needs to passed around across different security
* contexts the one retrieved from the OSGi service whiteboard should be used as
* this performs access control on every access.
*
* @author reto, mir, hasan
*
*/
//immedia is set to true as this should register the ImmutableGraph services (even if manager service is not required)
@Component(service = TcManager.class, immediate = true,
property={
"graph.cache.enabled=true",
"Graph.services.enabled=true"})
public class TcManager extends TcProviderMultiplexer implements GraphStore {
public final static String GENERAL_PURPOSE_TC = "general.purpose.tc";
public final static String Graph_SERVICES_ENABLED = "Graph.services.enabled";
public final static String MGRAPH_CACHE_ENABLED = "graph.cache.enabled";
private static volatile TcManager instance;
private TcAccessController tcAccessController = new TcAccessController() {
@Override
protected TcManager getTcManager() {
return TcManager.this;
}
};
private Map<IRI, ServiceRegistration> serviceRegistrations = Collections
.synchronizedMap(new HashMap<IRI, ServiceRegistration>());
protected QueryEngine queryEngine;
private boolean isActivated = false;
private boolean isTcServicesEnabled = true;
private ComponentContext componentContext;
protected SortedSet<WeightedTcProvider> tempProviderList = new TreeSet<WeightedTcProvider>(
new WeightedProviderComparator());
/**
* the constructor sets the singleton instance to allow instantiation by
* OSGi-DS. This constructor should not be called except by OSGi-DS,
* otherwise the static
* <code>getInstance</code> method should be used.
*/
public TcManager() {
TcManager.instance = this;
}
/**
* This returns the singleton instance. If an instance has been previously
* created (e.g. by OSGi declarative services) this instance is returned,
* otherwise a new instance is created and providers are injected using the
* service provider interface (META-INF/services/)
*
* @return the singleton instance
*/
public static TcManager getInstance() {
if (instance == null) {
synchronized (TcManager.class) {
if (instance == null) {
instance = new TcManager();
instance.isActivated = true;
Iterator<WeightedTcProvider> weightedProviders = ServiceLoader.load(WeightedTcProvider.class).iterator();
while (weightedProviders.hasNext()) {
WeightedTcProvider weightedProvider = weightedProviders.next();
instance.bindWeightedTcProvider(weightedProvider);
}
Iterator<QueryEngine> queryEngines = ServiceLoader.load(QueryEngine.class).iterator();
System.out.println("looking for QE");
if (queryEngines.hasNext()) {
instance.queryEngine = queryEngines.next();
System.out.println("QE: " + instance.queryEngine.getClass());
}
}
}
}
return instance;
}
protected void activate(final ComponentContext componentContext) {
this.componentContext = componentContext;
// Read configuration
isTcServicesEnabled = true;
Object configTcServicesEnabled = componentContext.getProperties().get(Graph_SERVICES_ENABLED);
if ( configTcServicesEnabled != null && configTcServicesEnabled instanceof String ) {
isTcServicesEnabled = Boolean.valueOf((String)configTcServicesEnabled);
}
Object configCacheEnabled = componentContext.getProperties().get(MGRAPH_CACHE_ENABLED);
if ( configCacheEnabled != null && configCacheEnabled instanceof String ) {
setCachingEnabled(Boolean.valueOf((String)configCacheEnabled));
}
isActivated = true;
for (WeightedTcProvider provider : tempProviderList) {
addWeightedTcProvider(provider);
}
tempProviderList.clear();
}
protected void deactivate(final ComponentContext componentContext) {
for (ServiceRegistration registration : serviceRegistrations.values()) {
registration.unregister();
}
serviceRegistrations.clear();
this.componentContext = null;
isActivated = false;
}
@Override
public ImmutableGraph getImmutableGraph(IRI name) throws NoSuchEntityException {
tcAccessController.checkReadPermission(name);
return super.getImmutableGraph(name);
}
@Override
public Graph getMGraph(IRI name) {
try {
tcAccessController.checkReadWritePermission(name);
} catch (AccessControlException e) {
tcAccessController.checkReadPermission(name);
return new WriteBlockedGraph(super.getMGraph(name));
}
return super.getMGraph(name);
}
@Override
public Graph getGraph(IRI name) {
try {
tcAccessController.checkReadWritePermission(name);
} catch (AccessControlException e) {
tcAccessController.checkReadPermission(name);
return new WriteBlockedGraph(super.getGraph(name));
}
return super.getGraph(name);
}
@Override
public Graph createGraph(IRI name)
throws UnsupportedOperationException {
tcAccessController.checkReadWritePermission(name);
return super.createGraph(name);
}
@Override
public ImmutableGraph createImmutableGraph(IRI name, Graph triples) {
tcAccessController.checkReadWritePermission(name);
return super.createImmutableGraph(name, triples);
}
@Override
public void deleteGraph(IRI name) {
tcAccessController.checkReadWritePermission(name);
super.deleteGraph(name);
}
@Override
public Set<IRI> getNames(ImmutableGraph ImmutableGraph) {
return super.getNames(ImmutableGraph);
}
@Override
public Set<IRI> listNamedGraphs() {
return this.listGraphs();
}
@Override
public Set<IRI> listGraphs() {
Set<IRI> result = super.listGraphs();
return excludeNonReadable(result);
}
@Override
public Set<IRI> listMGraphs() {
Set<IRI> result = super.listMGraphs();
return excludeNonReadable(result);
}
@Override
public Set<IRI> listImmutableGraphs() {
Set<IRI> result = super.listImmutableGraphs();
return excludeNonReadable(result);
}
private Set<IRI> excludeNonReadable(Set<IRI> tcNames) {
SecurityManager security = System.getSecurityManager();
if (security == null) {
return tcNames;
}
Set<IRI> result = new HashSet<IRI>();
for (IRI name : tcNames) {
try {
tcAccessController.checkReadPermission(name);
} catch (AccessControlException e) {
continue;
}
result.add(name);
}
return result;
}
/**
* Executes any sparql query. The type of the result object will vary
* depending on the type of the query. If the defaultGraph is available
* in this TcManages executeSparqlQuery(String, UriRef) should be used instead.
*
* @param query the sparql query to execute
* @param defaultGraph the default ImmutableGraph against which to execute the query
* if no FROM clause is present
* @return the resulting ResultSet, ImmutableGraph or Boolean value
*/
public Object executeSparqlQuery(String query, Graph defaultGraph) throws ParseException {
TcProvider singleTargetTcProvider = null;
final IRI defaultGraphName = new IRI("urn:x-temp:/kjsfadfhfasdffds");
final SparqlPreParser sparqlPreParser = new SparqlPreParser(this);
final Set<IRI> referencedGraphs = sparqlPreParser.getReferredGraphs(query, defaultGraphName);
if ((referencedGraphs != null) && (!referencedGraphs.contains(defaultGraphName))) {
singleTargetTcProvider = getSingleTargetTcProvider(referencedGraphs);
}
if ((singleTargetTcProvider != null) && (singleTargetTcProvider instanceof QueryableTcProvider)) {
return ((QueryableTcProvider) singleTargetTcProvider).executeSparqlQuery(query, null);
}
final QueryEngine queryEngine = this.queryEngine;
if (queryEngine != null) {
return queryEngine.execute(this, defaultGraph, query);
} else {
throw new NoQueryEngineException();
}
}
/**
* Executes any sparql query. The type of the result object will vary
* depending on the type of the query. Note that this method only works for
* queries that do not need a default ImmutableGraph.
*
* @param query the sparql query to execute
* @param forceFastlane indicate whether to force fastlane usage.
* @return the resulting ResultSet, ImmutableGraph or Boolean value
*/
public Object executeSparqlQuery(String query, boolean forceFastlane) throws ParseException {
TcProvider singleTargetTcProvider = null;
if (forceFastlane) {
singleTargetTcProvider = getSingleTargetTcProvider(Collections.EMPTY_SET);
} else {
final IRI defaultGraphName = new IRI("urn:x-temp:/kjsfadfhfasdffds");
SparqlPreParser sparqlPreParser = new SparqlPreParser(this);
final Set<IRI> referencedGraphs = sparqlPreParser.getReferredGraphs(query, defaultGraphName);
if ((referencedGraphs != null) && (!referencedGraphs.contains(defaultGraphName))) {
singleTargetTcProvider = getSingleTargetTcProvider(referencedGraphs);
}
}
if ((singleTargetTcProvider != null) && (singleTargetTcProvider instanceof QueryableTcProvider)) {
return ((QueryableTcProvider)singleTargetTcProvider).executeSparqlQuery(query, null);
}
final QueryEngine queryEngine = this.queryEngine;
if (queryEngine != null) {
return queryEngine.execute(this, new SimpleGraph(), query);
} else {
throw new NoQueryEngineException();
}
}
/**
* Executes any sparql query. The type of the result object will vary
* depending on the type of the query. If the defaultGraph is available
* in this TcManages executeSparqlQuery(String, UriRef) should be used instead.
*
* @param query the sparql query to execute
* @param defaultGraphName the ImmutableGraph to be used as default ImmutableGraph in the Sparql ImmutableGraph Store
* @return the resulting ResultSet, ImmutableGraph or Boolean value
*/
public Object executeSparqlQuery(String query, IRI defaultGraphName) throws ParseException {
return executeSparqlQuery(query, defaultGraphName, false);
}
/**
* Executes any sparql query. The type of the result object will vary
* depending on the type of the query. If the defaultGraph is available
* in this TcManages executeSparqlQuery(String, UriRef) should be used instead.
*
* @param query the sparql query to execute
* @param defaultGraphName the ImmutableGraph to be used as default ImmutableGraph in the Sparql ImmutableGraph Store
* @param forceFastlane indicate whether to force fastlane usage.
* @return the resulting ResultSet, ImmutableGraph or Boolean value
*/
public Object executeSparqlQuery(String query, IRI defaultGraphName, boolean forceFastlane) throws ParseException {
TcProvider singleTargetTcProvider = null;
if (forceFastlane) {
singleTargetTcProvider = getSingleTargetTcProvider(Collections.singleton(defaultGraphName));
} else {
SparqlPreParser sparqlPreParser = new SparqlPreParser(this);
final Set<IRI> referencedGraphs = sparqlPreParser.getReferredGraphs(query, defaultGraphName);
if ((referencedGraphs != null)) {
singleTargetTcProvider = getSingleTargetTcProvider(referencedGraphs);
}
}
if ((singleTargetTcProvider != null) && (singleTargetTcProvider instanceof QueryableTcProvider)) {
return ((QueryableTcProvider)singleTargetTcProvider).executeSparqlQuery(query, defaultGraphName);
}
final QueryEngine queryEngine = this.queryEngine;
if (queryEngine != null) {
return queryEngine.execute(this, this.getGraph(defaultGraphName), query);
} else {
throw new NoQueryEngineException();
}
}
/**
* Executes any sparql query. The type of the result object will vary
* depending on the type of the query.
*
* @param query the sparql query to execute
* @param defaultGraph the default ImmutableGraph against which to execute the query
* if no FROM clause is present
* @return the resulting ResultSet, ImmutableGraph or Boolean value
*
* @deprecated Query is discontinued
*/
@Deprecated
public Object executeSparqlQuery(Query query, Graph defaultGraph) {
final QueryEngine queryEngine = this.queryEngine;
if (queryEngine != null) {
return queryEngine.execute(this, defaultGraph, query.toString());
} else {
throw new NoQueryEngineException();
}
}
/**
* Executes a sparql SELECT query.
*
* @param query the sparql SELECT query to execute
* @param defaultGraph the default ImmutableGraph against which to execute the query
* if not FROM clause is present
* @return the resulting ResultSet
* @deprecated Query is discontinued
*/
@Deprecated
public ResultSet executeSparqlQuery(SelectQuery query,
Graph defaultGraph) {
return (ResultSet) executeSparqlQuery((Query) query, defaultGraph);
}
/**
* Executes a sparql ASK query.
*
* @param query the sparql ASK query to execute
* @param defaultGraph the default ImmutableGraph against which to execute the query
* if not FROM clause is present
* @return the boolean value this query evaluates to
* @deprecated Query is discontinued
*/
@Deprecated
public boolean executeSparqlQuery(AskQuery query,
Graph defaultGraph) {
return (Boolean) executeSparqlQuery((Query) query, defaultGraph);
}
/**
* Executes a sparql DESCRIBE query.
*
* @param query the sparql DESCRIBE query to execute
* @param defaultGraph the default ImmutableGraph against which to execute the query
* if not FROM clause is present
* @return the resulting ImmutableGraph
* @deprecated Query is discontinued
*/
@Deprecated
public ImmutableGraph executeSparqlQuery(DescribeQuery query,
Graph defaultGraph) {
return (ImmutableGraph) executeSparqlQuery((Query) query, defaultGraph);
}
/**
* Executes a sparql CONSTRUCT query.
*
* @param query the sparql CONSTRUCT query to execute
* @param defaultGraph the default ImmutableGraph against which to execute the query
* if not FROM clause is present
* @return the resulting ImmutableGraph
* @deprecated Query is discontinued
*/
@Deprecated
public ImmutableGraph executeSparqlQuery(ConstructQuery query,
Graph defaultGraph) {
return (ImmutableGraph) executeSparqlQuery((Query) query, defaultGraph);
}
/**
* @return the TcAccessController that can be used to set the permissions
* needed to access a Triple Collection
*/
public TcAccessController getTcAccessController() {
return tcAccessController;
}
/**
* Registers a provider
*
* @param provider the provider to be registered
*/
@Reference(policy = ReferencePolicy.DYNAMIC,
cardinality = ReferenceCardinality.MULTIPLE)
protected void bindWeightedTcProvider(WeightedTcProvider provider) {
if (isActivated) {
addWeightedTcProvider(provider);
} else {
tempProviderList.add(provider);
}
}
/**
* Unregister a provider
*
* @param provider the provider to be deregistered
*/
protected void unbindWeightedTcProvider(
WeightedTcProvider provider) {
removeWeightedTcProvider(provider);
}
/**
* Registers a provider
*
* @param provider the provider to be registered
*/
@Reference(policy = ReferencePolicy.DYNAMIC,
cardinality = ReferenceCardinality.AT_LEAST_ONE,
target = "("+ TcManager.GENERAL_PURPOSE_TC+"=true)")
protected void bindGpWeightedTcProvider(WeightedTcProvider provider) {
if (isActivated) {
addWeightedTcProvider(provider);
} else {
tempProviderList.add(provider);
}
}
/**
* Unregister a provider
*
* @param provider the provider to be deregistered
*/
protected void unbindGpWeightedTcProvider(
WeightedTcProvider provider) {
removeWeightedTcProvider(provider);
}
@Reference(policy = ReferencePolicy.DYNAMIC,
cardinality = ReferenceCardinality.OPTIONAL)
protected void bindQueryEngine(QueryEngine queryEngine) {
this.queryEngine = queryEngine;
}
protected void unbindQueryEngine(QueryEngine queryEngine) {
this.queryEngine = null;
}
@Override
protected void mGraphAppears(IRI name) {
if (isTcServicesEnabled()) {
// Only create the service when activated. When not activated
// creating will be delayed till after activation.
if (componentContext != null) {
registerGraphAsService(name, true);
}
}
}
@Override
protected void graphAppears(IRI name) {
if (isTcServicesEnabled()) {
// Only create the service when activated. When not activated
// creating will be delayed till after activation.
if (componentContext != null) {
registerGraphAsService(name, false);
}
}
}
private void registerGraphAsService(IRI name, boolean isMGraph) {
Dictionary<String,Object> props = new Hashtable<String, Object>();
props.put("name", name.getUnicodeString());
String[] interfaceNames;
Object service;
if (isMGraph) {
interfaceNames = new String[]{
Graph.class.getName(),
Graph.class.getName()
};
service = new MGraphServiceFactory(this, name, tcAccessController);
} else {
interfaceNames = new String[]{ImmutableGraph.class.getName()};
service = new ImmutableGraphServiceFactory(this, name, tcAccessController);
}
final int bundleState = componentContext.getBundleContext().getBundle().getState();
if ((bundleState == Bundle.ACTIVE) || (bundleState == Bundle.STARTING)) {
ServiceRegistration serviceReg = componentContext.getBundleContext()
.registerService(interfaceNames, service, props);
serviceRegistrations.put(name, serviceReg);
}
}
@Override
protected void tcDisappears(IRI name) {
ServiceRegistration reg = serviceRegistrations.get(name);
if (reg != null) {
reg.unregister();
serviceRegistrations.remove(name);
}
}
private TcProvider getSingleTargetTcProvider(final Set<IRI> referencedGraphs) {
TcProvider singleTargetTcProvider = null;
for (WeightedTcProvider provider : providerList) {
final Set<IRI> providerGraphs = provider.listGraphs();
if (providerGraphs.containsAll(referencedGraphs)) {
singleTargetTcProvider = provider;
break; //success
}
for (IRI graphName : referencedGraphs) {
if (providerGraphs.contains(graphName)) {
break; //failure
}
}
}
return singleTargetTcProvider;
}
public boolean isTcServicesEnabled() {
return isTcServicesEnabled;
}
}
|
package services;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.sql.rowset.CachedRowSet;
import util.ConnectionUtil;
import com.sun.rowset.CachedRowSetImpl;
public class SlipService {
public static List<CachedRowSet> getCachedRowSet(String period, String empNo){
List<CachedRowSet> listCr = new ArrayList<CachedRowSet>();
CachedRowSet cr = null;
Connection con = null;
try {
con = ConnectionUtil.createConnection();
CallableStatement cs = con.prepareCall("exec spe_rptslipess '2012/09','', '000001',''");
Boolean result = cs.execute();
while (result){
cr = new CachedRowSetImpl();
ResultSet rs = cs.getResultSet();
cr.populate(rs);
listCr.add(cr);
rs.close();
result = cs.getMoreResults();
}
} catch (SQLException e) {
e.printStackTrace();
} finally{
try {
con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return listCr;
}
}
|
package com.liyinghua.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.liyinghua.common.ConstantClass;
import com.liyinghua.dao.CollectMapper;
import com.liyinghua.entity.Collect;
import com.liyinghua.service.CollectService;
@Service
/**
* @ClassName: CollectServiceImpl
* @Description: TODO
* @author:李英华
* @date: 2019年11月23日 下午3:46:41
*/
public class CollectServiceImpl implements CollectService{
@Autowired
private CollectMapper mapper;
@Override
public Integer addCollect(Collect col) {
// TODO Auto-generated method stub
return mapper.addCollect(col);
}
@Override
public PageInfo<Collect> getUserCollectByUserId(Integer userId,Integer fy) {
System.out.println(fy);
PageHelper.startPage(fy, ConstantClass.PAGE_SIZE);
List<Collect> list=mapper.getUserCollectByUserId(userId);
PageInfo<Collect> p=new PageInfo<Collect>(list);
return p;
}
@Override
public Integer del(Integer id) {
// TODO Auto-generated method stub
return mapper.del(id);
}
}
|
package filmarchiv.model;
import java.util.List;
public class Kategorie {
public static final String ID_COL = "ID";
public static final String RUBRIK_COL = "Rubrik";
public static final String PROGRAMMTYP_COL = "Programmtyp";
public static final String GENRE_COL = "ID";
public static final String GENRE_TBL_NAME_COL = "Name";
public static final String GENRE_MAPPING_GENRE_ID = "Genre_ID";
public static final String GENRE_MAPPING_KATEGORIE_ID = "Kategorie_ID";
private int id;
private String rubrik;
private String programmtyp;
private List<String> genre;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getRubrik() {
return rubrik;
}
public void setRubrik(String rubrik) {
this.rubrik = rubrik;
}
public String getProgrammtyp() {
return programmtyp;
}
public void setProgrammtyp(String programmtyp) {
this.programmtyp = programmtyp;
}
public List<String> getGenre() {
return genre;
}
public void setGenre(List<String> genre) {
this.genre = genre;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((genre == null) ? 0 : genre.hashCode());
result = prime * result + id;
result = prime * result
+ ((programmtyp == null) ? 0 : programmtyp.hashCode());
result = prime * result + ((rubrik == null) ? 0 : rubrik.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Kategorie other = (Kategorie) obj;
if (genre == null) {
if (other.genre != null)
return false;
} else if (!genre.equals(other.genre))
return false;
if (id != other.id)
return false;
if (programmtyp == null) {
if (other.programmtyp != null)
return false;
} else if (!programmtyp.equals(other.programmtyp))
return false;
if (rubrik == null) {
if (other.rubrik != null)
return false;
} else if (!rubrik.equals(other.rubrik))
return false;
return true;
}
@Override
public String toString() {
return "Kategorie [id=" + id + ", rubrik=" + rubrik + ", programmtyp="
+ programmtyp + ", genre=" + genre + "]";
}
}
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package pages;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import model.Jdbc;
/**
*
* @author k4-bourne
*/
public class Reporting extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
HttpSession session = request.getSession(false);
Jdbc dbBean = new Jdbc();
dbBean.connect((Connection)request.getServletContext().getAttribute("connection"));
session.setAttribute("dbbean", dbBean);
String date = request.getParameter("date");
String[] queryResults = dbBean.retrieveReportingInformation(date);
createReportFormat(queryResults, request, date);
operationsReport(request, dbBean, date);
request.getRequestDispatcher("/WEB-INF/reporting.jsp").forward(request, response);
}
private void createReportFormat(String[] queryResults, HttpServletRequest request, String date) {
String report = "";
if (queryResults.length != 0) {
report = "<b><u>Information summary for " + date + "</u></b><br/><br/>The total turnover for today is: £" + queryResults[0] + "<br/>"
+ "The number of customers served today is: " + queryResults[1] + "<br/>";
} else {
report = "There is no information to report on for this day.";
}
request.setAttribute("dailyReport", report);
}
private void operationsReport(HttpServletRequest request, Jdbc dbBean, String date) throws IOException, ServletException {
try {
String msg = "No operations";
String qry = "SELECT CUSTOMERNAME, JRNY.DESTINATION, PRICE FROM INVOICES " +
"JOIN JOURNEY JRNY ON JRNY.JID = INVOICES.JID " +
"WHERE INVOICES.DATE = '" + date + "'";
String journeyResult = dbBean.retrieve(qry);
request.setAttribute("reportingQuery", journeyResult);
} catch (SQLException ex) {
Logger.getLogger(Reporting.class.getName()).log(Level.SEVERE, null, ex);
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
|
package com.data.rhis2;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.app.TimePickerDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.location.Location;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.GridView;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.SimpleAdapter;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.TimePicker;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import Common.Connection;
import Common.Global;
/**
* Created by user on 20/02/2015.
*/
public class ELCOForm extends Activity {
boolean netwoekAvailable = false;
Location currentLocation;
double currentLatitude, currentLongitude;
Location currentLocationNet;
double currentLatitudeNet, currentLongitudeNet;
Calendar c = Calendar.getInstance();
//Disabled Back/Home key
//--------------------------------------------------------------------------------------------------
@Override
public boolean onKeyDown(int iKeyCode, KeyEvent event) {
if (iKeyCode == KeyEvent.KEYCODE_BACK || iKeyCode == KeyEvent.KEYCODE_HOME) {
return false;
} else {
return true;
}
}
//Top menu
//--------------------------------------------------------------------------------------------------
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.mnuclose, menu);
return true;
}
public boolean onOptionsItemSelected(MenuItem item) {
AlertDialog.Builder adb = new AlertDialog.Builder(ELCOForm.this);
switch (item.getItemId()) {
case R.id.menuClose:
adb.setTitle("Close");
adb.setMessage("আপনি কি এই ফর্ম থেকে বের হতে চান?");
adb.setNegativeButton("না", null);
adb.setPositiveButton("হ্যাঁ", new AlertDialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
if (g.getCallFrom().equals("HAregis")) {
finish();
Intent f2 = new Intent(getApplicationContext(), Elcoview.class);
startActivity(f2);
} else {
finish();
Intent f2 = new Intent(getApplicationContext(), MemberList.class);
startActivity(f2);
g.setGeneratedId("");
}
/* finish();
Intent f2 = new Intent(getApplicationContext(),MemberList.class);
startActivity(f2);*/
}
});
adb.show();
return true;
}
return false;
}
String VariableID;
private int hour;
private int minute;
private int mDay;
private int mMonth;
private int mYear;
static final int DATE_DIALOG = 1;
static final int TIME_DIALOG = 2;
Connection C;
Global g;
SimpleAdapter dataAdapter;
ArrayList<HashMap<String, String>> dataList = new ArrayList<HashMap<String, String>>();
private String TableName;
private String TableNameELCOVisit;
TextView txtHealthID;
TextView txtPHHNo;
LinearLayout seclblH;
LinearLayout secDiv;
TextView VlblDiv;
EditText txtDiv;
ImageButton btnPlus;
ImageButton btnMinus;
LinearLayout secDist;
TextView VlblDist;
EditText txtDist;
LinearLayout secUpz;
TextView VlblUpz;
EditText txtUpz;
LinearLayout secUN;
TextView VlblUN;
EditText txtUN;
LinearLayout secMouza;
TextView VlblMouza;
EditText txtMouza;
LinearLayout secVill;
TextView VlblVill;
EditText txtVill;
LinearLayout secHHNo;
TextView VlblHHNo;
CheckBox chkHHNoDontKnow;
EditText txtHHNo;
LinearLayout secSNo;
TextView VlblSNo;
TextView txtSNo;
TextView VlblDOB;
TextView DOB;
LinearLayout secName;
TextView VlblName;
TextView txtName;
LinearLayout secAge;
TextView VlblAge;
TextView txtAge;
LinearLayout secHusName;
TextView VlblHus;
EditText txtHusName;
EditText txtHusAge;
LinearLayout secMEdu;
TextView VlblMEdu;
TextView txtMEdu;
LinearLayout secMNID;
TextView VlblMNID;
TextView txtMNID;
LinearLayout secMBRID;
TextView VlblMBRID;
TextView txtMBRID;
LinearLayout secMMNo;
TextView VlblMMNo;
TextView txtMMNo;
EditText txtELCONo;
LinearLayout secHTT;
TextView VlblHTT;
TextView VlblELCOStatus;
RadioGroup rdogrpELCOStatus;
RadioButton rdoELCOStatus1;
RadioButton rdoELCOStatus2;
LinearLayout secTTCardStatus;
TextView VlblTTCardStatus;
LinearLayout secTT1;
TextView VlblTT1;
CheckBox ChkTT1;
TextView VlblTTCard;
RadioGroup rdogrpTTCard;
RadioButton rdoCardYes;
RadioButton rdoCardNo;
EditText dtpDOTT1;
ImageButton btnDOTT1;
LinearLayout secDOM;
TextView VlblDOM;
EditText dtpDOM;
ImageButton btnDOM;
LinearLayout secMAge;
TextView VlblMAge;
EditText txtMAge;
LinearLayout secDOMSource;
TextView VlblDOMSource;
RadioGroup rdogrpDOMSource;
RadioButton rdoDOMSource1;
RadioButton rdoDOMSource2;
LinearLayout secLiveSon;
TextView VlblLiveSon;
EditText txtLiveSon;
TextView VlblLiveDau;
EditText txtLiveDau;
LinearLayout secDOV;
TextView VlblDOV;
EditText dtpDOV;
ImageButton btnDOV;
Button cmdPreVisits;
LinearLayout secVS;
RadioGroup rdogrpVS;
RadioButton rdoVSPresent;
RadioButton rdoVSAbsent;
LinearLayout secSS;
RadioGroup rdogrpSS;
RadioButton rdoSSOtherGovt;
RadioButton rdoSSFWA;
RadioButton rdoSSLMarket;
RadioButton rdoSSOther;
LinearLayout secMethod;
TextView VlblMethod;
Spinner spnMethod;
LinearLayout secMethodUnit;
Spinner spnMethodUnit;
EditText txtMethodQty;
EditText txtSyringeQty;
TextView dtDueDoze;
LinearLayout secSyringe;
LinearLayout secBrand;
Spinner spnBrand;
LinearLayout secMethodReceveDT;
TextView VlblMethodReceveDT;
RadioGroup rdogrpMethodReceveDT;
RadioButton rdoMethodReceveDT1;
RadioButton rdoMethodReceveDT2;
EditText txtMDAge;
TextView VlblMDAge;
EditText dtpMD;
ImageButton btnMD;
LinearLayout secWherePlace;
TextView VlblWherePlace;
Spinner spnWherePlace;
LinearLayout secSendForMethod;
TextView VlblSendForMethod;
Spinner spnSendForMethod;
LinearLayout secImpotent;
Spinner spnImpotent;
TextView VlblImpotent;
LinearLayout secDetail;
String StartTime;
LinearLayout secValidity;
EditText txtValidity;
Spinner spnValidityUnit;
GridView g1;
ImageButton btnAddTT;
ImageButton btnSaveTT;
ImageButton btnTTClose;
TextView txtVisitNo;
TextView Sex;
String LMP = "";
String pregnancyNo = "";
Context conxt;
Button cmdSave;
LinearLayout secMessage;
TextView VlblMessage;
TextView VlblMessageMeso;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
setContentView(R.layout.elco);
C = new Connection(this);
g = Global.getInstance();
StartTime = g.CurrentTime24();
conxt = this;
TableName = "ELCO";
TableNameELCOVisit = "ELCOVisit";
// Adapter
/*SpinnerAdapter adapter =
ArrayAdapter.createFromResource(this, R.array.actions,
android.R.layout.simple_spinner_dropdown_item);
// Callback
ActionBar.OnNavigationListener callback = new ActionBar.OnNavigationListener() {
String[] items = getResources().getStringArray(R.array.actions); // List items from res
@Override
public boolean onNavigationItemSelected(int position, long id) {
if (position == 1) {
Intent f2 = new Intent(getApplicationContext(), ELCOCurrentStock.class);
startActivity(f2);
}
if (position == 2) {
Intent f2 = new Intent(getApplicationContext(), Death.class);
startActivity(f2);
}
if (position == 3) {
Intent f2 = new Intent(getApplicationContext(), Elcoview.class);
startActivity(f2);
}
return true;
}
};
// Action Bar
ActionBar actions = getActionBar();
actions.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
actions.setDisplayShowTitleEnabled(true);
actions.setListNavigationCallbacks(adapter, callback);
String[] items = getResources().getStringArray(R.array.actions);*/
secMessage = (LinearLayout) findViewById(R.id.secMessage);
VlblMessage = (TextView) findViewById(R.id.VlblMessage);
VlblMessageMeso = (TextView) findViewById(R.id.VlblMessageMeso);
VlblMessage.setVisibility(View.GONE);
VlblMessageMeso.setVisibility(View.GONE);
secDetail = (LinearLayout) findViewById(R.id.secDetail);
seclblH = (LinearLayout) findViewById(R.id.seclblH);
seclblH.setVisibility(View.GONE);
txtHealthID = (TextView) findViewById(R.id.txtHealthID);
txtHealthID.setText(g.getHealthID());
/*if(g.getCallFrom().equals("1"))
{
txtHealthID.setText(g.getHealthID());
txtHHNo.setText(g.getHHNO());
txtSNo.setText(g.getSLno());
txtAge.setText(g.getAAge());
txtName.setText(g.getAName());
}
if(g.getCallFrom().equals("ml")) {
txtHealthID.setText(g.getHealthID());
txtHHNo.setText(g.getHouseholdNo());
txtName.setText(g.getAName());
txtAge.setText(g.getAAge());
}*/
txtVisitNo = (TextView) findViewById(R.id.txtVisitNo);
txtVisitNo.setText(VisitNumber(g.getGeneratedId()));
txtPHHNo = (TextView) findViewById(R.id.txtPHHNo);
txtPHHNo.setText(g.getHouseholdNo());
chkHHNoDontKnow = (CheckBox) findViewById(R.id.chkHHNoDontKnow);
txtHHNo = (EditText) findViewById(R.id.txtHHNo);
chkHHNoDontKnow.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (((CheckBox) v).isChecked()) {
txtHHNo.setText("");
txtHHNo.setEnabled(false);
} else {
txtHHNo.setEnabled(true);
}
}
});
txtHHNo.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (txtHHNo.getText().length() > 0) {
chkHHNoDontKnow.setChecked(false);
} else {
chkHHNoDontKnow.setChecked(true);
}
}
});
VlblSNo = (TextView) findViewById(R.id.VlblSNo);
txtSNo = (TextView) findViewById(R.id.txtSNo);
VlblDOB = (TextView) findViewById(R.id.VlblDOB);
DOB = (TextView) findViewById(R.id.DOB);
VlblHus = (TextView) findViewById(R.id.VlblHus);
secName = (LinearLayout) findViewById(R.id.secName);
VlblName = (TextView) findViewById(R.id.VlblName);
txtName = (TextView) findViewById(R.id.txtName);
secAge = (LinearLayout) findViewById(R.id.secAge);
VlblAge = (TextView) findViewById(R.id.VlblAge);
txtAge = (TextView) findViewById(R.id.txtAge);
secHusName = (LinearLayout) findViewById(R.id.secHusName);
txtHusName = (EditText) findViewById(R.id.txtHusName);
txtHusAge = (EditText) findViewById(R.id.txtHusAge);
secMEdu = (LinearLayout) findViewById(R.id.secMEdu);
VlblMEdu = (TextView) findViewById(R.id.VlblMEdu);
txtMEdu = (TextView) findViewById(R.id.txtMEdu);
secMNID = (LinearLayout) findViewById(R.id.secMNID);
VlblMNID = (TextView) findViewById(R.id.VlblMNID);
txtMNID = (TextView) findViewById(R.id.txtMNID);
secMBRID = (LinearLayout) findViewById(R.id.secMBRID);
VlblMBRID = (TextView) findViewById(R.id.VlblMBRID);
txtMBRID = (TextView) findViewById(R.id.txtMBRID);
secMMNo = (LinearLayout) findViewById(R.id.secMMNo);
VlblMMNo = (TextView) findViewById(R.id.VlblMMNo);
txtMMNo = (TextView) findViewById(R.id.txtMMNo);
txtELCONo = (EditText) findViewById(R.id.txtELCONo);
txtELCONo.requestFocus();
rdogrpELCOStatus = (RadioGroup) findViewById(R.id.rdogrpELCOStatus);
rdoELCOStatus1 = (RadioButton) findViewById(R.id.rdoELCOStatus1);
rdoELCOStatus2 = (RadioButton) findViewById(R.id.rdoELCOStatus2);
btnPlus = (ImageButton) findViewById(R.id.btnPlus);
btnMinus = (ImageButton) findViewById(R.id.btnMinus);
btnMinus.setVisibility(View.INVISIBLE);
secDetail.setVisibility(View.GONE);
secMEdu.setVisibility(View.GONE);
secMNID.setVisibility(View.GONE);
secMBRID.setVisibility(View.GONE);
secMMNo.setVisibility(View.GONE);
btnPlus.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
secDetail.setVisibility(View.VISIBLE);
btnPlus.setVisibility(View.GONE);
btnMinus.setVisibility(View.VISIBLE);
secMEdu.setVisibility(View.VISIBLE);
secMNID.setVisibility(View.VISIBLE);
secMBRID.setVisibility(View.VISIBLE);
secMMNo.setVisibility(View.VISIBLE);
}
});
btnMinus.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
secDetail.setVisibility(View.GONE);
btnPlus.setVisibility(View.VISIBLE);
btnMinus.setVisibility(View.GONE);
secMEdu.setVisibility(View.GONE);
secMNID.setVisibility(View.GONE);
secMBRID.setVisibility(View.GONE);
secMMNo.setVisibility(View.GONE);
}
});
secTTCardStatus = (LinearLayout) findViewById(R.id.secTTCardStatus);
VlblTTCardStatus = (TextView) findViewById(R.id.VlblTTCardStatus);
secTT1 = (LinearLayout) findViewById(R.id.secTT1);
VlblTT1 = (TextView) findViewById(R.id.VlblTT1);
ChkTT1 = (CheckBox) findViewById(R.id.ChkTT1);
VlblTTCard = (TextView) findViewById(R.id.VlblTTCard);
rdogrpTTCard = (RadioGroup) findViewById(R.id.rdogrpTTCard);
rdoCardYes = (RadioButton) findViewById(R.id.rdoCardYes);
rdoCardNo = (RadioButton) findViewById(R.id.rdoCardNo);
rdogrpTTCard.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup radioGroup, int radioButtonID) {
if (rdoCardYes.isChecked()) {
btnDOTT1.setEnabled(true);
dtpDOTT1.setVisibility(View.VISIBLE);
btnDOTT1.setVisibility(View.VISIBLE);
} else if (rdoCardNo.isChecked()) {
dtpDOTT1.setText("");
btnDOTT1.setEnabled(false);
dtpDOTT1.setVisibility(View.GONE);
btnDOTT1.setVisibility(View.GONE);
}
}
public void onNothingSelected(AdapterView<?> adapterView) {
return;
}
});
dtpDOTT1 = (EditText) findViewById(R.id.dtpDOTT1);
btnDOTT1 = (ImageButton) findViewById(R.id.btnDOTT1);
dtpDOTT1.setText("");
btnDOTT1.setEnabled(false);
ChkTT1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (((CheckBox) v).isChecked()) {
btnDOTT1.setEnabled(true);
VlblTTCard.setVisibility(View.VISIBLE);
rdogrpTTCard.setVisibility(View.VISIBLE);
btnSaveTT.setVisibility(View.VISIBLE);
} else {
rdogrpTTCard.clearCheck();
dtpDOTT1.setText("");
btnDOTT1.setEnabled(false);
VlblTTCard.setVisibility(View.GONE);
rdogrpTTCard.setVisibility(View.GONE);
dtpDOTT1.setVisibility(View.GONE);
btnDOTT1.setVisibility(View.GONE);
btnSaveTT.setVisibility(View.GONE);
}
}
});
dtpDOM = (EditText) findViewById(R.id.dtpDOM);
btnDOM = (ImageButton) findViewById(R.id.btnDOM);
secDOMSource = (LinearLayout) findViewById(R.id.secDOMSource);
VlblDOMSource = (TextView) findViewById(R.id.VlblDOMSource);
rdogrpDOMSource = (RadioGroup) findViewById(R.id.rdogrpDOMSource);
rdoDOMSource1 = (RadioButton) findViewById(R.id.rdoDOMSource1);
rdoDOMSource1.setChecked(true);
rdoDOMSource2 = (RadioButton) findViewById(R.id.rdoDOMSource2);
//secMAge.setVisibility( View.GONE );
txtMAge = (EditText) findViewById(R.id.txtMAge);
dtpDOM.setVisibility(View.VISIBLE);
btnDOM.setVisibility(View.VISIBLE);
txtMAge.setVisibility(View.GONE);
VlblMAge = (TextView) findViewById(R.id.VlblMAge);
VlblMAge.setVisibility(View.GONE);
rdogrpDOMSource.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
public void onCheckedChanged(RadioGroup arg0, int id) {
if (id == R.id.rdoDOMSource1) {
dtpDOM.setVisibility(View.VISIBLE);
btnDOM.setVisibility(View.VISIBLE);
txtMAge.setVisibility(View.GONE);
txtMAge.setText("");
VlblMAge.setVisibility(View.GONE);
btnDOM.requestFocus();
} else if (id == R.id.rdoDOMSource2) {
dtpDOM.setText("");
dtpDOM.setVisibility(View.GONE);
btnDOM.setVisibility(View.GONE);
txtMAge.setVisibility(View.VISIBLE);
VlblMAge.setVisibility(View.VISIBLE);
txtMAge.requestFocus();
}
}
});
secLiveSon = (LinearLayout) findViewById(R.id.secLiveSon);
VlblLiveSon = (TextView) findViewById(R.id.VlblLiveSon);
txtLiveSon = (EditText) findViewById(R.id.txtLiveSon);
VlblLiveDau = (TextView) findViewById(R.id.VlblLiveDau);
txtLiveDau = (EditText) findViewById(R.id.txtLiveDau);
dtpDOV = (EditText) findViewById(R.id.dtpDOV);
dtpDOV.setText(Global.DateNowDMY());
btnDOV = (ImageButton) findViewById(R.id.btnDOV);
secMethodReceveDT = (LinearLayout) findViewById(R.id.secMethodReceveDT);
VlblMethodReceveDT = (TextView) findViewById(R.id.VlblMethodReceveDT);
rdogrpMethodReceveDT = (RadioGroup) findViewById(R.id.rdogrpMethodReceveDT);
rdoMethodReceveDT1 = (RadioButton) findViewById(R.id.rdoMethodReceveDT1);
//rdoMethodReceveDT1.setChecked(true);
rdoMethodReceveDT2 = (RadioButton) findViewById(R.id.rdoMethodReceveDT2);
txtMDAge = (EditText) findViewById(R.id.txtMDAge);
VlblMDAge = (TextView) findViewById(R.id.VlblMDAge);
dtpMD = (EditText) findViewById(R.id.dtpMD);
dtpMD.setText(Global.DateNowDMY());
btnMD = (ImageButton) findViewById(R.id.btnMD);
rdogrpMethodReceveDT.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
public void onCheckedChanged(RadioGroup arg0, int id) {
if (id == R.id.rdoMethodReceveDT1) {
dtpMD.setVisibility(View.VISIBLE);
btnMD.setVisibility(View.VISIBLE);
txtMDAge.setVisibility(View.GONE);
txtMDAge.setText("");
VlblMDAge.setVisibility(View.GONE);
btnMD.requestFocus();
} else if (id == R.id.rdoMethodReceveDT2) {
dtpMD.setText("");
dtpMD.setVisibility(View.GONE);
btnMD.setVisibility(View.GONE);
txtMDAge.setVisibility(View.VISIBLE);
VlblMDAge.setVisibility(View.VISIBLE);
txtMDAge.requestFocus();
}
}
});
rdogrpVS = (RadioGroup) findViewById(R.id.rdogrpVS);
rdoVSPresent = (RadioButton) findViewById(R.id.rdoVSPresent);
rdoVSAbsent = (RadioButton) findViewById(R.id.rdoVSAbsent);
secMethod = (LinearLayout) findViewById(R.id.secMethod);
VlblMethod = (TextView) findViewById(R.id.VlblMethod);
spnMethod = (Spinner) findViewById(R.id.spnMethod);
spnMethod.setEnabled(false);
secSendForMethod = (LinearLayout) findViewById(R.id.secSendForMethod);
VlblSendForMethod = (TextView) findViewById(R.id.VlblSendForMethod);
spnSendForMethod = (Spinner) findViewById(R.id.spnSendForMethod);
List<String> listSendForMethod = new ArrayList<String>();
listSendForMethod.add("");
listSendForMethod.add("01-খাবার বড়ি");
listSendForMethod.add("02-কনডম");
listSendForMethod.add("03-ইনজেকটেবল");
listSendForMethod.add("04-আই ইউ ডি");
listSendForMethod.add("05-ইমপ্ল্যান্ট");
listSendForMethod.add("06-স্থায়ী পদ্ধতি(পুরুষ) এনএসভি");
listSendForMethod.add("07-স্থায়ী পদ্ধতি(মহিলা) টিউবেকটমী");
ArrayAdapter<String> adptrspnSendForMethod = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, listSendForMethod);
spnSendForMethod.setAdapter(adptrspnSendForMethod);
secImpotent = (LinearLayout) findViewById(R.id.secImpotent);
VlblImpotent = (TextView) findViewById(R.id.VlblImpotent);
spnImpotent = (Spinner) findViewById(R.id.spnImpotent);
List<String> listImpotent = new ArrayList<String>();
listImpotent.add("");
listImpotent.add("01-১ম");
listImpotent.add("02-২য়");
ArrayAdapter<String> adptrspnImpotent = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, listImpotent);
spnImpotent.setAdapter(adptrspnImpotent);
secSS = (LinearLayout) findViewById(R.id.secSS);
rdogrpSS = (RadioGroup) findViewById(R.id.rdogrpSS);
rdoSSOtherGovt = (RadioButton) findViewById(R.id.rdoSSOtherGovt);
rdoSSFWA = (RadioButton) findViewById(R.id.rdoSSFWA);
rdoSSLMarket = (RadioButton) findViewById(R.id.rdoSSLMarket);
rdoSSOther = (RadioButton) findViewById(R.id.rdoSSOther);
cmdSave = (Button) findViewById(R.id.cmdSave);
Sex = (TextView) findViewById(R.id.Sex);
Sex.setVisibility(View.GONE);
ELCOProfile e = new ELCOProfile();
e.PregnancyInfo(conxt, g.getGeneratedId(), LastPGNNo(), g.getProvType());
LMP = String.valueOf(e.getLMP());
Integer DiffLMP_VD = Global.DateDifferenceDays(dtpDOV.getText().toString(), LMP);
secBrand = (LinearLayout) findViewById(R.id.secBrand);
secBrand.setVisibility(View.GONE);
spnBrand = (Spinner) findViewById(R.id.spnBrand);
spnBrand.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
//Implanon
if (Global.Left(spnBrand.getSelectedItem().toString(), 2).equalsIgnoreCase("04")) {
txtValidity.setText("3");
txtValidity.setEnabled(false);
spnValidityUnit.setEnabled(false);
}
//Zdel
else if (Global.Left(spnBrand.getSelectedItem().toString(), 2).equalsIgnoreCase("05")) {
txtValidity.setText("5");
txtValidity.setEnabled(false);
spnValidityUnit.setEnabled(false);
} else {
txtValidity.setText("");
txtValidity.setEnabled(true);
spnValidityUnit.setEnabled(true);
}
}
@Override
public void onNothingSelected(AdapterView<?> parentView) {
}
});
rdogrpSS.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
public void onCheckedChanged(RadioGroup arg0, int id) {
Integer DiffLMP_VD = Global.DateDifferenceDays(dtpDOV.getText().toString(), LMP);
if (id == R.id.rdoSSFWA & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("01")) {
secMethodUnit.setVisibility(View.VISIBLE);
txtMethodQty.setEnabled(true);
spnMethodUnit.setSelection(1);
spnMethodUnit.setEnabled(false);
secBrand.setVisibility(View.VISIBLE);
spnBrand.setAdapter(null);
spnBrand.setAdapter(C.getArrayAdapter("Select ' 'as brandCode union Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('01','02') order by brandCode asc"));
rdoSSFWA.setVisibility(View.VISIBLE);
spnBrand.setSelection(Global.SpinnerItemPosition(spnBrand, 2, C.ReturnSingleValue("Select ifnull(brand,'') as brand from ElcoVisit where healthid='" + g.getGeneratedId() + "' and visit='" + txtVisitNo.getText() + "'")));
} else if (id == R.id.rdoSSLMarket & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("01")) {
secMethodUnit.setVisibility(View.GONE);
spnMethodUnit.setSelection(0);
secBrand.setVisibility(View.VISIBLE);
spnBrand.setAdapter(null);
spnBrand.setAdapter(C.getArrayAdapter("Select ' 'as brandCode union Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('77') order by brandCode asc"));
//spnBrand.setEnabled(false);
} else if (id == R.id.rdoSSOther & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("01")) {
secMethodUnit.setVisibility(View.GONE);
spnMethodUnit.setSelection(0);
secBrand.setVisibility(View.VISIBLE);
spnBrand.setAdapter(null);
spnBrand.setAdapter(C.getArrayAdapter("Select ' 'as brandCode union Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('01','02','77') order by brandCode asc"));
spnBrand.setEnabled(true);
} else if (id == R.id.rdoSSOtherGovt & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("01")) {
secMethodUnit.setVisibility(View.GONE);
spnMethodUnit.setSelection(0);
secBrand.setVisibility(View.VISIBLE);
spnBrand.setAdapter(null);
spnBrand.setAdapter(C.getArrayAdapter("Select ' 'as brandCode union Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('01','02') order by brandCode asc"));
spnBrand.setEnabled(true);
} else if (id == R.id.rdoSSFWA & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("02")) {
secMethodUnit.setVisibility(View.VISIBLE);
txtMethodQty.setEnabled(true);
spnMethodUnit.setSelection(2);
rdoSSFWA.setVisibility(View.VISIBLE);
secBrand.setVisibility(View.VISIBLE);
spnBrand.setAdapter(null);
spnBrand.setAdapter(C.getArrayAdapter("Select ' 'as brandCode union Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('03') order by brandCode asc"));
} else if (id == R.id.rdoSSLMarket & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("02")) {
secMethodUnit.setVisibility(View.GONE);
spnMethodUnit.setSelection(0);
txtMethodQty.setText("");
secBrand.setVisibility(View.VISIBLE);
spnBrand.setAdapter(null);
spnBrand.setAdapter(C.getArrayAdapter("Select ' 'as brandCode union Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('77') order by brandCode asc"));
} else if (id == R.id.rdoSSOther & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("02")) {
secMethodUnit.setVisibility(View.GONE);
spnMethodUnit.setSelection(0);
txtMethodQty.setText("");
secBrand.setVisibility(View.VISIBLE);
spnBrand.setAdapter(null);
spnBrand.setAdapter(C.getArrayAdapter("Select ' 'as brandCode union Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('03','77') order by brandCode asc"));
} else if (id == R.id.rdoSSOtherGovt & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("02")) {
secMethodUnit.setVisibility(View.GONE);
spnMethodUnit.setSelection(0);
txtMethodQty.setText("");
secBrand.setVisibility(View.VISIBLE);
spnBrand.setAdapter(null);
spnBrand.setAdapter(C.getArrayAdapter("Select ' 'as brandCode union Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('03') order by brandCode asc"));
} else if (id == R.id.rdoSSFWA & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("03")) {
secMethodReceveDT.setVisibility(View.VISIBLE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
secSyringe.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.VISIBLE);
txtMethodQty.setEnabled(false);
spnMethodUnit.setSelection(3);
txtMethodQty.setText("1");
txtSyringeQty.setText("1");
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (id == R.id.rdoSSLMarket & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("03")) {
secMethodReceveDT.setVisibility(View.VISIBLE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
secSyringe.setVisibility(View.GONE);
secMethodUnit.setVisibility(View.GONE);
spnMethodUnit.setSelection(0);
txtMethodQty.setText("");
} else if (id == R.id.rdoSSOther & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("03")) {
secMethodReceveDT.setVisibility(View.VISIBLE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
secSyringe.setVisibility(View.GONE);
secMethodUnit.setVisibility(View.GONE);
spnMethodUnit.setSelection(0);
txtMethodQty.setText("");
} else if (id == R.id.rdoSSOtherGovt & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("03")) {
secMethodReceveDT.setVisibility(View.VISIBLE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
secSyringe.setVisibility(View.GONE);
secMethodUnit.setVisibility(View.GONE);
spnMethodUnit.setSelection(0);
txtMethodQty.setText("");
} else if (id == R.id.rdoSSFWA & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("04")) {
secMethodReceveDT.setVisibility(View.VISIBLE);
secValidity.setVisibility(View.VISIBLE);
spnValidityUnit.setSelection(3);
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
} else if (id == R.id.rdoSSLMarket & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("04")) {
secMethodReceveDT.setVisibility(View.VISIBLE);
secValidity.setVisibility(View.VISIBLE);
spnValidityUnit.setSelection(3);
} else if (id == R.id.rdoSSOther & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("04")) {
secMethodReceveDT.setVisibility(View.VISIBLE);
secValidity.setVisibility(View.VISIBLE);
spnValidityUnit.setSelection(3);
} else if (id == R.id.rdoSSOtherGovt & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("04")) {
secMethodReceveDT.setVisibility(View.VISIBLE);
secValidity.setVisibility(View.VISIBLE);
spnValidityUnit.setSelection(3);
} else if (id == R.id.rdoSSFWA & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("05")) {
secMethodReceveDT.setVisibility(View.VISIBLE);
secValidity.setVisibility(View.VISIBLE);
spnValidityUnit.setSelection(3);
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
//secBrand.setVisibility(View.VISIBLE);
//spnBrand.setAdapter(C.getArrayAdapter("Select ' 'as brandCode union Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('04','05') order by brandCode asc"));
} else if (id == R.id.rdoSSLMarket & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("05")) {
secMethodReceveDT.setVisibility(View.VISIBLE);
secValidity.setVisibility(View.VISIBLE);
spnValidityUnit.setSelection(3);
secBrand.setVisibility(View.VISIBLE);
spnBrand.setAdapter(null);
spnBrand.setAdapter(C.getArrayAdapter("Select ' 'as brandCode union Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('77') order by brandCode asc"));
} else if (id == R.id.rdoSSOther & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("05")) {
secMethodReceveDT.setVisibility(View.VISIBLE);
secValidity.setVisibility(View.VISIBLE);
spnValidityUnit.setSelection(3);
secBrand.setVisibility(View.VISIBLE);
spnBrand.setAdapter(null);
spnBrand.setAdapter(C.getArrayAdapter("Select ' 'as brandCode union Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('04','05','77') order by brandCode asc"));
} else if (id == R.id.rdoSSOtherGovt & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("05")) {
secMethodReceveDT.setVisibility(View.VISIBLE);
secValidity.setVisibility(View.VISIBLE);
spnValidityUnit.setSelection(3);
secBrand.setVisibility(View.VISIBLE);
spnBrand.setAdapter(null);
spnBrand.setAdapter(C.getArrayAdapter("Select ' 'as brandCode union Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('04','05') order by brandCode asc"));
} else if (id == R.id.rdoSSFWA & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("06")) {
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
} else if (id == R.id.rdoSSFWA & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("07")) {
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
} else if (id == R.id.rdoSSFWA & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("08")) {
secMethodUnit.setVisibility(View.VISIBLE);
txtMethodQty.setEnabled(true);
spnMethodUnit.setSelection(3);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (id == R.id.rdoSSLMarket & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("08")) {
secMethodUnit.setVisibility(View.GONE);
spnMethodUnit.setSelection(0);
txtMethodQty.setText("");
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (id == R.id.rdoSSOther & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("08")) {
secMethodUnit.setVisibility(View.GONE);
spnMethodUnit.setSelection(0);
txtMethodQty.setText("");
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (id == R.id.rdoSSOtherGovt & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("08")) {
secMethodUnit.setVisibility(View.GONE);
spnMethodUnit.setSelection(0);
txtMethodQty.setText("");
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
} else if (id == R.id.rdoSSFWA & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("09")) {
if (DiffLMP_VD >= 224) {
cmdSave.setEnabled(true);
secMethodUnit.setVisibility(View.VISIBLE);
txtMethodQty.setEnabled(true);
spnMethodUnit.setSelection(3);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
VlblMessage.setVisibility(View.GONE);
VlblMessageMeso.setVisibility(View.VISIBLE);
} else {
VlblMessage.setVisibility(View.GONE);
VlblMessageMeso.setVisibility(View.GONE);
cmdSave.setEnabled(false);
Connection.MessageBox(ELCOForm.this, "গর্ভকালীন সেবার সময়ে ২২৩ দিনের পর থেকে মিসোপ্রোস্টোল বড়ি দিতে পারবে । ");
return;
}
} else if (id == R.id.rdoSSLMarket & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("09")) {
if (DiffLMP_VD >= 224) {
cmdSave.setEnabled(true);
secMethodUnit.setVisibility(View.GONE);
txtMethodQty.setText("");
spnMethodUnit.setSelection(0);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
VlblMessage.setVisibility(View.GONE);
VlblMessageMeso.setVisibility(View.VISIBLE);
} else {
VlblMessage.setVisibility(View.GONE);
VlblMessageMeso.setVisibility(View.GONE);
cmdSave.setEnabled(false);
Connection.MessageBox(ELCOForm.this, "গর্ভকালীন সেবার সময়ে ২২৩ দিনের পর থেকে মিসোপ্রোস্টোল বড়ি দিতে পারবে । ");
return;
}
} else if (id == R.id.rdoSSOther & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("09")) {
if (DiffLMP_VD >= 224) {
cmdSave.setEnabled(true);
secMethodUnit.setVisibility(View.GONE);
txtMethodQty.setText("");
spnMethodUnit.setSelection(0);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
VlblMessage.setVisibility(View.GONE);
VlblMessageMeso.setVisibility(View.VISIBLE);
} else {
VlblMessage.setVisibility(View.GONE);
VlblMessageMeso.setVisibility(View.GONE);
cmdSave.setEnabled(false);
Connection.MessageBox(ELCOForm.this, "গর্ভকালীন সেবার সময়ে ২২৩ দিনের পর থেকে মিসোপ্রোস্টোল বড়ি দিতে পারবে । ");
return;
}
} else if (id == R.id.rdoSSOtherGovt & Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("09")) {
if (DiffLMP_VD >= 224) {
cmdSave.setEnabled(true);
secMethodUnit.setVisibility(View.GONE);
txtMethodQty.setText("");
spnMethodUnit.setSelection(0);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
VlblMessage.setVisibility(View.GONE);
VlblMessageMeso.setVisibility(View.VISIBLE);
} else {
VlblMessage.setVisibility(View.GONE);
VlblMessageMeso.setVisibility(View.GONE);
cmdSave.setEnabled(false);
Connection.MessageBox(ELCOForm.this, "গর্ভকালীন সেবার সময়ে ২২৩ দিনের পর থেকে মিসোপ্রোস্টোল বড়ি দিতে পারবে । ");
return;
}
} else if (id == R.id.rdoSSLMarket | id == R.id.rdoSSOther | id == R.id.rdoSSOtherGovt) {
txtMethodQty.setText("");
txtMethodQty.setEnabled(false);
secMethodUnit.setVisibility(View.GONE);
}
}
});
secMethodUnit = (LinearLayout) findViewById(R.id.secMethodUnit);
spnMethodUnit = (Spinner) findViewById(R.id.spnMethodUnit);
txtMethodQty = (EditText) findViewById(R.id.txtMethodQty);
secSyringe = (LinearLayout) findViewById(R.id.secSyringe);
txtSyringeQty = (EditText) findViewById(R.id.txtSyringeQty);
dtDueDoze = (TextView) findViewById(R.id.dtDueDoze);
String lastDozeDate = C.ReturnSingleValue("select strftime('%d/%m/%Y', date( doseDate)) from womanInjectable where healthId='" + g.getGeneratedId() + "' and doseId=(select max(doseId) from womanInjectable)");
if (lastDozeDate != "") {
String DozeDate = Global.addDays(lastDozeDate, 90);
((TextView) findViewById(R.id.dtDueDoze)).setText(DozeDate);
}
secWherePlace = (LinearLayout) findViewById(R.id.secWherePlace);
VlblWherePlace = (TextView) findViewById(R.id.VlblWherePlace);
spnWherePlace = (Spinner) findViewById(R.id.spnWherePlace);
List<String> listFacility = new ArrayList<String>();
listFacility.add("");
listFacility.add("01-উপজেলা স্বাস্থ্য কমপ্লেক্স");
listFacility.add("02-ইউনিয়ন স্বাস্থ্য ও পরিবার কল্যাণ কেন্দ্র");
listFacility.add("03-মা ও শিশু কল্যাণ কেন্দ্র");
listFacility.add("04-জেলা সদর বা অন্যান্য সরকারী হাসপাতাল");
listFacility.add("05-এনজিও ক্লিনিক বা হাসপাতাল");
listFacility.add("06-প্রাইভেট ক্লিনিক বা হাসপাতাল");
ArrayAdapter<String> adptrspnWherePlace = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, listFacility);
spnWherePlace.setAdapter(adptrspnWherePlace);
secBrand = (LinearLayout) findViewById(R.id.secBrand);
secBrand.setVisibility(View.GONE);
spnBrand = (Spinner) findViewById(R.id.spnBrand);
rdogrpVS.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
public void onCheckedChanged(RadioGroup arg0, int id) {
if (id == R.id.rdoVSPresent) {
MethodList("p", Sex.getText().toString());
rdogrpSS.clearCheck();
secMethod.setVisibility(View.VISIBLE);
spnMethod.setSelection(0);
txtMethodQty.setText("");
spnMethodUnit.setSelection(0);
spnWherePlace.setSelection(0);
dtpMD.setText("");
spnMethod.setEnabled(true);
} else if (id == R.id.rdoVSAbsent) {
MethodList("a", Sex.getText().toString());
rdogrpSS.clearCheck();
secMethod.setVisibility(View.VISIBLE);
spnMethod.setSelection(0);
spnWherePlace.setSelection(0);
txtMethodQty.setText("");
dtpMD.setText("");
spnMethodUnit.setSelection(0);
spnMethod.setEnabled(true);
} else {
//secMethod.setVisibility( View.GONE );
}
}
});
if (CurrentStatus(g.getGeneratedId()).equals("12")) {
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select substr('0' ||EvCode, -2, 2)||'-'||EVName as EvCode from ElcoEvent where substr('0' ||EvCode, -2, 2) in('09') order by EvCode asc"));
secMessage.setVisibility(View.VISIBLE);
VlblMessage.setVisibility(View.VISIBLE);
cmdSave.setEnabled(false);
} else if (CurrentStatus(g.getGeneratedId()).equals("09")) {
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode"));
secMessage.setVisibility(View.VISIBLE);
VlblMessage.setVisibility(View.VISIBLE);
cmdSave.setEnabled(false);
} else {
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select substr('0' ||EvCode, -2, 2)||'-'||EVName as EvCode from ElcoEvent where substr('0' ||EvCode, -2, 2) not in('09','13','14') order by EvCode asc"));
cmdSave.setEnabled(true);
secMessage.setVisibility(View.GONE);
VlblMessage.setVisibility(View.GONE);
VlblMessageMeso.setVisibility(View.GONE);
}
List<String> listMethodUnit = new ArrayList<String>();
listMethodUnit.add("");
listMethodUnit.add("চক্র");
listMethodUnit.add("পিস");
listMethodUnit.add("ডোজ");
ArrayAdapter<String> adptrMethodUnit = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, listMethodUnit);
spnMethodUnit.setAdapter(adptrMethodUnit);
spnMethod.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
if (spnMethod.getSelectedItemPosition() == 0) {
secSS.setVisibility(View.GONE);
secMethodUnit.setVisibility(View.GONE);
spnMethodUnit.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
txtMethodQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("01") && rdoSSFWA.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.VISIBLE);
spnMethodUnit.setSelection(1);
spnMethodUnit.setEnabled(false);
secBrand.setVisibility(View.VISIBLE);
spnBrand.setAdapter(null);
spnBrand.setAdapter(C.getArrayAdapter("Select ' 'as brandCode union Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('01','02') order by brandCode asc"));
spnBrand.setSelection(Global.SpinnerItemPosition(spnBrand, 2, C.ReturnSingleValue("Select ifnull(brand,'') as brand from ElcoVisit where healthid='" + g.getGeneratedId() + "' and visit='" + txtVisitNo.getText() + "'")));
spnBrand.setEnabled(true);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("01") && rdoSSLMarket.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.VISIBLE);
spnBrand.setAdapter(C.getArrayAdapter("Select ' 'as brandCode union Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('77') order by brandCode asc"));
spnBrand.setEnabled(true);
spnMethodUnit.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("01") && rdoSSOther.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.VISIBLE);
spnBrand.setAdapter(C.getArrayAdapter("Select ' 'as brandCode union Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('01','02','77') order by brandCode asc"));
spnBrand.setEnabled(true);
spnMethodUnit.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("01") && rdoSSOtherGovt.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.VISIBLE);
spnBrand.setAdapter(C.getArrayAdapter("Select ' 'as brandCode union Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('01','02') order by brandCode asc"));
spnBrand.setEnabled(true);
spnMethodUnit.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("01")) {
secSS.setVisibility(View.VISIBLE);
rdogrpSS.clearCheck();
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
txtMethodQty.setText("");
spnMethodUnit.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("02") && rdoSSFWA.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.VISIBLE);
secBrand.setVisibility(View.VISIBLE);
spnBrand.setAdapter(C.getArrayAdapter("Select ' 'as brandCode union Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('03') order by brandCode asc"));
spnMethodUnit.setSelection(2);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("02") && rdoSSLMarket.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.VISIBLE);
spnBrand.setAdapter(C.getArrayAdapter("Select ' 'as brandCode union Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('77') order by brandCode asc"));
spnMethodUnit.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("02") && rdoSSOther.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.VISIBLE);
spnBrand.setAdapter(C.getArrayAdapter("Select ' 'as brandCode union Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('03','77') order by brandCode asc"));
spnMethodUnit.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("02") && rdoSSOtherGovt.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.VISIBLE);
spnBrand.setAdapter(C.getArrayAdapter("Select ' 'as brandCode union Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('03') order by brandCode asc"));
spnMethodUnit.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("02")) {
secSS.setVisibility(View.VISIBLE);
rdogrpSS.clearCheck();
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
txtMethodQty.setText("");
spnMethodUnit.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("03") && rdoSSFWA.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.VISIBLE);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
spnMethodUnit.setSelection(3);
txtMethodQty.setText("1");
txtMethodQty.setEnabled(false);
secSyringe.setVisibility(View.VISIBLE);
txtSyringeQty.setText("1");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.VISIBLE);
//dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("03") && rdoSSLMarket.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
spnMethodUnit.setSelection(0);
txtMethodQty.setText("");
txtMethodQty.setEnabled(false);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.VISIBLE);
//dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("03") && rdoSSOther.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
spnMethodUnit.setSelection(0);
txtMethodQty.setText("");
txtMethodQty.setEnabled(false);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.VISIBLE);
//dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("03") && rdoSSOtherGovt.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
spnMethodUnit.setSelection(0);
txtMethodQty.setText("");
txtMethodQty.setEnabled(false);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.VISIBLE);
//dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("03")) {
secSS.setVisibility(View.VISIBLE);
rdogrpSS.clearCheck();
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
spnMethodUnit.setSelection(0);
txtMethodQty.setText("");
txtMethodQty.setEnabled(false);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("04") && rdoSSFWA.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
spnMethodUnit.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secMethodReceveDT.setVisibility(View.VISIBLE);
secValidity.setVisibility(View.VISIBLE);
spnValidityUnit.setSelection(3);
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("04") && rdoSSLMarket.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
spnMethodUnit.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secMethodReceveDT.setVisibility(View.VISIBLE);
secValidity.setVisibility(View.VISIBLE);
spnValidityUnit.setSelection(3);
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("04") && rdoSSOther.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
spnMethodUnit.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secMethodReceveDT.setVisibility(View.VISIBLE);
secValidity.setVisibility(View.VISIBLE);
spnValidityUnit.setSelection(3);
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("04") && rdoSSOtherGovt.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
spnMethodUnit.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secMethodReceveDT.setVisibility(View.VISIBLE);
secValidity.setVisibility(View.VISIBLE);
spnValidityUnit.setSelection(3);
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("04")) {
secSS.setVisibility(View.VISIBLE);
rdogrpSS.clearCheck();
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
spnMethodUnit.setSelection(0);
txtMethodQty.setText("");
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
secValidity.setVisibility(View.GONE);
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("05") && rdoSSFWA.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
spnMethodUnit.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secMethodReceveDT.setVisibility(View.VISIBLE);
secValidity.setVisibility(View.VISIBLE);
spnValidityUnit.setSelection(3);
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("05") && rdoSSLMarket.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.VISIBLE);
spnBrand.setAdapter(C.getArrayAdapter("Select ' 'as brandCode union Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('77') order by brandCode asc"));
spnMethodUnit.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secMethodReceveDT.setVisibility(View.VISIBLE);
secValidity.setVisibility(View.VISIBLE);
spnValidityUnit.setSelection(3);
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("05") && rdoSSOther.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.VISIBLE);
spnBrand.setAdapter(C.getArrayAdapter("Select ' 'as brandCode union Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('04','05','77') order by brandCode asc"));
spnMethodUnit.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secMethodReceveDT.setVisibility(View.VISIBLE);
secValidity.setVisibility(View.VISIBLE);
spnValidityUnit.setSelection(3);
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("05") && rdoSSOtherGovt.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.VISIBLE);
spnBrand.setAdapter(C.getArrayAdapter("Select ' 'as brandCode union Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('04','05') order by brandCode asc"));
spnMethodUnit.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secMethodReceveDT.setVisibility(View.VISIBLE);
secValidity.setVisibility(View.VISIBLE);
spnValidityUnit.setSelection(3);
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("05")) {
secSS.setVisibility(View.VISIBLE);
rdogrpSS.clearCheck();
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
txtMethodQty.setText("");
spnMethodUnit.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
secValidity.setVisibility(View.GONE);
spnValidityUnit.setSelection(0);
dtpMD.setText("");
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("06") && rdoSSFWA.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
spnMethodUnit.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("06") && rdoSSLMarket.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
spnMethodUnit.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("06") && rdoSSOther.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
spnMethodUnit.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("06") && rdoSSOtherGovt.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
spnMethodUnit.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("06")) {
secSS.setVisibility(View.VISIBLE);
rdogrpSS.clearCheck();
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
spnMethodUnit.setSelection(0);
txtMethodQty.setText("");
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("07") && rdoSSFWA.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnMethodUnit.setSelection(3);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("07") && rdoSSLMarket.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnMethodUnit.setSelection(3);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("07") && rdoSSOther.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnMethodUnit.setSelection(3);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("07") && rdoSSOtherGovt.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnMethodUnit.setSelection(3);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("07")) {
secSS.setVisibility(View.VISIBLE);
rdogrpSS.clearCheck();
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnMethodUnit.setSelection(0);
txtMethodQty.setText("");
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("08") && rdoSSFWA.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.VISIBLE);
spnMethodUnit.setSelection(3);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("08") && rdoSSLMarket.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
txtMethodQty.setText("");
spnMethodUnit.setSelection(0);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("08") && rdoSSOther.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
txtMethodQty.setText("");
spnMethodUnit.setSelection(0);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("08") && rdoSSOtherGovt.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
txtMethodQty.setText("");
spnMethodUnit.setSelection(0);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("08")) {
secSS.setVisibility(View.VISIBLE);
rdogrpSS.clearCheck();
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
spnMethodUnit.setSelection(0);
txtMethodQty.setText("");
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("09") && rdoSSFWA.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.VISIBLE);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
spnMethodUnit.setSelection(3);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("09") && rdoSSLMarket.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
txtMethodQty.setText("");
spnMethodUnit.setSelection(0);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("09") && rdoSSOther.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
txtMethodQty.setText("");
spnMethodUnit.setSelection(0);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("09") && rdoSSOtherGovt.isChecked()) {
secSS.setVisibility(View.VISIBLE);
secMethodUnit.setVisibility(View.GONE);
txtMethodQty.setText("");
spnMethodUnit.setSelection(0);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("09")) {
secSS.setVisibility(View.VISIBLE);
rdogrpSS.clearCheck();
secMethodUnit.setVisibility(View.GONE);
spnMethodUnit.setSelection(0);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
txtMethodQty.setText("");
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
rdoSSFWA.setVisibility(View.VISIBLE);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("10")) {
secSS.setVisibility(View.GONE);
rdogrpSS.clearCheck();
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
spnMethodUnit.setSelection(0);
txtMethodQty.setText("");
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.VISIBLE);
//spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.VISIBLE);
//spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("11")) {
secSS.setVisibility(View.GONE);
rdogrpSS.clearCheck();
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
spnMethodUnit.setSelection(0);
txtMethodQty.setText("");
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.VISIBLE);
//spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.VISIBLE);
//spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
}
//
else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("17")) {
secSS.setVisibility(View.GONE);
rdogrpSS.clearCheck();
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
spnMethodUnit.setSelection(0);
txtMethodQty.setText("");
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.VISIBLE);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("15")) {
secSS.setVisibility(View.GONE);
rdogrpSS.clearCheck();
secMethodUnit.setVisibility(View.GONE);
secBrand.setVisibility(View.GONE);
spnBrand.setSelection(0);
spnMethodUnit.setSelection(0);
txtMethodQty.setText("");
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
dtpMD.setText("");
txtValidity.setText("");
spnValidityUnit.setSelection(0);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("12")) {
spnMethodUnit.setSelection(0);
txtMethodQty.setText("");
secSS.setVisibility(View.GONE);
rdogrpSS.clearCheck();
secMethodUnit.setVisibility(View.GONE);
spnBrand.setSelection(0);
spnMethodUnit.setSelection(0);
txtMethodQty.setText("");
secBrand.setVisibility(View.GONE);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
txtValidity.setText("");
spnValidityUnit.setSelection(0);
cmdSave.setText("Save and Continue...");
} else {
spnMethodUnit.setSelection(0);
txtMethodQty.setText("");
secSS.setVisibility(View.GONE);
rdogrpSS.clearCheck();
secMethodUnit.setVisibility(View.GONE);
spnBrand.setSelection(0);
spnMethodUnit.setSelection(0);
txtMethodQty.setText("");
secBrand.setVisibility(View.GONE);
secSyringe.setVisibility(View.GONE);
txtSyringeQty.setText("");
secWherePlace.setVisibility(View.GONE);
spnWherePlace.setSelection(0);
secSendForMethod.setVisibility(View.GONE);
spnSendForMethod.setSelection(0);
secImpotent.setVisibility(View.GONE);
spnImpotent.setSelection(0);
secValidity.setVisibility(View.GONE);
secMethodReceveDT.setVisibility(View.GONE);
rdogrpMethodReceveDT.clearCheck();
txtValidity.setText("");
spnValidityUnit.setSelection(0);
cmdSave.setText("Save");
}
}
@Override
public void onNothingSelected(AdapterView<?> parentView) {
}
});
btnDOM.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
VariableID = "btnDOM";
showDialog(DATE_DIALOG);
}
});
btnDOV.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
VariableID = "btnDOV";
showDialog(DATE_DIALOG);
}
});
btnMD.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
VariableID = "btnMD";
showDialog(DATE_DIALOG);
}
});
btnDOTT1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
VariableID = "btnDOTT1";
showDialog(DATE_DIALOG);
}
});
secValidity = (LinearLayout) findViewById(R.id.secValidity);
secValidity.setVisibility(View.GONE);
txtValidity = (EditText) findViewById(R.id.txtValidity);
spnValidityUnit = (Spinner) findViewById(R.id.spnValidityUnit);
List<String> listYMD = new ArrayList<String>();
listYMD.add("");
listYMD.add("দিন");
listYMD.add("মাস");
listYMD.add("বছর");
ArrayAdapter<String> adptrspnYMD = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, listYMD);
spnValidityUnit.setAdapter(adptrspnYMD);
DataSearch(g.getHealthID());
ELCOMemSearch(g.getGeneratedId());
//ImmunizationData(txtHealthID.getText().toString());
cmdSave.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
DataSave();
//g.setCallFrom("elco");
}
});
btnAddTT = (ImageButton) findViewById(R.id.btnAddTT);
btnSaveTT = (ImageButton) findViewById(R.id.btnSaveTT);
btnTTClose = (ImageButton) findViewById(R.id.btnTTClose);
btnAddTT.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
secTT1.setVisibility(View.VISIBLE);
btnTTClose.setVisibility(View.VISIBLE);
btnAddTT.setVisibility(View.GONE);
VlblTTCard.setVisibility(View.GONE);
rdogrpTTCard.setVisibility(View.GONE);
dtpDOTT1.setVisibility(View.GONE);
btnDOTT1.setVisibility(View.GONE);
btnSaveTT.setVisibility(View.GONE);
GridView gcount = (GridView) findViewById(R.id.gridTT);
g.setImuCode(String.valueOf(gcount.getCount() + 1));
}
});
btnTTClose.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ChkTT1.setChecked(false);
rdogrpTTCard.clearCheck();
dtpDOTT1.setText("");
secTT1.setVisibility(View.GONE);
btnTTClose.setVisibility(View.GONE);
btnAddTT.setVisibility(View.VISIBLE);
g.setImuCode("");
}
});
//ImageButton btnSaveTT = (ImageButton)findViewById(R.id.btnSaveTT);
btnSaveTT.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//GridView gcount=(GridView) findViewById(R.id.gridTT);
if (!ChkTT1.isChecked()) {
Connection.MessageBox(ELCOForm.this, "টিটি পেয়েছে কিনা এ তথ্য না হতে পারে না।");
ChkTT1.requestFocus();
return;
} else if (ChkTT1.isChecked()) {
if (!rdoCardYes.isChecked() & !rdoCardNo.isChecked()) {
Connection.MessageBox(ELCOForm.this, "টিটি কার্ড আছে কিনা এ তথ্য হ্যাঁ/না হতে হবে।");
rdoCardYes.requestFocus();
return;
} else if (rdoCardYes.isChecked() & dtpDOTT1.getText().length() == 0) {
Connection.MessageBox(ELCOForm.this, "টিটি কার্ড থাকলে অবশ্যই তারিখ থাকতে হবে।");
dtpDOTT1.requestFocus();
return;
} else if (rdoCardNo.isChecked() & dtpDOTT1.getText().length() == 0) {
} else {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
String formattedDate = sdf.format(c.getTime());
Date date1 = null;
try {
date1 = sdf.parse(formattedDate);
} catch (ParseException e) {
e.printStackTrace();
}
Date date2 = null;
try {
date2 = sdf.parse(dtpDOTT1.getText().toString());
} catch (ParseException e) {
e.printStackTrace();
}
if (date2.after(date1)) {
Connection.MessageBox(ELCOForm.this, "টিটি এর তারিখ আজকের তারিখ[" + formattedDate + "] এর সমান অথবা কম হতে হবে।");
dtpDOTT1.requestFocus();
return;
}
if (validateTTDateAgainstDOB()) {
Connection.MessageBox(ELCOForm.this, "টিটি এর তারিখ জন্ম তারিখ এর থেকে কম হবে না ।");
dtpDOTT1.requestFocus();
return;
}
}
}
ImmunizationSave(g.getImuCode());
ChkTT1.setChecked(false);
rdogrpTTCard.clearCheck();
dtpDOTT1.setText("");
secTT1.setVisibility(View.GONE);
btnTTClose.setVisibility(View.GONE);
btnAddTT.setVisibility(View.VISIBLE);
g.setImuCode("");
ImmunizationStatus();
}
});
ImmunizationStatus();
ElcoVisitStsatus();
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
} catch (Exception e) {
Connection.MessageBox(ELCOForm.this, e.getMessage());
return;
}
}
private boolean validateVisitDateAgainstSystemDate() {
if ((Global.DateDifferenceDays(dtpDOV.getText().toString(), Global.DateNowDMY()) >= 1)) {
return true;
}
return false;
}
private boolean validateMarriageDateAgainstSystemDate() {
if ((Global.DateDifferenceDays(dtpDOM.getText().toString(), Global.DateNowDMY()) >= 1)) {
return true;
}
return false;
}
private boolean validateMethodDateAgainstMarriageDate() {
if ((Global.DateDifferenceDays(dtpDOM.getText().toString(), dtpDOV.getText().toString()) >= 1)) {
return true;
}
return false;
}
private boolean validateTTDateAgainstDOB() {
String sq = String.format("Select DOB from Member where healthId = '%s' ", g.getHealthID());
if (C.Existence(sq)) {
String DOB = C.ReturnSingleValue(String.format("Select DOB from Member where healthId = '%s' ", g.getHealthID()));
if (Global.DateDifferenceDays(dtpDOTT1.getText().toString(), Global.DateConvertDMY(DOB)) < 1) {
return true;
}
}
return false;
}
private void MethodList(String Status, String sex) {
spnMethod.setAdapter(null);
if (Status.equals("p") & sex.equals("1")) {
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select substr('0' ||EvCode, -2, 2)||'-'||EVName as EvCode from ElcoEvent where substr('0' ||EvCode, -2, 2) in('06') order by EvCode asc"));
cmdSave.setEnabled(true);
} else if (Status.equals("p") & sex.equals("2")) {
if (CurrentStatus(g.getGeneratedId()).equals("12")) {
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select substr('0' ||EvCode, -2, 2)||'-'||EVName as EvCode from ElcoEvent where substr('0' ||EvCode, -2, 2) in('09') order by EvCode asc"));//in('09','12','13','14') order by EvCode asc"));
cmdSave.setEnabled(false);
} else if (CurrentStatus(g.getGeneratedId()).equals("09")) {
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode"));
cmdSave.setEnabled(false);
} else {
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select substr('0' ||EvCode, -2, 2)||'-'||EVName as EvCode from ElcoEvent where substr('0' ||EvCode, -2, 2) not in('13','14','09') order by EvCode asc"));
cmdSave.setEnabled(true);
}
} else if (Status.equals("a") & sex.equals("1")) {
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode"));
cmdSave.setEnabled(true);
} else if (Status.equals("a") & sex.equals("2")) {
if (CurrentStatus(g.getGeneratedId()).equals("12")) {
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select substr('0' ||EvCode, -2, 2)||'-'||EVName as EvCode from ElcoEvent where substr('0' ||EvCode, -2, 2) in('09') order by EvCode asc"));
cmdSave.setEnabled(false);
} else if (CurrentStatus(g.getGeneratedId()).equals("09")) {
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode"));
cmdSave.setEnabled(false);
} else
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select substr('0' ||EvCode, -2, 2)||'-'||EVName as EvCode from ElcoEvent where substr('0' ||EvCode, -2, 2) in('01','02') order by EvCode asc"));
}
}
public void ElcoVisitStsatus() {
g1 = (GridView) findViewById(R.id.gridElcoVisit);
g1.setAdapter(new ElcoVisit(this));
g1.setNumColumns(8);
}
public void ImmunizationStatus() {
GridView g1 = (GridView) findViewById(R.id.gridTT);
g1.setAdapter(new TTCard(this));
g1.setNumColumns(6);
}
//Pregnancy
private String CurrentStatus(String HealthID) {
return C.ReturnSingleValue("select ifnull(currstatus,'')currstatus from elcovisit where healthid='" + g.getGeneratedId() + "' order by date(vDate) desc limit 1");//order by date(systementrydate) desc limit 1// select ifnull(currstatus,'')currstatus from elcovisit where healthid='"+ HealthID +"' order by date(systementrydate) desc limit 1
}
//Pregnancy
private String CurrentStatusValidate(String HealthID) {
return C.ReturnSingleValue("select ifnull(currstatus,'')currstatus from elcovisit where healthid='" + g.getGeneratedId() + "' and vDate = '" + Global.DateConvertYMD(dtpDOV.getText().toString()) + "'");//order by date(vDate) desc limit 1// select ifnull(currstatus,'')currstatus from elcovisit where healthid='"+ HealthID +"' order by date(systementrydate) desc limit 1
}
private String VisitNumber(String HealthID) {
String SQL = "";
SQL = "Select (ifnull(max(cast(Visit as int)),0)+1)MaxVisit from ELCOVisit";
SQL += " where healthid='" + HealthID + "'";
String VisitNo = Global.Right(("00" + C.ReturnSingleValue(SQL)), 2);
return VisitNo;
}
private void SameDateDifferentItem() {
try {
if (validateMarriageDateAgainstSystemDate()) {
Connection.MessageBox(ELCOForm.this, " বিবাহের এর তারিখ আজকের তারিখ এর সমান অথবা কম হতে হবে।");
return;
}
if (validateMethodDateAgainstMarriageDate()) {
Connection.MessageBox(ELCOForm.this, " ভিজিট এর তারিখ বিবাহের তারিখ এর সমান অথবা বেশি হতে হবে।");
return;
}
if (secBrand.getVisibility() == View.VISIBLE) {
if (spnBrand.getSelectedItemPosition() == 0) {
Connection.MessageBox(ELCOForm.this, " ব্র্যান্ড লিখুন");
return;
}
}
if (secMethodUnit.getVisibility() == View.VISIBLE) {
if (txtMethodQty.getVisibility() == View.VISIBLE) {
if (txtMethodQty.getText().toString().length() == 0) {
Connection.MessageBox(ELCOForm.this, " পরিমান লিখুন");
return;
}
}
}
if (secWherePlace.getVisibility() == View.VISIBLE) {
if (spnWherePlace.getSelectedItemPosition() == 0) {
Connection.MessageBox(ELCOForm.this, " কোথায় প্রেরন করা হয়েছে লিখুন");
return;
}
}
if (secSendForMethod.getVisibility() == View.VISIBLE) {
if (spnSendForMethod.getSelectedItemPosition() == 0) {
Connection.MessageBox(ELCOForm.this, "কোন পদ্ধতি জন্য প্রেরন লিখুন");
return;
}
}
if (secImpotent.getVisibility() == View.VISIBLE) {
if (spnImpotent.getSelectedItemPosition() == 0) {
Connection.MessageBox(ELCOForm.this, "কত তম বন্ধ্যা সিলেক্ট করুন");
return;
}
}
if (secSS.getVisibility() == View.VISIBLE) {
if (rdogrpSS.getVisibility() == View.VISIBLE) {
Integer source = rdogrpSS.getCheckedRadioButtonId();
if (source == null) {
Connection.MessageBox(ELCOForm.this, " উৎস সিলেক্ট করুন।");
return;
}
if (source == -1) {
Connection.MessageBox(ELCOForm.this, " উৎস সিলেক্ট করুন।");
return;
}
}
}
if (secSyringe.getVisibility() == View.VISIBLE) {
if (txtSyringeQty.getText().toString().length() == 0) {
Connection.MessageBox(ELCOForm.this, "সিরিঙ্গের পরিমান লিখুন");
txtSyringeQty.requestFocus();
return;
}
}
if (!rdoMethodReceveDT1.isChecked() & !rdoMethodReceveDT2.isChecked() & secMethodReceveDT.isShown()) {
Connection.MessageBox(ELCOForm.this, "পদ্ধতি গ্রহনের উৎস কি সিলেক্ট করুন।");
rdoMethodReceveDT1.requestFocus();
return;
} else if (dtpMD.getText().toString().length() == 0 & secMethodReceveDT.isShown() & rdoMethodReceveDT1.isChecked()) {
Connection.MessageBox(ELCOForm.this, "পদ্ধতি গ্রহনের তারিখ লিখুন ।");
dtpMD.requestFocus();
return;
} else if (txtMDAge.getText().toString().length() == 0 & rdoMethodReceveDT2.isChecked() & secMethodReceveDT.isShown()) {
Connection.MessageBox(ELCOForm.this, "পদ্ধতি গ্রহনের বয়স কত লিখুন।");
txtMDAge.requestFocus();
return;
}
if (secValidity.getVisibility() == View.VISIBLE) {
if (txtValidity.getText().toString().length() == 0) {
Connection.MessageBox(ELCOForm.this, " কার্যকারিতা লিখুন");
txtValidity.requestFocus();
return;
} else if (spnValidityUnit.getSelectedItemPosition() == 0) {
Connection.MessageBox(ELCOForm.this, " ইউনিট লিখুন");
return;
}
}
String CurStatus = Global.Left(spnMethod.getSelectedItem().toString(), 2);
//Stock
if (secMethodUnit.getVisibility() == View.VISIBLE) {
if (txtMethodQty.getVisibility() == View.VISIBLE) {
if (txtMethodQty.getText().toString().length() == 0) {
Connection.MessageBox(ELCOForm.this, " পরিমান লিখুন");
return;
} else if (spnMethodUnit.getSelectedItemPosition() == 0) {
Connection.MessageBox(ELCOForm.this, " ইউনিট লিখুন");
return;
} else {
// Integer currentqty = Global.GetCurrentStockOfItem(C, g.getProvCode(), CurStatus);
if (CurStatus.equalsIgnoreCase("01")) {
if (Integer.parseInt(txtMethodQty.getText().toString()) > 3) {
Connection.MessageBox(ELCOForm.this, "ইস্যুর পরিমান 3টির থেকে কম হবে। ");
return;
}
}
}
}
}
//ELCO Visit
String VisitNo = txtVisitNo.getText().toString();
String sqlnew = "";
String sqlupdate = "";
String trnid = C.ReturnSingleValue("Select transactionId from elcovisit Where HealthID='" + g.getGeneratedId() + "' and Visit='" + VisitNo + "'");
String PrevItem = C.ReturnSingleValue("Select currStatus from elcovisit Where HealthID='" + g.getGeneratedId() + "' and Visit='" + VisitNo + "'");
sqlupdate = "Update elcoVisit Set ";
//sqlupdate+="vDate = '"+ Global.DateConvertYMD(dtpDOV.getText().toString()) +"',";
sqlupdate += "visitStatus = '" + (rdoVSPresent.isChecked() ? "1" : "2") + "',";
if (spnMethod.getSelectedItemPosition() == 0)
sqlupdate += "currStatus = '',";
else
sqlupdate += "currStatus = '" + Global.Left(spnMethod.getSelectedItem().toString(), 2) + "',";
//sqlupdate+="newOld = '"+ CurrentMethod +"',";
//sqlupdate+="mDate = '"+ Global.DateConvertYMD(dtpDOV.getText().toString()) +"',";
String SS = "";
if (rdoSSFWA.isChecked()) SS = "1";
if (rdoSSLMarket.isChecked()) SS = "2";
if (rdoSSOther.isChecked()) SS = "3";
if (rdoSSOtherGovt.isChecked()) SS = "4";
sqlupdate += "sSource = '" + SS + "',";
sqlupdate += "qty = '" + txtMethodQty.getText().toString() + "',";
sqlupdate += "unit = '" + (spnMethodUnit.getSelectedItemPosition() == 0 ? "" : String.valueOf(spnMethodUnit.getSelectedItemPosition())) + "',";
if (spnBrand.getSelectedItemPosition() == 0)
sqlupdate += "brand = '',";
else
sqlupdate += "brand = '" + Global.Left(spnBrand.getSelectedItem().toString(), 2) + "',";
//sqlupdate+="brand = '"+ Global.Left(spnBrand.getSelectedItem().toString(), 2) +"',";
sqlupdate += "referPlace = '" + (spnWherePlace.getSelectedItemPosition() == 0 ? "" : String.valueOf(spnWherePlace.getSelectedItemPosition())) + "',";
sqlupdate += "validity = '" + txtValidity.getText().toString() + "',";
sqlupdate += "dayMonYear = '" + (spnValidityUnit.getSelectedItemPosition() == 0 ? "" : String.valueOf(spnValidityUnit.getSelectedItemPosition())) + "',";
sqlupdate += "mrSource = '" + (rdoMethodReceveDT1.isChecked() ? "1" : (rdoMethodReceveDT2.isChecked() ? "2" : "")) + "',";//(rdoMethodReceveDT1.isChecked()?"1":"2")
if (rdoMethodReceveDT1.isChecked()) {
sqlupdate += "MRDate = '" + Global.DateConvertYMD(dtpMD.getText().toString()) + "',";
sqlupdate += "MRAge = '" + Global.DateDifferenceMonth(Global.DateNowDMY(), dtpMD.getText().toString()) + "',";//DateDifferenceYears DateDifferenceMonth
} else if (rdoMethodReceveDT2.isChecked()) {
sqlupdate += "MRDate = '" + Global.addDaysYMD(Global.DateNowDMY(), -Integer.valueOf(txtMDAge.getText().toString()) * 30) + "',";
sqlupdate += "MRAge = '" + txtMDAge.getText().toString() + "', ";
} else {
sqlupdate += "MRDate = '',";
sqlupdate += "MRAge = '', ";
}
sqlupdate += "syrinsQty = '" + txtSyringeQty.getText().toString() + "',";
if (spnSendForMethod.getSelectedItemPosition() == 0)
sqlupdate += "sendForMethod = '',";
else
sqlupdate += "sendForMethod = '" + Global.Left(spnSendForMethod.getSelectedItem().toString(), 2) + "',";
if (spnImpotent.getSelectedItemPosition() == 0)
sqlupdate += "impotent = ''";
else
sqlupdate += "impotent = '" + Global.Left(spnImpotent.getSelectedItem().toString(), 2) + "'";
sqlupdate += " Where HealthID='" + g.getGeneratedId() + "' and Visit='" + VisitNo + "'";
if (!Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("12") && !Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("13"))
C.Save(sqlupdate);
else {
sqlupdate = "Update elcoVisit Set pregNo = '" + PGNNo() + "' , ";
//sqlupdate += "vDate = '" + Global.DateConvertYMD(dtpDOV.getText().toString()) + "',";//dtpDOV
sqlupdate += "visitStatus = '" + (rdoVSPresent.isChecked() ? "1" : "2") + "',";
if (spnMethod.getSelectedItemPosition() == 0)
sqlupdate += "currStatus = '',";
else
sqlupdate += "currStatus = '" + Global.Left(spnMethod.getSelectedItem().toString(), 2) + "',";
//sqlupdate += "newOld = '" + CurrentMethod + "',";
//sqlupdate += "mDate = '" + Global.DateConvertYMD(dtpDOV.getText().toString()) + "',";
SS = "";
if (rdoSSFWA.isChecked()) SS = "1";
if (rdoSSLMarket.isChecked()) SS = "2";
if (rdoSSOther.isChecked()) SS = "3";
if (rdoSSOtherGovt.isChecked()) SS = "4";
sqlupdate += "sSource = '" + SS + "',";
sqlupdate += "qty = '" + txtMethodQty.getText().toString() + "',";
sqlupdate += "unit = '" + (spnMethodUnit.getSelectedItemPosition() == 0 ? "" : String.valueOf(spnMethodUnit.getSelectedItemPosition())) + "',";
if (spnBrand.getSelectedItemPosition() == 0)
sqlupdate += "brand = '',";
else
sqlupdate += "brand = '" + Global.Left(spnBrand.getSelectedItem().toString(), 2) + "',";
//sqlupdate += "brand = '" + (spnBrand.getSelectedItemPosition() == 0 ? "" : Global.Left(spnBrand.getSelectedItem().toString(), 2)) + "',";
sqlupdate += "referPlace = '" + (spnWherePlace.getSelectedItemPosition() == 0 ? "" : String.valueOf(spnWherePlace.getSelectedItemPosition())) + "',";
sqlupdate += "validity = '" + txtValidity.getText().toString() + "',";
sqlupdate += "dayMonYear = '" + (spnValidityUnit.getSelectedItemPosition() == 0 ? "" : String.valueOf(spnValidityUnit.getSelectedItemPosition())) + "',";
sqlupdate += "mrSource = '" + (rdoMethodReceveDT1.isChecked() ? "1" : (rdoMethodReceveDT2.isChecked() ? "2" : "")) + "',";//(rdoMethodReceveDT1.isChecked()?"1":"2")
if (rdoMethodReceveDT1.isChecked()) {
sqlupdate += "MRDate = '" + Global.DateConvertYMD(dtpMD.getText().toString()) + "',";
sqlupdate += "MRAge = '" + Global.DateDifferenceMonth(Global.DateNowDMY(), dtpMD.getText().toString()) + "',";//DateDifferenceYears DateDifferenceMonth
} else if (rdoMethodReceveDT2.isChecked()) {
sqlupdate += "MRDate = '" + Global.addDaysYMD(Global.DateNowDMY(), -Integer.valueOf(txtMDAge.getText().toString()) * 30) + "',";
sqlupdate += "MRAge = '" + txtMDAge.getText().toString() + "', ";
} else {
sqlupdate += "MRDate = '',";
sqlupdate += "MRAge = '', ";
}
sqlupdate += "syrinsQty = '" + txtSyringeQty.getText().toString() + "',";
sqlupdate += "sendForMethod = '',";
sqlupdate += "impotent = '',";
sqlupdate += "modifyDate = '" + Global.DateTimeNowYMDHMS() + "'";
sqlupdate += " Where HealthID='" + g.getGeneratedId() + "' and Visit='" + VisitNo + "'";
g.setPregNo(PGNNo());
}
//String CurStatus = Global.Left(spnMethod.getSelectedItem().toString(), 2);
if (secMethodUnit.getVisibility() == View.VISIBLE) {
if (txtMethodQty.getVisibility() == View.VISIBLE) {
//Validation is not required here. Validation of current stock is handled above.
/*if (!C.Existence("SELECT * FROM stockTransaction WHERE transactionType ='4' AND providerId ='" + g.getProvCode() + "' AND healthId = '" +
g.getGeneratedId() + "' AND itemCode = '" + CurStatus + "' AND systemEntryDate ='" + Global.DateNowYMD() + "'"))*/
String TransactionSQL = "SELECT * FROM stockTransaction WHERE transactionType ='4' AND providerId ='" + g.getProvCode() + "' AND healthId = '" + g.getGeneratedId() + "' AND systemEntryDate ='" + Global.DateConvertYMD(dtpDOV.getText().toString()) + "'and transactionId== '" + trnid + "'";
if (C.Existence(TransactionSQL)) {
if (CurStatus.equalsIgnoreCase("01")) {
//Suki
if (Global.Left(spnBrand.getSelectedItem().toString(), 2).equalsIgnoreCase("01")) {
UpdateStockAndItem(trnid, g.getProvCode(), PrevItem, Global.Left(spnMethod.getSelectedItem().toString(), 2).toString(), txtMethodQty.getText().toString());
}
//Apon
else if (Global.Left(spnBrand.getSelectedItem().toString(), 2).equalsIgnoreCase("02")) {
UpdateStockAndItem(trnid, g.getProvCode(), PrevItem, Global.Left(spnMethod.getSelectedItem().toString(), 2).toString(), txtMethodQty.getText().toString());
}
} else if (CurStatus.equalsIgnoreCase("02") | CurStatus.equalsIgnoreCase("08") || CurStatus.equalsIgnoreCase("09")) {
UpdateStockAndItem(trnid, g.getProvCode(), PrevItem, Global.Left(spnMethod.getSelectedItem().toString(), 2).toString(), txtMethodQty.getText().toString());
} else if (CurStatus.equalsIgnoreCase("03")) { //Injectable
UpdateStockAndItem(trnid, g.getProvCode(), PrevItem, Global.Left(spnMethod.getSelectedItem().toString(), 2).toString(), txtMethodQty.getText().toString());
}
} else {
if (CurStatus.equalsIgnoreCase("01")) {
//Suki
if (Global.Left(spnBrand.getSelectedItem().toString(), 2).equalsIgnoreCase("01")) {
String trnsactionid = Global.GenerateProviderId(g.getProvCode());
InsertTransactionUnstockToStock(CurStatus, g.getProvCode(), txtMethodQty.getText().toString(), trnsactionid);
}
//Apon
else if (Global.Left(spnBrand.getSelectedItem().toString(), 2).equalsIgnoreCase("02")) {
String trnsactionid = Global.GenerateProviderId(g.getProvCode());
InsertTransactionUnstockToStock("10", g.getProvCode(), txtMethodQty.getText().toString(), trnsactionid);
}
} else if (CurStatus.equalsIgnoreCase("02") | CurStatus.equalsIgnoreCase("08") || CurStatus.equalsIgnoreCase("09")) {
String trnsactionid = Global.GenerateProviderId(g.getProvCode());
InsertTransactionUnstockToStock(CurStatus, g.getProvCode(), txtMethodQty.getText().toString(), trnsactionid);
} else if (CurStatus.equalsIgnoreCase("03")) { //Injectable
String trnsactionid = Global.GenerateProviderId(g.getProvCode());
InsertTransactionUnstockToStock(CurStatus, g.getProvCode(), txtMethodQty.getText().toString(), trnsactionid);
trnid = String.valueOf(Long.parseLong(Global.GenerateProviderId(g.getProvCode())) + 1);
InsertTransactionUnstockToStock("5", g.getProvCode(), txtMethodQty.getText().toString(), trnid);
}
}
}
} else {
if (PrevItem.equalsIgnoreCase("01") | PrevItem.equalsIgnoreCase("02") | PrevItem.equalsIgnoreCase("03") | PrevItem.equalsIgnoreCase("08") | PrevItem.equalsIgnoreCase("09")) {
UpdateStockZeroAndItem(trnid, PrevItem, txtMethodQty.getText().toString());
}
}
ElcoVisitStsatus();
rdogrpVS.clearCheck();
spnMethod.setSelection(0);
rdogrpSS.clearCheck();
spnBrand.setSelection(0);
txtMethodQty.setText("");
spnMethodUnit.setSelection(0);
spnWherePlace.setSelection(0);
txtValidity.setText("");
spnValidityUnit.setSelection(0);
secMethod.setVisibility(View.VISIBLE);
spnMethod.setSelection(0);
txtMethodQty.setText("");
spnMethodUnit.setSelection(0);
} catch (Exception e) {
Log.e("Error from ELCO", e.getMessage());
Connection.MessageBox(ELCOForm.this, e.getMessage());
return;
}
}
private void DataSave() {
try {
//ELCO Profile
if (txtELCONo.getText().toString().length() == 0) {
Connection.MessageBox(ELCOForm.this, "দম্পতি নং কত লিখুন।");
txtELCONo.requestFocus();
return;
}
if (!rdoELCOStatus1.isChecked() & !rdoELCOStatus2.isChecked()) {
Connection.MessageBox(ELCOForm.this, "দম্পতির অবস্থা কি");
rdoELCOStatus1.requestFocus();
return;
}
if (!chkHHNoDontKnow.isChecked()) {
if (txtHHNo.getText().toString().length() == 0) {
Connection.MessageBox(ELCOForm.this, "খানা নম্বর কত লিখুন।");
txtHHNo.requestFocus();
return;
}
}
if (dtpDOM.getText().toString().length() == 0 & dtpDOM.isShown() & rdoDOMSource1.isChecked()) {
Connection.MessageBox(ELCOForm.this, "প্রকৃত বিবাহের তারিখ কত লিখুন।");
dtpDOM.requestFocus();
return;
} else if (txtMAge.getText().toString().length() == 0 & rdoDOMSource2.isChecked()) {
Connection.MessageBox(ELCOForm.this, "বিবাহের বয়স কত লিখুন।");
txtMAge.requestFocus();
return;
} else if (txtLiveSon.getText().toString().length() == 0) {
Connection.MessageBox(ELCOForm.this, "জীবিত ছেলের সংখ্যা লিখুন।");
txtLiveSon.requestFocus();
return;
} else if (txtLiveDau.getText().toString().length() == 0) {
Connection.MessageBox(ELCOForm.this, "জীবিত মেয়ের সংখ্যা লিখুন।");
txtLiveDau.requestFocus();
return;
}
if (!rdoVSPresent.isChecked() & !rdoVSAbsent.isChecked()) {
Connection.MessageBox(ELCOForm.this, "পরিদর্শনের অবস্থা সিলেক্ট করুন।");
rdoVSPresent.requestFocus();
return;
}
if (rdoVSPresent.isChecked() & spnMethod.getSelectedItemPosition() == 0 & secMethod.isShown()) {
Connection.MessageBox(ELCOForm.this, "জন্মনিয়ন্ত্রণ ব্যবস্থা/গর্ভাবস্থা সিলেক্ট করুন।।");
rdoVSPresent.requestFocus();
return;
}
if (validateVisitDateAgainstSystemDate()) {
Connection.MessageBox(ELCOForm.this, " ভিজিট এর তারিখ আজকের তারিখ এর সমান অথবা কম হতে হবে।");
return;
}
String PrevItem = C.ReturnSingleValue("Select currStatus from elcovisit Where HealthID='" + g.getGeneratedId() + "' and Visit='" + txtVisitNo.getText().toString() + "'");
if (!PrevItem.equalsIgnoreCase("")) {
if (Global.DateDifferenceDays(dtpDOV.getText().toString(), Global.DateConvertDMY(GetDOV(g.getGeneratedId()))) == 0 & IsItemSame(Global.Left(spnMethod.getSelectedItem().toString(), 2).toString(), txtVisitNo.getText().toString())) {
SameDateDifferentItem();
Connection.MessageBox(ELCOForm.this, "তথ্য সফলভাবে সম্পাদন করা হয়েছে।");
if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("12")) {
Intent f2 = new Intent(getApplicationContext(), FWAReg.class);
g.setAMElco(txtELCONo.getText().toString());
g.setAAge(txtAge.getText().toString());
Bundle IDbundle = new Bundle();
String sqlnew = "";
String sqlupdate = "";
if (sqlnew.length() > 0)
IDbundle.putString("sqlnew", sqlnew);
if (sqlupdate.length() > 0)
IDbundle.putString("sqlupdate", sqlupdate);
f2.putExtras(IDbundle);
startActivity(f2);
finish();
return;
} else {
if (g.getCallFrom().equals("HAregis")) {
finish();
Intent f2 = new Intent(getApplicationContext(), Elcoview.class);
startActivity(f2);
return;
} else {
finish();
Intent f2 = new Intent(getApplicationContext(), MemberList.class);
startActivity(f2);
return;
}
}
}
}
if (GetDOV(g.getGeneratedId()).equals("")) {
} else {//if(CurrentStatus(txtHealthID.getText().toString()).equals("12"))
String status = CurrentStatusValidate(g.getGeneratedId());
String spinnervalue = Global.Left(spnMethod.getSelectedItem().toString(), 2);
if ((status.equalsIgnoreCase(spinnervalue) && spinnervalue.equalsIgnoreCase("01") |
(status.equalsIgnoreCase(spinnervalue) && spinnervalue.equalsIgnoreCase("02")) |
(status.equalsIgnoreCase(spinnervalue) && spinnervalue.equalsIgnoreCase("03")) |
(status.equalsIgnoreCase(spinnervalue) && spinnervalue.equalsIgnoreCase("08")) |
(status.equalsIgnoreCase(spinnervalue) && spinnervalue.equalsIgnoreCase("09"))) && Global.DateDifferenceDays(dtpDOV.getText().toString(), Global.DateConvertDMY(GetDOV(g.getGeneratedId()))) <= 0) {
if (spinnervalue.equalsIgnoreCase("01")) {
if (secBrand.getVisibility() == View.VISIBLE) {
if (spnBrand.getSelectedItemPosition() == 0) {
Connection.MessageBox(ELCOForm.this, " ব্র্যান্ড লিখুন");
return;
}
}
if (secMethodUnit.getVisibility() == View.VISIBLE) {
if (txtMethodQty.getVisibility() == View.VISIBLE) {
if (txtMethodQty.getText().toString().length() == 0) {
Connection.MessageBox(ELCOForm.this, " পরিমান লিখুন");
return;
}
}
}
//Suki
if (Global.Left(spnBrand.getSelectedItem().toString(), 2).equalsIgnoreCase("01")) {
AdjustStockQty(txtMethodQty.getText().toString(), Global.Left(spnMethod.getSelectedItem().toString(), 2).toString(), g.getProvCode());
}
//Apon
else if (Global.Left(spnBrand.getSelectedItem().toString(), 2).equalsIgnoreCase("02")) {
AdjustStockQty(txtMethodQty.getText().toString(), "10", g.getProvCode());
}
} else {
/*if(IsItemSame(Global.Left(spnMethod.getSelectedItem().toString(), 2).toString(),txtVisitNo.getText().toString()))
{
SameDateDifferentItem();
}
else
{
AdjustStockQty(txtMethodQty.getText().toString(), Global.Left(spnMethod.getSelectedItem().toString(), 2).toString(), g.getProvCode());
}*/
AdjustStockQty(txtMethodQty.getText().toString(), Global.Left(spnMethod.getSelectedItem().toString(), 2).toString(), g.getProvCode());
}
if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("03")) {
this.InsertInjectableToWomanInjectableTable(Global.DateConvertYMD(dtpMD.getText().toString()));
}
Connection.MessageBox(ELCOForm.this, "তথ্য সফলভাবে সংরক্ষণ করা হয়েছে।");
if (g.getCallFrom().equals("HAregis")) {
finish();
Intent f2 = new Intent(getApplicationContext(), Elcoview.class);
startActivity(f2);
return;
} else {
finish();
Intent f2 = new Intent(getApplicationContext(), MemberList.class);
startActivity(f2);
return;
}
}
/* else if (Global.DateDifferenceDays(dtpDOV.getText().toString(), Global.DateConvertDMY(GetDOV(g.getGeneratedId()))) <= 0) {
Connection.MessageBox(ELCOForm.this, " ভিজিট এর তারিখ পূর্বের ভিজিট তারিখ এর বেশি হতে হবে");
return;
}*/
}
if (validateMarriageDateAgainstSystemDate()) {
Connection.MessageBox(ELCOForm.this, " বিবাহের এর তারিখ আজকের তারিখ এর সমান অথবা কম হতে হবে।");
return;
}
if (validateMethodDateAgainstMarriageDate()) {
Connection.MessageBox(ELCOForm.this, " ভিজিট এর তারিখ বিবাহের তারিখ এর সমান অথবা বেশি হতে হবে।");
return;
}
if (secBrand.getVisibility() == View.VISIBLE) {
if (spnBrand.getSelectedItemPosition() == 0) {
Connection.MessageBox(ELCOForm.this, " ব্র্যান্ড লিখুন");
return;
}
}
if (secMethodUnit.getVisibility() == View.VISIBLE) {
if (txtMethodQty.getVisibility() == View.VISIBLE) {
if (txtMethodQty.getText().toString().length() == 0) {
Connection.MessageBox(ELCOForm.this, " পরিমান লিখুন");
return;
}
}
}
if (secWherePlace.getVisibility() == View.VISIBLE) {
if (spnWherePlace.getSelectedItemPosition() == 0) {
Connection.MessageBox(ELCOForm.this, " কোথায় প্রেরন করা হয়েছে লিখুন");
return;
}
}
if (secSendForMethod.getVisibility() == View.VISIBLE) {
if (spnSendForMethod.getSelectedItemPosition() == 0) {
Connection.MessageBox(ELCOForm.this, "কোন পদ্ধতি জন্য প্রেরন লিখুন");
return;
}
}
if (secImpotent.getVisibility() == View.VISIBLE) {
if (spnImpotent.getSelectedItemPosition() == 0) {
Connection.MessageBox(ELCOForm.this, "কত তম বন্ধ্যা সিলেক্ট করুন");
return;
}
}
if (secSS.getVisibility() == View.VISIBLE) {
if (rdogrpSS.getVisibility() == View.VISIBLE) {
Integer source = rdogrpSS.getCheckedRadioButtonId();
if (source == null) {
Connection.MessageBox(ELCOForm.this, " উৎস সিলেক্ট করুন।");
return;
}
if (source == -1) {
Connection.MessageBox(ELCOForm.this, " উৎস সিলেক্ট করুন।");
return;
}
}
}
/*if(secMethodReceveDT.getVisibility() == View.VISIBLE & secValidity.getVisibility()==View.VISIBLE ) {
if (dtpMD.getText().toString().length() == 0 | txtValidity.getText().toString().length() == 0|spnValidityUnit.getSelectedItemPosition() == 0) {
AlertDialog.Builder adb = new AlertDialog.Builder(ELCOForm.this);
if(dtpMD.getText().toString().length() == 0) {
adb.setTitle("Close");
adb.setMessage("আপনি কি পদ্ধতি গ্রহনের তারিখ ছাড়াই ভিজিট সম্পূর্ণ করতে চান[হাঁ/না]");
adb.setNegativeButton("না", new AlertDialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
if (dtpMD.getText().toString().length() == 0) {
Connection.MessageBox(ELCOForm.this, " পদ্ধতি গ্রহনের তারিখ লিখুন");
return;
}
}
});
}
else if(txtValidity.getText().toString().length() == 0) {
adb.setTitle("Close");
adb.setMessage("আপনি কি কার্যকারিতা ছাড়াই ভিজিট সম্পূর্ণ করতে চান[হাঁ/না]");
adb.setNegativeButton("না", new AlertDialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
if (txtValidity.getText().toString().length() == 0) {
Connection.MessageBox(ELCOForm.this, " কার্যকারিতা লিখুন");
return;
}
}
});
}
else if(spnValidityUnit.getSelectedItemPosition() == 0) {
adb.setTitle("Close");
adb.setMessage("আপনি কি ইউনিট ছাড়াই ভিজিট সম্পূর্ণ করতে চান[হাঁ/না]");
adb.setNegativeButton("না", new AlertDialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
if (spnValidityUnit.getSelectedItemPosition() == 0) {
Connection.MessageBox(ELCOForm.this, " ইউনিট লিখুন");
return;
}
}
});
}
adb.setPositiveButton("হাঁ", new AlertDialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
spnValidityUnit.setSelection(0);
ELCOSave();
}
});
adb.show();
return;
}
}*/
if (secSyringe.getVisibility() == View.VISIBLE) {
if (txtSyringeQty.getText().toString().length() == 0) {
Connection.MessageBox(ELCOForm.this, "সিরিঙ্গের পরিমান লিখুন");
txtSyringeQty.requestFocus();
return;
}
}
if (!rdoMethodReceveDT1.isChecked() & !rdoMethodReceveDT2.isChecked() & secMethodReceveDT.isShown()) {
Connection.MessageBox(ELCOForm.this, "পদ্ধতি গ্রহনের উৎস কি সিলেক্ট করুন।");
rdoMethodReceveDT1.requestFocus();
return;
} else if (dtpMD.getText().toString().length() == 0 & secMethodReceveDT.isShown() & rdoMethodReceveDT1.isChecked()) {
Connection.MessageBox(ELCOForm.this, "পদ্ধতি গ্রহনের তারিখ লিখুন ।");
dtpMD.requestFocus();
return;
} else if (txtMDAge.getText().toString().length() == 0 & rdoMethodReceveDT2.isChecked() & secMethodReceveDT.isShown()) {
Connection.MessageBox(ELCOForm.this, "পদ্ধতি গ্রহনের বয়স কত লিখুন।");
txtMDAge.requestFocus();
return;
}
if (secValidity.getVisibility() == View.VISIBLE) {
if (txtValidity.getText().toString().length() == 0) {
Connection.MessageBox(ELCOForm.this, " কার্যকারিতা লিখুন");
txtValidity.requestFocus();
return;
} else if (spnValidityUnit.getSelectedItemPosition() == 0) {
Connection.MessageBox(ELCOForm.this, " ইউনিট লিখুন");
return;
}
}
String CurStatus = Global.Left(spnMethod.getSelectedItem().toString(), 2);
//Stock
if (secMethodUnit.getVisibility() == View.VISIBLE) {
if (txtMethodQty.getVisibility() == View.VISIBLE) {
if (txtMethodQty.getText().toString().length() == 0) {
Connection.MessageBox(ELCOForm.this, " পরিমান লিখুন");
return;
} else if (spnMethodUnit.getSelectedItemPosition() == 0) {
Connection.MessageBox(ELCOForm.this, " ইউনিট লিখুন");
return;
} else {
// Integer currentqty = Global.GetCurrentStockOfItem(C, g.getProvCode(), CurStatus);
if (CurStatus.equalsIgnoreCase("01")) {
if (Integer.parseInt(txtMethodQty.getText().toString()) > 3) {
Connection.MessageBox(ELCOForm.this, "ইস্যুর পরিমান 3টির থেকে কম হবে। ");
return;
}
}
}
}
}
String SQL = "";
//ELCO Registation
//------------------------------------------------------------------------------------------------------------------------
if (!C.Existence("Select healthid from " + TableName + " Where healthid='" + g.getGeneratedId() + "'")) {
SQL = "Insert into " + TableName + "(healthId,providerId,regDT,systemEntryDate,upload)Values(";
SQL += "'" + g.getGeneratedId() + "',";
SQL += "'" + g.getProvCode() + "',";
SQL += "'" + Global.DateNowYMD() + "',";
SQL += "'" + Global.DateTimeNowYMDHMS() + "',";
SQL += "'2')";
C.Save(SQL);
}
SQL = "Update " + TableName + " Set ";
SQL += "hhStatus = '" + (chkHHNoDontKnow.isChecked() ? "1" : "2") + "',";
SQL += "haHHNo = '" + txtHHNo.getText().toString() + "',";
SQL += "elcoNo = '" + txtELCONo.getText().toString() + "',";
SQL += "acceptorStatus = '" + (rdoELCOStatus1.isChecked() ? "1" : "2") + "',";
SQL += "husbandName = '" + txtHusName.getText().toString() + "',";
SQL += "husbandAge = '" + txtHusAge.getText().toString() + "',";
SQL += "DOMSource = '" + (rdoDOMSource1.isChecked() ? "1" : "2") + "',";
if (rdoDOMSource1.isChecked()) {
SQL += "MarrDate = '" + Global.DateConvertYMD(dtpDOM.getText().toString()) + "',";
SQL += "MarrAge = '" + Global.DateDifferenceYears(Global.DateNowDMY(), dtpDOM.getText().toString()) + "',";
} else {
SQL += "MarrDate = '" + Global.addDaysYMD(Global.DateNowDMY(), -Integer.valueOf(txtMAge.getText().toString()) * 365) + "',";
SQL += "MarrAge = '" + txtMAge.getText().toString() + "',";
}
SQL += "Son = '" + txtLiveSon.getText().toString() + "',";
SQL += "Dau = '" + txtLiveDau.getText().toString() + "',";
SQL += "modifyDate = '" + Global.DateTimeNowYMDHMS() + "'";
SQL += " Where HealthID='" + g.getGeneratedId() + "'";
C.Save(SQL);
if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("03")) {
this.InsertInjectableToWomanInjectableTable(Global.DateConvertYMD(dtpMD.getText().toString()));
}
//ELCO Visit
//When 12 14 come then handale another way.(Pandding)
String SQ1 = "";
SQ1 = "select CurrStatus||'^'||NewOld from ELCOVisit Where healthid='" + g.getGeneratedId() + "'";//and Visit='"+ txtVisitNo.getText().toString() +"'
SQ1 += " order by systemEntryDate desc limit 1";
String PerviousStatus = C.ReturnSingleValue(SQ1);
String[] PerviousMethods = Connection.split(PerviousStatus, '^');
String PreMethodStatus = PerviousMethods[0].toString();
// String PerviousMethodSign = PerviousMethods[1].toString();
/*
1.No Method=if Client Gorvoboti Hoy tahola M
Total Client=10
Method Neasa 5
2.No Method=(Total Client - Method Nease) tahola M
3.New=Goto masa Kono method chilo na but a masa kono poddotir nilo tahola N
4.New=Goto masa ja poddoti ta chilo a masa jodi client poddoti change kora thahola N
5.Swith over=Goto masa ja poddoti ta chilo a masa jodi client poddoti change kora thahola C
6.Old=Goto masa ja poddoti ta chilo a masa o client same poddotita nila thahola O
4+5=C Hoba karon aki session ar modda porasa.sa jonno Solution of New formula follow korta hoba.
Solution of New
----------------
Total New=Numbers of N + Numbers of C
Solution of switch over
------------------------
Total Swith over=Numbers of C
*/
String CurrentMethod = "";
if (GetDOV(g.getGeneratedId()).equals("")) {
if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("12")) {
CurrentMethod = "M";
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("13")) {
CurrentMethod = "";
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("14")) {
CurrentMethod = "";
} else {
if (PreMethodStatus.equalsIgnoreCase("")) {
CurrentMethod = "N";
} else if (PreMethodStatus.equals(Global.Left(spnMethod.getSelectedItem().toString(), 2))) {
CurrentMethod = "O";
} else if (!PreMethodStatus.equals(Global.Left(spnMethod.getSelectedItem().toString(), 2))) {
CurrentMethod = "C";
}
}
} else if (Global.DateDifferenceDays(dtpDOV.getText().toString(), Global.DateConvertDMY(GetDOV(g.getGeneratedId()))) <= 0) {
String VisitNo = txtVisitNo.getText().toString();
String ExistMethodStatus = C.ReturnSingleValue("Select newOld from elcovisit Where HealthID='" + g.getGeneratedId() + "' and Visit='" + VisitNo + "'");
CurrentMethod = ExistMethodStatus;
} else if (!GetDOV(g.getGeneratedId()).equals("")) {
if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("12")) {
CurrentMethod = "M";
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("13")) {
CurrentMethod = "";
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("14")) {
CurrentMethod = "";
} else {
if (PreMethodStatus.equalsIgnoreCase("")) {
CurrentMethod = "N";
} else if (PreMethodStatus.equals(Global.Left(spnMethod.getSelectedItem().toString(), 2))) {
CurrentMethod = "O";
} else if (!PreMethodStatus.equals(Global.Left(spnMethod.getSelectedItem().toString(), 2))) {
CurrentMethod = "C";
}
}
}
String VisitNo = txtVisitNo.getText().toString();
String sqlnew = "";
String sqlupdate = "";
String trnid = Global.GenerateProviderId(g.getProvCode());
//if(CurStatus.equalsIgnoreCase("01") |CurStatus.equalsIgnoreCase("02") | CurStatus.equalsIgnoreCase("03") |CurStatus.equalsIgnoreCase("08") || CurStatus.equalsIgnoreCase("09")) {
//if(!C.Existence("Select healthid from elcoVisit Where healthid='"+ g.getGeneratedId() +"' and Visit='"+ VisitNo +"' and currStatus = '"+ Global.Left(spnMethod.getSelectedItem().toString(), 2) +"'"))
if (!C.Existence("Select healthid from elcoVisit Where healthid='" + g.getGeneratedId() + "' and Visit='" + VisitNo + "'")) {
sqlnew = "Insert into elcoVisit(healthId,providerId,visit,systemEntryDate,upload,transactionId)Values(";
sqlnew += "'" + g.getGeneratedId() + "',";
sqlnew += "'" + g.getProvCode() + "',";
sqlnew += "'" + VisitNo + "',";
sqlnew += "'" + Global.DateTimeNowYMDHMS() + "',";
sqlnew += "'2',";
sqlnew += "'" + trnid + "')";
if (!Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("12") & !Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("04") & !Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("05") & !Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("18") & !Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("15") & !Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("16") & !Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("06") & !Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("07") & !Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("17") & !Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("11") & !Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("10")) {
if (txtMethodQty.getVisibility() == View.VISIBLE & secMethodUnit.isShown()) {
C.Save(sqlnew);
} else {
sqlnew = "Insert into elcoVisit(healthId,providerId,visit,systemEntryDate,upload)Values(";
sqlnew += "'" + g.getGeneratedId() + "',";
sqlnew += "'" + g.getProvCode() + "',";
sqlnew += "'" + VisitNo + "',";
sqlnew += "'" + Global.DateTimeNowYMDHMS() + "',";
sqlnew += "'2')";
C.Save(sqlnew);
}
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("04") | Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("05") | Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("18") | Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("15") | Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("16") | Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("06") | Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("07") | Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("17") | Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("11") | Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("10")) {
sqlnew = "Insert into elcoVisit(healthId,providerId,visit,systemEntryDate,upload)Values(";
sqlnew += "'" + g.getGeneratedId() + "',";
sqlnew += "'" + g.getProvCode() + "',";
sqlnew += "'" + VisitNo + "',";
sqlnew += "'" + Global.DateTimeNowYMDHMS() + "',";
sqlnew += "'2')";
//sqlnew += "'" + trnid + "')";
C.Save(sqlnew);
} else if (Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("12")) {
sqlnew = "Insert into elcoVisit(healthId,providerId,visit,systemEntryDate,upload,pregNo)Values(";
sqlnew += "'" + g.getGeneratedId() + "',";
sqlnew += "'" + g.getProvCode() + "',";
sqlnew += "'" + VisitNo + "',";
sqlnew += "'" + Global.DateTimeNowYMDHMS() + "',";
sqlnew += "'2',";
sqlnew += "'" + PGNNo() + "')";
g.setPregNo(PGNNo());
}
}
//}
sqlupdate = "Update elcoVisit Set ";
sqlupdate += "vDate = '" + Global.DateConvertYMD(dtpDOV.getText().toString()) + "',";
sqlupdate += "visitStatus = '" + (rdoVSPresent.isChecked() ? "1" : "2") + "',";
if (spnMethod.getSelectedItemPosition() == 0)
sqlupdate += "currStatus = '',";
else
sqlupdate += "currStatus = '" + Global.Left(spnMethod.getSelectedItem().toString(), 2) + "',";
sqlupdate += "newOld = '" + CurrentMethod + "',";
sqlupdate += "mDate = '" + Global.DateConvertYMD(dtpDOV.getText().toString()) + "',";
String SS = "";
if (rdoSSFWA.isChecked()) SS = "1";
if (rdoSSLMarket.isChecked()) SS = "2";
if (rdoSSOther.isChecked()) SS = "3";
if (rdoSSOtherGovt.isChecked()) SS = "4";
sqlupdate += "sSource = '" + SS + "',";
sqlupdate += "qty = '" + txtMethodQty.getText().toString() + "',";
sqlupdate += "unit = '" + (spnMethodUnit.getSelectedItemPosition() == 0 ? "" : String.valueOf(spnMethodUnit.getSelectedItemPosition())) + "',";
if (spnBrand.getSelectedItemPosition() == 0)
sqlupdate += "brand = '',";
else
sqlupdate += "brand = '" + Global.Left(spnBrand.getSelectedItem().toString(), 2) + "',";
//sqlupdate+="brand = '"+ Global.Left(spnBrand.getSelectedItem().toString(), 2) +"',";
sqlupdate += "referPlace = '" + (spnWherePlace.getSelectedItemPosition() == 0 ? "" : String.valueOf(spnWherePlace.getSelectedItemPosition())) + "',";
sqlupdate += "validity = '" + txtValidity.getText().toString() + "',";
sqlupdate += "dayMonYear = '" + (spnValidityUnit.getSelectedItemPosition() == 0 ? "" : String.valueOf(spnValidityUnit.getSelectedItemPosition())) + "',";
sqlupdate += "mrSource = '" + (rdoMethodReceveDT1.isChecked() ? "1" : (rdoMethodReceveDT2.isChecked() ? "2" : "")) + "',";//(rdoMethodReceveDT1.isChecked()?"1":"2")
if (rdoMethodReceveDT1.isChecked()) {
sqlupdate += "MRDate = '" + Global.DateConvertYMD(dtpMD.getText().toString()) + "',";
sqlupdate += "MRAge = '" + Global.DateDifferenceMonth(Global.DateNowDMY(), dtpMD.getText().toString()) + "',";//DateDifferenceYears DateDifferenceMonth
} else if (rdoMethodReceveDT2.isChecked()) {
sqlupdate += "MRDate = '" + Global.addDaysYMD(Global.DateNowDMY(), -Integer.valueOf(txtMDAge.getText().toString()) * 30) + "',";
sqlupdate += "MRAge = '" + txtMDAge.getText().toString() + "', ";
} else {
sqlupdate += "MRDate = '',";
sqlupdate += "MRAge = '', ";
}
sqlupdate += "syrinsQty = '" + txtSyringeQty.getText().toString() + "',";
if (spnSendForMethod.getSelectedItemPosition() == 0)
sqlupdate += "sendForMethod = '',";
else
sqlupdate += "sendForMethod = '" + Global.Left(spnSendForMethod.getSelectedItem().toString(), 2) + "',";
if (spnImpotent.getSelectedItemPosition() == 0)
sqlupdate += "impotent = ''";
else
sqlupdate += "impotent = '" + Global.Left(spnImpotent.getSelectedItem().toString(), 2) + "'";
sqlupdate += " Where HealthID='" + g.getGeneratedId() + "' and Visit='" + VisitNo + "'";
if (!Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("12") && !Global.Left(spnMethod.getSelectedItem().toString(), 2).equalsIgnoreCase("13"))
C.Save(sqlupdate);
else {
sqlupdate = "Update elcoVisit Set pregNo = '" + PGNNo() + "' , ";
sqlupdate += "vDate = '" + Global.DateConvertYMD(dtpDOV.getText().toString()) + "',";//dtpDOV
sqlupdate += "visitStatus = '" + (rdoVSPresent.isChecked() ? "1" : "2") + "',";
if (spnMethod.getSelectedItemPosition() == 0)
sqlupdate += "currStatus = '',";
else
sqlupdate += "currStatus = '" + Global.Left(spnMethod.getSelectedItem().toString(), 2) + "',";
sqlupdate += "newOld = '" + CurrentMethod + "',";
sqlupdate += "mDate = '" + Global.DateConvertYMD(dtpDOV.getText().toString()) + "',";
SS = "";
if (rdoSSFWA.isChecked()) SS = "1";
if (rdoSSLMarket.isChecked()) SS = "2";
if (rdoSSOther.isChecked()) SS = "3";
if (rdoSSOtherGovt.isChecked()) SS = "4";
sqlupdate += "sSource = '" + SS + "',";
sqlupdate += "qty = '" + txtMethodQty.getText().toString() + "',";
sqlupdate += "unit = '" + (spnMethodUnit.getSelectedItemPosition() == 0 ? "" : String.valueOf(spnMethodUnit.getSelectedItemPosition())) + "',";
if (spnBrand.getSelectedItemPosition() == 0)
sqlupdate += "brand = '',";
else
sqlupdate += "brand = '" + Global.Left(spnBrand.getSelectedItem().toString(), 2) + "',";
//sqlupdate += "brand = '" + (spnBrand.getSelectedItemPosition() == 0 ? "" : Global.Left(spnBrand.getSelectedItem().toString(), 2)) + "',";
sqlupdate += "referPlace = '" + (spnWherePlace.getSelectedItemPosition() == 0 ? "" : String.valueOf(spnWherePlace.getSelectedItemPosition())) + "',";
sqlupdate += "validity = '" + txtValidity.getText().toString() + "',";
sqlupdate += "dayMonYear = '" + (spnValidityUnit.getSelectedItemPosition() == 0 ? "" : String.valueOf(spnValidityUnit.getSelectedItemPosition())) + "',";
sqlupdate += "mrSource = '" + (rdoMethodReceveDT1.isChecked() ? "1" : (rdoMethodReceveDT2.isChecked() ? "2" : "")) + "',";//(rdoMethodReceveDT1.isChecked()?"1":"2")
if (rdoMethodReceveDT1.isChecked()) {
sqlupdate += "MRDate = '" + Global.DateConvertYMD(dtpMD.getText().toString()) + "',";
sqlupdate += "MRAge = '" + Global.DateDifferenceMonth(Global.DateNowDMY(), dtpMD.getText().toString()) + "',";//DateDifferenceYears DateDifferenceMonth
} else if (rdoMethodReceveDT2.isChecked()) {
sqlupdate += "MRDate = '" + Global.addDaysYMD(Global.DateNowDMY(), -Integer.valueOf(txtMDAge.getText().toString()) * 30) + "',";
sqlupdate += "MRAge = '" + txtMDAge.getText().toString() + "', ";
} else {
sqlupdate += "MRDate = '',";
sqlupdate += "MRAge = '', ";
}
sqlupdate += "syrinsQty = '" + txtSyringeQty.getText().toString() + "',";
sqlupdate += "sendForMethod = '',";
sqlupdate += "impotent = '',";
sqlupdate += "modifyDate = '" + Global.DateTimeNowYMDHMS() + "'";
sqlupdate += " Where HealthID='" + g.getGeneratedId() + "' and Visit='" + VisitNo + "'";
g.setPregNo(PGNNo());
}
CurStatus = Global.Left(spnMethod.getSelectedItem().toString(), 2);
if (secMethodUnit.getVisibility() == View.VISIBLE) {
if (txtMethodQty.getVisibility() == View.VISIBLE) {
//Validation is not required here. Validation of current stock is handled above.
/*if (!C.Existence("SELECT * FROM stockTransaction WHERE transactionType ='4' AND providerId ='" + g.getProvCode() + "' AND healthId = '" +
g.getGeneratedId() + "' AND itemCode = '" + CurStatus + "' AND systemEntryDate ='" + Global.DateNowYMD() + "'"))*/
if (!C.Existence("SELECT * FROM stockTransaction WHERE transactionType ='4' AND providerId ='" + g.getProvCode() + "' AND healthId = '" +
g.getGeneratedId() + "' AND itemCode = '" + CurStatus + "' AND systemEntryDate ='" + Global.DateConvertYMD(dtpDOV.getText().toString()) + "'")) {
if (CurStatus.equalsIgnoreCase("01")) {
//Suki
if (Global.Left(spnBrand.getSelectedItem().toString(), 2).equalsIgnoreCase("01")) {
InsertTransaction(CurStatus, g.getProvCode(), txtMethodQty.getText().toString(), trnid);
UpdateCurrentStock(g.getProvCode(), Global.Left(spnMethod.getSelectedItem().toString(), 2).toString(), txtMethodQty.getText().toString());
}
//Apon
else if (Global.Left(spnBrand.getSelectedItem().toString(), 2).equalsIgnoreCase("02")) {
InsertTransaction("10", g.getProvCode(), txtMethodQty.getText().toString(), trnid);
UpdateCurrentStock(g.getProvCode(), "10", txtMethodQty.getText().toString());
}
} else if (CurStatus.equalsIgnoreCase("02") | CurStatus.equalsIgnoreCase("08") || CurStatus.equalsIgnoreCase("09")) {
InsertTransaction(CurStatus, g.getProvCode(), txtMethodQty.getText().toString(), trnid);
UpdateCurrentStock(g.getProvCode(), Global.Left(spnMethod.getSelectedItem().toString(), 2).toString(), txtMethodQty.getText().toString());
} else if (CurStatus.equalsIgnoreCase("03")) { //Injectable
InsertTransaction(CurStatus, g.getProvCode(), txtMethodQty.getText().toString(), trnid);
UpdateCurrentStock(g.getProvCode(), Global.Left(spnMethod.getSelectedItem().toString(), 2).toString(), txtMethodQty.getText().toString());
trnid = String.valueOf(Long.parseLong(Global.GenerateProviderId(g.getProvCode())) + 1);
InsertTransaction("5", g.getProvCode(), txtMethodQty.getText().toString(), trnid);
UpdateCurrentStock(g.getProvCode(), "5", txtMethodQty.getText().toString());
}
}
}
}
ElcoVisitStsatus();
rdogrpVS.clearCheck();
spnMethod.setSelection(0);
rdogrpSS.clearCheck();
spnBrand.setSelection(0);
txtMethodQty.setText("");
spnMethodUnit.setSelection(0);
spnWherePlace.setSelection(0);
txtValidity.setText("");
spnValidityUnit.setSelection(0);
secMethod.setVisibility(View.VISIBLE);
spnMethod.setSelection(0);
txtMethodQty.setText("");
spnMethodUnit.setSelection(0);
Connection.MessageBox(ELCOForm.this, "তথ্য সফলভাবে সংরক্ষণ করা হয়েছে।");
//pregnant
if (CurStatus.equalsIgnoreCase("12")) {
Intent f2 = new Intent(getApplicationContext(), FWAReg.class);
//add nisan
g.setAMElco(txtELCONo.getText().toString());
g.setAAge(txtAge.getText().toString());
Bundle IDbundle = new Bundle();
if (sqlnew.length() > 0)
IDbundle.putString("sqlnew", sqlnew);
if (sqlupdate.length() > 0)
IDbundle.putString("sqlupdate", sqlupdate);
f2.putExtras(IDbundle);
startActivity(f2);
finish();
} else {
if (g.getCallFrom().equals("HAregis")) {
finish();
Intent f2 = new Intent(getApplicationContext(), Elcoview.class);
startActivity(f2);
} else {
finish();
Intent f2 = new Intent(getApplicationContext(), MemberList.class);
startActivity(f2);
}
}
} catch (Exception e) {
Connection.MessageBox(ELCOForm.this, e.getMessage());
return;
}
}
private Integer BrandSelect(String U) {
Integer i = 0;
//Cursor cur = C.ReadData("Select DivCode,DCode,Upz,UN from Section1 where idno='" + txtIdNo.getText().toString().trim() + "'");
Cursor cur = C.ReadData("Select brandCode as brandCode from BrandMethod where idno ='" + Global.Left(spnBrand.getSelectedItem().toString(), 2) + "'");
cur.moveToFirst();
while (!cur.isAfterLast()) {
if (U.equals("brandCode")) {
i = Global.SpinnerItemPosition(spnBrand, 2, cur.getString(cur.getColumnIndex("brandCode")));
}
cur.moveToNext();
}
cur.close();
return i;
}
private String PGNNo() {
String SQL = "";
String PGNNo = "";
SQL = "Select (ifnull(max(cast(PregNo as int)),0)+1)MaxPGNNo from PregWomen WHERE healthId = " + g.getGeneratedId();
PGNNo = Global.Right(("00" + C.ReturnSingleValue(SQL)), 2);
return PGNNo;
}
private String LastPGNNo() {
String SQL = "";
String PGNNo = "";
SQL = "Select (ifnull(max(cast(PregNo as int)),0))MaxPGNNo from PregWomen WHERE healthId = " + g.getGeneratedId();
PGNNo = Global.Right(("00" + C.ReturnSingleValue(SQL)), 2);
return PGNNo;
}
private void InsertTransaction(String ItemCode, String ProviderCode, String Qty, String trnid) {
/*if(!C.Existence("SELECT * FROM stockTransaction WHERE transactionType ='4' AND providerId ='" + g.getProvCode() + "' AND healthId = '" +
g.getGeneratedId() +"' AND itemCode = '" + ItemCode +"' AND systemEntryDate ='" + Global.DateNowYMD() +"'"))*/
if (!C.Existence("SELECT * FROM stockTransaction WHERE transactionType ='4' AND providerId ='" + g.getProvCode() + "' AND healthId = '" +
g.getGeneratedId() + "' AND itemCode = '" + ItemCode + "' AND systemEntryDate ='" + Global.DateConvertYMD(dtpDOV.getText().toString()) + "'"))//transactionId ='" + trnid +"'"))
{
String Sql = "Insert Into stockTransaction(transactionId,transactionDateTime,providerId,transactionType,healthId,itemCode,receiveQty,issueQty,systemEntryDate, Upload)" +
" VALUES('" + trnid + "','" + Global.DateTimeNowYMDHMS() + "','" + g.getProvCode() + "','" + "4'" + ",'" + g.getGeneratedId() + "', '" + ItemCode + "','" + "0" + "', '"
+ Qty + "','" + Global.DateConvertYMD(dtpDOV.getText().toString()) + "', '2')";
/*String Sql = "Insert Into stockTransaction(transactionId,transactionDateTime,providerId,transactionType,healthId,itemCode,receiveQty,issueQty,systemEntryDate)" +
" VALUES('"+trnid + "','" +Global.DateTimeNowYMDHMS()+"','"+ g.getProvCode() +"','"+ "4'" + ",'" + g.getGeneratedId() +"', '"+ ItemCode +"','"+ "0" + "', '"
+ Qty +"','" + Global.DateNowYMD() + "')";*/
C.Save(Sql);
} else {
String Sql = "Update stockTransaction Set Upload = '2', issueQty= '" + Qty + "', modifyDate = '" + Global.DateTimeNowYMDHMS() + "' WHERE providerId = '" + g.getProvCode() + "' AND itemCode = '" + ItemCode +
"' AND healthId = '" + g.getGeneratedId() + "' AND transactionType = '" + "4' AND systemEntryDate =' " + Global.DateConvertYMD(dtpDOV.getText().toString()) + "'";
/*String Sql = "Update stockTransaction Set issueQty= '" + Qty +"', modifyDate = '" + Global.DateTimeNowYMDHMS()+ "' WHERE providerId = '" + g.getProvCode() + "' AND itemCode = '" + ItemCode +
"' AND healthId = '" + g.getGeneratedId() +"' AND transactionType = '" + "4' AND systemEntryDate =' " + Global.DateNowYMD() +"'";*/
C.Save(Sql);
}
}
private void InsertTransactionUnstockToStock(String ItemCode, String ProviderCode, String Qty, String trnid) {
/*if(!C.Existence("SELECT * FROM stockTransaction WHERE transactionType ='4' AND providerId ='" + g.getProvCode() + "' AND healthId = '" +
g.getGeneratedId() +"' AND itemCode = '" + ItemCode +"' AND systemEntryDate ='" + Global.DateNowYMD() +"'"))*/
if (!C.Existence("SELECT * FROM stockTransaction WHERE transactionType ='4' AND providerId ='" + g.getProvCode() + "' AND healthId = '" +
g.getGeneratedId() + "' AND itemCode = '" + ItemCode + "' AND systemEntryDate ='" + Global.DateConvertYMD(dtpDOV.getText().toString()) + "'"))//transactionId ='" + trnid +"'"))
{
String Sql = "Insert Into stockTransaction(transactionId,transactionDateTime,providerId,transactionType,healthId,itemCode,receiveQty,issueQty,systemEntryDate, Upload)" +
" VALUES('" + trnid + "','" + Global.DateTimeNowYMDHMS() + "','" + g.getProvCode() + "','" + "4'" + ",'" + g.getGeneratedId() + "', '" + ItemCode + "','" + "0" + "', '"
+ Qty + "','" + Global.DateConvertYMD(dtpDOV.getText().toString()) + "', '2')";
/*String Sql = "Insert Into stockTransaction(transactionId,transactionDateTime,providerId,transactionType,healthId,itemCode,receiveQty,issueQty,systemEntryDate)" +
" VALUES('"+trnid + "','" +Global.DateTimeNowYMDHMS()+"','"+ g.getProvCode() +"','"+ "4'" + ",'" + g.getGeneratedId() +"', '"+ ItemCode +"','"+ "0" + "', '"
+ Qty +"','" + Global.DateNowYMD() + "')";*/
C.Save(Sql);
String sqlupdate = "";
String VisitNo = txtVisitNo.getText().toString();
sqlupdate = "Update elcoVisit Set ";
sqlupdate += "transactionId = '" + trnid + "'";
sqlupdate += " Where HealthID='" + g.getGeneratedId() + "' and Visit='" + VisitNo + "'";
C.Save(sqlupdate);
}
}
private void UpdateStockAndItem(String trnid, String providerId, String PrevItemCode, String CurrentItemCode, String Qty) {
String Sql = "Update stockTransaction Set issueQty= '" + String.valueOf(Qty) + "',itemCode = '" + CurrentItemCode + "', modifyDate = '" + Global.DateTimeNowYMDHMS() + "', Upload='2' WHERE providerId = '" + g.getProvCode() + "' AND itemCode = '" + PrevItemCode + "' and transactionId== '" + trnid + "'";
C.Save(Sql);
}
private void UpdateStockZeroAndItem(String trnid, String PrevItemCode, String Qty) {
String Sql = "Update stockTransaction Set issueQty= '0', modifyDate = '" + Global.DateTimeNowYMDHMS() + "', Upload='2' WHERE providerId = '" + g.getProvCode() + "' AND itemCode = '" + PrevItemCode + "' and transactionId== '" + trnid + "'";
C.Save(Sql);
}
private void UpdateCurrentStock(String providerId, String ItemCode, String Qty) {
Integer q = Global.GetCurrentStockOfItem(C, g.getProvCode(), ItemCode);
Integer currentStock = q - Integer.parseInt(Qty);
String Sql = "Update currentStock Set stockQty= '" + String.valueOf(currentStock) + "', modifyDate = '" + Global.DateTimeNowYMDHMS() + "' WHERE providerId = '" + g.getProvCode() + "' AND itemCode = '" + ItemCode + "'";
C.Save(Sql);
}
private boolean IsItemSame(String CurrentItem, String VisitNo) {
String PrevItem = C.ReturnSingleValue("Select currStatus from elcovisit Where HealthID='" + g.getGeneratedId() + "' and Visit='" + VisitNo + "'");
if (!CurrentItem.equalsIgnoreCase(PrevItem)) {
return true;
} else {
return false;
}
}
private void AdjustStockQty(String CurrentIssueQty, String ItemCode, String providerId) {
String VisitNo = txtVisitNo.getText().toString();
String Trid = C.ReturnSingleValue("Select transactionId from elcovisit Where HealthID='" + g.getGeneratedId() + "' and Visit='" + VisitNo + "'");
String IssueQty = C.ReturnSingleValue("Select qty from elcovisit Where HealthID='" + g.getGeneratedId() + "' and Visit='" + VisitNo + "'");
if (!IssueQty.equalsIgnoreCase("")) {
String CurrentQty = C.ReturnSingleValue("SELECT stockQty FROM currentStock WHERE providerId = '" + g.getProvCode() + "' AND itemCode = '" + ItemCode + "'");
Integer CurrentQty1 = Integer.parseInt(CurrentQty);
Integer UpdatedStock = CurrentQty1 + Integer.parseInt(IssueQty);
String Sql = "Update currentStock Set stockQty= '" + UpdatedStock + "', modifyDate = '" + Global.DateTimeNowYMDHMS() + "' WHERE providerId = '" + g.getProvCode() + "' AND itemCode = '" + ItemCode + "'";
C.Save(Sql);
Sql = "Update stockTransaction Set Upload = '2', issueQty= '" + CurrentIssueQty + "', modifyDate = '" + Global.DateTimeNowYMDHMS() + "' WHERE transactionId='" + Trid + "'";
C.Save(Sql);
Sql = "Update elcovisit Set qty= '" + CurrentIssueQty + "', modifyDate = '" + Global.DateTimeNowYMDHMS() + "' WHERE transactionId='" + Trid + "'";
C.Save(Sql);
// Needs this method
UpdateCurrentStock(providerId, ItemCode, CurrentIssueQty);
}
}
private void InsertInjectableToWomanInjectableTable(String doseDate) {
if (!C.Existence("SELECT * FROM womanInjectable WHERE doseDate ='" + doseDate + "' AND providerId ='" + g.getProvCode() + "' AND healthId = '" + g.getGeneratedId() + "'")) {
String sql = "INSERT INTO womanInjectable (healthId,providerId,doseId,doseDate,sideEffect,systemEntryDate,upload)";
sql = sql + "VALUES ('" + g.getGeneratedId() + "', '" + g.getProvCode() + "','" + GetInjectableDoseNumber() + "','" +
doseDate + "','2','" + Global.DateConvertYMD(dtpDOV.getText().toString()) + "','2')";
C.Save(sql);
}
/*else
{
String Sql = "Update womanInjectable Set doseDate= '" + doseDate +"', sideEffect = '2',modifyDate='" + Global.DateTimeNowYMDHMS() + "', upload='2' WHERE healthId = '" + g.getHealthID() + "' AND providerId = '" + g.getProvCode() +
"' AND doseId = '" + GetCurrentInjectableDoseNumber() +"'";
C.Save(Sql);
}*/
}
private String GetInjectableDoseNumber() {
String SQL = "";
SQL = "select ifnull(Count(*),'')+1 from womanInjectable";
SQL += " where healthId='" + g.getGeneratedId() + "' and providerId='" + g.getProvCode() + "'";
String SNo = C.ReturnSingleValue(SQL);
// Serial No auto increment
return SNo;
}
//ELCO Immunization
private void ImmunizationSave(String ImuIDNo) {
//Immunization
String SQL = "";
if (!C.Existence("Select healthid from immunizationHistory Where healthid='" + g.getGeneratedId() + "' and imuCode='" + ImuIDNo + "'")) {
SQL = "Insert into immunizationHistory(healthId,providerId,imuCode,imuDate,imuCard,imuSource,systemEntryDate,imuDose, Upload)Values(";
SQL += "'" + g.getGeneratedId() + "',";
SQL += "'" + g.getProvCode() + "',";
SQL += "'" + ImuIDNo + "',";
SQL += "'" + (dtpDOTT1.getText().toString().length() == 0 ? "" : Global.DateConvertYMD(dtpDOTT1.getText().toString())) + "',";
if (ChkTT1.isChecked() & rdoCardYes.isChecked())
SQL += "'1',";
else if (ChkTT1.isChecked() & rdoCardNo.isChecked())
SQL += "'2',";
else
SQL += "'',";
SQL += "'',";
SQL += "'" + Global.DateTimeNowYMDHMS() + "',";
//SQL += "'" + Global.DateTimeNowYMDHMS() + "',";
SQL += "'1','2')";
} else {
SQL = "Update immunizationHistory set Upload = '2',";
SQL += "imuDate='" + (dtpDOTT1.getText().toString().length() == 0 ? "" : Global.DateConvertYMD(dtpDOTT1.getText().toString())) + "',";
SQL += "modifyDate='" + Global.DateTimeNowYMDHMS() + "',";
if (ChkTT1.isChecked() & rdoCardYes.isChecked())
SQL += "imuCard='1'";
else if (ChkTT1.isChecked() & rdoCardNo.isChecked())
SQL += "imuCard='2'";
else
SQL += "imuCard=''";
SQL += " where healthid='" + g.getGeneratedId() + "' and imuCode='" + ImuIDNo + "'";
}
C.Save(SQL);
}
private void DataSearch(String healthId) {
try {
String SQL = "";
//01 jun 2016
SQL = "SELECT ifnull(E.DOB,'') AS DOB , ifnull(E.Sex,'') AS Sex, ifnull(E.SNO,'') AS SNo, ifnull(E.HHno,'') as HHNo, ifnull(E.HealthID,'') as HealthID, ifnull(E.NameEng,'') as NameEng ,(Cast(((julianday(date('now'))-julianday(E.DOB))/30.4) as int)/12) AS Age,";
SQL += " ifnull((case when h.NameEng is null then ifnull(el.husbandName,'') else h.NameEng end),'')HusName,";
SQL += " ifnull((case when (Cast(((julianday(date('now'))-julianday(h.DOB))/30.4) as int)/12) is null then ifnull(el.husbandAge,'') else (Cast(((julianday(date('now'))-julianday(h.DOB))/30.4) as int)/12) end),'')HusAge,";
SQL += " ifnull(E.EDU,'') AS EDU, ifnull(E.HaveNID,'') AS HaveNID, ifnull(E.NID,'') as NID, ifnull(E.NIDStatus,'') AS NIDStatus, ifnull(E.HaveBR,'') AS HaveBR,ifnull(E.BRID,'') AS BRID, ifnull(E.BRIDStatus,'') AS BRIDStatus, ifnull(E.MobileNo1,'') AS MobileNo1, ifnull(E.MobileNo2,'') as MobileNo2";
SQL += " FROM member E";
SQL += " left outer join Member h on e.dist=h.dist and e.upz=h.upz and e.un=h.un and";
SQL += " e.mouza=h.mouza and e.vill=h.vill and e.hhno=h.hhno and e.spno1=h.sno";
SQL += " left outer join clientMap cm on e.healthid=cm.healthid";
SQL += " left outer join ELCO el on el.healthid=cm.generatedid";
SQL += " WHERE E.healthId ='" + healthId + "'";
Cursor cur = C.ReadData(SQL);
cur.moveToFirst();
while (!cur.isAfterLast()) {
txtSNo.setText(cur.getString(cur.getColumnIndex("SNo")));
DOB.setText(Global.DateConvertDMY(cur.getString(cur.getColumnIndex("DOB"))));
txtName.setText(cur.getString(cur.getColumnIndex("NameEng")));
txtAge.setText(cur.getString(cur.getColumnIndex("Age")));
txtHusName.setText(cur.getString(cur.getColumnIndex("HusName")).replace("null", ""));
txtHusAge.setText(cur.getString(cur.getColumnIndex("HusAge")).replace("null", ""));
Sex.setText(cur.getString(cur.getColumnIndex("Sex")));
txtPHHNo.setText(cur.getString(cur.getColumnIndex("HHNo")));
if (cur.getString(cur.getColumnIndex("Sex")).equalsIgnoreCase("1")) {
VlblName.setText("স্বামীর নাম");
VlblHus.setText("স্ত্রীর নাম");
} else {
VlblHus.setText("স্বামীর নাম");
VlblName.setText("স্ত্রীর নাম");
}
if (cur.getString(cur.getColumnIndex("EDU")).equals("00")) {
txtMEdu.setText("নার্সারি/কিন্ডার গার্ডেন");
} else if (cur.getString(cur.getColumnIndex("EDU")).equals("01")) {
txtMEdu.setText("১ম শ্রেনী");
} else if (cur.getString(cur.getColumnIndex("EDU")).equals("02")) {
txtMEdu.setText("২য় শ্রেনী");
} else if (cur.getString(cur.getColumnIndex("EDU")).equals("03")) {
txtMEdu.setText("৩য় শ্রেনী");
} else if (cur.getString(cur.getColumnIndex("EDU")).equals("04")) {
txtMEdu.setText("৪র্থ শ্রেনী");
} else if (cur.getString(cur.getColumnIndex("EDU")).equals("05")) {
txtMEdu.setText("৫ম শ্রেনী");
} else if (cur.getString(cur.getColumnIndex("EDU")).equals("06")) {
txtMEdu.setText("৬ষ্ঠ শ্রেনী");
} else if (cur.getString(cur.getColumnIndex("EDU")).equals("07")) {
txtMEdu.setText("৭ম শ্রেনী");
} else if (cur.getString(cur.getColumnIndex("EDU")).equals("08")) {
txtMEdu.setText("৮ম শ্রেনী");
} else if (cur.getString(cur.getColumnIndex("EDU")).equals("09")) {
txtMEdu.setText("৯ম শ্রেনী");
} else if (cur.getString(cur.getColumnIndex("EDU")).equals("10")) {
txtMEdu.setText("১০ম শ্রেনী বা সমতুল্য");
} else if (cur.getString(cur.getColumnIndex("EDU")).equals("11")) {
txtMEdu.setText("উচ্চ মাধ্যমিক বা সমতুল্য");
} else if (cur.getString(cur.getColumnIndex("EDU")).equals("12")) {
txtMEdu.setText("স্মাতক বা সমতুল্য");
} else if (cur.getString(cur.getColumnIndex("EDU")).equals("13")) {
txtMEdu.setText("স্মাতকোত্তর বা সমতুল্য");
} else if (cur.getString(cur.getColumnIndex("EDU")).equals("14")) {
txtMEdu.setText("ডাক্তারি");
} else if (cur.getString(cur.getColumnIndex("EDU")).equals("15")) {
txtMEdu.setText("ইঞ্জিনিয়ারিং");
} else if (cur.getString(cur.getColumnIndex("EDU")).equals("16")) {
txtMEdu.setText("বৃত্তিমুলক শিক্ষা");
} else if (cur.getString(cur.getColumnIndex("EDU")).equals("17")) {
txtMEdu.setText("কারিগরি শিক্ষা");
} else if (cur.getString(cur.getColumnIndex("EDU")).equals("18")) {
txtMEdu.setText("ধাত্রীবিদ্যা/নার্সিং");
} else if (cur.getString(cur.getColumnIndex("EDU")).equals("12")) {
txtMEdu.setText("অন্যান্য");
} else if (cur.getString(cur.getColumnIndex("EDU")).equals("77")) {
txtMEdu.setText("প্রযোজ্য নয়");
} else if (cur.getString(cur.getColumnIndex("EDU")).equals("99")) {
txtMEdu.setText("শিক্ষাগত যোগ্যতা নেই");
}
if (cur.getString(cur.getColumnIndex("HaveNID")).equals("1")) {
txtMNID.setText(cur.getString(cur.getColumnIndex("NID")));
} else {
if (cur.getString(cur.getColumnIndex("NIDStatus")).equals("1")) {
txtMNID.setText("কখনো ছিল না");
} else if (cur.getString(cur.getColumnIndex("NIDStatus")).equals("2")) {
txtMNID.setText("হারিয়ে ফেলেছি");
} else if (cur.getString(cur.getColumnIndex("NIDStatus")).equals("3")) {
txtMNID.setText("খুঁজে পাচ্ছি না");
} else if (cur.getString(cur.getColumnIndex("NIDStatus")).equals("4")) {
txtMNID.setText("অন্য জায়গায় আছে");
} else if (cur.getString(cur.getColumnIndex("NIDStatus")).equals("7")) {
txtMNID.setText("নাগরিক নয়");
}
}
if (cur.getString(cur.getColumnIndex("HaveBR")).equals("1")) {
txtMBRID.setText(cur.getString(cur.getColumnIndex("BRID")));
} else {
if (cur.getString(cur.getColumnIndex("BRIDStatus")).equals("1")) {
txtMBRID.setText("কখনো ছিল না");
} else if (cur.getString(cur.getColumnIndex("BRIDStatus")).equals("2")) {
txtMBRID.setText("হারিয়ে ফেলেছি");
} else if (cur.getString(cur.getColumnIndex("BRIDStatus")).equals("3")) {
txtMBRID.setText("খুজে পাচ্ছি না");
} else if (cur.getString(cur.getColumnIndex("BRIDStatus")).equals("4")) {
txtMBRID.setText("অন্য জায়গায় আছে");
} else if (cur.getString(cur.getColumnIndex("BRIDStatus")).equals("7")) {
txtMBRID.setText("নাগরিক নয়");
}
}
if (cur.getString(cur.getColumnIndex("MobileNo1")).equals("")) {
txtMMNo.setText(cur.getString(cur.getColumnIndex("MobileNo2")).replace("null", ""));
} else if (cur.getString(cur.getColumnIndex("MobileNo2")).equals("")) {
txtMMNo.setText(cur.getString(cur.getColumnIndex("MobileNo1")).replace("null", ""));
} else if (!cur.getString(cur.getColumnIndex("MobileNo1")).equals("")) {
txtMMNo.setText(cur.getString(cur.getColumnIndex("MobileNo1")).replace("null", ""));
} else if (!cur.getString(cur.getColumnIndex("MobileNo2")).equals("")) {
txtMMNo.setText(cur.getString(cur.getColumnIndex("MobileNo1")).replace("null", ""));
}
cur.moveToNext();
}
cur.close();
} catch (Exception e) {
Connection.MessageBox(ELCOForm.this, e.getMessage());
return;
}
}
private void ELCOMemSearch(String HealthID) {
try {
String SQL = "";
SQL = "Select healthId,providerId,hhStatus as HHStatus,haHHNo as HAHHNo,elcoNo as ELCONo,acceptorStatus,husbandName as husbandName,domSource as DOMSource,marrDate as MarrDate,marrAge as MarrAge,son as Son,dau as Dau,regDT";
SQL += " from ELCO Where healthId='" + HealthID + "'";
Cursor cur = C.ReadData(SQL);
cur.moveToFirst();
while (!cur.isAfterLast()) {
if (cur.getString(cur.getColumnIndex("HHStatus")).equals("1")) {
chkHHNoDontKnow.setChecked(true);
} else if (cur.getString(cur.getColumnIndex("HHStatus")).equals("2")) {
chkHHNoDontKnow.setChecked(false);
txtHHNo.setText(cur.getString(cur.getColumnIndex("HAHHNo")));
}
txtELCONo.setText(cur.getString(cur.getColumnIndex("ELCONo")).replace("null", ""));
if (cur.getString(cur.getColumnIndex("acceptorStatus")) != null) {
if (cur.getString(cur.getColumnIndex("acceptorStatus")).equals("1"))
rdoELCOStatus1.setChecked(true);
else if (cur.getString(cur.getColumnIndex("acceptorStatus")).equals("2"))
rdoELCOStatus2.setChecked(true);
}
txtLiveSon.setText(cur.getString(cur.getColumnIndex("Son")));
txtLiveDau.setText(cur.getString(cur.getColumnIndex("Dau")));
dtpDOM.setText(Global.DateConvertDMY(cur.getString(cur.getColumnIndex("MarrDate")).replace("null", "")));
txtMAge.setText(cur.getString(cur.getColumnIndex("MarrAge")).replace("null", ""));
if (cur.getString(cur.getColumnIndex("DOMSource")).equals("1"))
rdoDOMSource1.setChecked(true);
else
rdoDOMSource2.setChecked(true);
cur.moveToNext();
}
cur.close();
} catch (Exception e) {
Connection.MessageBox(ELCOForm.this, e.getMessage());
return;
}
}
public class ElcoVisit extends BaseAdapter {
private Context mContext;
String[][] vcode;
String MouzaCode;
Integer totalRec;
String PGNNo = "";
public ElcoVisit(Context c) {
mContext = c;
}
public int getCount() {
return Integer.parseInt(C.ReturnSingleValue("Select count(*)Total from elcoVisit where healthid='" + g.getGeneratedId() + "' order by vdate desc limit 10"));
}
public Object getItem(int position) {
return null;
}
public long getItemId(int position) {
return 0;
}
public View getView(final int position, View convertView, ViewGroup parent) {
View MyView = convertView;
if (convertView == null) {
LayoutInflater li = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
MyView = li.inflate(R.layout.elcovisit_item, null);
//Previous Code
String SQL = "Select currStatus as currstatus,vdate as vdate, visit as visit from elcoVisit where healthid='" + g.getGeneratedId() + "' order by date(vdate) asc";//limit 10
try {
Cursor cur = C.ReadData(SQL);
cur.moveToFirst();
totalRec = cur.getCount();
vcode = new String[4][totalRec];
int i = 0;
String M = "";
while (!cur.isAfterLast()) {
vcode[0][i] = cur.getString(cur.getColumnIndex("currstatus"));
vcode[1][i] = cur.getString(cur.getColumnIndex("vdate"));
M = cur.getString(cur.getColumnIndex("currstatus"));
if (M.equals("01")) vcode[2][i] = "খাবার বড়ি";
else if (M.equals("02")) vcode[2][i] = "কনডম";
else if (M.equals("03")) vcode[2][i] = "ইনজেকটেবল";
else if (M.equals("04")) vcode[2][i] = "আই ইউ ডি";
else if (M.equals("05")) vcode[2][i] = "ইমপ্যান্ট";
else if (M.equals("06")) vcode[2][i] = "স্থায়ী পদ্ধতি(পুরুষ) এনএসভি";
else if (M.equals("07")) vcode[2][i] = "স্থায়ী পদ্ধতি(মহিলা) টিউবেকটমী";
else if (M.equals("08")) vcode[2][i] = "ইসিপি ";
else if (M.equals("09")) vcode[2][i] = "মিসোপ্রোস্টোল";
else if (M.equals("10")) vcode[2][i] = "পার্শ্ব-প্রতিক্রিয়ার জন্য প্রেরন ";
else if (M.equals("11")) vcode[2][i] = "পদ্ধতির জন্য প্রেরন";
else if (M.equals("12")) vcode[2][i] = "গর্ভবতী ";
else if (M.equals("13")) vcode[2][i] = "জীবিত জন্ম ";
else if (M.equals("14")) vcode[2][i] = "গর্ভ খালাস (জীবিত জন্ম ছাড়া)";
else if (M.equals("15")) vcode[2][i] = "অপারেশন করে জরায়ু অপসারণ";
else if (M.equals("16")) vcode[2][i] = "স্বামী বিদেশ";
else if (M.equals("17")) vcode[2][i] = "বন্ধ্যা";
else if (M.equals("18")) vcode[2][i] = "অন্য যে কোন অবস্থা ";
/* else if(M.equals("19")) vcode[2][i]= "এ এন সি সার্ভিস ";*/
else vcode[2][i] = "অনুপস্থিত";
vcode[3][i] = cur.getString(cur.getColumnIndex("visit"));
i += 1;
cur.moveToNext();
}
cur.close();
Button tv = (Button) MyView.findViewById(R.id.image_name);
tv.setTextSize(14);
tv.setText(vcode[2][position] + "\n" + Global.DateConvertDMY(vcode[1][position]));
final Integer p = position;
tv.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Cursor cur = C.ReadData("Select visit as visit,vdate as vdate,visitstatus as visitstatus,currstatus as currstatus,ssource as ssource,qty as qty,unit as unit,brand as brand,validity as validity,daymonyear as dmy, ifnull(referPlace,'') as referplace,mrSource, MRDate,MRAge,syrinsQty, ifnull(pregNo,'') AS PGNNo,sendForMethod,impotent from ElcoVisit where healthid='" + g.getGeneratedId() + "' and visit='" + vcode[3][position] + "'");
cur.moveToFirst();
while (!cur.isAfterLast()) {
rdogrpVS.clearCheck();
//spnMethod.setSelection(0);
rdogrpSS.clearCheck();
txtVisitNo.setText(cur.getString(cur.getColumnIndex("visit")));
if (cur.getString(cur.getColumnIndex("visitstatus")).equals("1")) {
rdoVSPresent.setChecked(true);
} else if (cur.getString(cur.getColumnIndex("visitstatus")).equals("2")) {
rdoVSAbsent.setChecked(true);
}
//spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select EvCode||'-'||EVName as EvCode from ElcoEvent where evcode order by EvCode asc"));
//spnMethod.setSelection(Global.SpinnerItemPosition(spnMethod, 2, cur.getString(cur.getColumnIndex("currstatus"))));
String spnMethodForNullCheck = cur.getString(cur.getColumnIndex("currstatus")).replace("null", "");
if (!spnMethodForNullCheck.equals("") & !spnMethodForNullCheck.equals("null")) {
Integer spnMethods = Integer.parseInt(cur.getString(cur.getColumnIndex("currstatus")));
if (spnMethods == 1) {
rdoSSFWA.setVisibility(View.VISIBLE);
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select substr('0' ||EvCode, -2, 2)||'-'||EVName as EvCode from ElcoEvent where substr('0' ||EvCode, -2, 2) order by EvCode asc"));
spnMethod.setSelection(Global.SpinnerItemPosition(spnMethod, 2, cur.getString(cur.getColumnIndex("currstatus"))));
if (cur.getString(cur.getColumnIndex("ssource")).equals("1")) {
if (cur.getString(cur.getColumnIndex("brand")).equals("1")) {
//BrandSelect("brandCode");
spnBrand.setAdapter(C.getArrayAdapter("Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('01') order by brandCode asc"));
spnBrand.setSelection(Global.SpinnerItemPosition(spnBrand, 2, cur.getString(cur.getColumnIndex("brand"))));
} else if (cur.getString(cur.getColumnIndex("brand")).equals("2")) {
spnBrand.setAdapter(C.getArrayAdapter("Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('02') order by brandCode asc"));
spnBrand.setSelection(Global.SpinnerItemPosition(spnBrand, 1, cur.getString(cur.getColumnIndex("brand"))));
//spnBrand.setSelection(Global.SpinnerItemPosition(spnBrand, 2, C.ReturnSingleValue("Select ifnull(brand,'') as brand from ElcoVisit where healthid='"+ g.getGeneratedId() +"' and visit='"+ txtVisitNo.getText() +"'")));
}
} else if (cur.getString(cur.getColumnIndex("ssource")).equals("2")) {
spnBrand.setAdapter(C.getArrayAdapter("Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('77') order by brandCode asc"));
spnBrand.setSelection(Global.SpinnerItemPosition(spnBrand, 1, cur.getString(cur.getColumnIndex("brand"))));
} else if (cur.getString(cur.getColumnIndex("ssource")).equals("3")) {
if (cur.getString(cur.getColumnIndex("brand")).equals("1")) {
spnBrand.setAdapter(C.getArrayAdapter("Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('01') order by brandCode asc"));
spnBrand.setSelection(Global.SpinnerItemPosition(spnBrand, 1, cur.getString(cur.getColumnIndex("brand"))));
} else if (cur.getString(cur.getColumnIndex("brand")).equals("2")) {
spnBrand.setAdapter(C.getArrayAdapter("Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('02') order by brandCode asc"));
spnBrand.setSelection(Global.SpinnerItemPosition(spnBrand, 1, cur.getString(cur.getColumnIndex("brand"))));
} else if (cur.getString(cur.getColumnIndex("brand")).equals("77")) {
spnBrand.setAdapter(C.getArrayAdapter("Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('77') order by brandCode asc"));
spnBrand.setSelection(Global.SpinnerItemPosition(spnBrand, 1, cur.getString(cur.getColumnIndex("brand"))));
}
} else if (cur.getString(cur.getColumnIndex("ssource")).equals("4")) {
if (cur.getString(cur.getColumnIndex("brand")).equals("1")) {
spnBrand.setAdapter(C.getArrayAdapter("Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('01') order by brandCode asc"));
spnBrand.setSelection(Global.SpinnerItemPosition(spnBrand, 1, cur.getString(cur.getColumnIndex("brand"))));
} else if (cur.getString(cur.getColumnIndex("brand")).equals("2")) {
spnBrand.setAdapter(C.getArrayAdapter("Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('02') order by brandCode asc"));
spnBrand.setSelection(Global.SpinnerItemPosition(spnBrand, 1, cur.getString(cur.getColumnIndex("brand"))));
}
}
} else if (spnMethods == 2) {
rdoSSFWA.setVisibility(View.VISIBLE);
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select substr('0' ||EvCode, -2, 2)||'-'||EVName as EvCode from ElcoEvent where substr('0' ||EvCode, -2, 2) order by EvCode asc"));
spnMethod.setSelection(Global.SpinnerItemPosition(spnMethod, 2, cur.getString(cur.getColumnIndex("currstatus"))));
if (cur.getString(cur.getColumnIndex("ssource")).equals("1")) {
if (cur.getString(cur.getColumnIndex("brand")).equals("3")) {
spnBrand.setAdapter(C.getArrayAdapter("Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('03') order by brandCode asc"));
spnBrand.setSelection(Global.SpinnerItemPosition(spnBrand, 1, cur.getString(cur.getColumnIndex("brand"))));
}
} else if (cur.getString(cur.getColumnIndex("ssource")).equals("2")) {
spnBrand.setAdapter(C.getArrayAdapter("Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('77') order by brandCode asc"));
spnBrand.setSelection(Global.SpinnerItemPosition(spnBrand, 1, cur.getString(cur.getColumnIndex("brand"))));
} else if (cur.getString(cur.getColumnIndex("ssource")).equals("3")) {
if (cur.getString(cur.getColumnIndex("brand")).equals("3")) {
spnBrand.setAdapter(C.getArrayAdapter("Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('03') order by brandCode asc"));
spnBrand.setSelection(Global.SpinnerItemPosition(spnBrand, 1, cur.getString(cur.getColumnIndex("brand"))));
} else if (cur.getString(cur.getColumnIndex("brand")).equals("77")) {
spnBrand.setAdapter(C.getArrayAdapter("Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('77') order by brandCode asc"));
spnBrand.setSelection(Global.SpinnerItemPosition(spnBrand, 1, cur.getString(cur.getColumnIndex("brand"))));
}
} else if (cur.getString(cur.getColumnIndex("ssource")).equals("4")) {
if (cur.getString(cur.getColumnIndex("brand")).equals("3")) {
spnBrand.setAdapter(C.getArrayAdapter("Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('03') order by brandCode asc"));
spnBrand.setSelection(Global.SpinnerItemPosition(spnBrand, 1, cur.getString(cur.getColumnIndex("brand"))));
}
}
} else if (spnMethods == 3) {
rdoSSFWA.setVisibility(View.VISIBLE);
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select substr('0' ||EvCode, -2, 2)||'-'||EVName as EvCode from ElcoEvent where substr('0' ||EvCode, -2, 2) order by EvCode asc"));
spnMethod.setSelection(Global.SpinnerItemPosition(spnMethod, 2, cur.getString(cur.getColumnIndex("currstatus"))));
} else if (spnMethods == 4) {
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select substr('0' ||EvCode, -2, 2)||'-'||EVName as EvCode from ElcoEvent where substr('0' ||EvCode, -2, 2) order by EvCode asc"));
spnMethod.setSelection(Global.SpinnerItemPosition(spnMethod, 2, cur.getString(cur.getColumnIndex("currstatus"))));
} else if (spnMethods == 5) {
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select substr('0' ||EvCode, -2, 2)||'-'||EVName as EvCode from ElcoEvent where substr('0' ||EvCode, -2, 2) order by EvCode asc"));
spnMethod.setSelection(Global.SpinnerItemPosition(spnMethod, 2, cur.getString(cur.getColumnIndex("currstatus"))));
if (cur.getString(cur.getColumnIndex("ssource")).equals("2")) {
spnBrand.setAdapter(C.getArrayAdapter("Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('77') order by brandCode asc"));
spnBrand.setSelection(Global.SpinnerItemPosition(spnMethod, 1, cur.getString(cur.getColumnIndex("brand"))));
} else if (cur.getString(cur.getColumnIndex("ssource")).equals("3")) {
if (cur.getString(cur.getColumnIndex("brand")).equals("4")) {
spnBrand.setAdapter(C.getArrayAdapter("Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('04') order by brandCode asc"));
spnBrand.setSelection(Global.SpinnerItemPosition(spnMethod, 1, cur.getString(cur.getColumnIndex("brand"))));
} else if (cur.getString(cur.getColumnIndex("brand")).equals("5")) {
spnBrand.setAdapter(C.getArrayAdapter("Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('05') order by brandCode asc"));
spnBrand.setSelection(Global.SpinnerItemPosition(spnMethod, 1, cur.getString(cur.getColumnIndex("brand"))));
} else if (cur.getString(cur.getColumnIndex("brand")).equals("77")) {
spnBrand.setAdapter(C.getArrayAdapter("Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('77') order by brandCode asc"));
spnBrand.setSelection(Global.SpinnerItemPosition(spnMethod, 1, cur.getString(cur.getColumnIndex("brand"))));
}
} else if (cur.getString(cur.getColumnIndex("ssource")).equals("4")) {
if (cur.getString(cur.getColumnIndex("brand")).equals("4")) {
spnBrand.setAdapter(C.getArrayAdapter("Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('04') order by brandCode asc"));
spnBrand.setSelection(Global.SpinnerItemPosition(spnMethod, 1, cur.getString(cur.getColumnIndex("brand"))));
} else if (cur.getString(cur.getColumnIndex("brand")).equals("5")) {
spnBrand.setAdapter(C.getArrayAdapter("Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) in('05') order by brandCode asc"));
spnBrand.setSelection(Global.SpinnerItemPosition(spnMethod, 1, cur.getString(cur.getColumnIndex("brand"))));
}
}
} else if (spnMethods == 6) {
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select substr('0' ||EvCode, -2, 2)||'-'||EVName as EvCode from ElcoEvent where substr('0' ||EvCode, -2, 2) order by EvCode asc"));
spnMethod.setSelection(Global.SpinnerItemPosition(spnMethod, 2, cur.getString(cur.getColumnIndex("currstatus"))));
} else if (spnMethods == 7) {
rdoSSFWA.setVisibility(View.GONE);
rdoSSFWA.setChecked(false);
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select substr('0' ||EvCode, -2, 2)||'-'||EVName as EvCode from ElcoEvent where substr('0' ||EvCode, -2, 2) order by EvCode asc"));
spnMethod.setSelection(Global.SpinnerItemPosition(spnMethod, 2, cur.getString(cur.getColumnIndex("currstatus"))));
} else if (spnMethods == 8) {
rdoSSFWA.setVisibility(View.VISIBLE);
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select substr('0' ||EvCode, -2, 2)||'-'||EVName as EvCode from ElcoEvent where substr('0' ||EvCode, -2, 2) order by EvCode asc"));//in('08')
spnMethod.setSelection(Global.SpinnerItemPosition(spnMethod, 2, cur.getString(cur.getColumnIndex("currstatus"))));
} else if (spnMethods == 9) {
rdoSSFWA.setVisibility(View.VISIBLE);
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select substr('0' ||EvCode, -2, 2)||'-'||EVName as EvCode from ElcoEvent where substr('0' ||EvCode, -2, 2) order by EvCode asc"));
spnMethod.setSelection(Global.SpinnerItemPosition(spnMethod, 2, cur.getString(cur.getColumnIndex("currstatus"))));
} else if (spnMethods == 10) {
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select substr('0' ||EvCode, -2, 2)||'-'||EVName as EvCode from ElcoEvent where substr('0' ||EvCode, -2, 2) order by EvCode asc"));
spnMethod.setSelection(Global.SpinnerItemPosition(spnMethod, 2, cur.getString(cur.getColumnIndex("currstatus"))));
} else if (spnMethods == 11) {
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select substr('0' ||EvCode, -2, 2)||'-'||EVName as EvCode from ElcoEvent where substr('0' ||EvCode, -2, 2) order by EvCode asc"));
spnMethod.setSelection(Global.SpinnerItemPosition(spnMethod, 2, cur.getString(cur.getColumnIndex("currstatus"))));
} else if (spnMethods == 12) {
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select substr('0' ||EvCode, -2, 2)||'-'||EVName as EvCode from ElcoEvent where substr('0' ||EvCode, -2, 2) order by EvCode asc"));
spnMethod.setSelection(Global.SpinnerItemPosition(spnMethod, 2, cur.getString(cur.getColumnIndex("currstatus"))));
} else if (spnMethods == 13) {
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select substr('0' ||EvCode, -2, 2)||'-'||EVName as EvCode from ElcoEvent where substr('0' ||EvCode, -2, 2) order by EvCode asc"));
spnMethod.setSelection(Global.SpinnerItemPosition(spnMethod, 2, cur.getString(cur.getColumnIndex("currstatus"))));
} else if (spnMethods == 14) {
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select substr('0' ||EvCode, -2, 2)||'-'||EVName as EvCode from ElcoEvent where substr('0' ||EvCode, -2, 2) order by EvCode asc"));
spnMethod.setSelection(Global.SpinnerItemPosition(spnMethod, 2, cur.getString(cur.getColumnIndex("currstatus"))));
} else if (spnMethods == 15) {
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select substr('0' ||EvCode, -2, 2)||'-'||EVName as EvCode from ElcoEvent where substr('0' ||EvCode, -2, 2) order by EvCode asc"));
spnMethod.setSelection(Global.SpinnerItemPosition(spnMethod, 2, cur.getString(cur.getColumnIndex("currstatus"))));
} else if (spnMethods == 16) {
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select substr('0' ||EvCode, -2, 2)||'-'||EVName as EvCode from ElcoEvent where substr('0' ||EvCode, -2, 2) order by EvCode asc"));
spnMethod.setSelection(Global.SpinnerItemPosition(spnMethod, 2, cur.getString(cur.getColumnIndex("currstatus"))));
} else if (spnMethods == 17) {
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select substr('0' ||EvCode, -2, 2)||'-'||EVName as EvCode from ElcoEvent where substr('0' ||EvCode, -2, 2) order by EvCode asc"));
spnMethod.setSelection(Global.SpinnerItemPosition(spnMethod, 2, cur.getString(cur.getColumnIndex("currstatus"))));
} else if (spnMethods == 18) {
spnMethod.setAdapter(C.getArrayAdapter("Select ' 'as EvCode union Select substr('0' ||EvCode, -2, 2)||'-'||EVName as EvCode from ElcoEvent where substr('0' ||EvCode, -2, 2) order by EvCode asc"));
spnMethod.setSelection(Global.SpinnerItemPosition(spnMethod, 2, cur.getString(cur.getColumnIndex("currstatus"))));
}
}
//spnMethod.setSelection(Integer.parseInt(Global.Left(spnMethod.getSelectedItem().toString(), 2)));
//spnMethod.setSelection(Integer.parseInt(cur.getString(cur.getColumnIndex("currstatus"))));
//spnMethod.setSelection(Integer.parseInt(cur.getString(cur.getColumnIndex("currstatus"))));
if (cur.getString(cur.getColumnIndex("ssource")).equals("1")) {
rdoSSFWA.setChecked(true);
txtMethodQty.setText(cur.getString(cur.getColumnIndex("qty")));
if (cur.getString(cur.getColumnIndex("unit")).equals("1"))
spnMethodUnit.setSelection(1);
else if (cur.getString(cur.getColumnIndex("unit")).equals("2"))
spnMethodUnit.setSelection(2);
else if (cur.getString(cur.getColumnIndex("unit")).equals("3"))
spnMethodUnit.setSelection(3);
} else if (cur.getString(cur.getColumnIndex("ssource")).equals("2"))
rdoSSLMarket.setChecked(true);
else if (cur.getString(cur.getColumnIndex("ssource")).equals("3"))
rdoSSOther.setChecked(true);
else if (cur.getString(cur.getColumnIndex("ssource")).equals("4"))
rdoSSOtherGovt.setChecked(true);
// else if(cur.getString(cur.getColumnIndex("brand")).equals("3")) spnBrand.setSelection(3);
//
//spnBrand.setSelection(Global.SpinnerItemPosition(spnBrand, 2, cur.getString(cur.getColumnIndex("brand"))));
//Integer Brand=Integer.parseInt(cur.getString(cur.getColumnIndex("brand")));
//if(Brand==77) {
///spnBrand.setAdapter(C.getArrayAdapter("Select substr('0' ||brandCode, -2, 2)||'-'||brandName as brandCode from BrandMethod where substr('0' ||brandCode, -2, 2) order by brandCode asc"));
// spnBrand.setSelection(Global.SpinnerItemPosition(spnBrand, 2, cur.getString(cur.getColumnIndex("brand"))));
// }
/*else if(Brand==1)
{
spnBrand.setSelection(1);
}
else if(Brand==2)
{
spnBrand.setSelection(2);
}*/
//spnFaci.setSelection(Global.SpinnerItemPosition(spnFaci, 2 ,cur.getString(cur.getColumnIndex("referCenter"))));
//secMethodUnit.setVisibility(View.GONE);
if (cur.getString(cur.getColumnIndex("referplace")).equals("1"))
spnWherePlace.setSelection(1);
else if (cur.getString(cur.getColumnIndex("referplace")).equals("2"))
spnWherePlace.setSelection(2);
else if (cur.getString(cur.getColumnIndex("referplace")).equals("3"))
spnWherePlace.setSelection(3);
else if (cur.getString(cur.getColumnIndex("referplace")).equals("4"))
spnWherePlace.setSelection(4);
else if (cur.getString(cur.getColumnIndex("referplace")).equals("5"))
spnWherePlace.setSelection(5);
else if (cur.getString(cur.getColumnIndex("referplace")).equals("6"))
spnWherePlace.setSelection(6);
txtValidity.setText(cur.getString(cur.getColumnIndex("validity")));
if (cur.getString(cur.getColumnIndex("dmy")).equals("1"))
spnValidityUnit.setSelection(1);
else if (cur.getString(cur.getColumnIndex("dmy")).equals("2"))
spnValidityUnit.setSelection(2);
else if (cur.getString(cur.getColumnIndex("dmy")).equals("3"))
spnValidityUnit.setSelection(3);
String MRdate = cur.getString(cur.getColumnIndex("MRDate"));
PGNNo = cur.getString(cur.getColumnIndex("PGNNo"));
if (MRdate != null) {
dtpMD.setText(Global.DateConvertDMY(cur.getString(cur.getColumnIndex("MRDate"))));
}
//dtpMD.setText(Global.DateConvertDMY(cur.getString(cur.getColumnIndex("MRDate"))));
txtMDAge.setText(cur.getString(cur.getColumnIndex("MRAge")));
String mrSource = cur.getString(cur.getColumnIndex("mrSource"));
if (mrSource != null) {
if (cur.getString(cur.getColumnIndex("mrSource")).equals("1"))
rdoMethodReceveDT1.setChecked(true);
else if (cur.getString(cur.getColumnIndex("mrSource")).equals("2"))
rdoMethodReceveDT2.setChecked(true);
else {
}
}
txtSyringeQty.setText(cur.getString(cur.getColumnIndex("syrinsQty")));
dtpDOV.setText(Global.DateConvertDMY(cur.getString(cur.getColumnIndex("vdate"))));
String sendForMethod = cur.getString(cur.getColumnIndex("sendForMethod"));
if (sendForMethod != null) {
if (cur.getString(cur.getColumnIndex("sendForMethod")).equals("01")) {
spnSendForMethod.setSelection(1);
} else if (cur.getString(cur.getColumnIndex("sendForMethod")).equals("02")) {
spnSendForMethod.setSelection(2);
} else if (cur.getString(cur.getColumnIndex("sendForMethod")).equals("03")) {
spnSendForMethod.setSelection(3);
} else if (cur.getString(cur.getColumnIndex("sendForMethod")).equals("04")) {
spnSendForMethod.setSelection(4);
} else if (cur.getString(cur.getColumnIndex("sendForMethod")).equals("05")) {
spnSendForMethod.setSelection(5);
} else if (cur.getString(cur.getColumnIndex("sendForMethod")).equals("06")) {
spnSendForMethod.setSelection(6);
} else if (cur.getString(cur.getColumnIndex("sendForMethod")).equals("07")) {
spnSendForMethod.setSelection(7);
}
}
String impotent = cur.getString(cur.getColumnIndex("impotent"));
if (impotent != null) {
if (cur.getString(cur.getColumnIndex("impotent")).equals("01")) {
spnImpotent.setSelection(1);
} else if (cur.getString(cur.getColumnIndex("impotent")).equals("02")) {
spnImpotent.setSelection(2);
}
}
cur.moveToNext();
}
cur.close();
if (String.valueOf(vcode[0][position]).equalsIgnoreCase("12")) {
Connection.MessageBox(ELCOForm.this, "এই মহিলাটি বর্তমানে গর্ভবতী। এই গর্ভবতী মহিলার গর্ভ সংক্রান্ত সকল তথ্য 'গর্ভবতী মা ও নবজাতকের তথ্য/সেবা ছক' এ সংগ্রহ করুন ।");
cmdSave.setEnabled(false);
/*Intent f2 = new Intent(getApplicationContext(), FWAReg.class);
Bundle IDbundle = new Bundle();
g.setPregNo(PGNNo);
f2.putExtras(IDbundle);
startActivity(f2);
finish();*/
} else if (String.valueOf(vcode[0][position]).equalsIgnoreCase("13")) {
cmdSave.setEnabled(false);
} else if (String.valueOf(vcode[0][position]).equalsIgnoreCase("14")) {
cmdSave.setEnabled(false);
}
/*else if(String.valueOf(vcode[0][position]).equalsIgnoreCase("13")) {
Intent f2 = new Intent(getApplicationContext(), FWAReg.class);
Bundle IDbundle = new Bundle();
g.setPregNo(PGNNo);
IDbundle.putString("currentstatus","13");
f2.putExtras(IDbundle);
startActivity(f2);
finish();
}
else if(String.valueOf(vcode[0][position]).equalsIgnoreCase("14")) {
Intent f2 = new Intent(getApplicationContext(), FWAReg.class);
Bundle IDbundle = new Bundle();
g.setPregNo(PGNNo);
IDbundle.putString("currentstatus","14");
f2.putExtras(IDbundle);
startActivity(f2);
finish();
}*/
}
});
} catch (Exception ex) {
Connection.MessageBox(ELCOForm.this, ex.getMessage());
}
}
return MyView;
}
}
public class TTCard extends BaseAdapter {
private Context mContext;
String[][] vcode;
Integer totalRec;
public TTCard(Context c) {
mContext = c;
}
public int getCount() {
return Integer.parseInt(C.ReturnSingleValue("Select count(*)total from immunizationHistory where healthid='" + g.getGeneratedId() + "'"));
}
public Object getItem(int position) {
return null;
}
public long getItemId(int position) {
return 0;
}
public View getView(final int position, View convertView, ViewGroup parent) {
View MyView = convertView;
if (convertView == null) {
LayoutInflater li = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
MyView = li.inflate(R.layout.tt_item, null);
String SQL = "Select imucode as imucode,imudate as imudate,imuCard as imucard from immunizationHistory where healthid='" + g.getGeneratedId() + "' order by imuCode asc";//date(imudate) asc
try {
Cursor cur = C.ReadData(SQL);
cur.moveToFirst();
totalRec = cur.getCount();
vcode = new String[4][totalRec];
int i = 0;
while (!cur.isAfterLast()) {
vcode[0][i] = "টিটি " + String.valueOf(i + 1);//String.valueOf(cur.getString(cur.getColumnIndex("imucode")));
vcode[1][i] = Global.DateConvertDMY(cur.getString(cur.getColumnIndex("imudate")));
vcode[2][i] = cur.getString(cur.getColumnIndex("imucard"));
vcode[3][i] = String.valueOf(cur.getString(cur.getColumnIndex("imucode")));
i += 1;
cur.moveToNext();
}
cur.close();
Button tv = (Button) MyView.findViewById(R.id.image_name);
tv.setTextSize(14);
tv.setText(vcode[0][position] + "\n" + vcode[1][position]);
final Integer p = position;
tv.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
ChkTT1.setChecked(true);
if (vcode[2][position].equals("1")) {
rdoCardYes.setChecked(true);
rdogrpTTCard.setVisibility(View.VISIBLE);
} else if (vcode[2][position].equals("2")) {
rdoCardNo.setChecked(true);
rdogrpTTCard.setVisibility(View.VISIBLE);
}
if (vcode[1][position].length() != 0) {
dtpDOTT1.setText(vcode[1][position]);
dtpDOTT1.setVisibility(View.VISIBLE);
btnDOTT1.setVisibility(View.VISIBLE);
} else {
dtpDOTT1.setText("");
dtpDOTT1.setVisibility(View.GONE);
btnDOTT1.setVisibility(View.GONE);
}
secTT1.setVisibility(View.VISIBLE);
btnTTClose.setVisibility(View.VISIBLE);
btnAddTT.setVisibility(View.GONE);
btnSaveTT.setVisibility(View.VISIBLE);
g.setImuCode(vcode[3][position]);
}
});
} catch (Exception ex) {
Connection.MessageBox(ELCOForm.this, ex.getMessage());
}
}
return MyView;
}
}
private String GetDOV(String HealthId) {
String sq = String.format("Select ifnull(max(vDate),'') as Vdate from elcoVisit WHERE healthId = '%s' and vDate<>'null'", g.getGeneratedId());
return C.ReturnSingleValue(sq);
}
protected Dialog onCreateDialog(int id) {
final Calendar c = Calendar.getInstance();
hour = c.get(Calendar.HOUR_OF_DAY);
minute = c.get(Calendar.MINUTE);
Integer Y = g.mYear;
Integer M = g.mMonth;
Integer D = g.mDay;
switch (id) {
case DATE_DIALOG:
return new DatePickerDialog(this, mDateSetListener, Y, M - 1, D);
case TIME_DIALOG:
return new TimePickerDialog(this, timePickerListener, hour, minute, false);
}
return null;
}
private DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener() {
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
mYear = year;
mMonth = monthOfYear + 1;
mDay = dayOfMonth;
EditText dtpDate;
dtpDate = (EditText) findViewById(R.id.dtpDOM);
if (VariableID.equals("btnDOM")) {
dtpDate = (EditText) findViewById(R.id.dtpDOM);
} else if (VariableID.equals("btnDOV")) {
dtpDate = (EditText) findViewById(R.id.dtpDOV);
} else if (VariableID.equals("btnDOTT1")) {
dtpDate = (EditText) findViewById(R.id.dtpDOTT1);
} else if (VariableID.equals("btnMD")) {
dtpDate = (EditText) findViewById(R.id.dtpMD);
}
dtpDate.setText(new StringBuilder()
.append(Global.Right("00" + mDay, 2)).append("/")
.append(Global.Right("00" + mMonth, 2)).append("/")
.append(mYear));
try {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
String formattedDate = sdf.format(c.getTime());
Date date1 = sdf.parse(formattedDate);
Date date2 = sdf.parse(dtpDate.getText().toString());
if (date2.after(date1)) {
if (VariableID.equals("btnDOV")) {
Connection.MessageBox(ELCOForm.this, "তারিখ আজকের তারিখের সমান অথবা কম হতে হবে।");
return;
}
}
String DOB1 = "15/" + DOB.getText() + "/" + DOB.getText();
Date DOB11 = sdf.parse(DOB1);
if (date2.before(DOB11)) {
if (VariableID.equals("btnB11")) {
Connection.MessageBox(ELCOForm.this, "আপনার সর্বশেষ গর্ভ ফলাফলের তারিখ জন্ম তারিখ অপেক্ষা বড় হবে না");
return;
}
}
String DOB2 = Global.DateConvertDMY(GetDOV(g.getGeneratedId()));
Date DOB21 = sdf.parse(DOB2);
if (date2.before(DOB21)) {
/*if (VariableID.equals("btnDOV"))
{
Connection.MessageBox(ELCOForm.this," ভিজিট এর তারিখ পূর্বের ভিজিট তারিখ এর সমান অথবা বেশি হতে হবে");
return;
}*/
}
} catch (ParseException ex) {
ex.printStackTrace();
}
}
};
private TimePickerDialog.OnTimeSetListener timePickerListener = new TimePickerDialog.OnTimeSetListener() {
public void onTimeSet(TimePicker view, int selectedHour, int selectedMinute) {
hour = selectedHour;
minute = selectedMinute;
EditText tpTime;
}
};
} |
package pl.smilu.budowniczy;
public class Main
{
public static void main(String args[])
{
System.out.println("start");
Rower rowerAdama = Rower.create("kolarka", 28, "czerwona");
Rower rowerEwy = Rower.create("kolarka", "czerwona");
System.out.println("Rower Adama="+rowerAdama.toString());
System.out.println("Rower Ewy="+rowerEwy.toString());
System.out.println("koniec");
}
}
|
package com.example.forwork;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.RadioGroup;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.textfield.TextInputLayout;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class FeedbackActivity extends AppCompatActivity {
private TextInputLayout commentView;
private DatabaseReference feedbackDatabase;
private FirebaseAuth mAuth;
private FirebaseUser user;
private RadioGroup feedbackCategory;
private String commentStr;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_feedback);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
commentView = findViewById(R.id.comment);
mAuth = FirebaseAuth.getInstance();
user = mAuth.getCurrentUser();
feedbackDatabase = FirebaseDatabase.getInstance().getReference("Feedback");
feedbackCategory = findViewById(R.id.feedbackCategory);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// handle arrow click here
if (item.getItemId() == android.R.id.home) {
finish();
}
return super.onOptionsItemSelected(item);
}
private boolean validateComment() {
commentStr = commentView.getEditText().getText().toString().trim();
if (commentStr.isEmpty()) {
commentView.setError("Field can't be empty!");
return false;
} else {
commentView.setError(null);
commentView.setErrorEnabled(false);
}
return true;
}
public void submitFeedback(View view) {
InputMethodManager inputManager = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
if (inputManager != null) {
inputManager.hideSoftInputFromWindow(view.getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
if (validateComment()) {
String category;
switch (feedbackCategory.getCheckedRadioButtonId()) {
case R.id.suggestion:
category = "Suggestion";
break;
case R.id.compliment:
category = "Compliment";
break;
default:
category = "Complaint";
break;
}
Feedback feedback = new Feedback(user.getEmail(), category, commentStr, new SimpleDateFormat("dd-MM-yyyy", Locale.getDefault()).format(new Date()));
feedbackDatabase.child(feedbackDatabase.push().getKey()).setValue(feedback);
Snackbar.make(findViewById(R.id.feedback_layout), getString(R.string.feedback_sent), Snackbar.LENGTH_LONG).show();
}
}
}
|
package com.cinema_ticketing_sys.cinema.dao;
import com.cinema_ticketing_sys.cinema.dao.CinemaDAO;
import com.cinema_ticketing_sys.cinema.entity.Cinema;
import com.cinema_ticketing_sys.support.base.BaseDAOImpl;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created by KC on 2017/5/15.
*/
@Repository
public class CinemaDAOImpl extends BaseDAOImpl<Cinema> implements CinemaDAO {
@Override
public Cinema findCinemaById(int id) {
return findByUnique("cinemaId", id);
}
@Override
public Cinema findCinemaByName(String name) {
return findByUnique("cinemaName", name);
}
@Override
public List<Cinema> findCinemaByRate(int rate) {
return findBy("rate", rate);
}
@Override
public void saveOrUpdateCinema(Cinema cinema) {
save(cinema);
}
@Override
protected Class<Cinema> getEntityClass() {
return Cinema.class;
}
@Override
public List<Cinema> findCinemaByPage(Integer pageNo, Integer pageSize) { return findByPage(pageNo, pageSize); }
@Override
public long findCinemaCount(Class<Cinema> cinemaClass) { return findCount(cinemaClass); }
}
|
package br.com.formacao.java.herdado;
/**
* Classe que representa o controle de bonifica��o do funcion�rio.
*
* @author Guilherme Vilela
* @version 0.1
*/
public class ControleBonificacao {
private double soma;
/**
*
* @param f
*/
public void registra(Funcionario f) {
double boni = f.getBonificacao();
this.soma += boni;
}
/**
*
* @return Soma
*/
public double getSoma() {
return soma;
}
}
|
package lesson22;
public class Run {
public static void main(String[] args) {
Animal animal = new Animal();
Animal cat = new Cat();
Animal fish = new Fish();
Animal bird = new Bird();
//gọi ra các phương thức override
animal.move();
cat.move();
fish.move();
bird.move();
}
}
|
package co.sptnk.service.api;
import co.sptnk.service.api.dto.BookDto;
import co.sptnk.service.api.dto.criteria.SearchCriteriaBook;
import co.sptnk.service.api.dto.response.AddOrUpdateResponse;
import co.sptnk.service.api.dto.response.FindResponse;
/**
* Created by Владимир on 01.11.2016.
*
* Сервис для работы с каталогом книг
*/
public interface LibraryService {
AddOrUpdateResponse addOrUpdateBook(BookDto bookDto) throws IllegalAccessException, InstantiationException;
void deleteBook(BookDto bookDto) throws IllegalAccessException, InstantiationException;
FindResponse getBook(String id) throws IllegalAccessException, InstantiationException;
FindResponse findBooks(SearchCriteriaBook criteria) throws IllegalAccessException, InstantiationException;
}
|
package laba1;
public class DemoDog {
public static void main(String[] args) {
dog d1 = new dog ("Popo", 3);
dog d2 = new dog ("Lolo", 6);
dog d3 = new dog ("Apu", 2);
System.out.println(d1);
System.out.println(d2);
System.out.println(d3);
d1.setAge(5);
d1.setName("uma");
System.out.println(d1);
;
}
}
|
package com.company.customer.repository.constants;
public interface AddressConstants {
String SCHEMA = "public";
String TABLE = "address";
String SCHEMA_TABLE = SCHEMA + "." + TABLE;
String PREFIX = TABLE + "_";
String ID = PREFIX + "id";
String CUSTOMER_ID = PREFIX + "customerid";
String STREET = PREFIX + "street";
String NUMBER = PREFIX + "number";
String COMPLEMENT = PREFIX + "complement";
String ZIP_CODE = PREFIX + "zipcode";
String CITY = PREFIX + "city";
String STATE = PREFIX + "state";
String COUNTRY = PREFIX + "country";
String DISTRICT = PREFIX + "district";
String TYPE = PREFIX + "type";
} |
package cargos;
public class Estagiario extends Cargo{
//Construtor
public Estagiario(String cargo, double salario) {
this.cargo =cargo;
this.salario=salario;
}
//IR
public void impostoRenda() {
System.out.println("Não há imposto de renda para estagiario.");
}
}
|
package one.kii.summer.beans.utils;
import one.kii.summer.beans.annotations.Commit;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Created by WangYanJiong on 18/05/2017.
*/
public class CommitCalculator {
public static String[] find(Object object) {
Class klass = object.getClass();
Field[] fields = klass.getDeclaredFields();
List<String> keyFactors = new ArrayList<>();
for (Field field : fields) {
Annotation annotation = field.getAnnotation(Commit.class);
if (annotation != null) {
keyFactors.add(field.getName());
}
}
String[] keys = keyFactors.toArray(new String[0]);
Arrays.sort(keys);
return keys;
}
public static String[] find(Class klass) {
Field[] fields = klass.getDeclaredFields();
List<String> keyFactors = new ArrayList<>();
for (Field field : fields) {
Annotation annotation = field.getAnnotation(Commit.class);
if (annotation != null) {
keyFactors.add(field.getName());
}
}
String[] keys = keyFactors.toArray(new String[0]);
Arrays.sort(keys);
return keys;
}
}
|
package com.mes.cep.manage;
/**
*@author Stephen Wen
*@email 872003894@qq.com
*@date 2017年4月11日
*@Version
*@Chinesename 生产管理
*/
public class ProductionManagement {
}
|
package Problema2;
/**
*
* @author Andrés Cuéllar
*/
public class Triangulo implements Poligono {
public double area(double base, double altura) {
return (base * altura) / 2;
}
public double perimetro(double[] lados) {
int sum = 0;
for (int i = 0; i < lados.length; i++) {
sum += lados[i];
}
return sum;
}
}
|
package com.mideas.rpg.v2.hud.instance.pvp;
import java.util.ArrayList;
import com.mideas.rpg.v2.Mideas;
import com.mideas.rpg.v2.hud.instance.InstanceFrame;
import com.mideas.rpg.v2.hud.instance.InstanceCategoryButton;
import com.mideas.rpg.v2.utils.Frame;
public class PremadeGroupPvPFrame extends Frame
{
private final InstanceFrame parentFrame;
private final ArrayList<InstanceCategoryButton> buttonList;
private InstanceCategoryButton selectedMenu;
public PremadeGroupPvPFrame(InstanceFrame frame)
{
super("PremadeGroupPvPFrame");
this.parentFrame = frame;
this.buttonList = new ArrayList<InstanceCategoryButton>();
/*this.buttonList.add(new PremadeGroupCategoryButton(this.parentFrame, null, "Quick Match", PremadeGroupCategoryButton.BUTTON_X_OFFSET, PremadeGroupCategoryButton.BUTTON_Y_OFFSET));
this.buttonList.add(new PremadeGroupCategoryButton(this.parentFrame, null, "Rated", PremadeGroupCategoryButton.BUTTON_X_OFFSET, (short)(PremadeGroupCategoryButton.BUTTON_Y_OFFSET + PremadeGroupCategoryButton.BUTTON_HEIGHT)));
this.buttonList.add(new PremadeGroupCategoryButton(this.parentFrame, null, "Premade Groups", PremadeGroupCategoryButton.BUTTON_X_OFFSET, (short)(PremadeGroupCategoryButton.BUTTON_Y_OFFSET + 2 * PremadeGroupCategoryButton.BUTTON_HEIGHT)));*/
}
@Override
public void draw()
{
}
@Override
public boolean mouseEvent()
{
return (false);
}
@Override
public boolean keyboardEvent()
{
return (false);
}
@Override
public void open()
{
}
@Override
public void close()
{
}
@Override
public boolean isOpen()
{
return (this.parentFrame.isOpen());
}
@Override
public void reset()
{
}
@Override
public void shouldUpdateSize()
{
}
@Override
public void updateSize()
{
}
}
|
/**
* Copyright (c) 2012, Ben Fortuna
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* o Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* o Neither the name of Ben Fortuna nor the names of any other contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.fortuna.ical4j.vcard;
import static org.junit.Assert.assertEquals;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import net.fortuna.ical4j.data.ParserException;
import net.fortuna.ical4j.model.ValidationException;
import net.fortuna.ical4j.util.CompatibilityHints;
import net.fortuna.ical4j.vcard.Property.Id;
import net.fortuna.ical4j.vcard.parameter.Type;
import net.fortuna.ical4j.vcard.property.Address;
import org.apache.commons.codec.DecoderException;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
/**
*
* The dirk example file has been prepared for the Nepomuk Social Semantic
* Desktop Project, as a VCard of one of the personae, conceived in the
* requirements management process. It is quite simple except for the fact that
* the N property contains a single element. Before this test was written, the N
* class yielded a NullPointerException on this.
*
* The specification doesn't say that the value of the N property MUST have at
* least two components.
*
* This file has been created with Outlook 2003, and uses my workarounds for the
* Outlook quirks.
*
* Moreover, the dirk-whitespaceafterbegin exhibits two problems I've
* encountered in the field. The first is that Outlook 2003 can produce vcf
* files with whitespace after BEGIN:VCARD.
*
* The second problem is about the ADR property. I would like to parse files
* with
*
* <pre>
* ADR;WORK:;Szczecin
* </pre>
*
*
* Created on: 2010-03-29
*
* @author antheque
*
*/
public class DirkWhitespaceAfterBeginTest {
@Before
public void setup() {
CompatibilityHints.clearHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING);
}
/**
* Without relaxed parsing this should end with a parse error on the first
* line.
*/
@Test
public void testDirkExampleWhitespaceAfterBegin() throws IOException, ParserException,
ValidationException, DecoderException {
final Reader reader = new InputStreamReader(getClass().getResourceAsStream(
"/samples/invalid/vcard-dirk-whitespaceafterbegin.vcf"));
GroupRegistry groupRegistry = new GroupRegistry();
PropertyFactoryRegistry propReg = new PropertyFactoryRegistry();
ParameterFactoryRegistry parReg = new ParameterFactoryRegistry();
addTypeParamsToRegistry(parReg);
VCardBuilder builder =
new VCardBuilder(reader, groupRegistry, propReg, parReg);
try {
builder.build();
Assert.fail();
} catch (ParserException pe) {
assertEquals(1, pe.getLineNo());
return;
}
Assert.fail();
}
/**
* With relaxed parsing this should work OK, both the BEGIN:VCARD, and the
* ADR line.
*/
@Test
public void testDirkExampleWhitespaceAfterBeginRelaxedParsing() throws IOException, ParserException,
ValidationException, DecoderException {
File file = new File(
"./src/test/resources/samples/invalid/vcard-dirk-whitespaceafterbegin.vcf");
Reader reader = new FileReader(file);
GroupRegistry groupRegistry = new GroupRegistry();
PropertyFactoryRegistry propReg = new PropertyFactoryRegistry();
ParameterFactoryRegistry parReg = new ParameterFactoryRegistry();
addTypeParamsToRegistry(parReg);
CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING, true);
try {
VCardBuilder builder =
new VCardBuilder(reader, groupRegistry, propReg, parReg);
VCard card = builder.build();
Property prop = card.getProperty(Id.ADR);
Assert.assertNotNull(prop);
Address adr = (Address)prop;
assertEquals("Szczecin",adr.getExtended());
} finally {
CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING, false);
}
}
private void addTypeParamsToRegistry(ParameterFactoryRegistry parReg) {
for (final String name : new String[] { "HOME", "WORK", "MSG", "PREF",
"VOICE", "FAX", "CELL", "VIDEO", "PAGER", "BBS", "MODEM",
"CAR", "ISDN", "PCS", "INTERNET", "X400", "DOM", "INTL",
"POSTAL", "PARCEL" }) {
parReg.register(name, new ParameterFactory<Parameter>() {
public Parameter createParameter(String value) {
return new Type(name);
}
});
String lc = name.toLowerCase();
parReg.register(lc, new ParameterFactory<Parameter>() {
public Parameter createParameter(String value) {
return new Type(name);
}
});
}
}
}
|
/*
class whippedCream extends ToppingDrink {
public whippedCream(Drink base) {
super(base);
}
@Override
public String getDescription() {
return base.getDescription() + "\nAdded: whipped cream";
}
public void setCost(double cost){
super.base.setCost(cost);
}
}
*/ |
public class FindSecondLargestItem{
public static void main(String args[])throws Exception{
int array[] = {2,1,54,23,5,6};
System.out.println(getSecondLargestItem(array));
}
public static int getSecondLargestItem(int array[])throws Exception{
if(array.length < 2){
throw new Exception("Invalid input");
}
int first = Integer.MIN_VALUE;
int second = Integer.MIN_VALUE;
for(int i =0 ; i < array.length; i++){
if(array[i] > first){
second = first;
first = array[i];
}else if(second < array[i] && first != array[i]){
second = array[i];
}
}
if(second == Integer.MIN_VALUE){
throw new Exception("There is no second larget number");
}
return second;
}
} |
package hr.fiveplus.growplus;
import android.content.Context;
import android.graphics.Color;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.Fragment;
import android.net.Uri;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.TextView;
import android.widget.Toast;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import android.support.v7.app.ActionBarActivity;
import com.github.fafaldo.fabtoolbar.widget.FABToolbarLayout;
import hr.fiveplus.growplus.moodtracker.MoodTrackerMoodGradeFragment;
import hr.fiveplus.growplus.selfdev.SelfdevStoryDidYouKnowFragment;
import hr.fiveplus.growplus.selfdev.SelfdevStoryFragment;
import hr.fiveplus.growplus.selfdev.SelfdevStoryMyPerceptionFragment;
import hr.fiveplus.growplus.selfdev.SelfdevSubcategoryFragment;
import hr.fiveplus.myfragment_manager.MyFragmentManager;
import hr.fiveplus.growplus.selfdev.SelfdevCategoryFragment;
public class MainActivity extends /*FragmentActivity*/ AppCompatActivity
implements SelfdevCategoryFragment.OnFragmentInteractionListener,
SelfdevSubcategoryFragment.OnFragmentInteractionListener,
SelfdevStoryFragment.OnFragmentInteractionListener,
SelfdevStoryDidYouKnowFragment.OnFragmentInteractionListener,
SelfdevStoryMyPerceptionFragment.OnFragmentInteractionListener,
MoodTrackerMoodGradeFragment.OnFragmentInteractionListener
{
private Fragment activeFragment;
private boolean selfdevStory = false ;
public boolean isSelfdevStory() {
return selfdevStory;
}
public void setSelfdevStory(boolean selfdevStory) {
this.selfdevStory = selfdevStory;
}
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
myToolbar.setTitle(("Mood tracker").toUpperCase());
myToolbar.setTitleTextColor(Color.WHITE);
setSupportActionBar(myToolbar);
/*
myToolbar.setTitle(("Self development").toUpperCase());
new MyFragmentManager(this,getSupportFragmentManager(),savedInstanceState)
.showFragment(new SelfdevCategoryFragment(), R.id.fragment_container);
*/
new MyFragmentManager(this,getSupportFragmentManager(),savedInstanceState)
.showFragment(new MoodTrackerMoodGradeFragment(), R.id.fragment_container);
}
@Override
public void onAttachFragment(Fragment fragment) {
super.onAttachFragment(fragment);
this.activeFragment = fragment;
/* if(GrowPlusApplication.MoodTrackerMoodGradeFrag){
View view = this.getCurrentFocus();
if (view != null) {
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
}*/
}
@Override
public void onSelfdevCategoryFragmentInteraction(Uri uri) {
//TODO
}
@Override
public void onBackPressed() {
if(GrowPlusApplication.SelfDevStory && GrowPlusApplication.SelfDevStoryOpenedToolbar){
((FABToolbarLayout) activeFragment.getActivity().findViewById(R.id.fabtoolbar)).hide();
GrowPlusApplication.SelfDevStoryOpenedToolbar = false;
GrowPlusApplication.SelfDevStory = false;
return;
}
if(getSupportFragmentManager().getBackStackEntryCount()==1) {
this.finish();
} else {
super.onBackPressed();
this.activeFragment = getSupportFragmentManager().getFragments().get(getSupportFragmentManager().getBackStackEntryCount()-1);
}
}
@Override
public void onSelfdevSubcategoryFragmentInteraction(Uri uri) {
}
@Override
public void onSelfdevStoryFragmentInteraction(Uri uri) {
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()){
case R.id.action_calendar: //run function
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater mi = getMenuInflater();
mi.inflate(R.menu.menu_item,menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public void onSelfdevStoryDidYouKnowFragmentInteraction(Uri uri) {
}
@Override
public void onSelfdevStoryMyPerceptionFragmentInteraction(Uri uri) {
}
@Override
protected void onResumeFragments() {
super.onResumeFragments();
}
@Override
public void onMoodTrackerMoodGradeFragmenInteraction(Uri uri) {
}
}
|
package saim_only_03_30;
import java.util.*;
public class RandomNumber6digit {
public static void main (String [] args){
Random random =new Random();
String randomNum = "";
while(randomNum.length() !=6){
int eachNum = random.nextInt(10);
if(!randomNum.contains(""+eachNum)){
randomNum += eachNum;
}
}
System.out.println("The random number is " + randomNum);
}
}
|
package com.tencent.mm.plugin.appbrand.ui.recents;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.tencent.mm.bp.a;
import com.tencent.mm.modelappbrand.b.b;
import com.tencent.mm.plugin.appbrand.s.g;
import com.tencent.mm.plugin.appbrand.s.h;
import com.tencent.mm.plugin.appbrand.widget.AppBrandNearbyShowcaseView;
import com.tencent.mm.sdk.platformtools.x;
import com.tencent.mm.ui.widget.ThreeDotsLoadingView;
import java.util.List;
final class d implements OnClickListener {
b gzB;
int gzC = c.gzN;
final d gzD = new d((byte) 0);
private final int gzE;
private final int gzF = 200;
private final a gzG;
public d(ViewGroup viewGroup, int i) {
Context context = viewGroup.getContext();
this.gzG = new a(this, context, (byte) 0);
View inflate = LayoutInflater.from(context).inflate(h.app_brand_recents_list_header_v2, viewGroup, false);
this.gzD.SU = inflate;
this.gzD.gzS = (TextView) inflate.findViewById(g.title);
this.gzD.gzT = inflate.findViewById(g.nearby_showcase_container);
this.gzD.gzV = (TextView) inflate.findViewById(g.notice_text);
this.gzD.gzU = (AppBrandNearbyShowcaseView) inflate.findViewById(g.nearby_icon_showcase);
this.gzD.gzp = (ThreeDotsLoadingView) inflate.findViewById(g.nearby_loading_view);
this.gzD.gzW = (ImageView) inflate.findViewById(g.nearby_refresh_view);
this.gzD.SU.setOnClickListener(this);
this.gzD.gzS.setText(i);
AppBrandNearbyShowcaseView appBrandNearbyShowcaseView = this.gzD.gzU;
if (appBrandNearbyShowcaseView != null) {
appBrandNearbyShowcaseView.setIconLayerCount(4);
appBrandNearbyShowcaseView.setIconSize(this.gzG.gzI + (this.gzG.gzK * 2));
appBrandNearbyShowcaseView.setIconGap(this.gzG.gzJ);
}
this.gzE = a.g(context, com.tencent.mm.plugin.appbrand.s.d.grey_text_color);
}
protected final void aoi() {
x.i("MicroMsg.AppBrandLauncherRecentsListHeaderBase", "AppBrandLauncherRecentsListHeaderBase.loading");
this.gzC = c.gzO;
bN(this.gzD.gzT);
bN(this.gzD.gzW);
bO(this.gzD.gzp);
this.gzD.gzp.cAG();
}
protected final void a(List<String> list, String str, Integer num) {
x.i("MicroMsg.AppBrandLauncherRecentsListHeaderBase", "AppBrandLauncherRecentsListHeaderBase.loadingSuccess");
this.gzC = c.gzP;
this.gzD.gzp.cAH();
bN(this.gzD.gzp);
if (list == null || list.size() == 0) {
x.e("MicroMsg.AppBrandLauncherRecentsListHeaderBase", "AppBrandLauncherRecentsListHeaderBase.showLoadingSuccess empty iconUrl list");
return;
}
int i;
if (list != null) {
this.gzD.gzU.setIconLayerCount(Math.min(list.size(), 4));
this.gzD.gzU.aoT();
a aVar = this.gzG;
if (aVar.gzM == null) {
aVar.gzM = new com.tencent.mm.plugin.appbrand.ui.widget.a(aVar.gzI, aVar.gzK);
}
com.tencent.mm.plugin.appbrand.ui.widget.a aVar2 = aVar.gzM;
i = 0;
while (true) {
int i2 = i;
if (i2 >= this.gzD.gzU.getChildCount()) {
break;
}
b.Ka().a(this.gzD.gzU.lT(i2), (String) list.get(i2), com.tencent.mm.modelappbrand.b.a.JZ(), aVar2);
i = i2 + 1;
}
} else {
x.e("MicroMsg.AppBrandLauncherRecentsListHeaderBase", "prepareIconList without icon urls");
}
i = num == null ? this.gzE : num.intValue();
if (this.gzD.gzV != null) {
this.gzD.gzV.setText(str);
this.gzD.gzV.setTextColor(i);
}
if (this.gzD.gzT != null) {
bO(this.gzD.gzT);
if (this.gzD.gzU != null) {
this.gzD.gzU.aoU();
}
if (this.gzD.gzV != null) {
this.gzD.gzV.setAlpha(0.0f);
this.gzD.gzV.animate().alpha(1.0f).setDuration(500).start();
}
}
}
public final void onClick(View view) {
if (this.gzB != null) {
this.gzB.a(this.gzC, view);
}
}
final void bN(View view) {
if (view.getVisibility() == 0) {
view.animate().setDuration(200).alpha(0.0f).withEndAction(new 1(this, view)).start();
}
}
static void bO(View view) {
if (view.getVisibility() != 0) {
view.setAlpha(0.0f);
view.setVisibility(0);
}
view.animate().setDuration(200).alpha(1.0f).withEndAction(null).start();
}
}
|
package org.dmonix.cipher;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import org.dmonix.AbstractTestCase;
import org.dmonix.io.NullInputStream;
import org.dmonix.io.NullOutputStream;
import org.junit.After;
import org.junit.Before;
public class TestCipherPBE extends AbstractTestCase {
private SerializableTestBean OBJECT_TO_CIPHER = new SerializableTestBean("Peter", System.currentTimeMillis());
private char[] KEY_PBE = "fairfnqi9480498204235h".toCharArray();
private static final byte[] SALT = { (byte) 0xc7, (byte) 0x73, (byte) 0x21, (byte) 0x8c, (byte) 0x7e, (byte) 0xc8, (byte) 0xee, (byte) 0x99 };
private static final int ITERATION_COUNT = 20;
private File testFile = new File("testCipherPBEOstream.cph");
@Before
public void setUp() throws Exception {
testFile = new File("testCipherPBEOstream.cph");
}
@After
public void tearDown() throws Exception {
testFile.delete();
}
/**
* Test writing an object to file and decoding the object.
*
* @throws Exception
*/
public void testCipherPBEOstream() throws Exception {
CipherOutputStreamPBE dmCipherOutputStreamPBE = new CipherOutputStreamPBE(new FileOutputStream(testFile), KEY_PBE);
CipherInputStreamPBE dmCipherInputStreamPBE = new CipherInputStreamPBE(new FileInputStream(testFile), KEY_PBE);
assertEncodeDecode(dmCipherOutputStreamPBE, dmCipherInputStreamPBE);
}
/**
* Test writing an object to file and decoding the object.
*
* @throws Exception
*/
public void testCipherPBEOstream2() throws Exception {
CipherOutputStreamPBE dmCipherOutputStreamPBE = new CipherOutputStreamPBE(new FileOutputStream(testFile), KEY_PBE, SALT, ITERATION_COUNT);
CipherInputStreamPBE dmCipherInputStreamPBE = new CipherInputStreamPBE(new FileInputStream(testFile), KEY_PBE, SALT, ITERATION_COUNT);
assertEncodeDecode(dmCipherOutputStreamPBE, dmCipherInputStreamPBE);
}
/**
* Test that cloning can not be performed on DMCipherOutputStreamPBE
*
* @throws Exception
*/
public void testCloningCipherPBEOstream() throws Exception {
CipherOutputStreamPBE stream = new CipherOutputStreamPBE(new NullOutputStream(), KEY_PBE);
try {
stream.clone();
} catch (CloneNotSupportedException ex) {
super.setExceptionCaught();
}
super.assertExceptionCaught();
}
/**
* Test that cloning can not be performed on DMCipherOutputStreamPBE
*
* @throws Exception
*/
public void testCloningCipherPBEIstream() throws Exception {
CipherInputStreamPBE stream = new CipherInputStreamPBE(new NullInputStream(), KEY_PBE);
try {
stream.clone();
} catch (CloneNotSupportedException ex) {
super.setExceptionCaught();
}
super.assertExceptionCaught();
}
private void assertEncodeDecode(CipherOutputStreamPBE dmCipherOutputStreamPBE, CipherInputStreamPBE dmCipherInputStreamPBE) throws Exception {
ObjectOutputStream ostream = new ObjectOutputStream(dmCipherOutputStreamPBE);
ostream.writeObject(OBJECT_TO_CIPHER);
ostream.flush();
ostream.close();
assertTrue(testFile.exists());
ObjectInputStream istream = new ObjectInputStream(dmCipherInputStreamPBE);
Object object = istream.readObject();
istream.close();
assertEquals(OBJECT_TO_CIPHER, object);
testFile.delete();
}
}
|
package com.tyss.cg.polymorphism;
public interface MethodsInterface {
public String displayMessage();
public String printMessage();
}
|
package com.ttcscn.controller;
import java.io.File;
import java.util.List;
import javax.transaction.Transactional;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.ttcscn.entity.Menu;
import com.ttcscn.entity.Message;
@RestController
public class TrangChu {
@RequestMapping(value = "/", method = RequestMethod.GET)
public String getAllListMenu() {
return "Trang Chủ";
}
@RequestMapping(value = "/uploadanh", method = RequestMethod.POST)
@ResponseBody
public Message uploadFile(@RequestParam("imageFile") MultipartFile imageFile) {
System.out.println("Chay duoc");
Message message = new Message();
try {
String fileName = imageFile.getOriginalFilename();
File file = new File("C:\\xampp\\htdocs\\ordercoffee\\image", fileName);
imageFile.transferTo(file);
} catch (Exception e) {
System.out.println("Uploadddd Errrorrrr");
//e.printStackTrace();
}
message.setMessage("Success");
return message;
}
}
|
package jv2_session2;
public class SieuNhanCap2 extends SieuNhanCap1{
public void bienhinh2(){
}
}
|
/*
* Copyright (C) 2015 Miquel Sas
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*/
package com.qtplaf.library.database.rdbms;
import java.sql.SQLException;
import java.util.NoSuchElementException;
import com.qtplaf.library.database.PersistorException;
import com.qtplaf.library.database.Record;
import com.qtplaf.library.database.RecordIterator;
/**
* A database record iterator.
*
* @author Miquel Sas
*/
public class DBRecordIterator implements RecordIterator {
/**
* The underlying cursor.
*/
private Cursor cursor;
/**
* Constructor.
*
* @param cursor The underlying cursor.
*/
public DBRecordIterator(Cursor cursor) {
super();
this.cursor = cursor;
}
/**
* Returns {@code true} if the iteration has more records. (In other words, returns {@code true} if {@link #next}
* would return a record rather than throwing an exception.)
*
* @return {@code true} if the iteration has more elements
*/
@Override
public boolean hasNext() {
if (cursor.isClosed()) {
return false;
}
boolean next = false;
try {
next = cursor.nextRecord();
} catch (SQLException e) {
silentlyClose();
}
if (!next) {
silentlyClose();
}
return next;
}
/**
* Returns the next record in the iteration.
*
* @return the next record in the iteration
* @throws NoSuchElementException if the iteration has no more records
*/
@Override
public Record next() {
return cursor.getRecord();
}
/**
* Close underlying resources.
*
* @throws PersistorException if any errors occur closing the underlying resources
*/
@Override
public void close() throws PersistorException {
if (!cursor.isClosed()) {
try {
cursor.close();
} catch (SQLException exc) {
throw new PersistorException(exc.getMessage(), exc);
}
}
}
/**
* Silently close this iterator underlying cursor.
*/
private void silentlyClose() {
try {
close();
} catch (PersistorException exc) {
throw new IllegalStateException(exc);
}
}
}
|
package rs.jug.rx.composition.domain;
public class Social {
public String facebookUrl;
public Social(String facebookUrl) {
super();
this.facebookUrl = facebookUrl;
}
@Override
public String toString() {
return "Social [facebookUrl=" + facebookUrl + "]";
}
}
|
package lintcode;
/**
* @program: coder
* @description:
* @author: Majpyi
* @create: 2019-06-15 11:33
**/
public class T125背包问题II {
public int backPackII(int m, int[] A, int[] V) {
int[][] dp = new int[A.length + 1][m + 1];
for (int i = 1; i < dp.length; i++) {
for (int j = 0; j < dp[0].length; j++) {
if (j >= A[i-1]) {
dp[i][j] = Math.max(dp[i - 1][j], dp[i - 1][j - A[i - 1]] + V[i - 1]);
}else {
dp[i][j] = dp[i-1][j];
}
}
}
return dp[dp.length-1][dp[0].length-1];
}
}
|
/**
* Reads an undirected graph in the form of an adjacency matrix
* from file graph.txt, prompts user for start and end nodes,
* then prints the shortest path between the two nodes.
* @author Jesse Li
*/
import java.io.*;
import java.util.Scanner;
import java.util.*;
public class Dijkstra {
/**
* Reads an undirected graph in the form of an adjacency matrix
* from file graph.txt, prompts user for start and end nodes,
* then prints the shortest path between the two nodes.
* @param args Command line arguments
*/
public static void main(String[] args) {
try {
Scanner scan = new Scanner(System.in);
System.out.println("Welcome to Dijkstra Town");
int[][] graph = readGraph("graph.txt");
System.out.println("File Reading Complete!");
boolean quit = false;
while (!quit) {
System.out.println("What node to start at? (-1 to quit)");
int start = scan.nextInt();
if (start >= 0) {
System.out.println("What node to end at?");
int end = scan.nextInt();
ArrayList<Integer> solution = solve(start, end, graph);
System.out.print("Your path is: ");
for (int i = 0; i < solution.size() - 1; i++) {
System.out.print(solution.get(i) + " -> ");
}
System.out.println(solution.get(solution.size() - 1));
} else {
quit = true;
System.out.println("Goodbye");
}
}
} catch (Exception e) {
System.out.println(e);
}
}
/**
* Reads graph from a file
* @param filename file to read
* @return 2D array representing graph
* @throws FileNotFoundException Thrown when file is missing
*/
public static int[][] readGraph(String filename) throws FileNotFoundException {
Scanner scan;
scan = new Scanner(new BufferedReader(new FileReader(filename)));
int size = scan.nextInt();
int[][] graph = new int[size][size];
for (int row = 0; row < size; row++) {
for (int col = 0; col < size; col++) {
graph[row][col] = scan.nextInt();
}
}
return graph;
}
/**
* Solve shortest path using Dijkstra's algorithm
* @param start starting node
* @param stop ending node
* @param graph 2D array representing graph
* @return ArrayList containing steps of shortest path
*/
public static ArrayList<Integer> solve(int start, int stop, int[][] graph) {
int graphSize = graph.length;
int[] dist = new int[graphSize];
int[] prev = new int[graphSize];
MinHeap heap = new MinHeap();
//Set up dist, prev
for(int v = 0; v < graphSize; v++) {
int distance;
if (v != start) {
//basically infinite
distance = Integer.MAX_VALUE;
dist[v] = distance;
prev[v] = -1;
} else {
heap.insert(0, v);
}
}
while (!heap.isEmpty()) {
int u = heap.peekNode();
heap.delete();
//iterate over adjacent nodes
for (int v = 0; v < graphSize; v++) {
//check if there's a path
if (graph[u][v] > 0) {
int length = dist[u] + graph[u][v];
//update distance if shorter
if (length < dist[v]) {
dist[v] = length;
prev[v] = u;
heap.insert(length, v);
}
}
}
}
//build solution from prev
ArrayList<Integer> solution = new ArrayList<Integer>();
int curr = stop;
while (prev[curr] != -1) {
solution.add(0, curr);
curr = prev[curr];
}
return solution;
}
} |
package com.example.study.activity.mode;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import com.example.study.R;
public class ModeSingleTaskActivity extends AppCompatActivity {
public static void startAction(Context context){
context.startActivity(new Intent(context, ModeSingleTaskActivity.class));
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mode_single_task);
findViewById(R.id.btn_start).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ModeSingleTaskAssitActivity.startAction(ModeSingleTaskActivity.this);
ModeSingleTaskAssitActivity.startAction(ModeSingleTaskActivity.this);
ModeSingleTaskAssitActivity.startAction(ModeSingleTaskActivity.this);
}
});
}
}
|
package com.tencent.mm.sandbox.updater;
import android.os.Message;
import com.tencent.mm.protocal.c.bhp;
import com.tencent.mm.sdk.platformtools.ag;
import com.tencent.mm.sdk.platformtools.x;
import java.io.File;
class c$1 extends ag {
final /* synthetic */ c sDP;
c$1(c cVar) {
this.sDP = cVar;
}
public final void handleMessage(Message message) {
if (1 == message.what && !c.a(this.sDP)) {
new File(this.sDP.beJ()).delete();
if (message.arg1 == 0) {
x.d("MicroMsg.NetSceneGetUpdatePackFromCDN", "patch ok");
c.b(this.sDP).a(200, 0, (bhp) message.obj);
} else if (message.arg1 == 3) {
c.b(this.sDP).a(3, -1, (bhp) message.obj);
} else if (message.arg1 == 4) {
c.b(this.sDP).a(4, -1, (bhp) message.obj);
}
}
super.handleMessage(message);
}
}
|
package cn.edu.sdjzu.xg.bysj.domain.authority;
import lombok.*;
import java.io.Serializable;
import java.util.Collection;
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
@ToString
public final class Role implements Comparable<Role>, Serializable {
private Integer id;
private String description;
private String no;
//本对象对应的所有的资源。表中没有对应的字段,需要倒查。
private Collection<Resource> resources;
public Role(Integer id, String description, String no) {
this.id = id;
this.description = description;
this.no = no;
}
@Override
public int compareTo(Role o) {
return this.id - o.id;
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.