예제 #1
0
        public Hashtable GetAllBranch()
        {
            Hashtable retData = new Hashtable();
            string query = @"SELECT [ID], [Name], [Description], [UpdateBy], [UpdateTime] FROM [Branch] ";
            DataSet dataSet = DataAccess.ExecuteQuery(query);

            if ((dataSet != null) && (dataSet.Tables.Count > 0) && (dataSet.Tables[0].Rows.Count > 0))
            {
                for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++)
                {
                    Branch branch = new Branch(dataSet.Tables[0].Rows[i][0].ToString());
                    branch.Name = dataSet.Tables[0].Rows[i][1].ToString();

                    if (dataSet.Tables[0].Rows[i][2] != DBNull.Value)
                    {
                        branch.Description = dataSet.Tables[0].Rows[i][2].ToString();
                    }
                    else
                    {
                        branch.Description = null;
                    }

                    if (dataSet.Tables[0].Rows[i][3] != DBNull.Value)
                    {
                        branch.UpdateBy = dataSet.Tables[0].Rows[i][3].ToString();
                    }
                    else
                    {
                        branch.UpdateBy = null;
                    }

                    if (dataSet.Tables[0].Rows[i][4] != DBNull.Value)
                    {
                        branch.UpdateTime = (DateTime)dataSet.Tables[0].Rows[i][4];
                    }
                    else
                    {
                        branch.UpdateTime = DateTime.MaxValue;
                    }

                    retData[branch.Id] = branch;
                }
            }

            return retData;
        }
 public BranchCalculationResult(Branch branch)
 {
     this.Branch = branch;
 }