Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["year"]))
            {
                int.TryParse(Request.QueryString["year"], out year);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["month"]))
            {
                int.TryParse(Request.QueryString["month"], out month);
            }
            resourceList = new UserResourceBLL().GetResourceByTime(year, month);
            long resId = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["resId"]) && long.TryParse(Request.QueryString["resId"], out resId))
            {
                resQuota = salBll.GetResMonthQuota(resId, year, month);
            }
            long id = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["id"]) && long.TryParse(Request.QueryString["id"], out id))
            {
                resQuota = salBll.GetQuotaById(id);
            }

            if (resQuota != null)
            {
                isAdd = false;
                var thisRes = new UserResourceBLL().GetResourceById(resQuota.resource_id);
                year  = resQuota.year;
                month = resQuota.month;
                if (resourceList == null || (!resourceList.Any(_ => _.id == resQuota.resource_id)))
                {
                    resourceList.Add(thisRes);
                }
            }
        }