Exemplo n.º 1
0
        public static void AddPending(PALMPending pending)
        {
            string    tableName    = "PALM_Pending";
            string    searchString = "UserID LIKE '" + pending.User.ID + "'";
            string    targetString = null;
            DataTable _dataTable   = QuantApp.Kernel.Database.DB["CloudApp"].GetDataTable(tableName, targetString, searchString);

            DataRowCollection rows = _dataTable.Rows;

            var lrows = from lrow in new LINQList <DataRow>(rows)
                        where (DateTime)lrow["SubmissionDate"] == pending.SubmissionDate && (string)lrow["Provider"] == pending.Provider && (string)lrow["AccountID"] == pending.AccountID
                        select lrow;

            if (lrows.Count() == 0)
            {
                DataRow r = _dataTable.NewRow();
                r["UserID"]         = pending.User.ID;
                r["StrategyID"]     = pending.Strategy == null ? -1 : pending.Strategy.ID;
                r["SubmissionDate"] = pending.SubmissionDate;

                r["AttorneyID"] = pending.Attorney == null ? "" : pending.Attorney.ID;
                r["Provider"]   = pending.Provider;
                r["AccountID"]  = pending.AccountID;

                rows.Add(r);
                QuantApp.Kernel.Database.DB["CloudApp"].UpdateDataTable(_dataTable);
            }
        }
Exemplo n.º 2
0
        public static void UpdatePending(PALMPending pending)
        {
            string    tableName    = "PALM_Pending";
            string    searchString = "UserID LIKE '" + pending.User.ID + "' AND Provider LIKE '" + pending.Provider + "' AND AccountID LIKE '" + pending.AccountID + "'";
            string    targetString = null;
            DataTable _dataTable   = QuantApp.Kernel.Database.DB["CloudApp"].GetDataTable(tableName, targetString, searchString);

            DataRowCollection  rows = _dataTable.Rows;
            List <PALMPending> ret  = new List <PALMPending>();

            if (rows.Count != 0)
            {
                foreach (DataRow row in rows)
                {
                    row["StrategyID"] = pending.Strategy == null ? -1 : pending.Strategy.ID;
                    row["AttorneyID"] = pending.Attorney.ID;
                    row["Provider"]   = pending.Provider;
                    row["AccountID"]  = pending.AccountID;
                    if (pending.CreationDate != DateTime.MinValue || pending.CreationDate != DateTime.MaxValue)
                    {
                        row["CreationDate"] = pending.CreationDate;
                    }
                }
            }

            QuantApp.Kernel.Database.DB["CloudApp"].UpdateDataTable(_dataTable);
        }