示例#1
0
 /// <summary>
 /// 更新事件{事件}对象(即:一条记录
 /// </summary>
 public int Update(TemplateEvent templateEvent)
 {
     using (var dbContext = UnitOfWork.Get(Unity.ContainerName))
     {
         return(new TemplateEventRepository(dbContext).Update(templateEvent));
     }
 }
示例#2
0
        public List <TemplateEvent> GetTemplatesid(int EventId)
        {
            SqlConnection        DefaultConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString.ToString());
            List <TemplateEvent> TemplatesList     = new List <TemplateEvent>();

            DefaultConnection.Open();
            string        sql       = "Select * From Template where EventId=" + EventId;
            SqlCommand    myCommand = new SqlCommand(sql, DefaultConnection);
            TemplateEvent t;

            using (SqlDataReader dr = myCommand.ExecuteReader())
            {
                while (dr.Read())
                {
                    t = new TemplateEvent
                    {
                        TemplateId   = Convert.ToInt32(dr["Id"].ToString()),
                        TemplateName = dr["Name"].ToString(),
                        EventId      = Convert.ToInt32(dr["EventId"].ToString()),
                    };
                    TemplatesList.Add(t);
                }
            }
            DefaultConnection.Close();
            return(TemplatesList);
        }
        public async Task <Tuple <ErrorResponse, TemplateEvent> > CreateTemplateEvent(Template template)
        {
            var templateEvent = new TemplateEvent
            {
                EventType = EventType.Create
            };

            return(await PersistTemplateEvent(template, EventType.Update));
        }
        private async Task <Tuple <ErrorResponse, TemplateEvent> > PersistTemplateEvent(Template template, EventType eventType)
        {
            var templateEvent = new TemplateEvent
            {
                EventType = eventType,
                Template  = template
            };
            var createdEvent = await repository.CreateTemplateEvent(templateEvent);

            return(new Tuple <ErrorResponse, TemplateEvent>(null, createdEvent));
        }
 /// <summary>
 /// 更新事件{事件}对象(即:一条记录
 /// </summary>
 public int Update(TemplateEvent templateEvent)
 {
     return(Update <TemplateEvent>(templateEvent));
 }
 /// <summary>
 /// 添加事件{事件}对象(即:一条记录
 /// </summary>
 public long Add(TemplateEvent templateEvent)
 {
     return(Add <TemplateEvent>(templateEvent));
 }
示例#7
0
        private bool OnTemplateEvent(int index, EventArgs ea, TemplateEvent type)
        {
            bool result = false;
            // if (BindTemplate != null)
            {
                //                Debug.WriteLine("TemplateEvent: " + type.ToString());
                FluidTemplate template = GetTemplate(index);
                PointEventArgs e = ea as PointEventArgs;

                // set the selected template to this template. A template is always reused and the Index and ItemIndex might change
                // when it is not accessed within the OnBind method (e.g. on a TextChanged event of a TextBox in the template).
                // Therefore these two values are stored on any OnTemplate event, assuming that the control that has the focus and might raise
                // an event is always the control that is inside the template that lately received an event:
                selectedTemplate = template;
                selectedTemplateIndex = template != null ? template.ItemIndex : -1;

                if (template != null)
                {
                    PointEventArgs p = templatePointEventArg;
                    if (e != null)
                    {
                        template.BeginInit();
                        p.X = e.X;
                        p.Y = e.Y;
                        p.Gesture = e.Gesture;
                        p = TranslatePoint(template, p);
                        template.EndInit();
                    }
                    switch (type)
                    {
                        case TemplateEvent.Down:
                            templateIndex = index;
                            template.OnDown(p);
                            break;

                        case TemplateEvent.Up:
                            template.OnUp(p);
                            break;

                        case TemplateEvent.Release:
                            template.OnRelease(p);
                            templateIndex = -1;
                            break;

                        case TemplateEvent.Click:
                            result = template.OnClick(p);
                            break;

                        case TemplateEvent.Move:
                            template.OnMove(p);
                            break;

                        case TemplateEvent.KeyDown:
                            template.OnKeyDown(ea as KeyEventArgs);
                            break;

                        case TemplateEvent.KeyUp:
                            template.OnKeyUp(ea as KeyEventArgs);
                            break;

                        case TemplateEvent.KeyPress:
                            template.OnKeyPress(ea as KeyPressEventArgs);
                            break;

                    }

                }
            }
            return result;
        }
        public async Task <TemplateEvent> CreateTemplateEvent(TemplateEvent templateEvent)
        {
            await AddAsync(templateEvent);

            return(templateEvent);
        }