Exemple #1
0
        //遍历数组,拿出数据
        private static List <SentTB> GetSentTBBySql(string strsql)
        {
            CustomersService     cs   = new CustomersService();
            CarrieCompanyService ccs  = new CarrieCompanyService();
            List <SentTB>        list = new List <SentTB>();

            DataTable table = DBHelper.GetTable(strsql);

            foreach (DataRow row in table.Rows)
            {
                SentTB st = new SentTB();
                st.Sid       = Convert.ToInt32(row["sid"]);
                st.CusID     = Convert.ToInt32(row["cusid"]);
                st.Cid       = Convert.ToInt32(row["cid"]);
                st.CSid      = Convert.ToInt64(row["csid"]);
                st.Kilo      = Convert.ToDouble(row["kilo"]);
                st.Price     = Convert.ToDouble(row["price"]);
                st.BeginDate = Convert.ToDateTime(row["begindate"]);
                st.Remark    = row["remark"].ToString();
                st.cust      = cs.GetCusmoerByid(Convert.ToInt32(row["cusid"]));
                st.company   = ccs.GetCompanyByid(Convert.ToInt32(row["cid"]));
                list.Add(st);
            }
            return(list);
        }
        //根据sql语句得到信息
        public static List <CustomerSentTB> GetAllBySql(string strsql)
        {
            CustomersService      cst = new CustomersService();
            CarrieCompanyService  ccs = new CarrieCompanyService();
            List <CustomerSentTB> all = new List <CustomerSentTB>();
            DataTable             ds  = DBHelper.GetTable(strsql);

            foreach (DataRow row in ds.Rows)
            {
                CustomerSentTB cs = new CustomerSentTB();
                cs.CSid = Convert.ToInt32(row["csid"]);
                cs.Rid  = (long)row["rid"];
                //cs.cusid = Convert.ToInt32(row["cusid"]);
                cs.cusid = row["cusid"] != DBNull.Value ? Convert.ToInt32(row["cusid"]) : 0;
                //cs.Cid = Convert.ToInt32(row["cid"]);
                cs.Cid = row["cid"] != DBNull.Value ? Convert.ToInt32(row["cid"]) : 0;
                if (cs.cusid != 0)
                {
                    cs.customer      = cst.GetCusmoerByid(Convert.ToInt32(row["cusid"]));
                    cs.carriecompany = ccs.GetCompanyByid(Convert.ToInt32(row["cid"]));
                }
                cs.Destination = row["destination"].ToString();
                cs.Kilo        = Convert.ToDouble(row["kilo"]);
                cs.Price       = Convert.ToDouble(row["price"]);
                cs.Resdate     = Convert.ToDateTime(row["resdate"]);
                cs.IsSet       = (row["isset"].ToString());
                if (cs.IsSet == "true")
                {
                    cs.IsSet = "是";
                }
                else
                {
                    cs.IsSet = "否";
                }
                cs.Remark = row["remark"].ToString();

                all.Add(cs);
            }
            return(all);
        }
Exemple #3
0
        //根据sql语句查询
        private static List <CustomerPriceTB> GetCustomersBySql(string strsql)
        {
            CustomersService     cs  = new CustomersService();
            CarrieCompanyService ccs = new CarrieCompanyService();

            List <CustomerPriceTB> list = new List <CustomerPriceTB>();

            DataTable table = DBHelper.GetTable(strsql);

            foreach (DataRow row in table.Rows)
            {
                CustomerPriceTB cp = new CustomerPriceTB();
                cp.Cpid          = Convert.ToInt32(row["cpid"]);
                cp.carriecomapny = ccs.GetCompanyByid(Convert.ToInt32(row["cid"]));
                cp.customer      = cs.GetCusmoerByid(Convert.ToInt32(row["cusid"]));
                cp.CusID         = Convert.ToInt32(row["cusid"]);
                cp.Cid           = Convert.ToInt32(row["cid"]);
                cp.CpName        = row["cpname"].ToString();
                cp.PNo           = row["pno"].ToString();
                cp.Remark        = row["remark"].ToString();
                list.Add(cp);
            }
            return(list);
        }