Beispiel #1
0
 public static string GetAutoDataKey(string tblName, string prefix, int maxLen, bool usePending)
 {
     common.myAutoKeyInfo keyInfo = GetAutoKey(tblName, usePending);
     if (keyInfo == null)
     {
         return(null);
     }
     return(prefix + keyInfo.value.PadLeft(maxLen - prefix.Length, '0'));
 }
Beispiel #2
0
 public void UpdatePortfolio(ref data.baseDS.portfolioDataTable tbl)
 {
     for (int idx = 0; idx < tbl.Count; idx++)
     {
         if (tbl[idx].code.Trim() == Consts.constNotMarkerNEW)
         {
             common.myAutoKeyInfo info = application.SysLibs.GetAutoKey(tbl.TableName, false);
             tbl[idx].code = info.value.ToString().PadLeft(tbl.codeColumn.MaxLength, '0');
         }
     }
     DbAccess.UpdateData(tbl);
 }
Beispiel #3
0
        public override void AddNew(string code)
        {
            this.AddNewRow();
            data.baseDS.portfolioRow row = (data.baseDS.portfolioRow)((DataRowView)myMasterSource.Current).Row;
            if (row == null)
            {
                return;
            }
            application.dataLibs.InitData(row);

            common.myAutoKeyInfo info = application.sysLibs.GetAutoKey(myDataSet.portfolio.TableName, false);
            row.code         = info.value.ToString().PadLeft(myDataSet.portfolio.codeColumn.MaxLength, '0');
            row.investorCode = this.investorCode;
            codeEd.Text      = row.code;
            interestedStrategy.Clear();
        }
Beispiel #4
0
        protected override void UpdateData(DataRow row)
        {
            if (row == null)
            {
                application.dataLibs.UpdateData(myDataSet.portfolio);
                return;
            }
            data.baseDS.portfolioRow portfolioRow = (data.baseDS.portfolioRow)row;
            if (portfolioRow.code.Trim() == "")
            {
                common.myAutoKeyInfo info = application.sysLibs.GetAutoKey(myDataSet.portfolio.TableName, false);
                portfolioRow.code = info.value.ToString().PadLeft(myDataSet.portfolio.codeColumn.MaxLength, '0');
            }
            application.dataLibs.UpdateData(portfolioRow);

            interestedStrategy.SaveData();
        }
Beispiel #5
0
 protected override void CloseAutoEditKey(common.myAutoKeyInfo autoKeyInfo)
 {
     DataAccess.Libs.DeleteKeyPending(autoKeyInfo);
 }
Beispiel #6
0
 public static void DeleteKeyPending(common.myAutoKeyInfo autoKeyInfo)
 {
     //Remove the used key in pending list
     DbAccess.DeleteAutoKeyPending(autoKeyInfo.key, autoKeyInfo.value);
 }