Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["username"] == null)
            {
                Response.Write("<script>alert('請先登入系統!');top.location.href='login.aspx';</script>");
                return;
            }
            if (!IsPostBack)
            {
                DataSet deviceTypeDs = DeviceTypeDAO.QueryAllDeviceType();
                for (int i = 0; i < deviceTypeDs.Tables[0].Rows.Count; i++)
                {
                    DataRow  dr = deviceTypeDs.Tables[0].Rows[i];
                    ListItem li = new ListItem(dr["typeName"].ToString(), dr["typeId"].ToString());
                    this.TypeId.Items.Add(li);
                }

                DataSet placeDs = PlaceDAO.QueryAllPlace();
                this.UsePlace.DataSource = placeDs;
                this.UsePlace.DataBind();

                int id = Int32.Parse(Request.QueryString["id"]);
                UsingDeviceModel usingDevice = UsingDeviceDAO.GetUsingDevice(id);
                this.TypeId.SelectedValue   = usingDevice.getTypeId().ToString();
                this.DeviceName.Text        = usingDevice.getDeviceName().ToString();
                this.DeviceModel.Text       = usingDevice.getDeviceModel().ToString();
                this.DeviceFrom.Text        = usingDevice.getDeviceFrom().ToString();
                this.Manufacturer.Text      = usingDevice.getManufacturer().ToString();
                this.UseDate.Text           = usingDevice.getUseDate().ToShortDateString();
                this.DeviceLife.Text        = usingDevice.getDeviceLife().ToString();
                this.UsePlace.SelectedValue = usingDevice.getUsePlace().ToString();
                this.DeviceCount.Text       = usingDevice.getDeviceCount().ToString();
                this.DeviceState.Text       = usingDevice.getDeviceState().ToString();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            {
                if (Session["username"] == null)
                {
                    Response.Write("<script>alert('請先登入系統!');top.location.href='login.aspx';</script>");
                    return;
                }
                if (!IsPostBack)
                {
                    /*初始化設備類別下拉清單*/
                    ListItem li = new ListItem("請選擇", "0");
                    this.TypeId.Items.Add(li);
                    DataSet deviceTypeDs = DeviceTypeDAO.QueryAllDeviceType();
                    for (int i = 0; i < deviceTypeDs.Tables[0].Rows.Count; i++)
                    {
                        DataRow dr = deviceTypeDs.Tables[0].Rows[i];
                        li = new ListItem(dr["typeName"].ToString(), dr["typeId"].ToString());
                        this.TypeId.Items.Add(li);
                    }

                    /*初始化使用地點*/
                    li = new ListItem("請選擇", "");
                    this.UsePlace.Items.Add(li);
                    DataSet placeDs = PlaceDAO.QueryAllPlace();
                    for (int i = 0; i < placeDs.Tables[0].Rows.Count; i++)
                    {
                        DataRow dr = placeDs.Tables[0].Rows[i];
                        li = new ListItem(dr["placeName"].ToString(), dr["placeName"].ToString());
                        this.UsePlace.Items.Add(li);
                    }
                }
            }
        }
Пример #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["username"] == null)
     {
         Response.Write("<script>alert('請先登入系統!');top.location.href='login.aspx';</script>");
         return;
     }
     if (!IsPostBack)
     {
         DataSet deviceTypeDs = DeviceTypeDAO.QueryAllDeviceType();
         for (int i = 0; i < deviceTypeDs.Tables[0].Rows.Count; i++)
         {
             DataRow  dr = deviceTypeDs.Tables[0].Rows[i];
             ListItem li = new ListItem(dr["typeName"].ToString(), dr["typeId"].ToString());
             this.TypeId.Items.Add(li);
         }
         int id = Int32.Parse(Request.QueryString["id"]);
         BackupDeviceModel backupDevice = BackupDeviceDAO.GetBackupDevice(id);
         this.TypeId.SelectedValue = backupDevice.getTypeId().ToString();
         this.DeviceName.Text      = backupDevice.getDeviceName();
         this.DeviceModel.Text     = backupDevice.getDeviceModel();
         this.Price.Text           = backupDevice.getPrice().ToString();
         this.DeviceFrom.Text      = backupDevice.getDeviceFrom();
         this.Manufacturer.Text    = backupDevice.getManufacturer();
         this.InDate.Text          = backupDevice.getInDate();
         this.OutDate.Text         = backupDevice.getOutDate();
         this.StockCount.Text      = backupDevice.getStockCount().ToString();
         this.InOperator.Text      = backupDevice.getInOperator();
         this.OutOperator.Text     = backupDevice.getOutOperator();
     }
 }
Пример #4
0
        private void InitDeviceTypeInfo()
        {
            DataSet deviceTypeDs = DeviceTypeDAO.QueryAllDeviceType();

            this.GridView1.DataSourceID = null;
            GridView1.DataSource        = deviceTypeDs;
            GridView1.DataBind();
        }