コード例 #1
0
        protected void Btn_Update_Click(object sender, EventArgs e)
        {
            BackupDeviceModel backupDevice = new BackupDeviceModel();
            int id = Int32.Parse(Request.QueryString["id"]);

            backupDevice.setId(id);
            backupDevice.setTypeId(Int32.Parse(this.TypeId.SelectedValue));
            backupDevice.setDeviceName(this.DeviceName.Text);
            backupDevice.setDeviceModel(this.DeviceModel.Text);
            backupDevice.setPrice(Convert.ToSingle(this.Price.Text));
            backupDevice.setDeviceFrom(this.DeviceFrom.Text);
            backupDevice.setManufacturer(this.Manufacturer.Text);
            backupDevice.setInDate(this.InDate.Text);
            backupDevice.setOutDate(this.OutDate.Text);
            backupDevice.setStockCount(Int32.Parse(this.StockCount.Text));
            backupDevice.setInOperator(this.InOperator.Text);
            backupDevice.setOutOperator(this.OutOperator.Text);

            if (BackupDeviceDAO.UpdateDeviceModel(backupDevice))
            {
                Response.Write("<script>alert('更新成功!');location.href='BackupDeviceManage.aspx';</script>");
            }
            else
            {
                Response.Write("<script>alert('更新失敗!');</script>");
            }
        }
コード例 #2
0
        /*取得某個備用設備資訊*/

        public static BackupDeviceModel GetBackupDevice(int id)
        {
            BackupDeviceModel backupDevice = null;
            string            queryString  = "select * from [t_device_backup] where id=" + id;
            DataBase          db           = new DataBase();
            DataSet           deviceDs     = db.GetDataSet(queryString);

            if (deviceDs.Tables[0].Rows.Count > 0)
            {
                backupDevice = new BackupDeviceModel();
                DataRow dr = deviceDs.Tables[0].Rows[0];
                backupDevice.setTypeId(Convert.ToInt32(dr["typeId"]));
                backupDevice.setDeviceName(dr["deviceName"].ToString());
                backupDevice.setDeviceModel(dr["deviceModel"].ToString());
                backupDevice.setPrice(Convert.ToSingle(dr["price"]));
                backupDevice.setDeviceFrom(dr["deviceFrom"].ToString());
                backupDevice.setManufacturer(dr["manufacturer"].ToString());
                backupDevice.setInDate(dr["inDate"].ToString());
                backupDevice.setOutDate(dr["outDate"].ToString());
                backupDevice.setStockCount(Convert.ToInt32(dr["stockCount"]));
                backupDevice.setInOperator(dr["inOperator"].ToString());
                backupDevice.setOutOperator(dr["outOperator"].ToString());
            }
            return(backupDevice);
        }
コード例 #3
0
        protected void Btn_Add_Click(object sender, EventArgs e)
        {
            BackupDeviceModel backupDevice = new BackupDeviceModel();

            backupDevice.setTypeId(Int32.Parse(this.TypeId.SelectedValue));
            backupDevice.setDeviceName(this.DeviceName.Text);
            backupDevice.setDeviceModel(this.DeviceModel.Text);
            backupDevice.setPrice(Convert.ToSingle(this.Price.Text));
            backupDevice.setDeviceFrom(this.DeviceFrom.Text);
            backupDevice.setManufacturer(this.Manufacturer.Text);
            backupDevice.setInDate(this.InDate.Text);
            backupDevice.setOutDate(this.OutDate.Text);
            backupDevice.setStockCount(Int32.Parse(this.StockCount.Text));
            backupDevice.setInOperator(this.InOperator.Text);
            backupDevice.setOutOperator(this.OutOperator.Text);

            if (BackupDeviceDAO.AddBackupDevice(backupDevice))
            {
                Response.Write("<script>alert('備用備件登記成功!');location.href='BackupDeviceAdd.aspx';</script>");
            }
            else
            {
                Response.Write("<script>alert('備用備件登記失敗!');location.href='BackupDeviceAdd.aspx';</script>");
            }
        }