Beispiel #1
0
 public string DoSave()
 {
     var dm = new VIRETAILDAL.Masters.Customer();
     dm.customerRow = CustomerRow;
     dm.insurancediscDataTable = InsurancediscDataTable;
     var retval = dm.DoSave();
     if(retval=="1")
     {
         Customerno = Utils.CustomerNo;
     }
     return retval;
 }
 public string DoDownLoadCustomer()
 {
     string retval = "1";
     var _remotecustomer = new Customer().GetCustomerMembersDataTable(true, _syncConstr);
     var ds = new DsMaster().CUSTOMER;
     var taCustomer = new DsMasterTableAdapters.CUSTOMERTableAdapter{Connection = { ConnectionString = Utils.Connectionstring } };
     taCustomer.Fill(ds);
     foreach (DataRow dr in _remotecustomer.Rows)
     {
         var isnew = false;
         var dsup = ds.FindByCUSTNO(dr["CUSTNO"].ToString());
         if (dsup != null)
         {
             dsup.BeginEdit();
         }
         else
         {
             dsup = (DsMaster.CUSTOMERRow)ds.NewRow();
             isnew = true;
             foreach (DataColumn dc in _remotecustomer.Columns)
             {
                 if (dc.ColumnName == "CUSTOMERPOINT")
                 {
                     dsup[dc.ColumnName] = 0;
                 }
                 else
                 {
                     dsup[dc.ColumnName] = dr[dc.ColumnName];
                 }
             }
         }
         bool update = true;
         if (!isnew)
         {
             update = Equals(dr, dsup);
         }
         if (!update)
         {
             foreach (DataColumn dc in _remotecustomer.Columns)
             {
                 if (dc.ColumnName == "CUSTOMERPOINT")
                 {
                     dsup[dc.ColumnName] = 0;
                 }
                 else
                 {
                     dsup[dc.ColumnName] = dr[dc.ColumnName];
                 }
             }
         }
         if (isnew)
         {
             ds.Rows.Add(dsup);
             var t = taCustomer.Update(ds);
             if (t == 0)
                 retval += "Customer master not created";
         }
         else
         {
             dsup.EndEdit();
             taCustomer.Update(dsup);
         }
     }
     return retval;
 }
Beispiel #3
0
        void DouploadCustomerRedimPoints()
        {
            txtstatus.Caption = "Uploading Customer Points";
            Application.DoEvents();
            try
            {
                var dm = new VIRETAILDAL.Masters.Customer();
                var dt = dm.GetCustomerPointNotUploaded();
                var syc = new RemoteSync();
                if (dt.Rows.Count <= 0) return;
                foreach (Ledgers.CUSTOMERPOINTSRow dr in dt.Rows)
                {
                    var drd1 = _dsdownload.NewRow();
                    var ret = syc.UpdatePointsDetails(dr); //syc.DoSavePurchaseRequestInRemote(dm.GetPurchaseRequstNotSync());
                    if (ret == "1")
                    {
                        dm.SetCustomerPointUploadStatus(dr.TID);
                        drd1[1] = DateTime.Now.Date;
                        drd1[2] = "Customer Points re-dim details";
                        drd1[3] = "Re-dim Updated";
                    }
                    else
                    {
                        drd1[3] = "Error " + ret;
                    }
                    _dsdownload.Rows.Add(drd1);
                }
            }
            catch (Exception exp)
            {
                XtraMessageBox.Show(exp.ToString(), "POS", MessageBoxButtons.OK,
                           MessageBoxIcon.Information);
            }


        }
Beispiel #4
0
        void DoUploadCustomerPoints()
        {
            txtstatus.Caption = "Uploading Customer Points";
            Application.DoEvents();
            try
            {
                var dm = new VIRETAILDAL.Masters.Customer();
                var dt = dm.GetCustomerWithPoints();
                
                var syc = new RemoteSync();

                if (dt.Rows.Count == 0)
                {
                    var drd = _dsdownload.NewRow();
                    drd[0] = "";
                    drd[1] = DateTime.Now.Date;
                    drd[2] = "Customer Points";
                    drd[3] = "Nothing to Upload ";
                    _dsdownload.Rows.Add(drd);
                }
                else
                {
                    foreach (DsMaster.CUSTOMERRow dr in dt.Rows)
                    {
                        var drd1 = _dsdownload.NewRow();

                        var ret = syc.SetAvailablePoints(dr.CUSTNO, dr.CUSTOMERPOINT); //syc.DoSavePurchaseRequestInRemote(dm.GetPurchaseRequstNotSync());
                        if (ret == "1")
                        {

                            dm.UpdateCustomerPoints(dr.CUSTNO, -dr.CUSTOMERPOINT);
                            drd1[1] = DateTime.Now.Date;
                            drd1[2] = "Customer Points";
                            drd1[3] = "Points Updated";
                        }
                        else
                        {
                            drd1[3] = "Error " + ret;
                        }
                        _dsdownload.Rows.Add(drd1);
                    }
                }
            }
            catch (Exception exp)
            {
                XtraMessageBox.Show(exp.ToString(), "POS", MessageBoxButtons.OK,
                           MessageBoxIcon.Information);
            }
        }
Beispiel #5
0
 public string UpdatePointsDetails(string custno, decimal points, string comp, DateTime dt, string sinv, decimal redimamt, bool useother = false, string cnstr = "x")
 {
     var bl = new VIRETAILDAL.Masters.Customer();
     return bl.UpdatePointsDetails(custno, points,comp,dt, sinv,redimamt,useother,cnstr);
 }
Beispiel #6
0
 public void GetCustomerByMemno(int custno)
 {
     var t = new VIRETAILDAL.Masters.Customer().GetCustomerByMemno(custno);
     if(t.Rows.Count > 0)
     CustomerRow = t[0];
 }