Пример #1
0
        void DoUploadPurchaseReturn()
        {
            txtstatus.Caption = "Uploading Purchase Return";
            try
            {
                var dm = new PurReturnDataManger();
                var dt = dm.GetPurchaseInvoiceReturnNotSync();
                var syc = new RemoteSync();
                if (dt.Rows.Count == 0)
                {
                    var drd = _dsdownload.NewRow();
                    drd[0] = "";
                    drd[1] = DateTime.Now.Date;
                    drd[2] = "Purchase Return";
                    drd[3] = "Nothing to Upload ";
                    _dsdownload.Rows.Add(drd);
                }

                foreach (DsPurchase.RETURNMASTRow dr in dt.Rows)
                {
                    if (Utils.PingServer())
                    {
                        var drd = _dsdownload.NewRow();
                        drd[0] = dr.RETURNID;
                        drd[1] = DateTime.Now.Date;
                        drd[2] = "Purchase Return";
                        var ret = syc.DoSavePurchaseInvoiceReturnInRemote(dr, dm.GetPurRetInvDetailsById(dr.RETURNID));
                        if (ret == "1")
                        {
                            dm.UpdatedSynReturn(dr.RETURNID);
                            drd[3] = "Uploaded";
                        }
                        else
                        {
                            drd[3] = "Error " + ret;
                        }
                        _dsdownload.Rows.Add(drd);
                    }
                    else
                    {
                        XtraMessageBox.Show("Failed to connect server ", "POS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }

            }
            catch (Exception exp)
            {
                XtraMessageBox.Show(exp.ToString(), "POS", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }