Example #1
0
        //AcDrawGroundPostShield
        public static BEquipStatus SelectByACode(int ACode)
        {
            SqlConnection  connection = new SqlConnection(ConnectionString.LocalcnString);
            SqlDataAdapter adapter    = new SqlDataAdapter("B_EquipStatus_SelectMyACode", connection);

            adapter.SelectCommand.CommandType = CommandType.StoredProcedure;
            adapter.SelectCommand.Parameters.Add(new SqlParameter("iACode", ACode));
            DataSet dsProduct = new DataSet();

            connection.Open();
            adapter.Fill(dsProduct);
            BEquipStatus product = new BEquipStatus();

            if (dsProduct.Tables[0].Rows.Count > 0)
            {
                product.Code                = Convert.ToInt32(dsProduct.Tables[0].Rows[0]["Code"].ToString());
                product.Name                = dsProduct.Tables[0].Rows[0]["Name"].ToString();
                product.ACode               = Convert.ToInt32(dsProduct.Tables[0].Rows[0]["ACode"].ToString());
                product.IsDefault           = Convert.ToBoolean(dsProduct.Tables[0].Rows[0]["IsDefault"].ToString());
                product.PricePercent        = Convert.ToDouble(dsProduct.Tables[0].Rows[0]["PricePercent"].ToString());
                product.ExecutePricePercent = Convert.ToDouble(dsProduct.Tables[0].Rows[0]["ExecutePricePercent"].ToString());
                product.WagePricePercent    = Convert.ToDouble(dsProduct.Tables[0].Rows[0]["WagePricePercent"].ToString());
            }
            else
            {
                product.Code = -1;
            }
            connection.Close();
            return(product);
        }
Example #2
0
        //frmDrawBus
        public static BEquipStatus SelectByCode(int Code)
        {
            SqlConnection  connection = new SqlConnection(ConnectionString.LocalcnString);
            SqlDataAdapter adapter    = new SqlDataAdapter("B_EquipStatus_Select", connection);

            adapter.SelectCommand.CommandType = CommandType.StoredProcedure;
            adapter.SelectCommand.Parameters.Add(new SqlParameter("iCode", Code));
            DataSet dsProduct = new DataSet();

            connection.Open();
            adapter.Fill(dsProduct);
            BEquipStatus product = new BEquipStatus();

            if (dsProduct.Tables[0].Rows.Count > 0)
            {
                product.Code                = Convert.ToInt32(dsProduct.Tables[0].Rows[0]["Code"].ToString());
                product.Name                = dsProduct.Tables[0].Rows[0]["Name"].ToString();
                product.ACode               = Convert.ToInt32(dsProduct.Tables[0].Rows[0]["ACode"].ToString());
                product.IsDefault           = Convert.ToBoolean(dsProduct.Tables[0].Rows[0]["IsDefault"].ToString());
                product.PricePercent        = Convert.ToDouble(dsProduct.Tables[0].Rows[0]["PricePercent"].ToString());
                product.ExecutePricePercent = Convert.ToDouble(dsProduct.Tables[0].Rows[0]["ExecutePricePercent"].ToString());
                product.WagePricePercent    = Convert.ToDouble(dsProduct.Tables[0].Rows[0]["WagePricePercent"].ToString());
            }
            else
            {
                product.Code = -1;
            }

            adapter.SelectCommand.Parameters.Clear();
            adapter.SelectCommand.CommandText = "B_Status_WorkOrder_SelectByStatusEquipCode";
            adapter.SelectCommand.Parameters.Add(new SqlParameter("iEquipStatusCode", product.Code));
            SqlDataReader dr = adapter.SelectCommand.ExecuteReader();

            ArrayList a1 = new ArrayList();

            while (dr.Read())
            {
                a1.Add(dr["WorkOrderCode"].ToString());
            }
            dr.Close();
            product.ArraySub = a1;
            connection.Close();
            return(product);
        }