示例#1
0
        public async Task <IResult> FetchItem(TextID id)
        {
            _bodyConstants.TryGetValue(id, out var bodykey);
            if (string.IsNullOrWhiteSpace(bodykey))
            {
                return(NotFound);
            }

            _subjectConstants.TryGetValue(id, out var subjkey);

            return(Json(await DB.RunInTransactionAsync(db => {
                var body = Services.TextHelper.GetTextEntryFromDb(db, bodykey, "en");

                var res = new DataTransport()
                {
                    ID = id,
                    Body = body?.Text,
                    LastChanged = body == null ? new DateTime(0) :  body.Updated
                };
                if (!string.IsNullOrWhiteSpace(subjkey))
                {
                    res.Subject = Services.TextHelper.GetTextFromDb(db, subjkey, "en");
                }

                return res;
            })));
        }
示例#2
0
    public string this[TextID id]
    {
        get
        {
            foreach (var item in _data)
            {
                if (item.ID == id)
                {
                    return(item.Text);
                }
            }

            throw new ArgumentException();
        }
    }
示例#3
0
        // Додавання нового працівника
        private void AddWorker(object sender, MouseButtonEventArgs e)
        {
            string FullName = "", Position = "", Salary = "", ID = "";

            if (TextFullName.Text != "")
            {
                FullName = TextFullName.Text;
            }
            else
            {
                FullName = "*********";
            }
            TextFullName.Clear();

            if (TextPosition.Text != "")
            {
                Position = TextPosition.Text;
            }
            else
            {
                Position = "*********";
            }
            TextPosition.Clear();

            if (TextSalary.Text != "")
            {
                Salary = TextSalary.Text;
            }
            else
            {
                Salary = "*********";
            }
            TextSalary.Clear();

            if (TextID.Text != "")
            {
                ID = TextID.Text;
            }
            else
            {
                ID = "*********";
            }
            TextID.Clear();

            peoples.Add(new People(FullName, Position, Salary, ID));
            PeoplesItem.ItemsSource = peoples;
        }
示例#4
0
 [IEnumeratorCoroutineYield]                                                                                         // 0x0061A050-0x0061A0D0
 // [IteratorStateMachine] // 0x0061A050-0x0061A0D0
 public static IEnumerator Monologue(TextID textId) => default;                                                      // 0x00C007D0-0x00C00840
示例#5
0
 [IEnumeratorCoroutineYield]                                                                                         // 0x00619F50-0x00619FD0
 // [IteratorStateMachine] // 0x00619F50-0x00619FD0
 public static IEnumerator Talk(LuaSymAct symAct, TextID textId) => default;                                         // 0x00C00680-0x00C00700
示例#6
0
 [IEnumeratorCoroutineYield]                                                                                         // 0x00619ED0-0x00619F50
 // [IteratorStateMachine] // 0x00619ED0-0x00619F50
 public static IEnumerator ExplanationB(TextID textId) => default;                                                   // 0x00C005E0-0x00C00650
示例#7
0
 [IEnumeratorCoroutineYield]                                                                                         // 0x00619E50-0x00619ED0
 // [IteratorStateMachine] // 0x00619E50-0x00619ED0
 public static IEnumerator Explanation(TextID textId) => default;                                                    // 0x00C00540-0x00C005B0
示例#8
0
 [IEnumeratorCoroutineYield]                                                                                         // 0x00619DD0-0x00619E50
 // [IteratorStateMachine] // 0x00619DD0-0x00619E50
 public static IEnumerator NarrationB(LuaTimeSec timeSec1, LuaTimeSec timeSec2, TextID textId) => default;           // 0x00C00490-0x00C00510
示例#9
0
 [IEnumeratorCoroutineYield]                                                                                         // 0x00619CC0-0x00619D40
 // [IteratorStateMachine] // 0x00619CC0-0x00619D40
 public static IEnumerator NarrationBottomFrame(LuaTimeSec timeSec1, LuaTimeSec timeSec2, TextID textId) => default; // 0x00C003E0-0x00C00460
示例#10
0
 [IEnumeratorCoroutineYield]                                    // 0x00619B40-0x00619BC0
 // [IteratorStateMachine] // 0x00619B40-0x00619BC0
 public static IEnumerator SysAllMsg(TextID textId) => default; // 0x00C001C0-0x00C00230
示例#11
0
 [IEnumeratorCoroutineYield]                                       // 0x00619A40-0x00619AC0
 // [IteratorStateMachine] // 0x00619A40-0x00619AC0
 public static IEnumerator SysMsg(TextID textId) => default;       // 0x00C00120-0x00C00190
示例#12
0
    }                                                                               // 0x00BFFF20-0x00C00080

    // [IteratorStateMachine] // 0x006199D0-0x00619A40
    public static IEnumerator SystemLetter(TextID textId) => default; // 0x00C00080-0x00C000F0
示例#13
0
        public async Task <IResult> UpdateItem(TextID id, DataTransport data)
        {
            if (data == null || data.Body == null)
            {
                return(BadRequest);
            }

            _bodyConstants.TryGetValue(id, out var bodykey);
            if (string.IsNullOrWhiteSpace(bodykey))
            {
                return(NotFound);
            }

            _subjectConstants.TryGetValue(id, out var subjkey);
            var res = await DB.RunInTransactionAsync(db =>
            {
                var e = db.SelectItemById <Database.TextEntry>(bodykey);
                if (e == null)
                {
                    db.InsertItem(new Database.TextEntry()
                    {
                        ID       = bodykey,
                        Text     = data.Body,
                        IsDraft  = false,
                        Language = "en"
                    });
                }
                else
                {
                    if (e.Updated > data.LastChanged)
                    {
                        throw new HttpException(HttpStatusCode.Conflict, "The server data changed");
                    }

                    e.Text     = data.Body;
                    e.Language = "en";
                    e.IsDraft  = false;
                    db.UpdateItem(e);
                }

                // Re-read the values for reporting
                e = db.SelectItemById <Database.TextEntry>(bodykey);

                var dt = new DataTransport()
                {
                    Body        = e.Text,
                    LastChanged = e.Updated,
                    ID          = id
                };

                if (!string.IsNullOrWhiteSpace(subjkey) && data.Subject != null)
                {
                    e = db.SelectItemById <Database.TextEntry>(subjkey);
                    if (e == null)
                    {
                        e = db.InsertItem(new Database.TextEntry()
                        {
                            ID       = subjkey,
                            Text     = data.Subject,
                            IsDraft  = false,
                            Language = "en"
                        });
                    }
                    else
                    {
                        e.Text     = data.Subject;
                        e.Language = "en";
                        e.IsDraft  = false;
                        db.UpdateItem(e);
                    }
                    dt.Subject = e.Text;
                }

                return(dt);
            });

            return(Json(res));
        }
示例#14
0
 public bool Equals(Text other)
 {
     return(other != null && TextID.Equals(other.TextID));
 }
示例#15
0
        public override string Render()
        {
            if (Visiable)
            {
                AddAttributes();
                var texts = new List <string>();
                if (TextID.IsNullOrEmpty())
                {
                    TextID = "{0}_Text".FormatTo(Id);
                }
                if (!Value.IsNullOrEmpty() && !SelectType.IsNullOrEmpty())
                {
                    var page = PageBuilder.BuildPage(SelectType);
                    if (page != null && page.Controls.Count > 0)
                    {
                        IFieldConverter listDs = null;
                        page.Controls.ForEach((o) =>
                        {
                            if (o is IListDataSourceControl)
                            {
                                listDs = (o as IListDataSourceControl).DataSource as IFieldConverter;
                                return;
                            }
                            else if (o is ICascadeDataSourceControl)
                            {
                                listDs = (o as ICascadeDataSourceControl).DataSource as IFieldConverter;
                                return;
                            }
                        });
                        if (listDs != null)
                        {
                            if (IsMulitle)
                            {
                                foreach (var v in Value.Split(','))
                                {
                                    texts.Add(listDs.Converter(Id, v, null).ToString());
                                }
                            }
                            else
                            {
                                texts.Add(listDs.Converter(Id, Value, null).ToString());
                            }
                        }
                    }
                }
                string text = string.Empty;
                if (texts.Count > 0)
                {
                    text = string.Join(",", texts.ToArray());
                }
                var textBox = new TextBox()
                {
                    Id = TextID, Name = TextID, Value = text
                };
                if (!Attributes.IsNullOrEmpty())
                {
                    foreach (var attr in Attributes)
                    {
                        textBox.Attributes[attr.Key] = attr.Value;
                    }
                }
                textBox.Attributes["data-selector"]     = SelectType;
                textBox.Attributes["data-showtype"]     = ShowType.ToString();
                textBox.Attributes["data-multiple"]     = IsMulitle.ToString().ToLower();
                textBox.Attributes["data-target"]       = Id;
                textBox.Attributes["data-dialogheight"] = DialogHeight.ToString();
                textBox.Attributes["data-dialogwidth"]  = DialogWidth.ToString();

                var hidden = new HiddenField()
                {
                    Id = Id, Name = Id, Value = Value, Validator = Validator
                };
                string result = hidden.Render() + textBox.Render();
                return(ContainerTemplate.FormatTo(Id, Label, result, Description));
            }
            return(string.Empty);
        }
示例#16
0
 [IEnumeratorCoroutineYield]                                                                                         // 0x0061A0D0-0x0061A150
 // [IteratorStateMachine] // 0x0061A0D0-0x0061A150
 public static IEnumerator Monologue2(TextID textId) => default;                                                     // 0x00C00870-0x00C008E0
示例#17
0
    }                                           // 0x00BFE860-0x00BFE8E0

    public static void SelectChain(TextID textId, int id)
    {
    }                                                            // 0x00C00C00-0x00C00C10
示例#18
0
 [IEnumeratorCoroutineYield]                                                                                         // 0x00619BC0-0x00619C40
 // [IteratorStateMachine] // 0x00619BC0-0x00619C40
 public static IEnumerator Chapter(LuaTimeSec timeSec1, LuaTimeSec timeSec2, TextID textId) => default;              // 0x00C00280-0x00C00300