Esempio n. 1
0
        /// <summary>
        /// 插入人员外出信息
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>

        public bool InsertPersoOutInfo(PersonOutInfo info)
        {
            bool isresult = false;

            using (OleDbConnection connection = new OleDbConnection(DbHelperACE.connectionString))
            {
                OleDbCommand command = new OleDbCommand();
                command.Connection  = connection;
                command.CommandText = @"Insert INTO PersonOutInfo (NAMEID,NAME,INCIDENT,OUTTIME,BACKTIME,BZ,OPERATOR,OPERATORTIME,OPERATORID,A1,A2,A3,OUTTIMEHOUR,OUTTIMEMINUTE,BACKTIMEHOUR,BACKTIMEMINUTE ) values ('" + info.NAMEID + "','" + info.NAME + "','" + info.INCIDENT + "','" + info.OUTTIME + "','" + info.BACKTIME + "','" + info.BZ + "','" + info.OPERATOR + "','" + info.OPERATORTIME + "','" + info.OPERATORID + "','" + info.A1 + "','" + info.A2 + "','" + info.A3 + "','" + info.OUTTIMEHOUR + "','" + info.OUTTIMEMINUTE + "','" + info.BACKTIMEHOUR + "','" + info.BACKTIMEMINUTE + "' )";
                command.CommandType = CommandType.Text;
                try
                {
                    connection.Open();
                    int rows = command.ExecuteNonQuery();
                    isresult = true;
                }
                catch (System.Data.OleDb.OleDbException E)
                {
                    throw new Exception(E.Message);
                }
                finally
                {
                    command.Dispose();
                    connection.Close();
                }
            }

            return(isresult);
        }
Esempio n. 2
0
        public PersonOutInfoDialog(PersonOutInfo basicinfo, bool isReadOnly)
        {
            InitializeComponent();

            InitControl();

            IsReadOnly = isReadOnly;


            info = basicinfo;


            InitData();


            this.grid_main.DataContext = info;

            if (IsReadOnly == true)
            {
                this.grid_main.IsEnabled = false;
            }
            else
            {
                IsModify = true;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 修改人员信息
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public bool ModifyPersonOutInfo(PersonOutInfo info)
        {
            bool isresult = false;

            using (OleDbConnection connection = new OleDbConnection(DbHelperACE.connectionString))
            {
                OleDbCommand command = new OleDbCommand();
                command.Connection  = connection;
                command.CommandText = UpdatePersonOutInfoSql + @"  NAMEID = '" + info.NAMEID + "'"
                                      + @" , NAME = '" + info.NAME + "'"
                                      + @" , INCIDENT = '" + info.INCIDENT + "'"
                                      + @" , OUTTIME = '" + info.OUTTIME + "'"
                                      + @" , BACKTIME = '" + info.BACKTIME + "'"
                                      + @" , BZ = '" + info.BZ + "'"
                                      + @" , OPERATOR = '" + info.OPERATOR + "'"
                                      + @" , OPERATORTIME = '" + info.OPERATORTIME + "'"
                                      + @" , OPERATORID = '" + info.OPERATORID + "'"

                                      + @" , A1 = '" + info.A1 + "'"
                                      + @" , A2 = '" + info.A2 + "'"
                                      + @" , A3 = '" + info.A3 + "'"
                                      + @" , OUTTIMEHOUR = '" + info.OUTTIMEHOUR + "'"
                                      + @" , OUTTIMEMINUTE = '" + info.OUTTIMEMINUTE + "'"
                                      + @" , BACKTIMEHOUR = '" + info.BACKTIMEHOUR + "'"
                                      + @" , BACKTIMEMINUTE = '" + info.BACKTIMEMINUTE + "'"
                                      + @" where   ID =" + info.ID + "";



                command.CommandType = CommandType.Text;


                try
                {
                    connection.Open();
                    int rows = command.ExecuteNonQuery();
                    isresult = true;
                }
                catch (System.Data.OleDb.OleDbException E)
                {
                    throw new Exception(E.Message);
                }
                finally
                {
                    command.Dispose();
                    connection.Close();
                }
            }

            return(isresult);
        }
Esempio n. 4
0
        public void dataGridTemplate_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                DataGridRow dgr = DataGridRow.GetRowContainingElement(e.OriginalSource as FrameworkElement);
                if (dgr != null)
                {
                    PersonOutInfo personBasicInfo = dgr.DataContext as PersonOutInfo;
                    if (personBasicInfo != null)
                    {
                        PersonOutInfoDialog dialog = new PlanDatabase.PersonOutInfoDialog(personBasicInfo, true);

                        dialog.Show();
                    }
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 获取人员外出信息
        /// </summary>
        /// <returns>所有人员外出信息</returns>

        public List <PersonOutInfo> GetPersonOutInfos(string nameid, string incident, string fromdate, string todate)
        {
            if (!string.IsNullOrEmpty(incident))
            {
                SelectPersonOutInfoListSql += "and  INCIDENT = '" + incident + "'  ";
            }



            if (!string.IsNullOrEmpty(nameid))
            {
                SelectPersonOutInfoListSql += "and  NAMEID = '" + nameid + "'  ";
            }



            if (!string.IsNullOrEmpty(fromdate))
            {
                SelectPersonOutInfoListSql += "and   Format(OUTTIME,\"yyyy-mm-dd\") >= '" + fromdate + "'  ";
            }

            if (!string.IsNullOrEmpty(todate))
            {
                SelectPersonOutInfoListSql += "and   Format(BACKTIME,\"yyyy-mm-dd\") <= '" + todate + "'  ";
            }


            SelectPersonOutInfoListSql += " order by OPERATORTIME desc";


            DataSet ds = DbHelperACE.Query(SelectPersonOutInfoListSql);

            List <PersonOutInfo> list = new List <PersonOutInfo>();
            DataRowCollection    drs  = ds.Tables[0].Rows;

            for (int i = 0; i < drs.Count; i++)
            {
                PersonOutInfo item = new PersonOutInfo();


                item.ID       = drs[i]["ID"].ToString().Trim();
                item.NAMEID   = drs[i]["NAMEID"].ToString().Trim();
                item.NAME     = drs[i]["NAME"].ToString().Trim();
                item.INCIDENT = drs[i]["INCIDENT"].ToString().Trim();


                item.OUTTIMEHOUR = drs[i]["OUTTIMEHOUR"].ToString().Trim();
                if (string.IsNullOrEmpty(drs[i]["OUTTIMEMINUTE"].ToString()))
                {
                    item.OUTTIMEMINUTE = "00";
                }
                else
                {
                    item.OUTTIMEMINUTE = drs[i]["OUTTIMEMINUTE"].ToString().Trim();
                }

                item.BACKTIMEHOUR = drs[i]["BACKTIMEHOUR"].ToString().Trim();


                if (string.IsNullOrEmpty(drs[i]["BACKTIMEMINUTE"].ToString()))
                {
                    item.BACKTIMEMINUTE = "00";
                }
                else
                {
                    item.BACKTIMEMINUTE = drs[i]["BACKTIMEMINUTE"].ToString().Trim();
                }

                try
                {
                    if (drs[i]["OUTTIME"] != null && drs[i]["OUTTIME"].ToString() != string.Empty)
                    {
                        item.OUTTIME = Convert.ToDateTime(drs[i]["OUTTIME"]).ToString("yyyy-MM-dd") + " " + item.OUTTIMEHOUR + "时" + item.OUTTIMEMINUTE + "分";
                    }
                }
                catch
                {
                    item.OUTTIME = drs[i]["OUTTIME"].ToString().Trim();
                }



                try
                {
                    if (drs[i]["BACKTIME"] != null && drs[i]["BACKTIME"].ToString() != string.Empty)
                    {
                        item.BACKTIME = Convert.ToDateTime(drs[i]["BACKTIME"]).ToString("yyyy-MM-dd") + " " + item.BACKTIMEHOUR + "时" + item.BACKTIMEMINUTE + "分";
                    }
                }
                catch
                {
                    item.BACKTIME = drs[i]["BACKTIME"].ToString().Trim();
                }



                item.BZ       = drs[i]["BZ"].ToString().Trim();
                item.OPERATOR = drs[i]["OPERATOR"].ToString().Trim();

                if (drs[i]["OPERATORTIME"] != null && drs[i]["OPERATORTIME"].ToString() != string.Empty)
                {
                    item.OPERATORTIME = Convert.ToDateTime(drs[i]["OPERATORTIME"]);
                }


                try
                {
                    if (drs[i]["OPERATORTIME"] != null && drs[i]["OPERATORTIME"].ToString() != string.Empty)
                    {
                        item.OPERATORTIME = Convert.ToDateTime(drs[i]["OPERATORTIME"]).ToLocalTime();
                    }
                }
                catch
                {
                    //item.OPERATORTIME =null;
                }



                item.OPERATORID = drs[i]["OPERATORID"].ToString().Trim();


                item.A1 = drs[i]["A1"].ToString().Trim();
                item.A2 = drs[i]["A2"].ToString().Trim();
                item.A3 = drs[i]["A3"].ToString().Trim();



                list.Add(item);
            }
            return(list);
        }