Example #1
0
 public DsPurchase.PURCHASEREQUESTDataTable GetPurchaseRequestList(string company=null,bool inpo=false)
 {
     var ds = new DsPurchase().PURCHASEREQUEST;
     var ta = new PURCHASEREQUESTTableAdapter { Connection = { ConnectionString = _constr } };
     if (!inpo)
     {
         if (company == null)
         {
             ta.Fill(ds);
         }
         else
         {
             ta.FillByComp(ds, company);
         }
     }
     if (inpo)
         ta.FillByNotInPO(ds);
     return ds;
 }
Example #2
0
 public string DoSave()
 {
     string retval = "0";
     SqlTransaction tran = null;
     try
     {
         var cn = new SqlConnection(_constr);
         cn.Open();
         tran = cn.BeginTransaction(IsolationLevel.ReadUncommitted);
         var ds = new DsPurchase();
         var dt = ds.PURCHASEREQUEST;
         var taPurMain = new  PURCHASEREQUESTTableAdapter();
         taPurMain.Connection.ConnectionString = _constr;
         taPurMain.Fill(dt);
         taPurMain.AssignConnection(cn,tran);
         taPurMain.Update(Purchaserequest);
         tran.Commit();
         retval = "1";
     }
     catch (Exception ex)
     {
         if (tran != null)
             tran.Rollback();
         retval = ex.ToString();
     }
     return retval;
 }
Example #3
0
 public DsPurchase.PURCHASEREQUESTDataTable GetPurchaseRequest(string prno)
 {
     var ds = new DsPurchase().PURCHASEREQUEST;
     var ta = new PURCHASEREQUESTTableAdapter {Connection = {ConnectionString = _constr}};
     ta.FillByPRNO(ds, prno);
     return ds;
 }
Example #4
0
        public string DoSavePurchaseRequestInRemote(DsPurchase.PURCHASEREQUESTDataTable  dt)
        {
            var dm = new DataManager();
            string retval="0";
            SqlTransaction tran = null;
            var cn = new SqlConnection(_constr);
            try
            {
                cn.Open();
                tran = cn.BeginTransaction(IsolationLevel.ReadUncommitted);
                var ds = new DsPurchase();
                var dtdetail = ds.PURCHASEREQUEST;


 
                var taPurDetail = new  PURCHASEREQUESTTableAdapter();

                taPurDetail.AssignConnection(cn, tran);

                foreach (DsPurchase.PURCHASEREQUESTRow ditemdetarow in dt)
                {
                    var newdetrow = dtdetail.NewRow();
                    foreach (DataColumn dc in dt.Columns)
                    {
                        if (!dc.ReadOnly)
                        {
                            newdetrow[dc.ColumnName] = ditemdetarow[dc.ColumnName];
                        }
                    }
                    dtdetail.Rows.Add(newdetrow);
                }
                taPurDetail.Update(dtdetail);
                tran.Commit();
                retval = "1";
            }
            catch (Exception ex)
            {
                if (cn != null)
                {
                    if (tran != null)
                        tran.Rollback();
                }
                retval = ex.ToString();
            }
            return retval; 
        }