コード例 #1
0
ファイル: NewAsset.aspx.cs プロジェクト: blfsir/benzoa
        protected void cmdSubmit_Click(object sender, EventArgs e)
        {
            ActiveRecord.Model.Asset asset = new ActiveRecord.Model.Asset();
            asset.AssetName = this.txtName.Text;
            asset.AssetTypeID = int.Parse(ddlType.SelectedValue);
            string number = this.txtNumber.Text == "" ? "0" : this.txtNumber.Text;
            asset.AssetNumber = int.Parse(number);
            asset.AssetPreviousUserID = int.Parse(ddlOriginalUser.SelectedValue);
            asset.AssetPreviousUserDept = int.Parse(ddlOriginalDept.SelectedValue);
            asset.AssetCurrentUserID = int.Parse(ddlCurrentUser.SelectedValue);
            asset.AssetCurrentUserDept = int.Parse(ddlCurrentDept.SelectedValue);
            asset.AssetCurrentLocation = int.Parse(ddlLocation.SelectedValue);
            asset.AssetCurrentUseState = int.Parse(ddlUseState.SelectedValue);
            asset.AssetBuyUserID = int.Parse(ddlBuyUser.SelectedValue);
            string buyDate = (Request.Form["txtBuyDate"].ToString()=="")?"1900-1-1":Request.Form["txtBuyDate"].ToString();
            asset.AssetBuyDate = DateTime.Parse(buyDate);
            string moveDate = (Request.Form["txtMoveDate"].ToString() == "") ? "1900-1-1" : Request.Form["txtMoveDate"].ToString();
            asset.AssetMoveDate = DateTime.Parse(moveDate);
               // asset.AssetCreateDate = DateTime.Now;
            asset.AssetWarrantyPeriod = this.txtWarrantyPeriod.Text;

            if (this.lblAssetID.Text == "")
            {
                asset.Save();
                Response.Write("<script language=javascript>alert('新增IT设备保存完毕!');</script>");
                Response.Redirect("AssetMange.aspx");
            }
            else
            {
                asset.ID = int.Parse(this.lblAssetID.Text);
                asset.Update();
                Response.Write("<script language=javascript>alert('IT设备更新完毕!');</script>");
                Response.Redirect("AssetMange.aspx");
            }
        }
コード例 #2
0
ファイル: AssetMange.aspx.cs プロジェクト: blfsir/benzoa
        protected void dgAssetList_DeleteCommand(object source, DataGridCommandEventArgs e)
        {
            string StyleID = dgAssetList.DataKeys[e.Item.ItemIndex].ToString();
            ActiveRecord.Model.Asset at = new ActiveRecord.Model.Asset();
            at.ID = int.Parse(StyleID);
            at.Delete();

            Bangding();
        }
コード例 #3
0
ファイル: AssetMange.aspx.cs プロジェクト: blfsir/benzoa
        private void Bangding()
        {
            ActiveRecord.Model.Asset at = new ActiveRecord.Model.Asset();
            ActiveRecord.Model.Asset[] atArrary = ActiveRecord.Model.Asset.FindAll();

            DataTable dt = Converter.ConvertToDataTable(atArrary);

            this.dgAssetList.DataSource = dt;
            this.dgAssetList.DataBind();
        }
コード例 #4
0
ファイル: NewAsset.aspx.cs プロジェクト: blfsir/benzoa
        private void Bangding(int assetID)
        {
            ActiveRecord.Model.Asset at = new ActiveRecord.Model.Asset();
            at = ActiveRecord.Model.Asset.Find(assetID);

            this.txtName.Text = at.AssetName;
            this.txtNumber.Text = at.AssetNumber.ToString();
            this.ddlType.SelectedValue = at.AssetTypeID.ToString();
            this.ddlOriginalUser.SelectedValue = at.AssetPreviousUserID.ToString();
            this.ddlOriginalDept.SelectedValue = at.AssetPreviousUserDept.ToString();
            this.ddlCurrentUser.SelectedValue = at.AssetCurrentUserID.ToString();
            this.ddlCurrentDept.SelectedValue = at.AssetCurrentUserDept.ToString();
            this.ddlLocation.SelectedValue = at.AssetCurrentLocation.ToString();
            this.ddlUseState.SelectedValue = at.AssetCurrentUseState.ToString();
            this.ddlBuyUser.SelectedValue = at.AssetBuyUserID.ToString();
            txtBuyDate.Text = at.AssetBuyDate.ToShortDateString();
            txtMoveDate.Text = at.AssetMoveDate.ToShortDateString();
            txtWarrantyPeriod.Text = at.AssetWarrantyPeriod;
        }