Example #1
0
 public void load(Int64 ID, string DefaultText)
 {
     _labels       = SynapseLabel.Load("Where LABELID = " + ID + " ORDER BY LANGUAGE");
     _defaultLabel = DefaultText;
 }
Example #2
0
        private void tsbCopy_Click(object sender, EventArgs e)
        {
            SynapseCore.Database.DBFunction.StartTransaction();

            Definition reportDef = Definition.LoadByID(((Definition)olvReport.SelectedObject).ID);
            Definition reportNew = new Definition();

            try
            {
                reportNew.ID            = 0;
                reportNew.QRY_JOIN      = reportDef.QRY_JOIN;
                reportNew.QRY_CONDITION = reportDef.QRY_CONDITION;
                reportNew.QRY_GROUP     = reportDef.QRY_GROUP;
                reportNew.FK_MODULE     = reportDef.FK_MODULE;
                reportNew.FK_INTERFACE  = reportDef.FK_INTERFACE;
                reportNew.FK_CATEGORY   = reportDef.FK_CATEGORY;
                reportNew.FK_TYPE       = reportDef.FK_TYPE;
                reportNew.ADDCATEGORY   = reportDef.ADDCATEGORY;
                reportNew.AVAILABLE     = false;

                Int64 reportNew_lblID = SynapseLabel.GetNextID();
                foreach (SynapseLanguage lang in SynapseLanguage.LoadFromQuery("SELECT * FROM SYNAPSE_LANGUAGE ORDER BY CODE"))
                {
                    SynapseLabel newlabel = new SynapseLabel();

                    newlabel.LABELID  = reportNew_lblID;
                    newlabel.LANGUAGE = lang.CODE;
                    newlabel.TEXT     = SynapseLabel.Load("WHERE LANGUAGE='" + lang.CODE + "' AND LABELID=" + reportDef.LABELID).FirstOrDefault().TEXT + " (*)";
                    newlabel.save();
                }
                reportNew.LABELID = reportNew_lblID;

                reportNew.save();

                foreach (Tables tbl in Tables.Load("WHERE FK_REPORT=" + reportDef.ID))
                {
                    Tables tblNew = new Tables();
                    tblNew.ID        = 0;
                    tblNew.TABLENAME = tbl.TABLENAME;
                    tblNew.TYPE      = tbl.TYPE;
                    tblNew.FK_REPORT = reportNew.ID;

                    tblNew.save();
                }

                foreach (Field fld in Field.Load("WHERE FK_REPORT=" + reportDef.ID))
                {
                    Field fldNew = new Field();
                    fldNew.ID        = 0;
                    fldNew.FIELDNAME = fld.FIELDNAME;
                    fldNew.FORMAT    = fld.FORMAT;
                    fldNew.POSITION  = fld.POSITION;
                    fldNew.WIDTH     = fld.WIDTH;
                    fldNew.FK_REPORT = reportNew.ID;

                    Int64 fldNew_lblID = SynapseLabel.GetNextID();
                    foreach (SynapseLanguage lang in SynapseLanguage.LoadFromQuery("SELECT * FROM SYNAPSE_LANGUAGE ORDER BY CODE"))
                    {
                        SynapseLabel newlabel = new SynapseLabel();

                        newlabel.LABELID  = fldNew_lblID;
                        newlabel.LANGUAGE = lang.CODE;
                        newlabel.TEXT     = SynapseLabel.Load("WHERE LANGUAGE='" + lang.CODE + "' AND LABELID=" + fld.ALIASID).FirstOrDefault().TEXT;
                        newlabel.save();
                    }
                    fldNew.ALIASID = fldNew_lblID;

                    fldNew.save();
                }

                foreach (Filter flt in Filter.Load("WHERE FK_REPORT=" + reportDef.ID))
                {
                    Filter fltNew = new Filter();
                    fltNew.ID                 = 0;
                    fltNew.NAME               = flt.NAME;
                    fltNew.TYPE               = flt.TYPE;
                    fltNew.POSITION           = flt.POSITION;
                    fltNew.CTRL_TABLE         = flt.CTRL_TABLE;
                    fltNew.CTRL_FIELD         = flt.CTRL_FIELD;
                    fltNew.CTRL_CUSTOM        = flt.CTRL_CUSTOM;
                    fltNew.DATA_TABLE         = flt.DATA_TABLE;
                    fltNew.DATA_VALUE         = flt.DATA_VALUE;
                    fltNew.DATA_DISPLAY       = flt.DATA_DISPLAY;
                    fltNew.DATA_QUERY         = flt.DATA_QUERY;
                    fltNew.WIDTH              = flt.WIDTH;
                    fltNew.ADD_TO_REPORTTITLE = flt.ADD_TO_REPORTTITLE;
                    fltNew.IS_LINKED          = false;
                    fltNew.LINKED_FILTERID    = 0;
                    fltNew.LINKED_FIELD       = "";
                    fltNew.CTRL_TYPE          = flt.CTRL_TYPE;
                    fltNew.FK_REPORT          = reportNew.ID;

                    Int64 fltNew_lblID = SynapseLabel.GetNextID();
                    foreach (SynapseLanguage lang in SynapseLanguage.LoadFromQuery("SELECT * FROM SYNAPSE_LANGUAGE ORDER BY CODE"))
                    {
                        SynapseLabel newlabel = new SynapseLabel();

                        newlabel.LABELID  = fltNew_lblID;
                        newlabel.LANGUAGE = lang.CODE;
                        newlabel.TEXT     = SynapseLabel.Load("WHERE LANGUAGE='" + lang.CODE + "' AND LABELID=" + flt.LABELID).FirstOrDefault().TEXT;
                        newlabel.save();
                    }
                    fltNew.LABELID = fltNew_lblID;

                    fltNew.save();
                }

                SynapseCore.Database.DBFunction.CommitTransaction();

                listReport();
            }
            catch (Exception ex)
            {
                SynapseCore.Database.DBFunction.RollbackTransaction();
                GlobalFunctions.showMessage("ERR", "Err.9999", ex.Message);
            }
        }