本文整理汇总了C#中DataManager.UpdateAutoNum方法的典型用法代码示例。如果您正苦于以下问题:C# DataManager.UpdateAutoNum方法的具体用法?C# DataManager.UpdateAutoNum怎么用?C# DataManager.UpdateAutoNum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataManager
的用法示例。
在下文中一共展示了DataManager.UpdateAutoNum方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoSave
public string DoSave()
{
var dm = new DataManager();
string retval;
SqlTransaction tran = null;
var isnew = false;
try
{
var cn = new SqlConnection(_constr);
cn.Open();
tran = cn.BeginTransaction(IsolationLevel.ReadUncommitted);
var ds = new DsPurchase();
var dt = ds.POMAIN;
var taPurMain = new POMAINTableAdapter();
var taPurDetail = new PODETAILTableAdapter();
taPurMain.Connection.ConnectionString = _constr;
taPurMain.Fill(dt);
// Assaign Transaction
taPurMain.AssignConnection(cn, tran);
taPurDetail.AssignConnection(cn, tran);
var dr = dt.FindByPONO(Drow.PONO);
if (dr != null)
{ dr.BeginEdit(); }
else
{ dr = (DsPurchase.POMAINRow)dt.NewRow(); }
if (string.IsNullOrEmpty(Drow.PONO))
{
var autoid = dm.GetAutoId(11);
autoid++;
Utils.Pono = dm.CreateFormatedAutoNo(autoid);
dr.PONO = Utils.Pono;
dr.USERID = Utils.Userid;
dr.COMPANY = Utils.Company;
dr.UDATE = DateTime.Now;
isnew = true;
}
else
{
Utils.Pono = Drow.PONO;
dr.EDATE = DateTime.Now;
dr.EUSERID = Utils.Userid;
}
dr.TRANDATE = Drow.TRANDATE;
dr.SUPID = Drow.SUPID;
dr.SUPNAME = Drow.SUPNAME;
dr.SUPADD = Drow.SUPADD;
dr.DELADD = Drow.DELADD;
dr.DUEDAYS = Drow.DUEDAYS;
dr.STORECODE = Drow.STORECODE;
dr.EXTRDISC = Drow.EXTRDISC;
dr.NETVALUE = Drow.NETVALUE;
dr.PAYTERMS = Drow.PAYTERMS;
dr.supnote = Drow.supnote;
if (isnew)
{
dt.Rows.Add(dr);
taPurMain.Update(dt);
}
else
{
dr.EndEdit();
taPurMain.Update(dr);
}
foreach (DataRow purd in Podetail.Rows)
{
if ((purd.RowState != DataRowState.Deleted))
purd["PONO"] = Utils.Pono;
}
taPurDetail.Update(Podetail);
tran.Commit();
dm.UpdateAutoNum(11);
retval = "1";
}
catch (Exception ex)
{
if (tran != null)
tran.Rollback();
if (isnew)
Utils.Pono = string.Empty;
retval = ex.ToString();
}
return retval;
}
示例2: DoSave
public string DoSave(DsPurchase.RETURNMASTRow drow, DsPurchase.RETURNDETAILDataTable returndetail)
{
var dm = new DataManager();
string retval;
SqlTransaction tran = null;
var isnew = false;
try
{
var cn = new SqlConnection(_constr);
cn.Open();
tran = cn.BeginTransaction(IsolationLevel.ReadUncommitted);
var ds = new DsPurchase();
var dsStock = new DsInventory();
var dt = ds.RETURNMAST;
var taPurMain = new RETURNMASTTableAdapter {Connection = {ConnectionString = _constr}};
var taPurDetail = new RETURNDETAILTableAdapter();
var taStockMaster = new STOCKMASTERTableAdapter {Connection = {ConnectionString = _constr}};
var taapar = new LedgersTableAdapters.APARMAINTableAdapter();
var taledger = new LedgersTableAdapters.LEDGERSTableAdapter();
taStockMaster.Fill(dsStock.STOCKMASTER);
taPurMain.Fill(ds.RETURNMAST);
// Assaign Transaction
taPurMain.AssignConnection(cn, tran);
taPurDetail.AssignConnection(cn, tran);
taStockMaster.AssignConnection(cn, tran);
taapar.AssignConnection(cn, tran);
taledger.AssignConnection(cn, tran);
var dr = dt.FindByRETURNID(drow.RETURNID);
if (dr != null)
{ dr.BeginEdit(); }
else
{ dr = (DsPurchase.RETURNMASTRow)dt.NewRow(); }
if (string.IsNullOrEmpty(drow.RETURNID))
{
var autoid = dm.GetAutoId(2);
autoid++;
Utils.Retinvid = dm.CreateFormatedAutoNo(autoid);
dr.RETURNID = Utils.Retinvid;
dr.USERID = Utils.Userid;
dr.COMPANY = Utils.Company;
dr.TRANDATE = System.DateTime.Now;
isnew = true;
}
else
{
Utils.Retinvid = drow.RETURNID;
dr.EDATE = DateTime.Now;
dr.EUSERID = Utils.Userid;
}
dr.SUPID = drow.SUPID;
dr.SUPNAME = drow.SUPNAME;
dr.INVDATE = drow.INVDATE;
dr.INVNO = drow.INVNO;
dr.SPDISCOUNT = drow.SPDISCOUNT;
dr.WHID = drow.WHID;
dr.ADJVALUE = drow.ADJVALUE;
dr.NETVALUE = drow.NETVALUE;
dr.HOLD = drow.HOLD;
if (isnew)
{
dt.Rows.Add(dr);
taPurMain.Update(dt);
}
else
{
dr.EndEdit();
taPurMain.Update(dr);
}
foreach (DataRow purd in returndetail.Rows)
{
if ((purd.RowState != DataRowState.Deleted))
purd["RETURNID"] = Utils.Retinvid;
}
taPurDetail.Update(returndetail);
//STOCK
if (!dr.HOLD)
{
// Masters.StockMaster.UpdateQtyInStockDataSet(ref dsStock, returndetail, true);
// taStockMaster.Update(dsStock.STOCKMASTER);
Masters.StockMaster.UpdateQtyInStockDataSet(ref cn,ref tran, returndetail, true);
//LEDGER
taapar.Insert("S", dr.SUPID, DateTime.Now.Date, dr.INVDATE, Utils.Retinvid, dr.INVNO, -dr.NETVALUE, 0, -dr.NETVALUE, Utils.Company, 2, Utils.Userid, 0);
taledger.Insert("S", dr.SUPID, DateTime.Now.Date, dr.INVDATE, Utils.Retinvid, dr.INVNO, dr.NETVALUE,0, 2, Utils.Company, Utils.Userid, "Purchase Retun");
}
dm.UpdateAutoNum(2);
tran.Commit();
retval = "1";
}
catch (Exception ex)
{
//.........这里部分代码省略.........
示例3: DoSave
public string DoSave(DsInventory.ADJMASTRow drow,
DsInventory.ADJDETAILDataTable adjdetailDataTable)
{
var dm = new DataManager();
string retval;
SqlTransaction tran = null;
var isnew = false;
try
{
var cn = new SqlConnection(_constr);
cn.Open();
tran = cn.BeginTransaction(IsolationLevel.ReadUncommitted);
var ds = new DsInventory();
var dt = ds.ADJMAST;
var taAdjMast = new ADJMASTTableAdapter();
var taAdjDetail = new ADJDETAILTableAdapter();
var taStockMaster = new STOCKMASTERTableAdapter();
taStockMaster.Connection.ConnectionString = _constr;
taAdjMast.Connection.ConnectionString = _constr;
taStockMaster.Fill(ds.STOCKMASTER);
taAdjMast.Fill(ds.ADJMAST);
// Assaign Transaction
taAdjMast.AssignConnection(cn, tran);
taAdjDetail.AssignConnection(cn, tran);
taStockMaster.AssignConnection(cn, tran);
var dr = dt.FindByADJID(drow.ADJID);
if (dr != null)
{
dr.BeginEdit();
}
else
{
dr = (DsInventory.ADJMASTRow )dt.NewRow();
}
if (string.IsNullOrEmpty(drow.ADJID))
{
var autoid = dm.GetAutoId(10);
autoid++;
Utils.Adjid = dm.CreateFormatedAutoNo(autoid);
dr.ADJID = Utils.Adjid;
dr.USERID = Utils.Userid;
dr.COMPANY = Utils.Company;
isnew = true;
}
else
{
Utils.Adjid = drow.ADJID;
}
dr.STORECODE = drow.STORECODE;
dr.TRANDATE = drow.TRANDATE;
dr.REASON = drow.REASON;
if (isnew)
{
dt.Rows.Add(dr);
taAdjMast.Update(dt);
}
else
{
dr.EndEdit();
taAdjMast.Update(dr);
}
foreach (DataRow purd in adjdetailDataTable.Rows)
{
if ((purd.RowState != DataRowState.Deleted))
purd["ADJID"] = Utils.Adjid;
}
taAdjDetail.Update(adjdetailDataTable);
Masters.StockMaster.UpdateInventoryItem(ref ds, adjdetailDataTable);
taStockMaster.Update(ds.STOCKMASTER);
tran.Commit();
dm.UpdateAutoNum(10);
retval = "1";
}
catch (Exception ex)
{
if (tran != null)
tran.Rollback();
if (isnew)
Utils.Adjid = string.Empty;
retval = ex.ToString();
}
return retval;
}
示例4: DoSave
public string DoSave(Ledgers.ARAPRECEIPTSRow drmain,Ledgers.ARAPRECEIPTSDETAILSDataTable dt)
{
SqlTransaction tran = null;
var isnew = false;
string retval = string.Empty;
try
{
var cn = new SqlConnection (_constr);
cn.Open();
tran = cn.BeginTransaction(IsolationLevel.ReadUncommitted);
var taPurPaid = new ARAPRECEIPTSTableAdapter {Connection = {ConnectionString = _constr}};
var dtmain = new Ledgers.ARAPRECEIPTSDataTable();
var ds = taPurPaid.Fill(dtmain);
var taPurPaidDet = new ARAPRECEIPTSDETAILSTableAdapter();
var taApAr = new LedgersTableAdapters.APARMAINTableAdapter();
var taLedger = new LedgersTableAdapters.LEDGERSTableAdapter();
taLedger.AssignConnection(cn, tran);
taPurPaid.AssignConnection(cn,tran);
var dm = new DataManager();
taPurPaidDet.AssignConnection(cn,tran);
var dr = dtmain.FindByARAPTRANID(drmain.ARAPTRANID);
if (dr != null)
{
dr.BeginEdit();
}
else
{
dr = (Ledgers.ARAPRECEIPTSRow) dtmain.NewRow();
Utils.PurPayment = dm.GetAutoId(19).ToString("D6");
drmain.ARAPTRANID =Utils.PurPayment;
dr.ARAPTRANID = Utils.PurPayment;
isnew = true;
}
dr.AMOUNT = drmain.AMOUNT;
dr.TDATE = drmain.TDATE;
dr.BANKID = drmain.BANKID;
dr.POSTED = false;
string cmdtxt = string.Empty;
foreach (Ledgers.ARAPRECEIPTSDETAILSRow drdet in dt.Rows)
{
if (drdet.RowState != DataRowState.Deleted)
{
drdet.ARAPTRANID = dr.ARAPTRANID;
cmdtxt = "update APARMAIN set PAIDAMOUNT = " + drdet.AppliedAmt +
", BALANCE = 0 where TRANID = " + drdet.TRANID;
var cmd = new SqlCommand(cmdtxt, cn, tran);
cmd.ExecuteNonQuery();
taLedger.Insert("S", drdet.REFNO, DateTime.Now.Date, drdet.INVOICEDATE, dr.ARAPTRANID,drdet.INVOICENO, drdet.INVAMOUNT,0, 18, Utils.Company, Utils.Userid, "Purchase Payment");
}
}
if (isnew)
{
dtmain.Rows.Add(dr);
taPurPaid.Update(dtmain);
}
else
{
dr.EndEdit();
taPurPaid.Update(dr);
}
taPurPaidDet.Update(dt);
tran.Commit();
dm.UpdateAutoNum(19);
retval = "1";
}
catch (Exception ex)
{
tran.Rollback();
retval = ex.ToString();
}
return retval;
}
示例5: GetInvoiceNo
public string GetInvoiceNo(int srcid=14)
{
var dm = new DataManager();
var autoid = dm.GetAutoId(srcid);
autoid++;
string retval = Utils.Company + autoid.ToString("D8"); // dm.CreateFormatedAutoNo(autoid);
dm.UpdateAutoNum(srcid);
return retval;
}
示例6: DoSave
public bool DoSave()
{
bool retval = false;
var ta = new DISKDETAILSTableAdapter {Connection = {ConnectionString = _constr}};
var taitemove = new ItemMoveDataManager();
var taitemtran = new ITEMTRANSFERMAINTableAdapter {Connection = {ConnectionString = _constr}};
taitemtran.DiskCreated(Tranid);
var taauto = new DataManager();
retval = ta.Insert(fileno, DateTime.Now, Utils.Userid, Tranid, Utils.Company, ftype) > 0;
// taitemove.UpdateFileNo(fileno, Tranid);
taauto.UpdateAutoNum(5);
return retval;
}