protected void Page_Load(object sender, EventArgs e) { this.PageType = Eyousoft.Common.Page.PageType.boxyPage; int FixedID = Utils.GetInt(Request["FixedID"], -1); string Method = Utils.GetFormValue("hidMethod"); if (!IsPostBack && FixedID != -1) { //初始化 EyouSoft.BLL.AdminCenterStructure.FixedAsset bllFixedAsset = new EyouSoft.BLL.AdminCenterStructure.FixedAsset(); EyouSoft.Model.AdminCenterStructure.FixedAsset modelFixedAsset = bllFixedAsset.GetModel(CurrentUserCompanyID, FixedID); if (modelFixedAsset != null) { this.hidFixedID.Value = modelFixedAsset.Id.ToString(); Number = modelFixedAsset.AssetNo; AssetName = modelFixedAsset.AssetName; BuyTime = modelFixedAsset.BuyDate; Cost = modelFixedAsset.Cost; Reamrk = modelFixedAsset.Remark; } } if (Method == "save") { EyouSoft.BLL.AdminCenterStructure.FixedAsset bllFixedAsset = new EyouSoft.BLL.AdminCenterStructure.FixedAsset(); EyouSoft.Model.AdminCenterStructure.FixedAsset modelFixedAsset = new EyouSoft.Model.AdminCenterStructure.FixedAsset(); modelFixedAsset.AssetNo = Utils.GetFormValue("txt_Number"); modelFixedAsset.AssetName = Utils.GetFormValue("txt_AssetName"); modelFixedAsset.BuyDate = Utils.GetDateTime(Request.Form["txt_BuyTime"], new DateTime(1990, 01, 01)); modelFixedAsset.Cost = Utils.GetDecimal(Request.Form["txt_Cost"]); modelFixedAsset.Remark = Utils.GetFormValue("txt_Reamrk", 250); modelFixedAsset.CompanyId = CurrentUserCompanyID; if (FixedID == -1) { if (!CheckGrant(global::Common.Enum.TravelPermission.行政中心_固定资产管理_新增资产)) { Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.行政中心_固定资产管理_新增资产, true); } if (bllFixedAsset.Add(modelFixedAsset)) { MessageBox.ResponseScript(this, string.Format("alert('{0}');window.parent.Boxy.getIframeDialog('{1}').hide();window.parent.location='{2}';", "保存成功!", Utils.GetQueryStringValue("iframeId"), "/administrativeCenter/fixedAssetsManage/Default.aspx")); } else { MessageBox.Show(this.Page, "保存失败!"); } } if (FixedID != -1) { if (!CheckGrant(global::Common.Enum.TravelPermission.行政中心_固定资产管理_修改资产)) { Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.行政中心_固定资产管理_删除资产, true); } modelFixedAsset.Id = Utils.GetInt(this.hidFixedID.Value); if (bllFixedAsset.Update(modelFixedAsset)) { MessageBox.ResponseScript(this, string.Format("alert('{0}');window.parent.Boxy.getIframeDialog('{1}').hide();window.parent.location='{2}';", "修改成功!", Utils.GetQueryStringValue("iframeId"), "/administrativeCenter/fixedAssetsManage/Default.aspx")); } else { MessageBox.Show(this.Page, "修改失败!"); } } } }
protected void Page_Load(object sender, EventArgs e) { int FixedAssetID = Utils.GetInt(Request.QueryString["FixedAssetID"], -1); string method = Utils.GetQueryStringValue("Method"); PageIndex = Utils.GetInt(Request.QueryString["Page"], -1); if (!IsPostBack && FixedAssetID == -1) { if (CheckGrant(global::Common.Enum.TravelPermission.行政中心_固定资产管理_修改资产)) { EditFlag = true; } if (CheckGrant(global::Common.Enum.TravelPermission.行政中心_固定资产管理_删除资产)) { DeleteFlag = true; } string Number = Utils.InputText(Utils.GetQueryStringValue("Number")); string AssetName = Utils.InputText(Utils.GetQueryStringValue("AssetName")); DateTime?BuyTimeStart = Utils.GetDateTimeNullable(Request.QueryString["BuyTimeStart"]); DateTime?BuyTimeEnd = Utils.GetDateTimeNullable(Request.QueryString["BuyTimeEnd"]); EyouSoft.BLL.AdminCenterStructure.FixedAsset bllFixedAsset = new EyouSoft.BLL.AdminCenterStructure.FixedAsset(); IList <EyouSoft.Model.AdminCenterStructure.FixedAsset> listFixedAsset = bllFixedAsset.GetList(PageSize, PageIndex, ref RecordCount, CurrentUserCompanyID, Number, AssetName, BuyTimeStart, BuyTimeEnd); if (listFixedAsset != null && listFixedAsset.Count > 0) { this.crptFixedAssetsList.DataSource = listFixedAsset;//绑定数据 this.crptFixedAssetsList.DataBind(); BindPage(); } else { this.crptFixedAssetsList.EmptyText = "<tr><td colspan=\"11\"><div style=\"text-align:center; margin-top:75px; margin-bottom:75px;\">没有相关的数据!</span></div></td></tr>"; this.ExporPageInfoSelect1.Visible = false; } } if (method == "DeleteFixedAsset" && FixedAssetID != -1)//删除 { if (!CheckGrant(global::Common.Enum.TravelPermission.行政中心_固定资产管理_删除资产)) { Response.Clear(); Response.Write("NoPermission"); Response.End(); } else { EyouSoft.BLL.AdminCenterStructure.FixedAsset bllFixedAsset = new EyouSoft.BLL.AdminCenterStructure.FixedAsset(); if (bllFixedAsset.Delete(CurrentUserCompanyID, FixedAssetID)) { Response.Clear(); Response.Write("True"); Response.End(); } else { Response.Clear(); Response.Write("False"); Response.End(); } } } }