Exemplo n.º 1
0
        public void Save_Widget(lsttbl_Widget info)
        {
            var db = GlobalVar.DbBI;
            try
            {
                var objFound = db.lsttbl_Widgets.FirstOrDefault(p => p.Code == info.Code);
                if (objFound == null)
                    db.lsttbl_Widgets.InsertOnSubmit(info);
                else
                    objFound.UpdateOnSubmit(info);

                db.SubmitChanges();
            }
            catch { }
        }
Exemplo n.º 2
0
 partial void Deletelsttbl_Widget(lsttbl_Widget instance);
Exemplo n.º 3
0
 partial void Insertlsttbl_Widget(lsttbl_Widget instance);
Exemplo n.º 4
0
 partial void Updatelsttbl_Widget(lsttbl_Widget instance);
Exemplo n.º 5
0
        protected void cbp_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
        {
            var cbp = sender as ASPxCallbackPanel;
            if (cbp == null) return;

            var objSett = this.GetDefineInfo();
            if (cbp.ID == this.cbpSavingMsg.ID)
            {
                var actionName = Lib.IsNOE(MySession.LayoutDefine_CurEditing) ? "Add new " : "Update ";
                try
                {
                    // Gọi hàm save
                    var objWg = new lsttbl_Widget()
                    {
                        Code = Lib.IfNOE(MySession.LayoutDefine_CurEditing, "wg_" + DateTime.Now.ToString("yyyyMMddHHmmss")),
                        Name = this.txtDisplayName.Text,
                        DSCode = objSett.DatasourceID,
                        WHCode = this.WHCode,// this.MyPage.WHCode,
                        WidgetType = this.CtrlTypeStr,
                        JsonStr = objSett.ToJsonStr()
                    };
                    MyBI.Me.Save_Widget(objWg);
                    MySession.LayoutDefine_CurEditing = objWg.Code;
                }
                catch { this.SetSaveMsgText(string.Format("{0} failed!", actionName), true); }
                // Gửi trạng thái về client;
                this.SetSaveMsgText(string.Format("{0} success!", actionName), false);
            }
            else if (cbp.ID == this.cbp_Header.ID)
            {
                if (!string.IsNullOrEmpty(MySession.LayoutDefine_CurEditing))
                {
                    var layoputs = MyBI.Me.Get_Widget(this.WHCode).ToList();
                    Helpers.SetDataSource(this.cboLayout, layoputs, "Code", "Name", MySession.LayoutDefine_CurEditing);
                }
            }
            else if (cbp.ID == this.cbpPreView.ID)
            {
                this.SetPreView(objSett);
            }
        }