Ejemplo n.º 1
0
 public MainWindow()
 {
     InitializeComponent();
     db = new Db_Context();
     db.dbSet.Load();
     StudentGrid.ItemsSource = db.dbSet.Select(p => p).ToList();
 }
Ejemplo n.º 2
0
 public HttpExampleFunction(Db_Context context)
 {
     _context = context;
 }
Ejemplo n.º 3
0
 public Repository(Db_Context context)
 {
     _context = context;
 }
Ejemplo n.º 4
0
    public CallbackResult CallBack_FormTag_65200_9()
    {
        /*id=request.id&allowempty=author,view&action=edit*/
        string formname = this.CallValue("formname");

        if (formname != "FormTag_65200_9")
        {
            return(null);
        }
        dynamic error = new ExpandoObject();

        error.formname = formname;
        CallbackResult call = new CallbackResult(error);

        call.type = "formcall";
        Article _article = null;
        long    long_id  = long.MinValue;

        long.TryParse("" + Request.QueryString["id"], out long_id);

        _article = Db_Context.Article.Where(x => x.IsLock != true).FirstOrDefault(b =>
                                                                                  b.ID == long_id
                                                                                  );
        if (_article == null)
        {
            /*编辑模式(action = edit),未找到记录则返回*/;
            error.code = 3;
            error.msg  = "操作失败:not found!";
            error.dom  = "";
            return(call);
        }
        string _Title = this.CallValue("Title");

        if (string.IsNullOrEmpty(_Title))
        {
            error.code = 1;
            error.msg  = "不能为空!";
            error.dom  = "Title";
            return(call);
        }
        _article.Title = _Title;
        string _Author = this.CallValue("Author");

        _article.Author = _Author;
        string   _Time  = this.CallValue("Time");
        DateTime __Time = DateTime.Now;

        if (DateTime.TryParse(_Time, out __Time))
        {
            _article.Time = __Time;
        }
        else
        {
            if (string.IsNullOrEmpty(_Time))
            {
                error.code = 1;
                error.msg  = "不能为空!";
                error.dom  = "Time";
                return(call);
            }
            else
            {
                error.code = 2;
                error.msg  = "请输入正确的时间";
                error.dom  = "Time";
                return(call);
            }
        }
        string _View  = this.CallValue("View");
        int    __View = 0;

        if (int.TryParse(_View, out __View))
        {
            _article.View = __View;
        }
        string _Content = this.CallValue("Content");

        if (string.IsNullOrEmpty(_Content))
        {
            error.code = 1;
            error.msg  = "不能为空!";
            error.dom  = "Content";
            return(call);
        }
        _article.Content = _Content;
        //
        Db_Context.SaveChanges();
        error.code = 0;
        error.msg  = "操作成功!";
        error.dom  = "";
        return(call);
    }
Ejemplo n.º 5
0
 public EmailController(Db_Context ctx)
 {
     this.ctx = ctx;
 }
Ejemplo n.º 6
0
 public FeedbackController(Db_Context c)
 {
     ctx = c;
 }
Ejemplo n.º 7
0
 public OrderRepository(Db_Context ctx, ILogger <OrderRepository> logger) : base(ctx)
 {
     _ctx    = ctx;
     _logger = logger;
 }
 public MainWindow()
 {
     db = new Db_Context();
 }
Ejemplo n.º 9
0
 public ProductRepository(Db_Context ctx, ILogger <ProductRepository> logger) : base(ctx)
 {
     _ctx    = ctx;
     _logger = logger;
 }
Ejemplo n.º 10
0
 public FlightController(Db_Context dbContext)
 {
     this.ctx = dbContext;
 }
Ejemplo n.º 11
0
 public Imp_DepremDepo(Db_Context context)
 {
     _context = context;
 }