示例#1
0
 public bool Login(string name, string pwd)
 {
     using (nemanpingEntities3 can = new nemanpingEntities3())
     {
         var user = can.UserTable.First(u => u.Name.Equals(name) && u.Pwd.Equals(pwd));
         return(true);
     }
 }
示例#2
0
 public void insertGongHuoFang(DataTable dt)
 {
     using (nemanpingEntities3 can = new nemanpingEntities3())
     {
         foreach (DataRow dr in dt.Rows)
         {
             if (dr[0] is DBNull || Convert.ToInt32(dr[0]) == 0)
             {
                 GongHuoFang insets = new GongHuoFang()
                 {
                     PingMing     = dr[1].ToString(),
                     HuoHao       = dr[2].ToString(),
                     Guige        = dr[3].ToString(),
                     SeHao        = dr[4].ToString(),
                     Yanse        = dr[5].ToString(),
                     DanJia       = dr[6].ToString(),
                     GongHuoFangA = dr[7].ToString(),
                     GongHuoFangB = dr[8].ToString(),
                     BeiZhu       = dr[9].ToString()
                 };
                 can.GongHuoFang.Add(insets);
             }
             else
             {
                 int id     = Convert.ToInt32(dr[0]);
                 var select = from sc in can.GongHuoFang where sc.Id == id select sc;
                 var target = select.FirstOrDefault <GongHuoFang>();
                 target.PingMing     = dr[1].ToString();
                 target.HuoHao       = dr[2].ToString();
                 target.Guige        = dr[3].ToString();
                 target.SeHao        = dr[4].ToString();
                 target.Yanse        = dr[5].ToString();
                 target.DanJia       = dr[6].ToString();
                 target.GongHuoFangA = dr[7].ToString();
                 target.GongHuoFangB = dr[8].ToString();
                 target.BeiZhu       = dr[9].ToString();
             }
         }
         can.SaveChanges();
     }
 }
示例#3
0
 public void deleteJaGongChang(List <int> id)
 {
     using (nemanpingEntities3 npe = new nemanpingEntities3())
     {
         foreach (int strid in id)
         {
             if (strid != null)
             {
                 if (strid != 0)
                 {
                     var select = from s in npe.JiaGongChang where s.id == strid select s;
                     foreach (var item in select)
                     {
                         npe.JiaGongChang.Remove(item);
                     }
                 }
             }
         }
         npe.SaveChanges();
     }
 }
示例#4
0
        //public bool Login(string name, string pwd)
        //{
        //    using (nemanpingEntities3 can = new nemanpingEntities3())
        //    {
        //        var user = can.UserTable.First(u => u.Name.Equals(name) && u.Pwd.Equals(pwd));
        //        return true;
        //    }

        //}
        #region 查询加工厂信息
        public List <JiaGongChang> selectJiaGongChang()
        {
            using (nemanpingEntities3 can = new nemanpingEntities3())
            {
                List <JiaGongChang> JiaGongChang = new List <JiaGongChang>();
                var select = from s in can.JiaGongChang select s;
                foreach (var item in select)
                {
                    JiaGongChang s = new JiaGongChang();
                    s.id          = item.id;
                    s.Name        = item.Name;
                    s.Address     = item.Address;
                    s.Lianxiren   = item.Lianxiren;
                    s.Phone       = item.Phone;
                    s.ZengZhiShui = item.ZengZhiShui;
                    s.Kaihuhang   = item.Kaihuhang;
                    s.Zhanghao    = item.Zhanghao;
                    JiaGongChang.Add(s);
                }
                return(JiaGongChang);
            }
        }
示例#5
0
 public void insertJiaGongChang(DataTable dt)
 {
     using (nemanpingEntities3 can = new nemanpingEntities3())
     {
         foreach (DataRow dr in dt.Rows)
         {
             if (dr[0] is DBNull || Convert.ToInt32(dr[0]) == 0)
             {
                 JiaGongChang insets = new JiaGongChang()
                 {
                     Name        = dr[1].ToString(),
                     Address     = dr[2].ToString(),
                     Lianxiren   = dr[3].ToString(),
                     Phone       = dr[4].ToString(),
                     ZengZhiShui = dr[5].ToString(),
                     Kaihuhang   = dr[6].ToString(),
                     Zhanghao    = dr[7].ToString()
                 };
                 can.JiaGongChang.Add(insets);
             }
             else
             {
                 int id     = Convert.ToInt32(dr[0]);
                 var select = from sc in can.JiaGongChang where sc.id == id select sc;
                 var target = select.FirstOrDefault <JiaGongChang>();
                 target.Name        = dr[1].ToString();
                 target.Address     = dr[2].ToString();
                 target.Lianxiren   = dr[3].ToString();
                 target.Phone       = dr[4].ToString();
                 target.ZengZhiShui = dr[5].ToString();
                 target.Kaihuhang   = dr[6].ToString();
                 target.Zhanghao    = dr[7].ToString();
             }
         }
         can.SaveChanges();
     }
 }
示例#6
0
 public List <GongHuoFang> selectGongHuoFang()
 {
     using (nemanpingEntities3 can = new nemanpingEntities3())
     {
         List <GongHuoFang> GongHuoFang = new List <GongHuoFang>();
         var select = from s in can.GongHuoFang select s;
         foreach (var item in select)
         {
             GongHuoFang s = new GongHuoFang();
             s.Id           = item.Id;
             s.PingMing     = item.PingMing;
             s.HuoHao       = item.HuoHao;
             s.Guige        = item.Guige;
             s.SeHao        = item.SeHao;
             s.Yanse        = item.Yanse;
             s.DanJia       = item.DanJia;
             s.GongHuoFangA = item.GongHuoFangA;
             s.GongHuoFangB = item.GongHuoFangB;
             s.BeiZhu       = item.BeiZhu;
             GongHuoFang.Add(s);
         }
         return(GongHuoFang);
     }
 }