Exemplo n.º 1
0
        public string DoUpLoadPromotions(Ledgers.COMMISIONMASTRow CommisionmastRow, Ledgers.COMMISIONDETAILDataTable commisiondetail,bool isRemote=false)
        {
            var dm = new DataManager();
            string retval;
            SqlTransaction tran = null;
            try
            {
                if (isRemote)
                    _syncConstr = Utils.Connectionstring;
                var cn = new SqlConnection(_syncConstr);
                cn.Open();
                tran = cn.BeginTransaction(IsolationLevel.ReadUncommitted);
                var ds = new Ledgers();
                var dt = ds.COMMISIONMAST;
                var dtdetail = ds.COMMISIONDETAIL;

                var taCommMain = new COMMISIONMASTTableAdapter();
                var taCommDetail = new COMMISIONDETAILTableAdapter();

               

                // Assaign Transaction
                taCommMain.AssignConnection(cn, tran);
                taCommDetail.AssignConnection(cn, tran);

                

                var dr = (Ledgers.COMMISIONMASTRow)dt.NewRow();

                dr.PRMOFRM = CommisionmastRow.PRMOFRM;
                dr.PRMOTO = CommisionmastRow.PRMOTO;
                dr.PROMONAME = CommisionmastRow.PROMONAME;
                dr.STOREID = CommisionmastRow.STOREID;
                dr.EMPNO = CommisionmastRow.EMPNO;
                dr.STATUS = CommisionmastRow.STATUS;
                dr.COMID = CommisionmastRow.COMID;
                dr.USERID = CommisionmastRow.USERID;
                dr.UDATE = DateTime.Now;

                dt.Rows.Add(dr);
                taCommMain.Update(dt);
                //LEDGER
                foreach (Ledgers.COMMISIONDETAILRow ditemdetarow in commisiondetail)
                {
                    var newdetrow = dtdetail.NewRow();
                    foreach (DataColumn dc in commisiondetail.Columns)
                    {
                        if (!dc.ReadOnly)
                        {
                            newdetrow[dc.ColumnName] = ditemdetarow[dc.ColumnName];
                        }
                    }
                    dtdetail.Rows.Add(newdetrow);
                }
                taCommDetail.Update(dtdetail);
                if (isRemote)
                {
                    var dmu = new CommissionSetup();
                    dmu.UpdateSync(dr.COMID, true);
                }
                tran.Commit();
                retval = "1";
            }
            catch (Exception ex)
            {
                if (tran != null)
                    tran.Rollback();
                retval = ex.ToString();
            }
            return retval; 
        }
Exemplo n.º 2
0
  public string DoSave()
  {
 
      var dl = new VIRETAILDAL.Masters.CommissionSetup
          {CommisionmastRow = CommisionmastRow, Commisiondetail = Commisiondetail};
      var retval = dl.DoSave();
      if (retval == "1")
      {
          tranid = Utils.CommissionNo;
      }
      return retval;
  }