Beispiel #1
0
        public static FG_Root GetCSharpFormGlobals_NEW(EbWebForm _this, WebformData _formdata, WebformData _formdataBkUp, IDatabase DataDB, DbConnection DbCon, bool isSrcForm)
        {
            FG_User   fG_User   = new FG_User(_this.UserObj.UserId, _this.UserObj.FullName, _this.UserObj.Email, _this.UserObj.Roles);
            FG_System fG_System = new FG_System();
            FG_DataDB fG_DataDB = null;

            if (DataDB != null)
            {
                DelegateTest OutDelObj = new DelegateTest(DataDB, DbCon);
                fG_DataDB = new FG_DataDB(OutDelObj.ExecuteScalar);
            }
            WebformData _formdataEmpty = _this.GetEmptyModel();

            if (_formdata == null)
            {
                _formdata = _formdataEmpty;
            }
            else
            {
                _formdata.DGsRowDataModel = _formdataEmpty.DGsRowDataModel;
            }
            FG_Locations fG_Locations = Get_FG_Locations(_this.SolutionObj.Locations);
            int          createdBy    = _this.TableRowId <= 0 ? _this.UserObj.UserId : _formdata.CreatedBy;
            string       createdAt    = _this.TableRowId <= 0 ? DateTime.UtcNow.ConvertFromUtc(_this.UserObj.Preference.TimeZone).ToString(FormConstants.yyyyMMdd_HHmmss, CultureInfo.InvariantCulture) : _formdata.CreatedAt;
            FG_WebForm   fG_WebForm   = new FG_WebForm(_this.TableName, _this.TableRowId, _this.LocationId, _this.RefId, createdBy, createdAt);

            GetCSharpFormGlobalsRec_NEW(fG_WebForm, _this, _formdata, _formdataBkUp);

            return(new FG_Root(fG_WebForm, fG_User, fG_System, isSrcForm, fG_DataDB, fG_Locations));
        }
Beispiel #2
0
        public static List <FG_WebForm> GetEmptyDestinationModelGlobals(List <EbWebForm> DestForms)
        {
            List <FG_WebForm> fG_WebFormsList = new List <FG_WebForm>();

            for (int i = 0; i < DestForms.Count; i++)
            {
                EbWebForm   Form       = DestForms[i];
                WebformData _formdata  = Form.GetEmptyModel();
                int         createdBy  = Form.TableRowId <= 0 ? Form.UserObj.UserId : _formdata.CreatedBy;
                string      createdAt  = Form.TableRowId <= 0 ? DateTime.UtcNow.ConvertFromUtc(Form.UserObj.Preference.TimeZone).ToString(FormConstants.yyyyMMdd_HHmmss, CultureInfo.InvariantCulture) : _formdata.CreatedAt;
                FG_WebForm  fG_WebForm = new FG_WebForm(Form.TableName, Form.TableRowId, Form.LocationId, Form.RefId, createdBy, createdAt);
                GetCSharpFormGlobalsRec_NEW(fG_WebForm, Form, _formdata, null);
                fG_WebFormsList.Add(fG_WebForm);
            }
            return(fG_WebFormsList);
        }
Beispiel #3
0
        private static void GetCSharpFormGlobalsRec_NEW(FG_WebForm fG_WebForm, EbControlContainer _container, WebformData _formdata, WebformData _formdataBkUp)
        {
            SingleTable Table     = _formdata.MultipleTables.ContainsKey(_container.TableName) ? _formdata.MultipleTables[_container.TableName] : new SingleTable();
            SingleTable TableBkUp = _formdataBkUp != null && _formdataBkUp.MultipleTables.ContainsKey(_container.TableName) ? _formdataBkUp.MultipleTables[_container.TableName] : new SingleTable();

            if (_container is EbDataGrid)
            {
                fG_WebForm.DataGrids.Add(GetDataGridGlobal(_container as EbDataGrid, Table, _formdata.DGsRowDataModel[_container.TableName]));
            }
            else if (_container is EbReview)
            {
                fG_WebForm.Review = GetReviewGlobal(_container as EbReview, Table, TableBkUp);
            }
            else
            {
                foreach (EbControl _control in _container.Controls)
                {
                    if (_control is EbControlContainer)
                    {
                        GetCSharpFormGlobalsRec_NEW(fG_WebForm, _control as EbControlContainer, _formdata, _formdataBkUp);
                    }
                    else
                    {
                        object data = null;
                        Dictionary <string, object> Metas = new Dictionary <string, object>();
                        if (_control is EbAutoId && fG_WebForm.__mode == "new")// && fG_WebForm.id == 0
                        {
                            data = FG_Constants.AutoId_PlaceHolder;
                        }
                        else
                        {
                            SingleColumn psSC = null;
                            if (Table.Count > 0 && Table[0].GetColumn(_control.Name) != null && !(_control is EbAutoId)) //(!(_control is EbAutoId) || (_control is EbAutoId && fG_WebForm.__mode == "edit")))// && fG_WebForm.id > 0
                            {
                                data = Table[0][_control.Name];
                                psSC = Table[0].GetColumn(_control.Name);
                            }
                            else if (TableBkUp.Count > 0 && TableBkUp[0].GetColumn(_control.Name) != null)
                            {
                                data = TableBkUp[0][_control.Name];
                                psSC = TableBkUp[0].GetColumn(_control.Name);
                            }
                            else if (Table.Count > 0 && Table[0].GetColumn(_control.Name) != null)// Hint: For BatchDataPusher, AutoId available in 'Table' only
                            {
                                data = Table[0][_control.Name];
                                psSC = Table[0].GetColumn(_control.Name);
                            }
                            if (psSC != null && _control is IEbPowerSelect)
                            {
                                Metas.Add(FG_Constants.Columns, psSC.R);
                            }
                        }
                        if (_control is EbAutoId ebAI)
                        {
                            Metas.Add(FG_Constants.SerialLength, ebAI.Pattern?.SerialLength ?? 0);
                        }

                        fG_WebForm.FlatCtrls.Controls.Add(new FG_Control(_control.Name, _control.ObjType, data, Metas));
                    }
                }
            }
        }