/// <summary>
        /// /// <summary>
        /// 只更新原来数据中的EMPL_CODE,VALID_STATE,SORT_ID
        /// </summary>
        /// </summary>
        /// <param name="pkId"></param>
        ///
        /// <param name="info"></param>
        /// <returns></returns>

        public int Update(string pkId, FinanceGroup info)
        {
            string strSql = "";

            if (this.Sql.GetSql("Fee.EmployeeFinanceGroup.Update", ref strSql) == -1)
            {
                return(-1);
            }

            try
            {
                //strSql = string.Format(strSql,pkId,info.ID,info.Name,info.EmployeeID,info.ValidState,info.SortID,this.Operator.ID);
                strSql = string.Format(strSql, info.Name, ((int)info.ValidState).ToString(), info.SortID, pkId);
            }
            catch (Exception ex)
            {
                this.ErrCode = ex.Message;
                this.Err     = ex.Message;
                return(-1);
            }

            try
            {
                return(this.ExecNoQuery(strSql));
            }
            catch (Exception ex)
            {
                this.ErrCode = ex.Message;
                this.Err     = ex.Message;
                return(-1);
            }
        }
        public ArrayList GetFinaceGroupAll()
        {
            string strSql = "";

            if (this.Sql.GetSql("Fee.EmployeeFinanceGroup.GetFinaceGroupAll", ref strSql) == -1)
            {
                return(null);
            }
            try
            {
                ArrayList List = new ArrayList();
                this.ExecQuery(strSql);
                while (this.Reader.Read())
                {
                    FinanceGroup info = new FinanceGroup();
                    info.ID   = Reader[0].ToString();
                    info.Name = Reader[1].ToString();
                    List.Add(info);
                }

                return(List);
            }
            catch (Exception ex)
            {
                this.ErrCode = ex.Message;
                this.Err     = ex.Message;
                return(null);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public System.Collections.ArrayList GetFinaceGroupInfoAll()
        {
            string strSql = "";

            if (this.Sql.GetSql("Fee.EmployeeFinanceGroup.GetFinaceGroupInfo.All", ref strSql) == -1)
            {
                return(null);
            }


            try
            {
                ArrayList List = new ArrayList();
                this.ExecQuery(strSql);
                while (this.Reader.Read())
                {
                    FinanceGroup info = new FinanceGroup();
                    info.PkID          = Reader[0].ToString();
                    info.ID            = Reader[1].ToString();
                    info.Name          = Reader[2].ToString();
                    info.Employee.ID   = Reader[3].ToString();
                    info.Employee.Name = Reader[4].ToString();
                    info.ValidState    = (Neusoft.HISFC.Models.Base.EnumValidState)NConvert.ToInt32(Reader[5].ToString());
                    try
                    {
                        if (Reader[5].ToString() == "")
                        {
                            info.SortID = 0;
                        }
                        else
                        {
                            info.SortID = (int)Reader[5];
                        }
                    }
                    catch (Exception ee)
                    {
                        string Error = ee.Message;
                        info.SortID = 0;
                    }

                    List.Add(info);
                    info = null;
                }

                return(List);
            }
            catch (Exception ex)
            {
                this.ErrCode = ex.Message;
                this.Err     = ex.Message;
                return(null);
            }
        }
        public ArrayList QueryFinaceGroupIDAndNameAll()
        {
            string sql = string.Empty;

            if (this.Sql.GetSql("Fee.EmployeeFinanceGroup.GetFinaceGroupAll", ref sql) == -1)
            {
                this.Err = "没有找到索引为:Fee.EmployeeFinanceGroup.GetFinaceGroupAll的SQL语句";

                return(null);
            }

            if (this.ExecQuery(sql) == -1)
            {
                return(null);
            }

            ArrayList tempList = new ArrayList();

            try
            {
                while (this.Reader.Read())
                {
                    FinanceGroup financeGroup = new FinanceGroup();
                    financeGroup.ID   = this.Reader[0].ToString();
                    financeGroup.Name = this.Reader[1].ToString();

                    tempList.Add(financeGroup);
                }

                this.Reader.Close();

                return(tempList);
            }
            catch (Exception e)
            {
                this.Err = e.Message;
                if (!this.Reader.IsClosed)
                {
                    this.Reader.Close();
                }

                return(null);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="info"></param>
        ///	 info.ID,info.Name,info.EmployeeID,info.ValidState,info.SortID
        /// FinanceGroup
        /// <returns></returns>
        public int Insert(FinanceGroup info)
        {
            string strSql   = "";
            string OperCode = "";

            try
            {
                OperCode = this.Operator.ID;
            }
            catch (Exception ee)
            {
                string Error = ee.Message;
                OperCode = "unkonwn";
            }
            if (this.Sql.GetSql("Fee.EmployeeFinanceGroup.Insert", ref strSql) == -1)
            {
                return(-1);
            }

            try
            {
                strSql = string.Format(strSql, info.PkID, info.ID, info.Name, info.Employee.ID, ((int)info.ValidState).ToString(), info.SortID, OperCode);
            }
            catch (Exception ex)
            {
                this.ErrCode = ex.Message;
                this.Err     = ex.Message;
                return(-1);
            }

            try
            {
                return(this.ExecNoQuery(strSql));
            }
            catch (Exception ex)
            {
                this.ErrCode = ex.Message;
                this.Err     = ex.Message;
                return(-1);
            }
        }
Example #6
0
File: DB.cs Project: Skovmissen/MCB
        public static List <FinanceGroup> GetAllFinanceGroups() // Lavet af Lasse
        {
            OpenDb();
            List <FinanceGroup> FinanceGroups = new List <FinanceGroup>();
            SqlCommand          command       = new SqlCommand("SELECT * From FinanceGroup ORDER BY [ID]", connection);

            try
            {
                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    FinanceGroup p = new FinanceGroup();
                    p.Name = (string)reader["Name"];
                    FinanceGroups.Add(p);
                }
                CloseDb();
                return(FinanceGroups);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public int Delete(FinanceGroup info)
 {
     return(Delete(info.ID));
 }