当前位置: 首页>>代码示例>>C#>>正文


C# SQLite.SQLiteConnection.Update方法代码示例

本文整理汇总了C#中SQLite.SQLiteConnection.Update方法的典型用法代码示例。如果您正苦于以下问题:C# SQLite.SQLiteConnection.Update方法的具体用法?C# SQLite.SQLiteConnection.Update怎么用?C# SQLite.SQLiteConnection.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SQLite.SQLiteConnection的用法示例。


在下文中一共展示了SQLite.SQLiteConnection.Update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Update

 private void Update(Source model)
 {
     using (var db = new SQLite.SQLiteConnection(Settings.DatabasePath))
     {
         db.Update(model);
     }
 }
开发者ID:ktei,项目名称:JsonResxEditor,代码行数:7,代码来源:SourceService.cs

示例2: update

        public void update(string name,string address)
        {          
            using (var db = new SQLite.SQLiteConnection(app.dbPath))
            {
                try
                {//db.Execute("update meterbox set currentUnits = currentUnits -" + used);
                    var existing = db.Query<Job>("select * from Job").First();

                    if (existing != null)
                    {
                        existing.name = name;
                        existing.address = address;
                        db.RunInTransaction(() =>
                        {
                            db.Update(existing);
                        });
                    }
                }

                catch (Exception e)
                {

                }
            }
        }
开发者ID:Ranzu,项目名称:Voluteers-App,代码行数:25,代码来源:JobViewModel.cs

示例3: butSaveClick

 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();
 }
开发者ID:mokth,项目名称:merpV2Production,代码行数:25,代码来源:SettingActivity.cs

示例4: UpdateInvoiceAmount

 public void UpdateInvoiceAmount(string invno)
 {
     using (var db = new SQLite.SQLiteConnection (pathToDatabase)) {
         var itemlist = db.Table<InvoiceDtls> ().Where (x => x.invno == invno);
         double ttlamt= itemlist.Sum (x => x.netamount);
         double ttltax= itemlist.Sum (x => x.tax);
         var invlist =db.Table<Invoice> ().Where (x => x.invno == invno).ToList<Invoice> ();
         if (invlist.Count > 0) {
             invlist [0].amount = ttlamt;
             invlist [0].taxamt = ttltax;
             db.Update (invlist [0]);
         }
     }
 }
开发者ID:mokth,项目名称:merpCS,代码行数:14,代码来源:InvItemActivity.cs

示例5: addMeterBox

            public void addMeterBox(string meterBoxNumber, double current)
            {
                
                string result = string.Empty;
                using (var db = new SQLite.SQLiteConnection(app.DBPath))
                    try
                    {
                        db.CreateTable<MeterBox>();
                        int success1 = db.Insert(new MeterBox()
                        {
                            ID = 0,
                            meterBoxNumber = meterBoxNumber,
                            currentUnits = current
                        });
                        var existing = db.Query<MeterBox>("select * from MeterBox").First();
                        if (existing == null)
                        {
                                int success = db.Insert(new MeterBox()
                            {
                                ID = 0,
                                meterBoxNumber = meterBoxNumber,
                                currentUnits = current
                            });
                        }
                        else if(existing != null)
                        {
                            existing.meterBoxNumber = meterBoxNumber;
                            existing.currentUnits = current;
                            db.RunInTransaction(() =>
                            {
                                db.Update(existing);
                            });
                        }
                  
                    }
                    catch (Exception e)
                    {

                    }
                //return "Success";
            }
开发者ID:sovenga,项目名称:ElectricityApp1,代码行数:41,代码来源:MeterViewModel.cs

示例6: AddBarCodeItem

        private void AddBarCodeItem(Item prd )
        {
            //TextView txtInvNo =  FindViewById<TextView> (Resource.Id.txtInvno);
            double stqQty = 1;
            double uprice= Utility.GetUnitPrice (trd, prd);
            double taxval = prd.tax;
            double amount = Math.Round((stqQty * uprice),2);
            double netamount = amount;
            bool taxinclusice = prd.isincludesive;
            double taxamt = 0;
            if (taxinclusice) {
                double percent = (taxval/100) + 1;
                double amt2 =Math.Round( amount / percent,2,MidpointRounding.AwayFromZero);
                taxamt = amount - amt2;
                netamount = amount - taxamt;

            } else {
                taxamt = Math.Round(amount * (taxval / 100),2,MidpointRounding.AwayFromZero);
            }

            InvoiceDtls invdtls = new InvoiceDtls ();
            invdtls.invno = inv.invno;
            invdtls.amount = amount;
            invdtls.icode = prd.ICode;
            invdtls.price = uprice;
            invdtls.qty = stqQty;
            invdtls.tax = taxamt;
            invdtls.taxgrp = prd.taxgrp;
            invdtls.netamount = netamount;
            invdtls.description = prd.IDesc;
            //int id = Convert.ToInt32 (ITEMUID);
            //inv..title = spinner.SelectedItem.ToString ();
            using (var db = new SQLite.SQLiteConnection (pathToDatabase)) {
                var list =db.Table<InvoiceDtls> ().Where (x => x.invno == inv.invno && x.icode == prd.ICode).ToList ();
                if (list.Count > 0) {
                    list [0].qty = list [0].qty + 1;
                    stqQty = list [0].qty;
                    amount = Math.Round((stqQty * uprice),2);
                    netamount = amount;
                    if (taxinclusice) {
                        double percent = (taxval/100) + 1;
                        double amt2 =Math.Round( amount / percent,2,MidpointRounding.AwayFromZero);
                        taxamt = amount - amt2;
                        netamount = amount - taxamt;

                    } else {
                        taxamt = Math.Round(amount * (taxval / 100),2,MidpointRounding.AwayFromZero);
                    }
                    list [0].tax = taxamt;
                    list [0].amount =amount;
                    list [0].netamount = netamount;

                    db.Update (list [0]);
                }else db.Insert (invdtls);
            }
            //spinItem.SetSelection (-1);
            ClearItemData ();
            Toast.MakeText (this, Resources.GetString(Resource.String.msg_itemadded), ToastLength.Long).Show ();
        }
开发者ID:mokth,项目名称:merpV3,代码行数:59,代码来源:InvoiceActivityEx.cs

示例7: updatePrintedStatus

 void updatePrintedStatus(Invoice inv)
 {
     using (var db = new SQLite.SQLiteConnection (pathToDatabase)) {
         var list = db.Table<Invoice> ().Where (x => x.invno == inv.invno).ToList<Invoice> ();
         if (list.Count > 0) {
             //if only contains items then allow to update the printed status.
             //this to allow the invoice;s item can be added. if not can not be posted(upload)
             var list2 = db.Table<InvoiceDtls> ().Where (x => x.invno == inv.invno).ToList<InvoiceDtls> ();
             if (list2.Count > 0) {
                 list [0].isPrinted = true;
                 db.Update (list [0]);
             }
         }
     }
 }
开发者ID:mokth,项目名称:merpV3,代码行数:15,代码来源:InvoiceActivityEx.cs

示例8: InsertCompProfIntoDb

        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);
                }
            }
        }
开发者ID:mokth,项目名称:merpV2Production,代码行数:76,代码来源:DataHelper.cs

示例9: SaveInvoice

        private bool SaveInvoice()
        {
            bool lSave = false;
            Invoice inv = new Invoice ();
            EditText trxdate =  FindViewById<EditText> (Resource.Id.newinv_date);
            if (!Utility.IsValidDateString (trxdate.Text)) {
                Toast.MakeText (this,Resources.GetString(Resource.String.msg_invaliddate), ToastLength.Long).Show ();
                return lSave;
            }
            DateTime invdate = Utility.ConvertToDate (trxdate.Text);
            Spinner spinner = FindViewById<Spinner> (Resource.Id.newinv_custcode);
            //Spinner spinner2 = FindViewById<Spinner> (Resource.Id.newinv_type);
            TextView txtinvno =FindViewById<TextView> (Resource.Id.newinv_no);
            EditText txtcustname = FindViewById<EditText> (Resource.Id.newinv_custname);
            EditText remark = FindViewById<EditText> (Resource.Id.newinv_remark);

            if (spinner.SelectedItem == null) {
                Toast.MakeText (this, Resources.GetString(Resource.String.msg_invalidcust), ToastLength.Long).Show ();
                spinner.RequestFocus ();
                return lSave;
            }

            string[] codes = spinner.SelectedItem.ToString().Split (new char[]{ '|' });
            if (codes.Length == 0)
                return lSave;

            using (var db = new SQLite.SQLiteConnection (pathToDatabase)) {

                invInfo.invdate = invdate;
                invInfo.trxtype = TRXTYPE;//spinner2.SelectedItem.ToString ();
                invInfo.created = DateTime.Now;
                invInfo.description = codes [1].Trim ();
                invInfo.remark = remark.Text.ToUpper ();
                //inv.amount = 0;
                invInfo.custcode = codes [0].Trim ();
                invInfo.isUploaded = false;

                if (codes [0].Trim () == "COD" || codes [0].Trim () == "CASH") {
                    inv.description = txtcustname.Text.ToUpper ();
                }

                db.Update (invInfo);
                lSave = true;
            }

            return lSave;
        }
开发者ID:mokth,项目名称:merpV3,代码行数:47,代码来源:EditInvoice.cs

示例10: populate

        void populate(List<InvoiceDtls> list)
        {
            comp = DataHelper.GetCompany (pathToDatabase);
            //SqliteConnection.CreateFile(pathToDatabase);
            using (var db = new SQLite.SQLiteConnection(pathToDatabase))
            {
                var list1 = db.Table<Invoice>().Where(x=>x.invno==invno).ToList<Invoice>();
                var list2 = db.Table<InvoiceDtls>().Where(x=>x.invno==invno).ToList<InvoiceDtls>();
                var list3 = db.Table<Trader>().Where(x=>x.CustCode==CUSTCODE).ToList<Trader>();

                double ttlamt = 0;
                double ttltax = 0;
                if (list3.Count > 0) {
                    CUSTNAME = list3 [0].CustName;
                }
                foreach(var item in list2)
                {
                    ttlamt = ttlamt + item.netamount;
                    ttltax = ttltax + item.tax;
                    list.Add(item);
                }
                if (list1.Count > 0) {
                    list1 [0].amount = ttlamt;
                    db.Update (list1 [0]);
                }
            //				InvoiceDtls inv1 = new InvoiceDtls ();
            //				inv1.icode = "TAX";
            //				inv1.netamount = ttltax;
            //				InvoiceDtls inv2 = new InvoiceDtls ();
            //				inv2.icode = "AMOUNT";
            //				inv2.netamount = ttlamt;
            //
            //				list.Add (inv1);
            //				list.Add (inv2);

                double roundVal = 0;
                double ttlNet = Utility.AdjustToNear (ttlamt + ttltax, ref roundVal);
                InvoiceDtls inv1 = new InvoiceDtls ();
                inv1.icode = "TAX";
                inv1.netamount = ttlamt;
                inv1.description = "TOTAL EXCL GST";
                InvoiceDtls inv2 = new InvoiceDtls ();
                inv2.icode = "AMOUNT";
                inv2.netamount = ttltax;
                inv2.description = "TOTAL 6% GST" ;
                InvoiceDtls inv3 = new InvoiceDtls ();
                inv3.icode = "TAX";
                inv3.netamount = ttlamt + ttltax;
                inv3.description = "TOTAL INCL GST" ;
                InvoiceDtls inv4 = new InvoiceDtls ();
                inv4.icode = "AMOUNT";
                inv4.netamount =  roundVal;
                inv4.description = "ROUNDING ADJUST";
                InvoiceDtls inv5 = new InvoiceDtls ();
                inv5.icode = "AMOUNT";
                inv5.netamount = ttlNet;
                inv5.description = "NET TOTAL";

                list.Add (inv1);
                list.Add (inv2);
                list.Add (inv3);
                if (TRXTYPE == "CASH") {
                    list.Add (inv4);
                    list.Add (inv5);
                }
            }
        }
开发者ID:mokth,项目名称:merpV3,代码行数:67,代码来源:InvItemHisActivity.cs

示例11: CreateNewCN

        private void CreateNewCN()
        {
            CNNote inv = new CNNote ();
            EditText trxdate =  FindViewById<EditText> (Resource.Id.newinv_date);
            if (!Utility.IsValidDateString (trxdate.Text)) {
                Toast.MakeText (this,"Invalid Transaction Date format...", ToastLength.Long).Show ();
                return;
            }
            DateTime invdate = Utility.ConvertToDate (trxdate.Text);
            DateTime tmr = invdate.AddDays (1);
            AdNumDate adNum= DataHelper.GetNumDate (pathToDatabase, invdate,"CN",compCode,branchCode);
            Spinner spinner = FindViewById<Spinner> (Resource.Id.newinv_custcode);
            TextView txtinvno =FindViewById<TextView> (Resource.Id.newinv_no);
            TextView custname = FindViewById<TextView> (Resource.Id.newinv_custname);
            TextView cninvno =  FindViewById<TextView> (Resource.Id.newcninv_no);
            string prefix = apara.CNPrefix.Trim ().ToUpper ();
            if (spinner.SelectedItem == null) {
                Toast.MakeText (this, "No Customer code selected...", ToastLength.Long).Show ();
                spinner.RequestFocus ();
                return;
            }

            string[] codes = spinner.SelectedItem.ToString().Split (new char[]{ '|' });
            if (codes.Length == 0)
                return;

            using (var db = new SQLite.SQLiteConnection (pathToDatabase)) {
                string invno = "";
                int runno = adNum.RunNo + 1;
                int currentRunNo =DataHelper.GetLastCNRunNo (pathToDatabase, invdate,compCode,branchCode);
                if (currentRunNo >= runno)
                    runno = currentRunNo + 1;

                invno =prefix + invdate.ToString("yyMM") + runno.ToString().PadLeft (4, '0');
                txtinvno.Text= invno;
                inv.invdate = invdate;
                inv.trxtype = "CN";
                inv.created = DateTime.Now;
                inv.cnno = invno;
                inv.description = custname.Text;
                inv.amount = 0;
                inv.custcode = codes [0].Trim ();
                inv.isUploaded = false;
                inv.invno = cninvno.Text;
                inv.CompCode = compCode;
                inv.BranchCode = branchCode;

                db.Insert (inv);
                adNum.RunNo = runno;
                if (adNum.ID >= 0)
                    db.Update (adNum);
                else
                    db.Insert (adNum);
            }

            ShowItemEntry (inv, codes);
        }
开发者ID:mokth,项目名称:merpCS,代码行数:57,代码来源:CreateCNNote.cs

示例12: DeleteInv

 private void DeleteInv()
 {
     try {
         using (var db = new SQLite.SQLiteConnection (pathToDatabase)) {
             var list = db.Table<InvoiceDtls> ().Where (x => x.invno == invno).ToList<InvoiceDtls> ();
             var list2 = db.Table<Invoice> ().Where (x => x.invno == invno).ToList<Invoice> ();
             if (list2.Count > 0) {
                 string trxtype = "INV";
                 AdNumDate adNum = DataHelper.GetNumDate (pathToDatabase, list2 [0].invdate, trxtype);
                 if (invno.Length > 5) {
                     string snum = invno.Substring (invno.Length - 4);
                     int num;
                     if (int.TryParse (snum, out num)) {
                         if (adNum.RunNo == num) {
                             adNum.RunNo = num - 1;
                             db.Update(adNum);
                             db.Delete (list2 [0]);
                             if (list.Count>0)
                             {
                                 foreach(var itmdtls in list)
                                     db.Delete(itmdtls);
                             }
                         }
                     }
                 }
             }
         }
     } catch (Exception ex)
     {
         Toast.MakeText (this,ex.Message , ToastLength.Long).Show ();
     }
 }
开发者ID:mokth,项目名称:merpV3,代码行数:32,代码来源:InvoiceActivityEx.cs

示例13: CreateNewDO

        private void CreateNewDO()
        {
            DelOrder dorder = new DelOrder ();
            EditText trxdate =  FindViewById<EditText> (Resource.Id.newinv_date);
            if (!Utility.IsValidDateString (trxdate.Text)) {
                Toast.MakeText (this,Resources.GetString(Resource.String.msg_invaliddate), ToastLength.Long).Show ();
                return;
            }
            DateTime dodate = Utility.ConvertToDate (trxdate.Text);
            DateTime tmr = dodate.AddDays (1);
            AdNumDate adNum= DataHelper.GetNumDate(pathToDatabase, dodate,"DO");
            Spinner spinner = FindViewById<Spinner> (Resource.Id.newinv_custcode);
            Spinner spinner2 = FindViewById<Spinner> (Resource.Id.newinv_type);
            TextView txtinvno =FindViewById<TextView> (Resource.Id.newinv_no);
            EditText remark = FindViewById<EditText> (Resource.Id.newinv_custname);
            //EditText custpo =  FindViewById<EditText> (Resource.Id.newinv_po);
            //EditText remark =  FindViewById<EditText> (Resource.Id.newinv_remark);
            string prefix = apara.DOPrefix.Trim ().ToUpper ();
            if (spinner.SelectedItem == null) {
                Toast.MakeText (this, Resources.GetString(Resource.String.msg_invalidcust), ToastLength.Long).Show ();
                spinner.RequestFocus ();
                return;
            }

            string[] codes = spinner.SelectedItem.ToString().Split (new char[]{ '|' });
            if (codes.Length == 0)
                return;

            using (var db = new SQLite.SQLiteConnection (pathToDatabase)) {
                string dono = "";
                int runno = adNum.RunNo + 1;
                int currentRunNo =DataHelper.GetLastDORunNo(pathToDatabase, dodate);
                if (currentRunNo >= runno)
                    runno = currentRunNo + 1;

                dono =prefix + dodate.ToString("yyMM") + runno.ToString().PadLeft (4, '0');

                txtinvno.Text= dono;
                dorder.dodate = dodate;
                dorder.trxtype ="DO" ;
                dorder.created = DateTime.Now;
                dorder.dono = dono;
                dorder.description =  codes [1].Trim ();
                dorder.remark = remark.Text;
                dorder.term =  spinner2.SelectedItem.ToString ();
                dorder.amount = 0;
                dorder.custcode = codes [0].Trim ();
                dorder.isUploaded = false;

                txtinvno.Text = dono;
                db.Insert (dorder);
                adNum.RunNo = runno;
                if (adNum.ID >= 0)
                    db.Update (adNum);
                else
                    db.Insert (adNum);
            }

            ShowItemEntry (dorder, codes);
        }
开发者ID:mokth,项目名称:merpV3,代码行数:60,代码来源:CreateDelOrder.cs

示例14: CreateNewInvoice

        private void CreateNewInvoice()
        {
            Invoice inv = new Invoice ();
            EditText trxdate =  FindViewById<EditText> (Resource.Id.newinv_date);
            if (!Utility.IsValidDateString (trxdate.Text)) {
                Toast.MakeText (this,Resources.GetString(Resource.String.msg_invaliddate), ToastLength.Long).Show ();
                return;
            }
            DateTime invdate = Utility.ConvertToDate (trxdate.Text);
            DateTime tmr = invdate.AddDays (1);
            AdNumDate adNum;// = DataHelper.GetNumDate (pathToDatabase, invdate);
            Spinner spinner = FindViewById<Spinner> (Resource.Id.newinv_custcode);
            Spinner spinner2 = FindViewById<Spinner> (Resource.Id.newinv_type);
            TextView txtinvno =FindViewById<TextView> (Resource.Id.newinv_no);
            EditText remark = FindViewById<EditText> (Resource.Id.newinv_remark);
            EditText custname = FindViewById<EditText> (Resource.Id.newinv_custname);
            string[] prefixs = apara.Prefix.Trim ().ToUpper ().Split(new char[]{'|'});
            string prefix = "";
            string trxtype = spinner2.SelectedItem.ToString ();
            //			if (trxtype == "CASH") {
            //				adNum = DataHelper.GetNumDate (pathToDatabase, invdate, "CS");
            //				if (prefixs.Length > 1) {
            //					prefix = prefixs [1];
            //				}else prefix = prefixs [0];
            //			} else {
                adNum = DataHelper.GetNumDate (pathToDatabase, invdate, "INV");
                prefix = prefixs [0];
            //}

            if (spinner.SelectedItem == null) {
                Toast.MakeText (this, Resources.GetString(Resource.String.msg_invalidcust), ToastLength.Long).Show ();
                spinner.RequestFocus ();
                return;
            }

            string[] codes = spinner.SelectedItem.ToString().Split (new char[]{ '|' });
            if (codes.Length == 0)
                return;

            using (var db = new SQLite.SQLiteConnection (pathToDatabase)) {

                string invno = "";
                int runno = adNum.RunNo + 1;
                int currentRunNo =DataHelper.GetLastInvRunNo (pathToDatabase, invdate,spinner2.SelectedItem.ToString ());
                if (currentRunNo >= runno)
                    runno = currentRunNo + 1;

                invno =prefix + invdate.ToString("yyMM") + runno.ToString().PadLeft (4, '0');

                txtinvno.Text= invno;
                inv.invdate = invdate;
                inv.trxtype = "INVOICE";//spinner2.SelectedItem.ToString ();
                inv.created = DateTime.Now;
                inv.invno = invno;
                inv.description = codes [1].Trim ();//custname.Text;
                inv.amount = 0;
                inv.custcode = codes [0].Trim ();
                inv.isUploaded = false;
                inv.remark = remark.Text.ToUpper();
                if (codes [0].Trim () == "COD" || codes [0].Trim () == "CASH") {
                    inv.description = custname.Text.ToUpper ();
                }
                txtinvno.Text = invno;
                db.Insert (inv);
                adNum.RunNo = runno;
                if (adNum.ID >= 0)
                    db.Update (adNum);
                else
                    db.Insert (adNum);
            }

            ShowItemEntry (inv, codes);
        }
开发者ID:mokth,项目名称:merpV3,代码行数:73,代码来源:CreateInvoice.cs

示例15: butSaveClick

        private void butSaveClick(object sender,EventArgs e)
        {
            TextView txtInvNo =  FindViewById<TextView> (Resource.Id.txtInvnp);
            Spinner spinner = FindViewById<Spinner> (Resource.Id.txtcode);
            EditText qty = FindViewById<EditText> (Resource.Id.txtqty);
            EditText price = FindViewById<EditText> (Resource.Id.txtprice);
            TextView txttax =  FindViewById<TextView> (Resource.Id.txttax);
            EditText ttlamt = FindViewById<EditText> (Resource.Id.txtamount);
            EditText ttltax = FindViewById<EditText> (Resource.Id.txttaxamt);
            if (spinner.SelectedItem == null) {
                Toast.MakeText (this, Resources.GetString(Resource.String.msg_invaliditem), ToastLength.Long).Show ();
                spinner.RequestFocus ();
                return;
            }

            if (string.IsNullOrEmpty(qty.Text)) {
                Toast.MakeText (this, Resources.GetString(Resource.String.msg_invalidqty), ToastLength.Long).Show ();
                qty.RequestFocus ();
                return;
            }
            if (string.IsNullOrEmpty(price.Text)) {
                Toast.MakeText (this, Resources.GetString(Resource.String.msg_invalidprice), ToastLength.Long).Show ();
                price.RequestFocus ();
                return;
            }
            double stqQty = Convert.ToDouble(qty.Text);
            double uprice = Convert.ToDouble(price.Text);
            double taxval = taxper;//Convert.ToDouble(taxper.Text);
            double amount = Math.Round((stqQty * uprice),2);
            double netamount = amount;
            bool taxinclusice = isInclusive;// isincl.Checked;
            double taxamt = 0;
            if (taxinclusice) {
                double percent = (taxval/100) + 1;
                double amt2 =Math.Round( amount / percent,2,MidpointRounding.AwayFromZero);
                taxamt = amount - amt2;
                netamount = amount - taxamt;

            } else {
                taxamt = Math.Round(amount * (taxval / 100),2,MidpointRounding.AwayFromZero);
            }

            SaleOrderDtls so = new SaleOrderDtls ();
            string[] codedesc = spinner.SelectedItem.ToString ().Split (new char[]{ '|' });
            so.sono = txtInvNo.Text;
            so.amount = amount;
            so.description = codedesc [1].Trim();
            so.icode = codedesc [0].Trim();// spinner.SelectedItem.ToString ();
            so.price = uprice;
            so.qty = stqQty;
            so.tax = taxamt;
            so.taxgrp = txttax.Text;
            so.netamount = netamount;

            var itemlist = items.Where (x => x.ICode == so.icode).ToList<Item> ();
            if (itemlist.Count == 0) {
                Toast.MakeText (this, Resources.GetString(Resource.String.msg_invaliditem), ToastLength.Long).Show ();
                return;
            }

            int id = Convert.ToInt32 (ITEMUID);
            //so..title = spinner.SelectedItem.ToString ();
            using (var db = new SQLite.SQLiteConnection (pathToDatabase)) {
                var invlist =db.Table<SaleOrderDtls> ().Where (x => x.sono == so.sono&& x.ID==id).ToList<SaleOrderDtls> ();
                if (invlist.Count > 0) {
                    SaleOrderDtls soItem = invlist [0];
                    soItem.amount = amount;
                    soItem.netamount = netamount;
                    soItem.tax = taxamt;
                    soItem.taxgrp = txttax.Text;
                    soItem.description =  codedesc [1].Trim();
                    soItem.icode =  codedesc [0].Trim(); //spinner.SelectedItem.ToString ();
                    soItem.price = uprice;
                    soItem.qty = stqQty;
                    db.Update (soItem);
                }else db.Insert (so);
            }

            //spinner.SetSelection (-1);
            qty.Text = "";
            //price.Text = "";
            ttltax.Text = "";
            ttlamt.Text = "";
            Toast.MakeText (this, Resources.GetString(Resource.String.msg_itemadded), ToastLength.Long).Show ();
        }
开发者ID:mokth,项目名称:merpV3,代码行数:85,代码来源:SOEntryActivity.cs


注:本文中的SQLite.SQLiteConnection.Update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。