Exemplo n.º 1
0
        public OrderTypeEntity GetOrderTypeByID(string typeid, string agentid, string clientid)
        {
            if (string.IsNullOrEmpty(typeid))
            {
                return null;
            }
            var list = GetOrderTypes(agentid, clientid);
            if (list.Where(m => m.TypeID == typeid).Count() > 0)
            {
                return list.Where(m => m.TypeID == typeid).FirstOrDefault();
            }

            OrderTypeEntity model = new OrderTypeEntity();
            DataTable dt = SystemDAL.BaseProvider.GetOrderTypeByID(typeid);
            if (dt.Rows.Count > 0)
            {
                model.FillData(dt.Rows[0]);
                model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, agentid);
                OrderTypes[clientid].Add(model);
            }
            
            return model;
        }
Exemplo n.º 2
0
        public List<OrderTypeEntity> GetOrderTypes(string agentid, string clientid)
        {
            if (OrderTypes.ContainsKey(clientid))
            {
                return OrderTypes[clientid].ToList();
            }

            List<OrderTypeEntity> list = new List<OrderTypeEntity>();
            DataSet ds = SystemDAL.BaseProvider.GetOrderTypes(clientid);
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                OrderTypeEntity model = new OrderTypeEntity();
                model.FillData(dr);
                model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, agentid);
                list.Add(model);
            }

            OrderTypes.Add(clientid, list);

            return list;
        }