Пример #1
0
        public IList <INVStockSerial> GetAllSerialForCollection(int pid, IList <INVStockSerial> invss)
        {
            List <long>               serids           = new List <long>();
            IList <INVStockSerial>    res              = new List <INVStockSerial>();
            IList <INVStockSerial>    result           = new List <INVStockSerial>();
            IList <INVStockSerial>    allserialByParty = invss;
            IList <SRVLoanCollection> allloansfrompid  = _loanDaoCollectionLinq.getAllLoansByParty(pid);

            foreach (SRVLoanCollection srvLoancollection in allloansfrompid)
            {
                string[] serials = srvLoancollection.SerialIDs.Split(',');
                foreach (string serial in serials)
                {
                    if (serial != "")
                    {
                        INVStockSerial iss = new SerialDAOLinq().PickByID(int.Parse(serial));
                        res.Add(iss);
                        serids.Add(iss.SerialID);
                    }
                }
            }
            //result = allserialByParty;
            foreach (INVStockSerial re in res)
            {
                //INVStockSerial[] arrss = allserialByParty.ToArray();
                //int i = 0;
                foreach (INVStockSerial ss in allserialByParty)
                {
                    if (ss.SerialID != re.SerialID && !serids.Contains(ss.SerialID))
                    {
                        //allserialByParty.RemoveAt(i);
                        result.Add(ss);
                    }
                    //i++;
                }
                //allserialByParty.Remove(re);
            }
            //result = allserialByParty.Except(res).ToList();
            return((res.Count > 0) ? result.Distinct().ToList() : allserialByParty);
        }
Пример #2
0
        public Int32 getBalance(int pid, int bags)
        {
            Int32 totbags = 0;
            IList <SRVLoanDisburse> ld = new LoanDAOLinq().getAllLoansByParty(pid);

            foreach (SRVLoanDisburse l in ld)
            {
                if (l.Bags == bags)
                {
                    string[] serials = l.serialIDs.Split(',');
                    foreach (string serial in serials)
                    {
                        if (serial != "")
                        {
                            INVStockSerial iss = new SerialDAOLinq().PickByID(int.Parse(serial));
                            totbags += Convert.ToInt32(iss.Bags);
                        }
                    }
                }
            }
            return(Convert.ToInt32(totbags) - bags);
        }