protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } SetTitle (Resource.String.submenu_summary); SetContentView (Resource.Layout.PrintInvSumm); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; apara = DataHelper.GetAdPara (pathToDatabase); Button butPrint= FindViewById<Button> (Resource.Id.printsumm); Button butInvBack= FindViewById<Button> (Resource.Id.printsumm_cancel); EditText frd = FindViewById<EditText> (Resource.Id.trxdatefr); EditText tod = FindViewById<EditText> (Resource.Id.trxdateto); imm = (InputMethodManager)GetSystemService(Context.InputMethodService); frd.Text = DateTime.Today.ToString ("dd-MM-yyyy"); frd.Click += delegate(object sender, EventArgs e) { imm.HideSoftInputFromWindow(frd.WindowToken, 0); ShowDialog (DATE_DIALOG_ID1); }; tod.Text = DateTime.Today.ToString ("dd-MM-yyyy"); date = DateTime.Today; tod.Click += delegate(object sender, EventArgs e) { imm.HideSoftInputFromWindow(tod.WindowToken, 0); ShowDialog (DATE_DIALOG_ID2); }; butInvBack.Click += (object sender, EventArgs e) => { StartActivity(typeof(TransListActivity)); }; butPrint.Click+= ButPrint_Click; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } SetTitle (Resource.String.submenu_cnlist); EventManagerFacade.Instance.GetEventManager().AddListener(this); // Create your application here //SetContentView (Resource.Layout.ListView); SetContentView (Resource.Layout.ListCustView); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; rights = Utility.GetAccessRights (pathToDatabase); Utility.GetDateRange (ref sdate,ref edate); populate (listData); apara = DataHelper.GetAdPara (pathToDatabase); listView = FindViewById<ListView> (Resource.Id.CustList); txtSearch= FindViewById<EditText > (Resource.Id.txtSearch); // TableLayout tlay = FindViewById<TableLayout> (Resource.Id.tableLayout1); // tlay.Visibility = ViewStates.Invisible; //Button butNew= FindViewById<Button> (Resource.Id.butCustBack); //butNew.Visibility = ViewStates.Invisible; Button butInvBack= FindViewById<Button> (Resource.Id.butCustBack); butInvBack.Click+= (object sender, EventArgs e) => { StartActivity(typeof(TransListActivity)); }; listView.ItemClick += OnListItemClick; listView.ItemLongClick += OnListItemLongClick; //listView.Adapter = new CusotmListAdapter(this, listData); SetViewDlg viewdlg = SetViewDelegate; listView.Adapter = new GenericListAdapter<CNNote> (this, listData, Resource.Layout.ListItemRowCN, viewdlg); txtSearch.TextChanged+= TxtSearch_TextChanged; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } SetContentView (Resource.Layout.PrintInvSumm); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; apara = DataHelper.GetAdPara (pathToDatabase); Button butPrint= FindViewById<Button> (Resource.Id.printsumm); Button butInvBack= FindViewById<Button> (Resource.Id.printsumm_cancel); EditText frd = FindViewById<EditText> (Resource.Id.trxdatefr); EditText tod = FindViewById<EditText> (Resource.Id.trxdateto); frd.Text = DateTime.Today.ToString ("dd-MM-yyyy"); frd.Click += delegate(object sender, EventArgs e) { ShowDialog (DATE_DIALOG_ID1); }; tod.Text = DateTime.Today.ToString ("dd-MM-yyyy"); date = DateTime.Today; tod.Click += delegate(object sender, EventArgs e) { ShowDialog (DATE_DIALOG_ID2); }; butInvBack.Click += (object sender, EventArgs e) => { StartActivity(typeof(TransListActivity)); }; butPrint.Click+= ButPrint_Click; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } // Create your application here SetTitle (Resource.String.title_so); SetContentView (Resource.Layout.ListView); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; rights = Utility.GetAccessRights (pathToDatabase); populate (listData); apara = DataHelper.GetAdPara (pathToDatabase); listView = FindViewById<ListView> (Resource.Id.feedList); Button butNew= FindViewById<Button> (Resource.Id.butnewInv); butNew.Click += butCreateNewInv; Button butInvBack= FindViewById<Button> (Resource.Id.butInvBack); butInvBack.Click += (object sender, EventArgs e) => { StartActivity(typeof(MainActivity)); }; listView.ItemClick += OnListItemClick; listView.ItemLongClick += OnListItemLongClick; //listView.Adapter = new CusotmListAdapter(this, listData); SetViewDlg viewdlg = SetViewDelegate; listView.Adapter = new GenericListAdapter<SaleOrder> (this, listData, Resource.Layout.ListItemRow, viewdlg); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish(); } SetTitle(Resource.String.submenu_summary); SetContentView(Resource.Layout.PrintInvSumm); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; apara = DataHelper.GetAdPara(pathToDatabase); Button butPrint = FindViewById <Button> (Resource.Id.printsumm); Button butInvBack = FindViewById <Button> (Resource.Id.printsumm_cancel); EditText frd = FindViewById <EditText> (Resource.Id.trxdatefr); EditText tod = FindViewById <EditText> (Resource.Id.trxdateto); imm = (InputMethodManager)GetSystemService(Context.InputMethodService); frd.Text = DateTime.Today.ToString("dd-MM-yyyy"); frd.Click += delegate(object sender, EventArgs e) { imm.HideSoftInputFromWindow(frd.WindowToken, 0); ShowDialog(DATE_DIALOG_ID1); }; tod.Text = DateTime.Today.ToString("dd-MM-yyyy"); date = DateTime.Today; tod.Click += delegate(object sender, EventArgs e) { imm.HideSoftInputFromWindow(tod.WindowToken, 0); ShowDialog(DATE_DIALOG_ID2); }; butInvBack.Click += (object sender, EventArgs e) => { StartActivity(typeof(TransListActivity)); }; butPrint.Click += ButPrint_Click; }
public static IPrintDocument GetPrintDocument <T>() { //string USERDEFINE = ((GlobalvarsApp)Application.Context).USERFUNCTION; string pathToDatabase = ((GlobalvarsApp)Application.Context).DATABASE_PATH; IPrintDocument intent = null; string classname = ""; AdPara para = DataHelper.GetAdPara(pathToDatabase); if (para.PaperSize == "8.5Inch") { if (para.PrinterType == "Network Laserjet Printer") { intent = GetPrintDocumentEX <PrintPCLInvoice> (); } else { intent = GetPrintDocumentEX <PrintDMInvoice> (); } } else { intent = GetPrintDocumentEX <T> (); } return(intent); }
public PrintESCPSBase() { pathToDatabase = ((GlobalvarsApp)Application.Context).DATABASE_PATH; USERID = ((GlobalvarsApp)Application.Context).USERID_CODE; apara = DataHelper.GetAdPara(pathToDatabase); compInfo = DataHelper.GetCompany(pathToDatabase); }
private void butSaveClick(object sender, EventArgs e) { TextView txtprinter = FindViewById <TextView> (Resource.Id.txtad_printer); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; AdPara apra = new AdPara(); apra.PrinterName = txtprinter.Text.ToUpper(); apra.PrinterType = spinPrType.SelectedItem.ToString(); apra.PrinterIP = txtPrinterIP.Text; using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { var list = db.Table <AdPara> ().ToList <AdPara> (); if (list.Count == 0) { db.Insert(apra); } else { apra = list [0]; apra.PrinterType = spinPrType.SelectedItem.ToString(); apra.PrinterName = txtprinter.Text.ToUpper(); apra.PaperSize = spinner.SelectedItem.ToString(); apra.PrinterIP = txtPrinterIP.Text; db.Update(apra); } } base.OnBackPressed(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } EventManagerFacade.Instance.GetEventManager().AddListener(this); // Create your application here SetContentView (Resource.Layout.ListView); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; compCode = ((GlobalvarsApp)this.Application).COMPANY_CODE; branchCode = ((GlobalvarsApp)this.Application).BRANCH_CODE; Utility.GetDateRange (ref sdate,ref edate); populate (listData); apara = DataHelper.GetAdPara (pathToDatabase,compCode,branchCode); listView = FindViewById<ListView> (Resource.Id.feedList); // TableLayout tlay = FindViewById<TableLayout> (Resource.Id.tableLayout1); // tlay.Visibility = ViewStates.Invisible; Button butNew= FindViewById<Button> (Resource.Id.butnewInv); butNew.Visibility = ViewStates.Invisible; Button butInvBack= FindViewById<Button> (Resource.Id.butInvBack); butInvBack.Click+= (object sender, EventArgs e) => { StartActivity(typeof(TransListActivity)); }; listView.ItemClick += OnListItemClick; listView.ItemLongClick += OnListItemLongClick; //listView.Adapter = new CusotmListAdapter(this, listData); SetViewDlg viewdlg = SetViewDelegate; listView.Adapter = new GenericListAdapter<CNNote> (this, listData, Resource.Layout.ListItemRow, viewdlg); }
void DownlooadLogo() { try { //backup db first before upload AdPara apara = DataHelper.GetAdPara(pathToDatabase); WebClient myWebClient = new WebClient(); string document = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); string logopath = ""; string filename = ""; if (apara.PaperSize == "58mm") { logopath = Path.Combine(document, "logo58.png"); filename = COMPCODE + "_" + BRANCODE + "_58_logo.png"; } else { logopath = Path.Combine(document, "logo80.png"); filename = COMPCODE + "_" + BRANCODE + "_80_logo.png"; } string url = WCFHelper.GetDownloadLogoUrl() + filename; // string localfilename = Path.Combine (sdcard, "logo.png"); if (File.Exists(logopath)) { File.Delete(logopath); } myWebClient.DownloadFile(url, logopath); //File.Copy (localfilename, logopath, true); // Toast.MakeText (this, Resources.GetString (Resource.String.msg_successdownlogo), ToastLength.Long).Show (); } catch (Exception ex) { Toast.MakeText(this, Resources.GetString(Resource.String.msg_faildowndb), ToastLength.Long).Show(); } }
private void butSaveClick(object sender,EventArgs e) { TextView txtprinter =FindViewById<TextView> (Resource.Id.txtad_printer); TextView txtprefix =FindViewById<TextView> (Resource.Id.txtad_prefix); TextView txttitle =FindViewById<TextView> (Resource.Id.txtad_title); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; AdPara apra = new AdPara (); apra.Prefix = txtprefix.Text.ToUpper(); apra.PrinterName = txtprinter.Text.ToUpper(); using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { var list = db.Table<AdPara> ().ToList<AdPara> (); if (list.Count == 0) { db.Insert (apra); } else { apra = list [0]; apra.Prefix = txtprefix.Text.ToUpper(); apra.PrinterName = txtprinter.Text.ToUpper(); apra.PaperSize = spinner.SelectedItem.ToString (); apra.ReceiptTitle =txttitle.Text.ToUpper(); db.Update (apra); } } base.OnBackPressed(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } SetTitle (Resource.String.title_cash); // Create your application here SetContentView (Resource.Layout.ListView); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; COMPCODE = ((GlobalvarsApp)this.Application).COMPANY_CODE; rights = Utility.GetAccessRights (pathToDatabase); populate (listData); apara = DataHelper.GetAdPara (pathToDatabase); listView = FindViewById<ListView> (Resource.Id.feedList); Button butNew= FindViewById<Button> (Resource.Id.butnewInv); butNew.Visibility = ViewStates.Gone; //butNew.Click += butCreateNewInv; Button butInvBack= FindViewById<Button> (Resource.Id.butInvBack); butInvBack.Click += (object sender, EventArgs e) => { StartActivity(typeof(POSSalesActivity)); }; //if (!rights.InvAllowAdd) // butNew.Enabled = false; listView.ItemClick += OnListItemLongClick;//OnListItemClick; listView.ItemLongClick += ListView_ItemLongClick; //listView.Adapter = new CusotmListAdapter(this, listData); SetViewDlg viewdlg = SetViewDelegate; listView.Adapter = new GenericListAdapter<Invoice> (this, listData, Resource.Layout.ListItemRow, viewdlg); }
public PrintESCPSBase() { pathToDatabase = ((GlobalvarsApp)Application.Context).DATABASE_PATH; USERID = ((GlobalvarsApp)Application.Context).USERID_CODE; apara = DataHelper.GetAdPara (pathToDatabase); compInfo =DataHelper.GetCompany(pathToDatabase); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish(); } // Create your application here SetTitle(Resource.String.title_so); SetContentView(Resource.Layout.ListView); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; rights = Utility.GetAccessRights(pathToDatabase); populate(listData); apara = DataHelper.GetAdPara(pathToDatabase); listView = FindViewById <ListView> (Resource.Id.feedList); // TableLayout tlay = FindViewById<TableLayout> (Resource.Id.tableLayout1); // tlay.Visibility = ViewStates.Invisible; Button butNew = FindViewById <Button> (Resource.Id.butnewInv); butNew.Visibility = ViewStates.Invisible; Button butInvBack = FindViewById <Button> (Resource.Id.butInvBack); butInvBack.Click += (object sender, EventArgs e) => { StartActivity(typeof(TransListActivity)); }; listView.ItemClick += OnListItemClick; listView.ItemLongClick += OnListItemLongClick; //listView.Adapter = new CusotmListAdapter(this, listData); SetViewDlg viewdlg = SetViewDelegate; listView.Adapter = new GenericListAdapter <SaleOrder> (this, listData, Resource.Layout.ListItemRow, viewdlg); }
//AccessRights rights; protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } SetTitle (Resource.String.title_sonew); SetContentView (Resource.Layout.CreateSO); EventManagerFacade.Instance.GetEventManager().AddListener(this); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; //rights = Utility.GetAccessRights (pathToDatabase); apara = DataHelper.GetAdPara (pathToDatabase); // Create your application here _date = DateTime.Today; spinner = FindViewById<Spinner> (Resource.Id.newinv_custcode); spinnerBill = FindViewById<Spinner> (Resource.Id.newinv_billto); TextView lbBillto = FindViewById<TextView> (Resource.Id.lbbillto); lbBillto.Text = "PAY FROM"; Button butSave = FindViewById<Button> (Resource.Id.newinv_bsave); Button butNew = FindViewById<Button> (Resource.Id.newinv_cancel); Button butFind = FindViewById<Button> (Resource.Id.newinv_bfind); Button butBillFind = FindViewById<Button> (Resource.Id.newinv_billfind); //spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); //spinnerBill.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); butSave.Click += butSaveClick; butNew.Click += butCancelClick; TextView invno = FindViewById<TextView> (Resource.Id.newinv_no); invno.Text = "AUTO"; EditText trxdate = FindViewById<EditText> (Resource.Id.newinv_date); trxdate.Text = _date.ToString ("dd-MM-yyyy"); trxdate.Click += delegate(object sender, EventArgs e) { ShowDialog (0); }; butFind.Click+= (object sender, EventArgs e) => { ShowCustLookUp(); }; butBillFind.Click+= (object sender, EventArgs e) => { ShowBillToLookUp(); }; //SqliteConnection.CreateFile(pathToDatabase); using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { items = db.Table<Trader> ().ToList<Trader> (); } var icodes = GetCustCode (IsValidCustTo); var icodes2 = GetCustCode (IsValidBillTo); dataAdapter = new ArrayAdapter<String> (this, Resource.Layout.spinner_item, icodes); dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner.Adapter =dataAdapter; dataAdapter2 = new ArrayAdapter<String> (this, Resource.Layout.spinner_item, icodes2); dataAdapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinnerBill.Adapter =dataAdapter2; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } // Create your application here SetContentView (Resource.Layout.ListView); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; compCode = ((GlobalvarsApp)this.Application).COMPANY_CODE; branchCode = ((GlobalvarsApp)this.Application).BRANCH_CODE; populate (listData); apara = DataHelper.GetAdPara (pathToDatabase,compCode,branchCode); listView = FindViewById<ListView> (Resource.Id.feedList); Button butNew= FindViewById<Button> (Resource.Id.butnewInv); butNew.Click += butCreateNewInv; Button butInvBack= FindViewById<Button> (Resource.Id.butInvBack); butInvBack.Click += (object sender, EventArgs e) => { StartActivity(typeof(TransactionsActivity)); }; listView.ItemClick += OnListItemClick; listView.ItemLongClick += OnListItemLongClick; //listView.Adapter = new CusotmListAdapter(this, listData); SetViewDlg viewdlg = SetViewDelegate; listView.Adapter = new GenericListAdapter<DelOrder> (this, listData, Resource.Layout.ListItemRow, viewdlg); }
void CreateNewInv() { DateTime invdate = Utility.ConvertToDate(txtInvDate.Text); DateTime tmr = invdate.AddDays(1); AdNumDate adNum; // = DataHelper.GetNumDate (pathToDatabase, invdate); apara = DataHelper.GetAdPara(pathToDatabase); string[] prefixs = apara.Prefix.Trim().ToUpper().Split(new char[] { '|' }); string prefix = ""; adNum = DataHelper.GetNumDate(pathToDatabase, invdate, "INV"); if (prefixs.Length > 1) { prefix = prefixs [0]; } else { prefix = prefixs [0]; } invno = ""; int runno = adNum.RunNo + 1; int currentRunNo = DataHelper.GetLastInvRunNo(pathToDatabase, invdate, "INVOICE"); if (currentRunNo >= runno) { runno = currentRunNo + 1; } invno = prefix + invdate.ToString("yyMM") + runno.ToString().PadLeft(4, '0'); using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { inv = new Invoice(); inv.invno = invno; inv.invdate = invdate; inv.trxtype = "INVOICE"; inv.created = DateTime.Now; inv.amount = 0; inv.isUploaded = false; inv.remark = ""; db.Insert(inv); adNum.RunNo = runno; if (adNum.ID >= 0) { db.Update(adNum); } else { db.Insert(adNum); } } txtInvNo.Text = inv.invno; txtInvDate.Text = inv.invdate.ToString("dd-MM-yyyy"); txtInvMode.Text = "NEW"; IsSave = false; IsFirePaid = false; IsFirePaidOnly = false; EnableControLs(true, true, false, true, false); }
protected override void OnResume() { base.OnResume(); listData = new List<CNNote> (); populate (listData); apara = DataHelper.GetAdPara (pathToDatabase); listView = FindViewById<ListView> (Resource.Id.feedList); SetViewDlg viewdlg = SetViewDelegate; listView.Adapter = new GenericListAdapter<CNNote> (this, listData, Resource.Layout.ListItemRowCN, viewdlg); }
protected override void OnResume() { base.OnResume(); listData = new List <CNNote> (); populate(listData); apara = DataHelper.GetAdPara(pathToDatabase); listView = FindViewById <ListView> (Resource.Id.feedList); SetViewDlg viewdlg = SetViewDelegate; listView.Adapter = new GenericListAdapter <CNNote> (this, listData, Resource.Layout.ListItemRowCN, viewdlg); }
protected override void OnResume() { base.OnResume(); listData = new List<Invoice> (); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; COMPCODE = ((GlobalvarsApp)this.Application).COMPANY_CODE; rights = Utility.GetAccessRights (pathToDatabase); populate (listData); apara = DataHelper.GetAdPara (pathToDatabase); listView = FindViewById<ListView> (Resource.Id.feedList); SetViewDlg viewdlg = SetViewDelegate; listView.Adapter = new GenericListAdapter<Invoice> (this, listData, Resource.Layout.ListItemRow, viewdlg); }
protected override void OnResume() { base.OnResume(); listData = new List <Invoice> (); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; COMPCODE = ((GlobalvarsApp)this.Application).COMPANY_CODE; rights = Utility.GetAccessRights(pathToDatabase); populate(listData); apara = DataHelper.GetAdPara(pathToDatabase); listView = FindViewById <ListView> (Resource.Id.feedList); SetViewDlg viewdlg = SetViewDelegate; listView.Adapter = new GenericListAdapter <Invoice> (this, listData, Resource.Layout.ListItemRow, viewdlg); }
public static AdPara GetAdPara(string pathToDatabase) { AdPara info = null; using (var db = new SQLite.SQLiteConnection (pathToDatabase)) { info = db.Table<AdPara> ().FirstOrDefault (); } if (info == null) { info = new AdPara (); } if (string.IsNullOrEmpty (info.Prefix)) info.Prefix = "CS"; if (string.IsNullOrEmpty (info.PrinterName)) info.PrinterName = "PT-II"; return info; }
protected override void OnResume() { base.OnResume(); if (txtSearch.Text != "") { FindItemByText(); return; } listData = new List <Invoice> (); populate(listData); apara = DataHelper.GetAdPara(pathToDatabase); listView = FindViewById <ListView> (Resource.Id.CustList); SetViewDlg viewdlg = SetViewDelegate; listView.Adapter = new GenericListAdapter <Invoice> (this, listData, Resource.Layout.ListItemRow, viewdlg); }
public static IPrintToDevice GetPrintingDevice <T>() { string USERDEFINE = ((GlobalvarsApp)Application.Context).USERFUNCTION; string pathToDatabase = ((GlobalvarsApp)Application.Context).DATABASE_PATH; IPrintToDevice intent = null; AdPara para = DataHelper.GetAdPara(pathToDatabase); if (para.PrinterType == "Network POS Printer") { intent = GetPrintingDeviceEx <TCPDeviceHelper> (); } else { intent = GetPrintingDeviceEx <T> (); } return(intent); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish(); } SetTitle(Resource.String.submenu_invlist); EventManagerFacade.Instance.GetEventManager().AddListener(this); // Create your application here SetContentView(Resource.Layout.ListCustView); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; rights = Utility.GetAccessRights(pathToDatabase); TRXTYPE = Intent.GetStringExtra("trxtype") ?? "CASH"; Utility.GetDateRange(ref sdate, ref edate); populate(listData); apara = DataHelper.GetAdPara(pathToDatabase); //listView = FindViewById<ListView> (Resource.Id.feedList); //CustList listView = FindViewById <ListView> (Resource.Id.CustList); //CustList // TableLayout tlay = FindViewById<TableLayout> (Resource.Id.tableLayout1); // tlay.Visibility = ViewStates.Invisible; //Button butNew= FindViewById<Button> (Resource.Id.butnewInv); //butNew.Visibility = ViewStates.Invisible; txtSearch = FindViewById <EditText> (Resource.Id.txtSearch); //Button butInvBack= FindViewById<Button> (Resource.Id.butInvBack); Button butInvBack = FindViewById <Button> (Resource.Id.butCustBack); butInvBack.Click += (object sender, EventArgs e) => { StartActivity(typeof(TransListActivity)); }; listView.ItemClick += OnListItemClick; listView.ItemLongClick += OnListItemLongClick; //listView.Adapter = new CusotmListAdapter(this, listData); SetViewDlg viewdlg = SetViewDelegate; listView.Adapter = new GenericListAdapter <Invoice> (this, listData, Resource.Layout.ListItemRow, viewdlg); txtSearch.TextChanged += TxtSearch_TextChanged; }
public static AdPara GetAdPara(string pathToDatabase) { AdPara info = null; using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { info = db.Table <AdPara> ().FirstOrDefault(); } if (info == null) { info = new AdPara(); } if (string.IsNullOrEmpty(info.Prefix)) { info.Prefix = "CS"; } if (string.IsNullOrEmpty(info.PrinterName)) { info.PrinterName = "PT-II"; } return(info); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish(); } SetTitle(Resource.String.title_invoice); // Create your application here SetContentView(Resource.Layout.ListView); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; COMPCODE = ((GlobalvarsApp)this.Application).COMPANY_CODE; rights = Utility.GetAccessRights(pathToDatabase); populate(listData); apara = DataHelper.GetAdPara(pathToDatabase); listView = FindViewById <ListView> (Resource.Id.feedList); Button butNew = FindViewById <Button> (Resource.Id.butnewInv); butNew.Visibility = ViewStates.Gone; //butNew.Click += butCreateNewInv; Button butInvBack = FindViewById <Button> (Resource.Id.butInvBack); butInvBack.Click += (object sender, EventArgs e) => { StartActivity(typeof(InvoiceActivityEx)); }; //if (!rights.InvAllowAdd) // butNew.Enabled = false; listView.ItemClick += OnListItemLongClick; //OnListItemClick; listView.ItemLongClick += ListView_ItemLongClick; //listView.Adapter = new CusotmListAdapter(this, listData); SetViewDlg viewdlg = SetViewDelegate; listView.Adapter = new GenericListAdapter <Invoice> (this, listData, Resource.Layout.ListItemRow, viewdlg); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish(); } SetTitle(Resource.String.title_creditnoteedit); SetContentView(Resource.Layout.CreateCNote); EventManagerFacade.Instance.GetEventManager().AddListener(this); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; CNNO = Intent.GetStringExtra("cnno") ?? "AUTO"; cnInfo = DataHelper.GetCNNote(pathToDatabase, CNNO); // Create your application here _date = DateTime.Today; spinner = FindViewById <Spinner> (Resource.Id.newinv_custcode); Button butSave = FindViewById <Button> (Resource.Id.newinv_bsave); butSave.Text = "SAVE"; Button butCancel = FindViewById <Button> (Resource.Id.newinv_cancel); Button butFind = FindViewById <Button> (Resource.Id.newinv_bfind); Button butFindInv = FindViewById <Button> (Resource.Id.newinv_bfindinv); spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); butSave.Click += butSaveClick; butCancel.Click += butCancelClick; TextView cnno = FindViewById <TextView> (Resource.Id.newinv_no); cnno.Enabled = false; EditText trxdate = FindViewById <EditText> (Resource.Id.newinv_date); // trxdate.Click += delegate(object sender, EventArgs e) { // ShowDialog (0); // }; //19-Nov-2015 //disable the date, for edit mode, date should not be editable //cuase running number issue. trxdate.Enabled = false; butFind.Click += (object sender, EventArgs e) => { ShowCustLookUp(); }; butFindInv.Click += (object sender, EventArgs e) => { ShowInvLookUp(); }; apara = DataHelper.GetAdPara(pathToDatabase); //SqliteConnection.CreateFile(pathToDatabase); using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { items = db.Table <Trader> ().ToList <Trader> (); } List <string> icodes = new List <string> (); foreach (Trader item in items) { icodes.Add(item.CustCode + " | " + item.CustName.Trim()); } dataAdapter = new ArrayAdapter <String>(this, Resource.Layout.spinner_item, icodes); // Drop down layout style - list view with radio button //dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); dataAdapter.SetDropDownViewResource(Resource.Layout.SimpleSpinnerDropDownItemEx); // attaching data adapter to spinner spinner.Adapter = dataAdapter; LoadData(); }
public BlueToothDeviceHelper() { pathToDatabase = ((GlobalvarsApp)Application.Context).DATABASE_PATH; apara = DataHelper.GetAdPara (pathToDatabase); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } SetTitle (Resource.String.title_creditnoteedit); SetContentView (Resource.Layout.CreateCNote); EventManagerFacade.Instance.GetEventManager().AddListener(this); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; CNNO = Intent.GetStringExtra ("cnno") ?? "AUTO"; cnInfo =DataHelper.GetCNNote (pathToDatabase, CNNO); // Create your application here _date = DateTime.Today; spinner = FindViewById<Spinner> (Resource.Id.newinv_custcode); Button butSave = FindViewById<Button> (Resource.Id.newinv_bsave); butSave.Text = "SAVE"; Button butCancel = FindViewById<Button> (Resource.Id.newinv_cancel); Button butFind = FindViewById<Button> (Resource.Id.newinv_bfind); Button butFindInv = FindViewById<Button> (Resource.Id.newinv_bfindinv); spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); butSave.Click += butSaveClick; butCancel.Click += butCancelClick; TextView cnno = FindViewById<TextView> (Resource.Id.newinv_no); cnno.Enabled = false; EditText trxdate = FindViewById<EditText> (Resource.Id.newinv_date); // trxdate.Click += delegate(object sender, EventArgs e) { // ShowDialog (0); // }; //19-Nov-2015 //disable the date, for edit mode, date should not be editable //cuase running number issue. trxdate.Enabled = false; butFind.Click+= (object sender, EventArgs e) => { ShowCustLookUp(); }; butFindInv.Click+= (object sender, EventArgs e) => { ShowInvLookUp(); }; apara = DataHelper.GetAdPara (pathToDatabase); //SqliteConnection.CreateFile(pathToDatabase); using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { items = db.Table<Trader> ().ToList<Trader> (); } List<string> icodes = new List<string> (); foreach (Trader item in items) { icodes.Add (item.CustCode+" | "+item.CustName.Trim()); } dataAdapter = new ArrayAdapter<String>(this,Resource.Layout.spinner_item, icodes); // Drop down layout style - list view with radio button //dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); dataAdapter.SetDropDownViewResource(Resource.Layout.SimpleSpinnerDropDownItemEx); // attaching data adapter to spinner spinner.Adapter =dataAdapter; LoadData (); }
private void LoadData() { TextView txtprinter =FindViewById<TextView> (Resource.Id.txtad_printer); TextView txtprefix =FindViewById<TextView> (Resource.Id.txtad_prefix); TextView txtcnprefix =FindViewById<TextView> (Resource.Id.txtad_cnprefix); TextView txttitle =FindViewById<TextView> (Resource.Id.txtad_title); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; AdPara apra = new AdPara (); using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { var list = db.Table<AdPara> ().ToList<AdPara> (); if (list.Count > 0) { apra = list [0]; txtprefix.Text = apra.Prefix; txtprinter.Text = apra.PrinterName; txttitle.Text = apra.ReceiptTitle; txtcnprefix.Text = apra.CNPrefix; int prnpos = adapterBT.GetPosition (apra.PrinterName); if (prnpos>0) spinBt.SetSelection (prnpos); int position=adapter.GetPosition (apra.PaperSize); if (position>0) spinner.SetSelection (position); else spinner.SetSelection (0); } else { txtprefix.Text = "CS"; txtprinter.Text = "PT-II"; txttitle.Text = "TAX INVOICE"; } } }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } SetContentView (Resource.Layout.CreateCNote); EventManagerFacade.Instance.GetEventManager().AddListener(this); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; compCode = ((GlobalvarsApp)this.Application).COMPANY_CODE; branchCode = ((GlobalvarsApp)this.Application).BRANCH_CODE; // Create your application here _date = DateTime.Today; spinner = FindViewById<Spinner> (Resource.Id.newinv_custcode); Button butSave = FindViewById<Button> (Resource.Id.newinv_bsave); Button butNew = FindViewById<Button> (Resource.Id.newinv_cancel); Button butFind = FindViewById<Button> (Resource.Id.newinv_bfind); Button butFindInv = FindViewById<Button> (Resource.Id.newinv_bfindinv); spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); butSave.Click += butSaveClick; butNew.Click += butCancelClick; TextView cnno = FindViewById<TextView> (Resource.Id.newinv_no); cnno.Text = "AUTO"; EditText trxdate = FindViewById<EditText> (Resource.Id.newinv_date); trxdate.Text = _date.ToString ("dd-MM-yyyy"); trxdate.Click += delegate(object sender, EventArgs e) { ShowDialog (0); }; butFind.Click+= (object sender, EventArgs e) => { ShowCustLookUp(); }; butFindInv.Click+= (object sender, EventArgs e) => { ShowInvLookUp(); }; apara = DataHelper.GetAdPara (pathToDatabase,compCode,branchCode); //SqliteConnection.CreateFile(pathToDatabase); using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { items = db.Table<Trader> ().Where(x=>x.CompCode==compCode&&x.BranchCode==branchCode).ToList<Trader> (); } List<string> icodes = new List<string> (); foreach (Trader item in items) { icodes.Add (item.CustCode+" | "+item.CustName); } dataAdapter = new ArrayAdapter<String>(this,Resource.Layout.spinner_item, icodes); // Drop down layout style - list view with radio button dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); // attaching data adapter to spinner spinner.Adapter =dataAdapter; }
private void LoadData() { TextView txtprinter =FindViewById<TextView> (Resource.Id.txtad_printer); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; AdPara apra = new AdPara (); using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { var list = db.Table<AdPara> ().ToList<AdPara> (); if (list.Count > 0) { apra = list [0]; string[] prefixs = apra.Prefix.Split (new char[]{ '|' }); txtInvPrefix.Text = prefixs[0]; if (prefixs.Length>1) txtCashPrefix.Text = prefixs [1]; else txtCashPrefix.Text = prefixs [0]; if (rights.IsSOModule) { txtSOPrefix.Text = apra.SOPrefix; } if (rights.IsCNModule) { txtCNPrefix.Text = apra.CNPrefix; } if (rights.IsDOModule) { txtDOPrefix.Text = apra.DOPrefix; } txtprinter.Text = apra.PrinterName; int ptypepos = adapterPT.GetPosition (apra.PrinterType); //to store printer type spinPrType.SetSelection(ptypepos); txtPrinterIP.Text = (string.IsNullOrEmpty(apra.PrinterIP))?"192.168.1.244":apra.PrinterIP; int prnpos = adapterBT.GetPosition (apra.PrinterName); if (prnpos>0) spinBt.SetSelection (prnpos); int position=adapter.GetPosition (apra.PaperSize); if (position>0) spinner.SetSelection (position); else spinner.SetSelection (0); } else { txtprinter.Text = "PT-II"; txtPrinterIP.Text = "192.168.1.244"; } } }
protected override void OnResume() { base.OnResume(); if (txtSearch.Text != "") { FindItemByText (); return; } listData = new List<Invoice> (); populate (listData); apara = DataHelper.GetAdPara (pathToDatabase); listView = FindViewById<ListView> (Resource.Id.CustList); SetViewDlg viewdlg = SetViewDelegate; listView.Adapter = new GenericListAdapter<Invoice> (this, listData, Resource.Layout.ListItemRow, viewdlg); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } SetTitle (Resource.String.title_donew); SetContentView (Resource.Layout.CreateDO); EventManagerFacade.Instance.GetEventManager().AddListener(this); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; compcode = ((GlobalvarsApp)this.Application).COMPANY_CODE; apara = DataHelper.GetAdPara (pathToDatabase); rights = Utility.GetAccessRights (pathToDatabase); // Create your application here _date = DateTime.Today; spinner = FindViewById<Spinner> (Resource.Id.newinv_custcode); Spinner spinnerType = FindViewById<Spinner> (Resource.Id.newinv_type); Button butSave = FindViewById<Button> (Resource.Id.newinv_bsave); Button butNew = FindViewById<Button> (Resource.Id.newinv_cancel); Button butFind = FindViewById<Button> (Resource.Id.newinv_bfind); EditText remark = FindViewById<EditText> (Resource.Id.newinv_custname); spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); butSave.Click += butSaveClick; butNew.Click += butCancelClick; TextView invno = FindViewById<TextView> (Resource.Id.newinv_no); invno.Text = "AUTO"; EditText trxdate = FindViewById<EditText> (Resource.Id.newinv_date); trxdate.Text = _date.ToString ("dd-MM-yyyy"); // trxdate.Click += delegate(object sender, EventArgs e) { // ShowDialog (0); // }; if (rights.DOEditTrxDate) { trxdate.Click += delegate(object sender, EventArgs e) { ShowDialog (0); }; } else trxdate.Enabled = false; butFind.Click+= (object sender, EventArgs e) => { ShowCustLookUp(); }; //SqliteConnection.CreateFile(pathToDatabase); using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { items = db.Table<Trader> ().ToList<Trader> (); } List<string> icodes = new List<string> (); foreach (Trader item in items) { icodes.Add (item.CustCode+" | "+item.CustName); } dataAdapter2 =ArrayAdapter.CreateFromResource ( this, Resource.Array.term, Resource.Layout.spinner_item); dataAdapter = new ArrayAdapter<String> (this, Resource.Layout.spinner_item, icodes); dataAdapter.SetDropDownViewResource(Resource.Layout.SimpleSpinnerDropDownItemEx); dataAdapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner.Adapter =dataAdapter; spinnerType.Adapter =dataAdapter2; remark.RequestFocus (); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } INVOICENO= Intent.GetStringExtra ("invoiceno")??"AUTO"; TRXTYPE= Intent.GetStringExtra ("trxtype") ?? "CASH"; if (TRXTYPE == "CASH") { SetTitle (Resource.String.title_cashedit); } else { SetTitle (Resource.String.title_invoiceedit); } SetContentView (Resource.Layout.CreateInvoice); EventManagerFacade.Instance.GetEventManager().AddListener(this); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; rights = Utility.GetAccessRights (pathToDatabase); invInfo =DataHelper.GetInvoice (pathToDatabase, INVOICENO); if (invInfo == null) { base.OnBackPressed (); } // Create your application here spinner = FindViewById<Spinner> (Resource.Id.newinv_custcode); spinnerType = FindViewById<Spinner> (Resource.Id.newinv_type); Button butSave = FindViewById<Button> (Resource.Id.newinv_bsave); butSave.Text = Resources.GetString(Resource.String.but_save);// "SAVE"; Button butCancel = FindViewById<Button> (Resource.Id.newinv_cancel); Button butFind = FindViewById<Button> (Resource.Id.newinv_bfind); spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); butSave.Click += butSaveClick; butCancel.Click += butCancelClick; spinnerType.Enabled = false; EditText trxdate = FindViewById<EditText> (Resource.Id.newinv_date); // trxdate.Click += delegate(object sender, EventArgs e) { // ShowDialog (0); // }; //19-Nov-2015 //disable the date, for edit mode, date should not be editable //cuase running number issue. trxdate.Enabled = false; butFind.Click+= (object sender, EventArgs e) => { ShowCustLookUp(); }; apara = DataHelper.GetAdPara (pathToDatabase); LoadTrader (); List<string> icodes = new List<string> (); int counter = 0; foreach (Trader item in custs) { icodes.Add (item.CustCode+" | "+item.CustName.Trim()); if (item.CustCode.Trim() == "COD" || item.CustCode.Trim() == "CASH") { CashPos = counter; } counter += 1; } dataAdapter = new ArrayAdapter<String> (this, Resource.Layout.spinner_item, icodes); dataAdapter2 =ArrayAdapter.CreateFromResource ( this, Resource.Array.trxtype, Resource.Layout.spinner_item); //dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); dataAdapter.SetDropDownViewResource(Resource.Layout.SimpleSpinnerDropDownItemEx); dataAdapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); // attaching data adapter to spinner spinner.Adapter =dataAdapter; spinnerType.Adapter =dataAdapter2; LoadData (); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish(); } INVOICENO = Intent.GetStringExtra("invoiceno") ?? "AUTO"; TRXTYPE = Intent.GetStringExtra("trxtype") ?? "CASH"; if (TRXTYPE == "CASH") { SetTitle(Resource.String.title_cashedit); } else { SetTitle(Resource.String.title_invoiceedit); } SetContentView(Resource.Layout.CreateInvoice); EventManagerFacade.Instance.GetEventManager().AddListener(this); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; rights = Utility.GetAccessRights(pathToDatabase); invInfo = DataHelper.GetInvoice(pathToDatabase, INVOICENO); if (invInfo == null) { base.OnBackPressed(); } // Create your application here spinner = FindViewById <Spinner> (Resource.Id.newinv_custcode); spinnerType = FindViewById <Spinner> (Resource.Id.newinv_type); Button butSave = FindViewById <Button> (Resource.Id.newinv_bsave); butSave.Text = Resources.GetString(Resource.String.but_save); // "SAVE"; Button butCancel = FindViewById <Button> (Resource.Id.newinv_cancel); Button butFind = FindViewById <Button> (Resource.Id.newinv_bfind); spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); butSave.Click += butSaveClick; butCancel.Click += butCancelClick; spinnerType.Enabled = false; EditText trxdate = FindViewById <EditText> (Resource.Id.newinv_date); // trxdate.Click += delegate(object sender, EventArgs e) { // ShowDialog (0); // }; //19-Nov-2015 //disable the date, for edit mode, date should not be editable //cuase running number issue. trxdate.Enabled = false; butFind.Click += (object sender, EventArgs e) => { ShowCustLookUp(); }; apara = DataHelper.GetAdPara(pathToDatabase); LoadTrader(); List <string> icodes = new List <string> (); int counter = 0; foreach (Trader item in custs) { icodes.Add(item.CustCode + " | " + item.CustName.Trim()); if (item.CustCode.Trim() == "COD" || item.CustCode.Trim() == "CASH") { CashPos = counter; } counter += 1; } dataAdapter = new ArrayAdapter <String> (this, Resource.Layout.spinner_item, icodes); dataAdapter2 = ArrayAdapter.CreateFromResource( this, Resource.Array.trxtype, Resource.Layout.spinner_item); //dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); dataAdapter.SetDropDownViewResource(Resource.Layout.SimpleSpinnerDropDownItemEx); dataAdapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); // attaching data adapter to spinner spinner.Adapter = dataAdapter; spinnerType.Adapter = dataAdapter2; LoadData(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish(); } SetTitle(Resource.String.title_doedit); SetContentView(Resource.Layout.CreateDO); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; EventManagerFacade.Instance.GetEventManager().AddListener(this); DONO = Intent.GetStringExtra("dono") ?? "AUTO"; doInfo = DataHelper.GetDO(pathToDatabase, DONO); if (doInfo == null) { base.OnBackPressed(); } // Create your application here _date = DateTime.Today; spinner = FindViewById <Spinner> (Resource.Id.newinv_custcode); Spinner spinnerType = FindViewById <Spinner> (Resource.Id.newinv_type); Button butSave = FindViewById <Button> (Resource.Id.newinv_bsave); Button butNew = FindViewById <Button> (Resource.Id.newinv_cancel); Button butFind = FindViewById <Button> (Resource.Id.newinv_bfind); EditText remark = FindViewById <EditText> (Resource.Id.newinv_custname); spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); butSave.Click += butSaveClick; butNew.Click += butCancelClick; TextView invno = FindViewById <TextView> (Resource.Id.newinv_no); EditText trxdate = FindViewById <EditText> (Resource.Id.newinv_date); // trxdate.Click += delegate(object sender, EventArgs e) { // ShowDialog (0); // }; //19-Nov-2015 //disable the date, for edit mode, date should not be editable //cuase running number issue. trxdate.Enabled = false; butFind.Click += (object sender, EventArgs e) => { ShowCustLookUp(); }; apara = DataHelper.GetAdPara(pathToDatabase); //SqliteConnection.CreateFile(pathToDatabase); using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { items = db.Table <Trader> ().ToList <Trader> (); } List <string> icodes = new List <string> (); foreach (Trader item in items) { icodes.Add(item.CustCode + " | " + item.CustName.Trim()); } dataAdapter2 = ArrayAdapter.CreateFromResource( this, Resource.Array.term, Resource.Layout.spinner_item); dataAdapter = new ArrayAdapter <String> (this, Resource.Layout.spinner_item, icodes); dataAdapter.SetDropDownViewResource(Resource.Layout.SimpleSpinnerDropDownItemEx); dataAdapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner.Adapter = dataAdapter; spinnerType.Adapter = dataAdapter2; remark.RequestFocus(); LoadData(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish(); } SetTitle(Resource.String.title_soedit); SetContentView(Resource.Layout.CreateSO); EventManagerFacade.Instance.GetEventManager().AddListener(this); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; SONO = Intent.GetStringExtra("sono") ?? "AUTO"; soInfo = DataHelper.GetSO(pathToDatabase, SONO); if (soInfo == null) { base.OnBackPressed(); } //rights = Utility.GetAccessRights (pathToDatabase); apara = DataHelper.GetAdPara(pathToDatabase); // Create your application here _date = DateTime.Today; spinner = FindViewById <Spinner> (Resource.Id.newinv_custcode); spinnerBill = FindViewById <Spinner> (Resource.Id.newinv_billto); Button butSave = FindViewById <Button> (Resource.Id.newinv_bsave); butSave.Text = Resources.GetString(Resource.String.but_save); // "SAVE"; Button butNew = FindViewById <Button> (Resource.Id.newinv_cancel); Button butFind = FindViewById <Button> (Resource.Id.newinv_bfind); Button butBillFind = FindViewById <Button> (Resource.Id.newinv_billfind); //spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); //spinnerBill.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); butSave.Click += butSaveClick; butNew.Click += butCancelClick; EditText trxdate = FindViewById <EditText> (Resource.Id.newinv_date); //trxdate.Text = _date.ToString ("dd-MM-yyyy"); // trxdate.Click += delegate(object sender, EventArgs e) { // ShowDialog (0); // }; //19-Nov-2015 //disable the date, for edit mode, date should not be editable //cuase running number issue. trxdate.Enabled = false; butFind.Click += (object sender, EventArgs e) => { ShowCustLookUp(); }; butBillFind.Click += (object sender, EventArgs e) => { ShowBillToLookUp(); }; //SqliteConnection.CreateFile(pathToDatabase); using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { items = db.Table <Trader> ().ToList <Trader> (); } icodes = GetCustCode(IsValidCustTo); icodes2 = GetCustCode(IsValidBillTo); dataAdapter = new ArrayAdapter <String> (this, Resource.Layout.spinner_item, icodes); dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner.Adapter = dataAdapter; dataAdapter2 = new ArrayAdapter <String> (this, Resource.Layout.spinner_item, icodes2); dataAdapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinnerBill.Adapter = dataAdapter2; LoadData(); }
public TCPDotMatrixHelper() { pathToDatabase = ((GlobalvarsApp)Application.Context).DATABASE_PATH; apara = DataHelper.GetAdPara(pathToDatabase); }
public TCPHPPCLHelper() { pathToDatabase = ((GlobalvarsApp)Application.Context).DATABASE_PATH; apara = DataHelper.GetAdPara (pathToDatabase); }
public BlueToothDeviceHelper() { pathToDatabase = ((GlobalvarsApp)Application.Context).DATABASE_PATH; apara = DataHelper.GetAdPara(pathToDatabase); }
public static void InsertCompProfIntoDb(CompanyProfile pro,string pathToDatabase) { using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { var list2 = db.Table<CompanyInfo>().ToList<CompanyInfo>(); var list3 = db.Table<AdPara>().ToList<AdPara>(); var list4 = db.Table<AdNumDate> ().Where (x => x.Year == DateTime.Now.Year && x.Month == DateTime.Now.Month).ToList<AdNumDate> (); CompanyInfo cprof = null; if (list2.Count > 0) { cprof = list2 [0]; } else { cprof = new CompanyInfo (); } cprof.Addr1 = pro.Addr1; cprof.Addr2= pro.Addr2; cprof.Addr3 = pro.Addr3; cprof.Addr4 = pro.Addr4; cprof.CompanyName = pro.CompanyName; cprof.Fax = pro.Fax; cprof.GSTNo = pro.GSTNo; cprof.HomeCurr = pro.HomeCurr; cprof.IsInclusive = pro.IsInclusive; cprof.RegNo = pro.RegNo; cprof.SalesTaxDec = pro.SalesTaxDec; cprof.AllowDelete = pro.AllowDelete; cprof.AllowEdit = pro.AllowEdit; cprof.WCFUrl = pro.WCFUrl; cprof.SupportContat = pro.SupportContat; cprof.ShowTime = pro.ShowPrintTime; cprof.AllowClrTrxHis = pro.AllowClrTrxHis; cprof.NotEditAfterPrint = pro.NoEditAfterPrint; cprof.Tel = pro.Tel; if (list2.Count==0) db.Insert (cprof); else db.Update (cprof); AdPara apara=null; if (list3.Count == 0) { apara= new AdPara (); } else { apara = list3 [0]; } apara.Prefix = pro.Prefix; apara.RunNo = pro.RunNo; apara.Warehouse = pro.WareHouse; //new added V2 apara.CNPrefix = pro.CNPrefix; apara.CNRunNo = pro.CNRunNo; apara.DOPrefix = pro.DOPrefix; apara.DORunNo = pro.DORunNo; apara.SOPrefix = pro.SOPrefix; apara.SORunNo = pro.SORunNo; if (list3.Count == 0) { apara.ReceiptTitle = "TAX INVOICE"; db.Insert (apara); } else { db.Update (apara); } AdNumDate info = null; if (list4.Count == 0) { info = new AdNumDate (); info.Year = DateTime.Now.Year; info.Month = DateTime.Now.Month; info.RunNo = pro.RunNo; info.TrxType = "INV"; db.Insert (info); } } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish(); } SetTitle(Resource.String.title_donew); SetContentView(Resource.Layout.CreateDO); EventManagerFacade.Instance.GetEventManager().AddListener(this); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; compcode = ((GlobalvarsApp)this.Application).COMPANY_CODE; apara = DataHelper.GetAdPara(pathToDatabase); rights = Utility.GetAccessRights(pathToDatabase); // Create your application here _date = DateTime.Today; spinner = FindViewById <Spinner> (Resource.Id.newinv_custcode); Spinner spinnerType = FindViewById <Spinner> (Resource.Id.newinv_type); Button butSave = FindViewById <Button> (Resource.Id.newinv_bsave); Button butNew = FindViewById <Button> (Resource.Id.newinv_cancel); Button butFind = FindViewById <Button> (Resource.Id.newinv_bfind); EditText remark = FindViewById <EditText> (Resource.Id.newinv_custname); spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); butSave.Click += butSaveClick; butNew.Click += butCancelClick; TextView invno = FindViewById <TextView> (Resource.Id.newinv_no); invno.Text = "AUTO"; EditText trxdate = FindViewById <EditText> (Resource.Id.newinv_date); trxdate.Text = _date.ToString("dd-MM-yyyy"); // trxdate.Click += delegate(object sender, EventArgs e) { // ShowDialog (0); // }; if (rights.DOEditTrxDate) { trxdate.Click += delegate(object sender, EventArgs e) { ShowDialog(0); }; } else { trxdate.Enabled = false; } butFind.Click += (object sender, EventArgs e) => { ShowCustLookUp(); }; //SqliteConnection.CreateFile(pathToDatabase); using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { items = db.Table <Trader> ().ToList <Trader> (); } List <string> icodes = new List <string> (); foreach (Trader item in items) { icodes.Add(item.CustCode + " | " + item.CustName); } dataAdapter2 = ArrayAdapter.CreateFromResource( this, Resource.Array.term, Resource.Layout.spinner_item); dataAdapter = new ArrayAdapter <String> (this, Resource.Layout.spinner_item, icodes); dataAdapter.SetDropDownViewResource(Resource.Layout.SimpleSpinnerDropDownItemEx); dataAdapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner.Adapter = dataAdapter; spinnerType.Adapter = dataAdapter2; remark.RequestFocus(); }
//StringBuilder errmsg = new StringBuilder (); public PrintInvHelper(string adpathToDatabase,string userid) { pathToDatabase = adpathToDatabase; USERID = userid; apara = DataHelper.GetAdPara (pathToDatabase); compinfo =DataHelper.GetCompany(pathToDatabase); sdcard = Path.Combine (Android.OS.Environment.ExternalStorageDirectory.Path, "erpdata\\log.txt"); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } SetTitle (Resource.String.title_soedit); SetContentView (Resource.Layout.CreateSO); EventManagerFacade.Instance.GetEventManager().AddListener(this); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; SONO = Intent.GetStringExtra ("sono") ?? "AUTO"; soInfo =DataHelper.GetSO(pathToDatabase, SONO); if (soInfo == null) { base.OnBackPressed (); } //rights = Utility.GetAccessRights (pathToDatabase); apara = DataHelper.GetAdPara (pathToDatabase); // Create your application here _date = DateTime.Today; spinner = FindViewById<Spinner> (Resource.Id.newinv_custcode); spinnerBill = FindViewById<Spinner> (Resource.Id.newinv_billto); Button butSave = FindViewById<Button> (Resource.Id.newinv_bsave); butSave.Text = Resources.GetString(Resource.String.but_save);// "SAVE"; Button butNew = FindViewById<Button> (Resource.Id.newinv_cancel); Button butFind = FindViewById<Button> (Resource.Id.newinv_bfind); Button butBillFind = FindViewById<Button> (Resource.Id.newinv_billfind); //spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); //spinnerBill.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); butSave.Click += butSaveClick; butNew.Click += butCancelClick; EditText trxdate = FindViewById<EditText> (Resource.Id.newinv_date); //trxdate.Text = _date.ToString ("dd-MM-yyyy"); // trxdate.Click += delegate(object sender, EventArgs e) { // ShowDialog (0); // }; //19-Nov-2015 //disable the date, for edit mode, date should not be editable //cuase running number issue. trxdate.Enabled = false; butFind.Click+= (object sender, EventArgs e) => { ShowCustLookUp(); }; butBillFind.Click+= (object sender, EventArgs e) => { ShowBillToLookUp(); }; //SqliteConnection.CreateFile(pathToDatabase); using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { items = db.Table<Trader> ().ToList<Trader> (); } icodes = GetCustCode (IsValidCustTo); icodes2 = GetCustCode (IsValidBillTo); dataAdapter = new ArrayAdapter<String> (this, Resource.Layout.spinner_item, icodes); dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner.Adapter =dataAdapter; dataAdapter2 = new ArrayAdapter<String> (this, Resource.Layout.spinner_item, icodes2); dataAdapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinnerBill.Adapter =dataAdapter2; LoadData (); }
void CreateNewInv() { DateTime invdate = Utility.ConvertToDate (txtInvDate.Text); DateTime tmr = invdate.AddDays (1); AdNumDate adNum;// = DataHelper.GetNumDate (pathToDatabase, invdate); apara = DataHelper.GetAdPara (pathToDatabase); string[] prefixs = apara.Prefix.Trim ().ToUpper ().Split(new char[]{'|'}); string prefix = ""; adNum = DataHelper.GetNumDate (pathToDatabase, invdate, "INV"); if (prefixs.Length > 1) { prefix = prefixs [0]; }else prefix = prefixs [0]; invno = ""; int runno = adNum.RunNo + 1; int currentRunNo =DataHelper.GetLastInvRunNo (pathToDatabase, invdate,"INVOICE"); if (currentRunNo >= runno) runno = currentRunNo + 1; invno =prefix + invdate.ToString("yyMM") + runno.ToString().PadLeft (4, '0'); using (var db = new SQLite.SQLiteConnection (pathToDatabase)) { inv = new Invoice (); inv.invno= invno; inv.invdate = invdate; inv.trxtype = "INVOICE"; inv.created = DateTime.Now; inv.amount = 0; inv.isUploaded = false; inv.remark =""; db.Insert (inv); adNum.RunNo = runno; if (adNum.ID >= 0) db.Update (adNum); else db.Insert (adNum); } txtInvNo.Text = inv.invno; txtInvDate.Text = inv.invdate.ToString ("dd-MM-yyyy"); txtInvMode.Text = "NEW"; IsSave = false; IsFirePaid = false; IsFirePaidOnly = false; EnableControLs (true, true, false, true, false); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } SetContentView (Resource.Layout.CreateDO); EventManagerFacade.Instance.GetEventManager().AddListener(this); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; compCode = ((GlobalvarsApp)this.Application).COMPANY_CODE; branchCode = ((GlobalvarsApp)this.Application).BRANCH_CODE; DONO = Intent.GetStringExtra ("dono") ?? "AUTO"; doInfo =DataHelper.GetDelOrder (pathToDatabase, DONO, compCode, branchCode); if (doInfo == null) { base.OnBackPressed (); } // Create your application here _date = DateTime.Today; spinner = FindViewById<Spinner> (Resource.Id.newinv_custcode); Button butSave = FindViewById<Button> (Resource.Id.newinv_bsave); Button butCancel = FindViewById<Button> (Resource.Id.newinv_cancel); Button butFind = FindViewById<Button> (Resource.Id.newinv_bfind); butSave.Text = "SAVE"; spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); butSave.Click += butSaveClick; butCancel.Click += butCancelClick; TextView invno = FindViewById<TextView> (Resource.Id.newinv_no); invno.Enabled = false; EditText trxdate = FindViewById<EditText> (Resource.Id.newinv_date); trxdate.Click += delegate(object sender, EventArgs e) { ShowDialog (0); }; butFind.Click+= (object sender, EventArgs e) => { ShowCustLookUp(); }; apara = DataHelper.GetAdPara (pathToDatabase,compCode,branchCode); //SqliteConnection.CreateFile(pathToDatabase); using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { items = db.Table<Trader> ().Where(x=>x.CompCode==compCode&&x.BranchCode==branchCode).ToList<Trader> (); } List<string> icodes = new List<string> (); foreach (Trader item in items) { icodes.Add (item.CustCode+" | "+item.CustName); } dataAdapter = new ArrayAdapter<String> (this, Resource.Layout.spinner_item, icodes); dataAdapter.SetDropDownViewResource(Resource.Layout.SimpleSpinnerDropDownItemEx); spinner.Adapter =dataAdapter; LoadData (); }
private void LoadData() { TextView txtprinter = FindViewById <TextView> (Resource.Id.txtad_printer); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; AdPara apra = new AdPara(); using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { var list = db.Table <AdPara> ().ToList <AdPara> (); if (list.Count > 0) { apra = list [0]; string[] prefixs = apra.Prefix.Split(new char[] { '|' }); txtInvPrefix.Text = prefixs[0]; if (prefixs.Length > 1) { txtCashPrefix.Text = prefixs [1]; } else { txtCashPrefix.Text = prefixs [0]; } if (rights.IsSOModule) { txtSOPrefix.Text = apra.SOPrefix; } if (rights.IsCNModule) { txtCNPrefix.Text = apra.CNPrefix; } if (rights.IsDOModule) { txtDOPrefix.Text = apra.DOPrefix; } txtprinter.Text = apra.PrinterName; int ptypepos = adapterPT.GetPosition(apra.PrinterType); //to store printer type spinPrType.SetSelection(ptypepos); txtPrinterIP.Text = (string.IsNullOrEmpty(apra.PrinterIP))?"192.168.1.244":apra.PrinterIP; int prnpos = adapterBT.GetPosition(apra.PrinterName); if (prnpos > 0) { spinBt.SetSelection(prnpos); } int position = adapter.GetPosition(apra.PaperSize); if (position > 0) { spinner.SetSelection(position); } else { spinner.SetSelection(0); } } else { txtprinter.Text = "PT-II"; txtPrinterIP.Text = "192.168.1.244"; } } }
//AccessRights rights; protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish(); } SetTitle(Resource.String.title_sonew); SetContentView(Resource.Layout.CreateSO); EventManagerFacade.Instance.GetEventManager().AddListener(this); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; //rights = Utility.GetAccessRights (pathToDatabase); apara = DataHelper.GetAdPara(pathToDatabase); // Create your application here _date = DateTime.Today; spinner = FindViewById <Spinner> (Resource.Id.newinv_custcode); spinnerBill = FindViewById <Spinner> (Resource.Id.newinv_billto); TextView lbBillto = FindViewById <TextView> (Resource.Id.lbbillto); lbBillto.Text = "PAY FROM"; Button butSave = FindViewById <Button> (Resource.Id.newinv_bsave); Button butNew = FindViewById <Button> (Resource.Id.newinv_cancel); Button butFind = FindViewById <Button> (Resource.Id.newinv_bfind); Button butBillFind = FindViewById <Button> (Resource.Id.newinv_billfind); //spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); //spinnerBill.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); butSave.Click += butSaveClick; butNew.Click += butCancelClick; TextView invno = FindViewById <TextView> (Resource.Id.newinv_no); invno.Text = "AUTO"; EditText trxdate = FindViewById <EditText> (Resource.Id.newinv_date); trxdate.Text = _date.ToString("dd-MM-yyyy"); trxdate.Click += delegate(object sender, EventArgs e) { ShowDialog(0); }; butFind.Click += (object sender, EventArgs e) => { ShowCustLookUp(); }; butBillFind.Click += (object sender, EventArgs e) => { ShowBillToLookUp(); }; //SqliteConnection.CreateFile(pathToDatabase); using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { items = db.Table <Trader> ().ToList <Trader> (); } var icodes = GetCustCode(IsValidCustTo); var icodes2 = GetCustCode(IsValidBillTo); dataAdapter = new ArrayAdapter <String> (this, Resource.Layout.spinner_item, icodes); dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner.Adapter = dataAdapter; dataAdapter2 = new ArrayAdapter <String> (this, Resource.Layout.spinner_item, icodes2); dataAdapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinnerBill.Adapter = dataAdapter2; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } SetContentView (Resource.Layout.CreateInvoice); EventManagerFacade.Instance.GetEventManager().AddListener(this); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; compCode = ((GlobalvarsApp)this.Application).COMPANY_CODE; branchCode = ((GlobalvarsApp)this.Application).BRANCH_CODE; INVOICENO = Intent.GetStringExtra ("invoiceno") ?? "AUTO"; invInfo =DataHelper.GetInvoice (pathToDatabase, INVOICENO, compCode, branchCode); if (invInfo == null) { base.OnBackPressed (); } // Create your application here spinner = FindViewById<Spinner> (Resource.Id.newinv_custcode); Spinner spinnerType = FindViewById<Spinner> (Resource.Id.newinv_type); Button butSave = FindViewById<Button> (Resource.Id.newinv_bsave); butSave.Text = "SAVE"; Button butCancel = FindViewById<Button> (Resource.Id.newinv_cancel); Button butFind = FindViewById<Button> (Resource.Id.newinv_bfind); spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); butSave.Click += butSaveClick; butCancel.Click += butCancelClick; EditText trxdate = FindViewById<EditText> (Resource.Id.newinv_date); trxdate.Click += delegate(object sender, EventArgs e) { ShowDialog (0); }; butFind.Click+= (object sender, EventArgs e) => { ShowCustLookUp(); }; ccType = FindViewById<EditText> (Resource.Id.newinv_cctype); ccNo = FindViewById<EditText> (Resource.Id.newinv_ccno); ccNo.AfterTextChanged+= CcNo_AfterTextChanged; apara = DataHelper.GetAdPara (pathToDatabase,compCode,branchCode); LoadTrader (); List<string> icodes = new List<string> (); foreach (Trader item in custs) { icodes.Add (item.CustCode+" | "+item.CustName); } dataAdapter = new ArrayAdapter<String> (this, Resource.Layout.spinner_item, icodes); dataAdapter2 =ArrayAdapter.CreateFromResource ( this, Resource.Array.trxtype, Resource.Layout.spinner_item); // Drop down layout style - list view with radio button dataAdapter.SetDropDownViewResource(Resource.Layout.SimpleSpinnerDropDownItemEx); dataAdapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); // attaching data adapter to spinner spinner.Adapter =dataAdapter; spinnerType.Adapter =dataAdapter2; LoadData (); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); if (!((GlobalvarsApp)this.Application).ISLOGON) { Finish (); } SetTitle (Resource.String.title_doedit); SetContentView (Resource.Layout.CreateDO); pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH; EventManagerFacade.Instance.GetEventManager().AddListener(this); DONO = Intent.GetStringExtra ("dono") ?? "AUTO"; doInfo =DataHelper.GetDO (pathToDatabase, DONO); if (doInfo == null) { base.OnBackPressed (); } // Create your application here _date = DateTime.Today; spinner = FindViewById<Spinner> (Resource.Id.newinv_custcode); Spinner spinnerType = FindViewById<Spinner> (Resource.Id.newinv_type); Button butSave = FindViewById<Button> (Resource.Id.newinv_bsave); Button butNew = FindViewById<Button> (Resource.Id.newinv_cancel); Button butFind = FindViewById<Button> (Resource.Id.newinv_bfind); EditText remark = FindViewById<EditText> (Resource.Id.newinv_custname); spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected); butSave.Click += butSaveClick; butNew.Click += butCancelClick; TextView invno = FindViewById<TextView> (Resource.Id.newinv_no); EditText trxdate = FindViewById<EditText> (Resource.Id.newinv_date); // trxdate.Click += delegate(object sender, EventArgs e) { // ShowDialog (0); // }; //19-Nov-2015 //disable the date, for edit mode, date should not be editable //cuase running number issue. trxdate.Enabled = false; butFind.Click+= (object sender, EventArgs e) => { ShowCustLookUp(); }; apara = DataHelper.GetAdPara (pathToDatabase); //SqliteConnection.CreateFile(pathToDatabase); using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { items = db.Table<Trader> ().ToList<Trader> (); } List<string> icodes = new List<string> (); foreach (Trader item in items) { icodes.Add (item.CustCode+" | "+item.CustName.Trim()); } dataAdapter2 =ArrayAdapter.CreateFromResource ( this, Resource.Array.term, Resource.Layout.spinner_item); dataAdapter = new ArrayAdapter<String> (this, Resource.Layout.spinner_item, icodes); dataAdapter.SetDropDownViewResource(Resource.Layout.SimpleSpinnerDropDownItemEx); dataAdapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner.Adapter =dataAdapter; spinnerType.Adapter =dataAdapter2; remark.RequestFocus (); LoadData (); }
public static AccessRights InsertCompProfIntoDb(CompanyProfile pro, string pathToDatabase) { AccessRights rights; if (pro.CompanyName == "SUSPENDED") { PerformSuspenedAction(pathToDatabase); } using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { var list2 = db.Table <CompanyInfo>().ToList <CompanyInfo>(); var list3 = db.Table <AdPara>().ToList <AdPara>(); var list4 = db.Table <AdNumDate> ().Where(x => x.Year == DateTime.Now.Year && x.Month == DateTime.Now.Month).ToList <AdNumDate> (); CompanyInfo cprof = null; if (list2.Count > 0) { cprof = list2 [0]; } else { cprof = new CompanyInfo(); } rights = Utility.GetAccessRightsByString(pro.WCFUrl); cprof.Addr1 = pro.Addr1; cprof.Addr2 = pro.Addr2; cprof.Addr3 = pro.Addr3; cprof.Addr4 = pro.Addr4; cprof.CompanyName = pro.CompanyName; cprof.Fax = pro.Fax; cprof.GSTNo = pro.GSTNo; cprof.HomeCurr = pro.HomeCurr; cprof.IsInclusive = pro.IsInclusive; cprof.RegNo = pro.RegNo; cprof.SalesTaxDec = pro.SalesTaxDec; cprof.AllowDelete = pro.AllowDelete; cprof.AllowEdit = pro.AllowEdit; cprof.WCFUrl = pro.WCFUrl; cprof.SupportContat = pro.SupportContat; cprof.ShowTime = rights.IsShowPrintTime; cprof.AllowClrTrxHis = pro.AllowClrTrxHis; cprof.NotEditAfterPrint = pro.NoEditAfterPrint; cprof.Tel = pro.Tel; if (list2.Count == 0) { db.Insert(cprof); } else { db.Update(cprof); } AdPara apara = null; if (list3.Count == 0) { apara = new AdPara(); } else { apara = list3 [0]; } apara.Prefix = pro.Prefix; apara.RunNo = pro.RunNo; apara.Warehouse = pro.WareHouse; //new added V2 apara.CNPrefix = pro.CNPrefix; apara.CNRunNo = pro.CNRunNo; apara.DOPrefix = pro.DOPrefix; apara.DORunNo = pro.DORunNo; apara.SOPrefix = pro.SOPrefix; apara.SORunNo = pro.SORunNo; apara.FooterNote = pro.InvTitle; if (list3.Count == 0) { apara.ReceiptTitle = "TAX INVOICE"; db.Insert(apara); } else { db.Update(apara); } AdNumDate info = null; if (list4.Count == 0) { info = new AdNumDate(); info.Year = DateTime.Now.Year; info.Month = DateTime.Now.Month; info.RunNo = pro.RunNo; info.TrxType = "INV"; db.Insert(info); } } return(rights); }