Example #1
0
        /// <summary>
        ///  Map a DataTable's Rows to a List of Dashlet Entity.
        /// </summary>
        /// <returns></returns>
        public static IList <Dashlet> Row2Entity(System.Data.DataTable dt)
        {
            IList <Dashlet> list = null;

            if (dt != null && dt.Rows.Count > 0)
            {
                list = new List <Dashlet>(dt.Rows.Count);
                foreach (System.Data.DataRow row in dt.Rows)
                {
                    Dashlet entity = Row2Entity(row);
                    if (entity != null)
                    {
                        list.Add(entity);
                    }
                }
            }
            return(list);
        }
Example #2
0
        /// <summary>
        ///  Map a DataRow to a Dashlet Entity.
        /// </summary>
        /// <returns></returns>
        public static Dashlet Row2Entity(System.Data.DataRow row)
        {
            if (row == null)
            {
                return(null);
            }

            Dashlet entity = new Dashlet();

            entity._dashletId         = Cast.Int(row["DL_ID"]);
            entity._category          = Cast.String(row["DL_CAT"]);
            entity._title             = Cast.String(row["DL_TITLE"]);
            entity._link              = Cast.String(row["DL_URL"]);
            entity._icon              = Cast.String(row["DL_ICON"]);
            entity._description       = Cast.String(row["DL_DESC"]);
            entity._instanceMethod    = Cast.String(row["DL_INST_TYPE"]);
            entity._instanceParameter = Cast.String(row["DL_PARAM"]);

            return(entity);
        }
Example #3
0
        /// <summary>
        ///  Map a DataRow to a Dashlet Entity.
        /// </summary>
        /// <returns></returns>
        public static Dashlet Row2Entity(System.Data.DataRow row)
        {
            if(row == null) return null;

            Dashlet entity = new Dashlet();

            entity._dashletId= Cast.Int(row["DL_ID"]);
            entity._category= Cast.String(row["DL_CAT"]);
            entity._title= Cast.String(row["DL_TITLE"]);
            entity._link= Cast.String(row["DL_URL"]);
            entity._icon= Cast.String(row["DL_ICON"]);
            entity._description= Cast.String(row["DL_DESC"]);
            entity._instanceMethod= Cast.String(row["DL_INST_TYPE"]);
            entity._instanceParameter= Cast.String(row["DL_PARAM"]);

               return entity;
        }
 //Save Data
 private void SaveData()
 {
     Dashlet dashlet = new  Dashlet();
     bool flag = true;
     try
     {
             dashlet.Category = ddlCategory.SelectedValue;
             dashlet.Title = txtTitle.Text.Trim();
             dashlet.Link = txtLink.Text.Trim();
             dashlet.Icon = txtIcon.Attributes["key"];
             dashlet.Description = txtDescription.Text.Trim();
             dashlet.InstanceMethod = txtInstanceMethod.Text.Trim();
             dashlet.InstanceParameter = txtInstanceParameter.Text.Trim();
         using (_session = new Session())
         {
             if (IsAddNew())
             {
                 flag = dashlet.Create(_session);
             }
             else
             {
                dashlet.DashletId = int.Parse(this.hidDashletId.Value);
                flag = dashlet.Update(_session,  "Category",  "Title",  "Link",  "Icon",  "Description",  "InstanceMethod",  "InstanceParameter");
             }
         }
         this.hidDashletId.Value = dashlet.DashletId.ToString();
        if(flag)
             WebUtil.ShowMsg(this,"操作成功","提示");
        else
             WebUtil.ShowMsg(this,"操作失败","提示");
     }
     catch(UnauthorizedException ex)
     {
         WebUtil.ShowMsg(this,ex.Message,"警告");
     }
     catch(ApplicationException ex)
     {
         WebUtil.ShowMsg(this,ex.Message,"提示");
     }
     catch(Exception ex)
     {
         logger.Info("保存Dashlet", ex);
         WebUtil.ShowMsg(this, "发生未处理的异常,请刷新页面重新操作,或者联系系统管理员");
     }
 }
Example #5
0
 public static string RenderDashlet(Dashlet dashlet)
 {
     return "<span>hello, wolrd!</span>";
 }