Ejemplo n.º 1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (RtbGBInfo.Text != null)
     {
         DialogResult dr = MessageBox.Show("确定录入?一旦录入后将无法修改及删除,或会影响员工的晋升!", "录入警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
         if (dr == DialogResult.Yes)
         {
             WorkerGoodBad goodBad = new WorkerGoodBad();
             goodBad.WorkNo      = lblWorkerNo.Text;
             goodBad.GBType      = CboType.SelectedIndex;
             goodBad.GBInfo      = RtbGBInfo.Text;
             goodBad.GBOperation = AdminInfo.Account;
             goodBad.GBTime      = DtpDate.Value;
             bool n = new WorkerGoodBadService().AddGoodBad(goodBad);
             if (n == true)
             {
                 MessageBox.Show("新增成功!");
                 #region 获取添加操作日志所需的信息
                 OperationLog o = new OperationLog();
                 o.OperationTime    = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd,HH:mm:ss"));
                 o.Operationlog     = AdminInfo.Account + AdminInfo.Name + "于" + DateTime.Now + "对员工:" + lblName.Text + "进行了奖罚情况录入!";
                 o.OperationAccount = LoginInfo.WorkerNo;
                 o.datains_usr      = LoginInfo.WorkerNo;
                 o.datains_date     = DateTime.Now;
                 new OperationlogService().InsertOperationLog(o);
                 #endregion
                 DgvGoodBadList.DataSource = new WorkerGoodBadService().SelectAllGoodBadByWorkNo(lblWorkerNo.Text);
             }
             else
             {
                 MessageBox.Show("或是服务器错误所致!");
             }
         }
         else
         {
             MessageBox.Show("取消录入操作!");
         }
     }
     else
     {
         MessageBox.Show("信息不能为空!");
     }
 }
Ejemplo n.º 2
0
        public static List <WorkerGoodBad> SelectAllGoodBadByWorkNo(string wn)
        {
            List <WorkerGoodBad> gb = new List <WorkerGoodBad>();
            string          sql     = "select * from WorkerGoodBad wgb,GBType gbt where wgb.GBType = gbt.GBType and wgb.WorkNo = '" + wn + "'";
            MySqlConnection conn    = DBHelper.GetConnection();

            conn.Open();
            MySqlDataReader dr = DBHelper.ExecuteReader(sql);

            while (dr.Read())
            {
                WorkerGoodBad goodBad = new WorkerGoodBad();
                goodBad.WorkNo      = dr["WorkNo"].ToString();
                goodBad.GBInfo      = dr["GBInfo"].ToString();
                goodBad.TypeName    = dr["GBName"].ToString();
                goodBad.GBOperation = dr["GBOperation"].ToString();
                goodBad.GBTime      = (DateTime)dr["GBTime"];
                gb.Add(goodBad);
            }
            dr.Close();
            DBHelper.Closecon();
            return(gb);
        }
 public static int AddGoodBad(WorkerGoodBad goodBad)
 {
     return(WorkerGoodBadService.AddGoodBad(goodBad));
 }
Ejemplo n.º 4
0
        public static int AddGoodBad(WorkerGoodBad goodBad)
        {
            string sql = "insert into WorkerGoodBad values('" + goodBad.WorkNo + "','" + goodBad.GBInfo + "','" + goodBad.GBType + "','" + goodBad.GBOperation + "','" + goodBad.GBTime + "')";

            return(DBHelper.ExecuteNonQuery(sql));
        }
 public bool AddGoodBad([FromBody] WorkerGoodBad goodBad)
 {
     return(new WorkerGoodBadService().AddGoodBad(goodBad));
 }