예제 #1
0
        /// <summary>
        /// 取消签到
        /// </summary>
        /// <param name="employeeNumber"></param>
        /// <returns></returns>
        public bool CheckOut(string employeeNumber)
        {
            AnnualPartyEntities entities = new AnnualPartyEntities();
            var emp = entities.Employee.SingleOrDefault(e => e.EmployeeNumber == employeeNumber);

            emp.CheckIn     = false;
            emp.CheckinTime = null;
            entities.SaveChanges();
            return(true);
            // string sql = "update Employee set checkin=0 where EmployeeNumber=@number";
            //return SqlHelper.ExecuteNonQuery(conn, System.Data.CommandType.Text, sql, new SqlParameter("@number", employeeNumber)) > 0;
        }
예제 #2
0
        /// <summary>
        /// 清空中奖结果
        /// </summary>
        /// <returns></returns>
        public bool ClearAward()
        {
            AnnualPartyEntities entities = new AnnualPartyEntities();

            foreach (var employee in entities.Employee)
            {
                employee.Award     = -1;
                employee.AwardTime = null;
            }
            entities.SaveChanges();
            return(true);
            //string sql = "update Employee set Award=-1,AwardTime=null,AwardName=''";
            //return SqlHelper.ExecuteNonQuery(conn, System.Data.CommandType.Text, sql) > 0;
        }
예제 #3
0
        /// <summary>
        /// 清空签到结果
        /// </summary>
        /// <returns></returns>
        public bool ClearCheckIn()
        {
            AnnualPartyEntities entities = new AnnualPartyEntities();

            foreach (var employee in entities.Employee)
            {
                employee.CheckIn     = false;
                employee.CheckinTime = null;
            }
            entities.SaveChanges();
            return(true);
            //string sql = "update Employee set checkin=0,CheckinTime=null";
            //return SqlHelper.ExecuteNonQuery(conn, System.Data.CommandType.Text, sql) > 0;
        }
예제 #4
0
        public bool CheckInAll()
        {
            AnnualPartyEntities entities = new AnnualPartyEntities();

            foreach (var emp in entities.Employee)
            {
                emp.CheckIn     = true;
                emp.CheckinTime = DateTime.Now;
            }
            entities.SaveChanges();
            return(true);
            // string sql = "update Employee set checkin=1,CheckinTime=GETDATE() where EmployeeNumber=@number";
            //return SqlHelper.ExecuteNonQuery(conn, System.Data.CommandType.Text, sql, new SqlParameter("@number", employeeNumber)) > 0;
        }
예제 #5
0
        /// <summary>
        /// 插入一个员工照片
        /// </summary>
        /// <param name="number"></param>
        /// <param name="img"></param>
        public void InitPhoto(string number, Image img)
        {
            AnnualPartyEntities entities = new AnnualPartyEntities();
            Photo p = new Photo()
            {
                EmployeeNumber = number, PhotoData = ImageToByte(img)
            };

            entities.Photo.Add(p);
            entities.SaveChanges();
            //string sql = "insert into Photo values(@num,@img)";
            //SqlParameter p1 = new SqlParameter("@num", number);
            //SqlParameter p2 = new SqlParameter("@img", ImageToByte(img));
            //SqlHelper.ExecuteNonQuery(conn, System.Data.CommandType.Text, sql,p1,p2);
        }
예제 #6
0
        /// <summary>
        /// 将中奖结果写入数据库
        /// </summary>
        /// <param name="number"></param>
        /// <param name="award"></param>
        /// <returns></returns>
        public bool UpdateAward(string number, int award, string awardName)
        {
            AnnualPartyEntities entities = new AnnualPartyEntities();
            var emp = entities.Employee.SingleOrDefault(e => e.EmployeeNumber == number);

            emp.Award     = award;
            emp.AwardTime = DateTime.Now;

            entities.SaveChanges();
            return(true);
            // string sql = "update Employee set Award=@award,AwardTime=getdate(),AwardName=@aindex where EmployeeNumber=@number";
            //return SqlHelper.ExecuteNonQuery(conn, System.Data.CommandType.Text, sql,
            //    new SqlParameter("@award", award),
            //    new SqlParameter("@number", number),
            //    new SqlParameter("@aindex", awardName)) > 0;
        }
예제 #7
0
        /// <summary>
        /// 插入一个员工信息
        /// </summary>
        /// <param name="e"></param>
        public void InitEmployee(MyEmployee e)
        {
            AnnualPartyEntities entities = new AnnualPartyEntities();
            Employee            employee = new Employee();

            employee.EmployeeNumber = e.EmployeeNumber;
            employee.Dept           = e.Dept;
            employee.Name           = e.Name;
            employee.PinyinFull     = e.Pinyin;
            employee.PinyinShort    = e.ShortPinyin;
            employee.Alias          = e.Alias;
            entities.Employee.Add(employee);
            entities.SaveChanges();
            // string sql =
            //    "insert into Employee(EmployeeNumber,Name,Dept,Alias,PinyinFull,PinyinShort) values(@num,@name,@dept,@alias,@pinyin,@pinyinshort)";
            //SqlParameter p1 = new SqlParameter("@num", e.EmployeeNumber);
            //SqlParameter p2 = new SqlParameter("@name", e.Name);
            //SqlParameter p3 = new SqlParameter("@dept", e.Dept);
            //SqlParameter p4 = new SqlParameter("@alias", e.Alias);
            //SqlParameter p5 = new SqlParameter("@pinyin", e.Pinyin);
            //SqlParameter p6 = new SqlParameter("@pinyinshort", e.ShortPinyin);
            //SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql, p1, p2, p3, p4, p5, p6);
        }
예제 #8
0
 /// <summary>
 /// 插入一个员工照片
 /// </summary>
 /// <param name="number"></param>
 /// <param name="img"></param>
 public void InitPhoto(string number, Image img)
 {
      AnnualPartyEntities entities = new AnnualPartyEntities();
      Photo p=new Photo() {EmployeeNumber = number,PhotoData = ImageToByte(img) };
     entities.Photo.Add(p);
     entities.SaveChanges();
     //string sql = "insert into Photo values(@num,@img)";
     //SqlParameter p1 = new SqlParameter("@num", number);
     //SqlParameter p2 = new SqlParameter("@img", ImageToByte(img));
     //SqlHelper.ExecuteNonQuery(conn, System.Data.CommandType.Text, sql,p1,p2);
 }
예제 #9
0
 /// <summary>
 /// 插入一个员工信息
 /// </summary>
 /// <param name="e"></param>
 public void InitEmployee(MyEmployee e)
 {
      AnnualPartyEntities entities = new AnnualPartyEntities();
      Employee employee=new Employee();
     employee.EmployeeNumber = e.EmployeeNumber;
     employee.Dept = e.Dept;
     employee.Name = e.Name;
     employee.PinyinFull = e.Pinyin;
     employee.PinyinShort = e.ShortPinyin;
     employee.Alias = e.Alias;
     entities.Employee.Add(employee);
     entities.SaveChanges();
     // string sql =
     //    "insert into Employee(EmployeeNumber,Name,Dept,Alias,PinyinFull,PinyinShort) values(@num,@name,@dept,@alias,@pinyin,@pinyinshort)";
     //SqlParameter p1 = new SqlParameter("@num", e.EmployeeNumber);
     //SqlParameter p2 = new SqlParameter("@name", e.Name);
     //SqlParameter p3 = new SqlParameter("@dept", e.Dept);
     //SqlParameter p4 = new SqlParameter("@alias", e.Alias);
     //SqlParameter p5 = new SqlParameter("@pinyin", e.Pinyin);
     //SqlParameter p6 = new SqlParameter("@pinyinshort", e.ShortPinyin);
     //SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql, p1, p2, p3, p4, p5, p6);
 }
예제 #10
0
       /// <summary>
       /// 清空中奖结果
       /// </summary>
       /// <returns></returns>
       public bool ClearAward()
       {
            AnnualPartyEntities entities = new AnnualPartyEntities();

            foreach (var employee in entities.Employee)
            {
                employee.Award = -1;
                employee.AwardTime = null;
               
            }
            entities.SaveChanges();
            return true;
            //string sql = "update Employee set Award=-1,AwardTime=null,AwardName=''";
            //return SqlHelper.ExecuteNonQuery(conn, System.Data.CommandType.Text, sql) > 0;
        }
예제 #11
0
       /// <summary>
       /// 将中奖结果写入数据库
       /// </summary>
       /// <param name="number"></param>
       /// <param name="award"></param>
       /// <returns></returns>
       public bool UpdateAward(string number, int award, string awardName)
       {
           AnnualPartyEntities entities = new AnnualPartyEntities();
           var emp = entities.Employee.SingleOrDefault(e => e.EmployeeNumber == number);
           emp.Award = award;
           emp.AwardTime = DateTime.Now;

           entities.SaveChanges();
           return true;
           // string sql = "update Employee set Award=@award,AwardTime=getdate(),AwardName=@aindex where EmployeeNumber=@number";
           //return SqlHelper.ExecuteNonQuery(conn, System.Data.CommandType.Text, sql, 
           //    new SqlParameter("@award", award), 
           //    new SqlParameter("@number", number),
           //    new SqlParameter("@aindex", awardName)) > 0;
       }
예제 #12
0
       /// <summary>
       /// 清空签到结果
       /// </summary>
       /// <returns></returns>
       public bool ClearCheckIn()
        {
            AnnualPartyEntities entities = new AnnualPartyEntities();

           foreach (var employee in entities.Employee)
           {
               employee.CheckIn = false;
               employee.CheckinTime = null;
           }
           entities.SaveChanges();
           return true;
            //string sql = "update Employee set checkin=0,CheckinTime=null";
            //return SqlHelper.ExecuteNonQuery(conn, System.Data.CommandType.Text, sql) > 0;
        }
예제 #13
0
  /// <summary>
  /// 取消签到
  /// </summary>
  /// <param name="employeeNumber"></param>
  /// <returns></returns>
  public bool CheckOut(string employeeNumber)
 {
      AnnualPartyEntities entities = new AnnualPartyEntities();
      var emp = entities.Employee.SingleOrDefault(e => e.EmployeeNumber == employeeNumber);
      emp.CheckIn = false;
      emp.CheckinTime = null;
      entities.SaveChanges();
      return true;
     // string sql = "update Employee set checkin=0 where EmployeeNumber=@number";
     //return SqlHelper.ExecuteNonQuery(conn, System.Data.CommandType.Text, sql, new SqlParameter("@number", employeeNumber)) > 0;
 }
예제 #14
0
  public bool CheckInAll()
  {
      AnnualPartyEntities entities = new AnnualPartyEntities();
      foreach (var emp in entities.Employee)
      {
 
      emp.CheckIn = true;
      emp.CheckinTime = DateTime.Now;
      }
      entities.SaveChanges();
      return true;
      // string sql = "update Employee set checkin=1,CheckinTime=GETDATE() where EmployeeNumber=@number";
      //return SqlHelper.ExecuteNonQuery(conn, System.Data.CommandType.Text, sql, new SqlParameter("@number", employeeNumber)) > 0;
  }