本文整理汇总了C#中DataManager.GetAutoId方法的典型用法代码示例。如果您正苦于以下问题:C# DataManager.GetAutoId方法的具体用法?C# DataManager.GetAutoId怎么用?C# DataManager.GetAutoId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataManager
的用法示例。
在下文中一共展示了DataManager.GetAutoId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: DoSave
public string DoSave()
{
string retval = "0";
SqlTransaction tran = null;
try
{
var cn = new SqlConnection { ConnectionString = _constr };
cn.Open();
tran = cn.BeginTransaction(IsolationLevel.ReadUncommitted);
var dm = new DataManager();
var dt = new Ledgers.APARMAINDataTable();
var ta = new LedgersTableAdapters.APARMAINTableAdapter {Connection = {ConnectionString = _constr}};
ta.Fill(dt);
var taleder = new LedgersTableAdapters.LEDGERSTableAdapter();
taleder.AssignConnection(cn,tran);
ta.AssignConnection(cn, tran);
var tasalesamtdetails = new LedgersTableAdapters.SalesAmountDetailsTableAdapter();
tasalesamtdetails.AssignConnection(cn, tran);
var autoid = dm.GetAutoId(17);
autoid++;
Utils.CustomerReceipt = dm.CreateFormatedAutoNo(autoid);
ta.Update(AparmainData);
var bl = new SalesManger().GetInvoiceNo(17);
taleder.Insert("C", customerno, trandate,
trandate, Utils.CustomerReceipt,
Utils.CustomerReceipt,0 , AppliedAmt, 17, Utils.Company,
Utils.Userid, "Customer Receipt");
tasalesamtdetails.Insert(trandate, null, customerno, "C", amountype, AppliedAmt, shiftcode, false, Utils.Company,userid, false, null);
tran.Commit();
retval = "1";
}
catch (Exception ex)
{
retval = ex.ToString();
if (tran != null) tran.Rollback();
}
return retval;
}
示例6: 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;
}
示例7: DoSave
public string DoSave(DsInventory.ITEMTRANSFERMAINRow drow,
DsInventory.ITEMTRANSFERDETAILDataTable itemtransferdetail, string Stype)
{
var dm = new DataManager();
string retval = "0";
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.ITEMTRANSFERMAIN;
var taItemTransMain = new ITEMTRANSFERMAINTableAdapter();
var taItremTransDetail = new ITEMTRANSFERDETAILTableAdapter();
var taStockMaster = new STOCKMASTERTableAdapter {Connection = {ConnectionString = _constr}};
taItemTransMain.Connection.ConnectionString = _constr;
taStockMaster.Fill(ds.STOCKMASTER);
taItemTransMain.FillByTranid(dt, drow.TRANID);
// Assaign Transaction
taItemTransMain.AssignConnection(cn, tran);
taItremTransDetail.AssignConnection(cn, tran);
taStockMaster.AssignConnection(cn, tran);
var dr = dt.FindByTRANID(drow.TRANID);
if (dr != null)
{
dr.BeginEdit();
}
else
{
dr = (DsInventory.ITEMTRANSFERMAINRow) dt.NewRow();
isnew = true;
}
if (isnew)
{
var autoid = dm.GetAutoId(3);
autoid++;
Utils.Tranid = dm.CreateFormatedAutoNo(autoid);
dr.TRANID = Utils.Tranid;
dr.COMPANY = Utils.Company;
}
else
{
Utils.Tranid = drow.TRANID;
dr.EDATE = DateTime.Now;
dr.EUSERID = Utils.Userid;
}
dr.FRMSTOREID = drow.FRMSTOREID;
dr.TOSTOREID = drow.TOSTOREID;
dr.TRANDATE = drow.TRANDATE;
dr.TOTVALUE = drow.TOTVALUE;
dr.TOTITEMS = itemtransferdetail.Count;
dr.HOLD = drow.HOLD;
dr.FRMNAME = drow.FRMNAME;
dr.TONAME = drow.TONAME;
dr.TTYPE = drow.TTYPE;
dr.TOCOMP = drow.TOCOMP;
dr.USERID = drow.USERID;
var taa = new DataManager();
dr.DOWNFILENO = drow.DOWNFILENO;
if (isnew)
{
dt.Rows.Add(dr);
taItemTransMain.Update(dt);
if (dr.TTYPE == 3)
{
dr.AFILENO = Utils.Tranid; // taa.CreateFormatedAutoNo(taa.GetAutoId(5));
dr.FLAGFILE = true;
}
}
else
{
dr.EndEdit();
taItemTransMain.Update(dr);
}
foreach (DataRow purd in itemtransferdetail.Rows)
{
if ((purd.RowState != DataRowState.Deleted))
{
purd["TRANID"] = Utils.Tranid;
purd["TOSTORE"] = drow.TOSTOREID;
}
}
taItremTransDetail.Update(itemtransferdetail);
if (!dr.HOLD)
{
Masters.StockMaster.UpdateQtyInStockDataSet(ref cn, ref tran, itemtransferdetail, false);
if (dr.TTYPE == 3)
{
new Masters.StockMaster().CreateStock(ref cn, ref tran, itemtransferdetail, drow.TOSTOREID,
Stype, false, false);
}
dm.UpdateAutoNum(3);
}
tran.Commit();
retval = "1";
}
catch (Exception ex)
//.........这里部分代码省略.........