Esempio n. 1
0
        public bool AssignElement(string clientid, string appid, int elementtype, string elementid)
        {
            DBDatabase db;

            db = base.Database;
            DBQuery insert = DBQuery.InsertInto(TzAccount.AppElements.Table).Fields(
                TzAccount.AppElements.ClientID.Name,
                TzAccount.AppElements.AppID.Name,
                TzAccount.AppElements.ElementID.Name,
                TzAccount.AppElements.ElementType.Name,
                TzAccount.AppElements.CreatedOn.Name)
                             .Values(
                DBConst.String(clientid),
                DBConst.String(appid),
                DBConst.String(elementid),
                DBConst.Int32(elementtype),
                DBConst.DateTime(DateTime.Now));
            int val = 0;

            using (DbTransaction trans = db.BeginTransaction())
            {
                val = db.ExecuteNonQuery(trans, insert);
                trans.Commit();
            }
            if (val > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public string SaveView(string viewName, string coreCompoent, string category)
        {
            string  ComponentId = Shared.generateID();
            DBQuery insert      = DBQuery.InsertInto(TalentozView.Table).
                                  Field((TalentozView.ViewID.Name)).
                                  Field((TalentozView.Name.Name)).
                                  Field((TalentozView.Catgory.Name)).
                                  Field((TalentozView.CoreComponent.Name)).
                                  Field((TalentozView.LastUPD.Name)).
                                  Value(DBConst.String(ComponentId)).
                                  Value(DBConst.String(viewName)).
                                  Value(DBConst.String(category)).
                                  Value(DBConst.String(coreCompoent)).
                                  Value(DBConst.DateTime(DateTime.Now))
            ;

            if (db.ExecuteNonQuery(insert) > 0)
            {
                return(ComponentId);
            }
            else
            {
                return("");
            }
        }
        public string SaveViewSchemaRelation(string viewID, string parent, string parentField, string child, string childField)
        {
            string  viewSchema = Shared.generateID();
            DBQuery insert     = DBQuery.InsertInto(TalentozViewSchemaRelation.Table).
                                 Field((TalentozViewSchemaRelation.ViewID.Name)).
                                 Field((TalentozViewSchemaRelation.ViewSchemaRelation.Name)).
                                 Field((TalentozViewSchemaRelation.Parent.Name)).
                                 Field((TalentozViewSchemaRelation.ParentField.Name)).
                                 Field((TalentozViewSchemaRelation.Child.Name)).
                                 Field((TalentozViewSchemaRelation.RelatedField.Name)).
                                 Field((TalentozViewSchemaRelation.LastUPD.Name)).
                                 Value(DBConst.String(viewID)).
                                 Value(DBConst.String(viewSchema)).
                                 Value(DBConst.String(parent)).
                                 Value(DBConst.String(parentField)).
                                 Value(DBConst.String(child)).
                                 Value(DBConst.String(childField)).
                                 Value(DBConst.DateTime(DateTime.Now))
            ;

            if (db.ExecuteNonQuery(insert) > 0)
            {
                return(viewSchema);
            }
            else
            {
                return("");
            }
        }
Esempio n. 4
0
        public string SaveSchedule(string clientid,
                                   string exportsettings,
                                   int status,
                                   DateTime eventDatetime,
                                   string filePath,
                                   bool ignoreError,
                                   int type
                                   )
        {
            DBDatabase db;

            db = base.Database;
            string  a = Shared.generateID();
            DBConst dbImportExportId = DBConst.String(a);
            DBConst dbclientid       = DBConst.String(clientid);
            DBConst dbexportsettings = DBConst.String(exportsettings);
            DBConst dbstatus         = DBConst.Int32(status);
            DBConst dbtype           = DBConst.Int32(type);
            DBConst dbeventDatetime  = DBConst.DateTime(eventDatetime);
            DBConst dbfilePath       = DBConst.String(filePath);
            DBConst dbignoreError    = DBConst.Const(DbType.Boolean, ignoreError);
            DBQuery insert           = DBQuery.InsertInto(TzAccount.ImportExportEvents.Table).Fields(
                TzAccount.ImportExportEvents.ClientID.Name,
                TzAccount.ImportExportEvents.ImportExportID.Name,
                TzAccount.ImportExportEvents.ExportSetting.Name,
                TzAccount.ImportExportEvents.Status.Name,
                TzAccount.ImportExportEvents.FilePath.Name,
                TzAccount.ImportExportEvents.IgnoreSQLErrors.Name,
                TzAccount.ImportExportEvents.EventDateTime.Name,
                TzAccount.ImportExportEvents.Type.Name).Values(
                dbclientid,
                dbImportExportId,
                dbexportsettings,
                dbstatus,
                dbfilePath,
                dbignoreError,
                dbeventDatetime,
                dbtype
                );
            int val = 0;

            using (DbTransaction trans = db.BeginTransaction())
            {
                val = db.ExecuteNonQuery(trans, insert);
                trans.Commit();
            }
            if (val > 0)
            {
                return(a);
            }
            else
            {
                return("");
            }
        }
Esempio n. 5
0
        public static bool SaveImportContext(string importID, string importContext, int step, string actionby, string conn, int clientID)
        {
            DataBase db = new DataBase();

            db.InitDbs(conn);
            if (GetImportContext(importID, conn).Rows.Count == 0)
            {
                DBQuery insert = DBQuery.InsertInto("tz_import_log")
                                 .Field("importID")
                                 .Field("ImportSchema")
                                 .Field("Step")
                                 .Field("ActionBy")
                                 .Field("LastUPD")
                                 //.Field("CreatedOn")
                                 .Field("ClientID")
                                 .Value(DBConst.String(importID))
                                 .Value(DBConst.String(importContext))
                                 .Value(DBConst.Int32(step))
                                 .Value(DBConst.String(actionby))
                                 .Value(DBConst.DateTime(DateTime.Now))
                                 //.Value(DBConst.DateTime(DateTime.Now))
                                 .Value(DBConst.Int32(clientID)
                                        );
                if (db.Database.ExecuteNonQuery(insert) > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                DBComparison dbcompo = DBComparison.Equal(DBField.Field("importID"), DBConst.String(importID));
                // DBComparison dbclient = DBComparison.Equal(DBField.Field("NextID"), DBConst.Int32 (nextindex));
                DBQuery update = DBQuery.Update("tz_import_log")
                                 .Set("ImportSchema", DBConst.String(importContext))
                                 .AndSet("ActionBy", DBConst.String(actionby))
                                 .AndSet("Step", DBConst.Int32(step))
                                 .AndSet("LastUPD", DBConst.DateTime(DateTime.Now)
                                         ).WhereAll(dbcompo);

                int i = db.Database.ExecuteNonQuery(update);
                if (i > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="formid"></param>
        /// <param name="clientid"></param>
        /// <param name="rendertype"></param>
        /// <param name="category"></param>
        /// <param name="left"></param>
        /// <param name="top"></param>
        /// <param name="attribute"></param>
        /// <returns></returns>
        public string Save(string formid,
                           string clientid,
                           int rendertype,
                           string attributeId,
                           string attribute)
        {
            DBDatabase db;

            db = base.Database;

            string  a      = Shared.generateID();
            DBQuery insert = DBQuery.InsertInto(TzAccount.FormFields.Table).Fields(
                TzAccount.FormFields.ClientID.Name,
                TzAccount.FormFields.FormID.Name,
                TzAccount.FormFields.FieldID.Name,
                TzAccount.FormFields.DataField.Name,
                TzAccount.FormFields.FieldRenderType.Name,
                TzAccount.FormFields.FieldAttribute.Name,
                TzAccount.FormFields.LastUPD.Name,
                TzAccount.FormFields.CreatedDate.Name)
                             .Values(
                DBConst.String(clientid),
                DBConst.String(formid),
                DBConst.String(a),
                DBConst.String(attributeId),
                DBConst.Int32(rendertype),
                DBConst.String(attribute),
                DBConst.DateTime(DateTime.Now),
                DBConst.DateTime(DateTime.Now)
                );
            int val = 0;

            using (DbTransaction trans = db.BeginTransaction())
            {
                val = db.ExecuteNonQuery(trans, insert);
                trans.Commit();
            }
            if (val > 0)
            {
                return(a);
            }
            else
            {
                return("");
            }
        }
Esempio n. 7
0
        /// <summary>
        /// /
        /// </summary>
        /// <param name="clientid"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public string SaveLookup(string clientid,
                                 string name,
                                 string description,
                                 bool isCore)
        {
            DBDatabase db;

            db = base.Database;
            string  a = Shared.generateID();
            DBConst dbComponentLookupID = DBConst.String(a);
            DBConst dbclientID          = DBConst.String(clientid);
            DBConst dbname = DBConst.String(name);
            DBQuery insert = DBQuery.InsertInto(TzAccount.ComponentLookUp.Table).Fields(
                TzAccount.ComponentLookUp.ClientID.Name,
                TzAccount.ComponentLookUp.LookupID.Name,
                TzAccount.ComponentLookUp.LookUpName.Name,
                TzAccount.ComponentLookUp.Description.Name,
                TzAccount.ComponentLookUp.IsCore.Name,
                TzAccount.ComponentLookUp.CreatedOn.Name,
                TzAccount.ComponentLookUp.LastUPD.Name)
                             .Values(
                dbclientID,
                dbComponentLookupID,
                dbname,
                DBConst.String(description),
                DBConst.Const(DbType.Boolean, isCore),
                DBConst.DateTime(DateTime.Now),
                DBConst.DateTime(DateTime.Now)
                );
            int val = 0;

            using (DbTransaction trans = db.BeginTransaction())
            {
                val = db.ExecuteNonQuery(trans, insert);
                trans.Commit();
            }
            if (val > 0)
            {
                return(a);
            }
            else
            {
                return("");
            }
        }
Esempio n. 8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pName"></param>
        /// <param name="category"></param>
        /// <param name="schemaType"></param>
        /// <param name="title"></param>
        /// <param name="primarykeys"></param>
        /// <param name="state"></param>
        /// <param name="tableName"></param>
        /// <returns></returns>
        protected internal string SaveComponent(string pName,
                                                string category,
                                                int schemaType,
                                                string title,
                                                string primarykeys,
                                                int state,
                                                string tableName,
                                                string entityKey
                                                )
        {
            string ComponentId = Shared.generateID();

            Tech.Data.Query.DBQuery dBQuery = DBQuery.InsertInto(TalentozSchema.Table)
                                              .Field(TalentozSchema.ComponentID.Name)
                                              .Field(TalentozSchema.ComponentName.Name)
                                              .Field(TalentozSchema.Category.Name)
                                              .Field(TalentozSchema.ComponentType.Name)
                                              .Field(TalentozSchema.Title.Name)
                                              .Field(TalentozSchema.ComponentState.Name)
                                              .Field(TalentozSchema.TableName.Name)
                                              .Field(TalentozSchema.LastUPD.Name)
                                              .Field(TalentozSchema.PrimaryKeys.Name)
                                              .Field(TalentozSchema.EntityKey.Name)
                                              .Values(DBConst.String(ComponentId),
                                                      DBConst.String(pName),
                                                      DBConst.String(category),
                                                      DBConst.Int32(schemaType),
                                                      DBConst.String(title),
                                                      DBConst.Int32(state),
                                                      DBConst.String(tableName),
                                                      DBConst.DateTime(DateTime.Today),
                                                      DBConst.String(primarykeys),
                                                      DBConst.String(entityKey));
            if (db.ExecuteNonQuery(dBQuery) > 0)
            {
                return(ComponentId);
            }
            else
            {
                return("");
            }
        }
        protected internal bool UpdateView(string viewID, string viewName, string coreCompoent, string category)
        {
            //   DBComparison client = DBComparison.Equal(DBField.Field(TalentozSchemaInfo.ClientID.Name), DBConst.Int32(clientID));
            DBComparison comp = DBComparison.Equal(DBField.Field(TalentozView.ViewID.Name), DBConst.String(viewID));
            // DBComparison att = DBComparison.Equal(DBField.Field(TalentozSchemaInfo.FieldID.Name), DBConst.String(attributeID));

            DBQuery update = DBQuery.Update(TalentozView.Table)
                             .Set(TalentozView.Name.Name, DBConst.String(viewName))
                             .AndSet(TalentozView.CoreComponent.Name, DBConst.String(coreCompoent))
                             .AndSet(TalentozView.Catgory.Name, DBConst.String(category))
                             .AndSet(TalentozView.LastUPD.Name, DBConst.DateTime(DateTime.Now)).WhereAll(comp);

            if (db.ExecuteNonQuery(update) > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 10
0
        public string Save(string clientid,
                           string appName,
                           string description,
                           string category
                           )
        {
            DBDatabase db;

            db = base.Database;
            string  a      = Shared.generateID();
            DBQuery insert = DBQuery.InsertInto(TzAccount.App.Table).Fields(
                TzAccount.App.ClientID.Name,
                TzAccount.App.AppID.Name,
                TzAccount.App.Name.Name,
                TzAccount.App.Description.Name,
                TzAccount.App.Category.Name,
                TzAccount.App.CreatedOn.Name)
                             .Values(
                DBConst.String(clientid),
                DBConst.String(a),
                DBConst.String(appName),
                DBConst.String(description),
                DBConst.String(category),
                DBConst.DateTime(DateTime.Now));
            int val = 0;

            using (DbTransaction trans = db.BeginTransaction())
            {
                val = db.ExecuteNonQuery(trans, insert);
                trans.Commit();
            }
            if (val > 0)
            {
                return(a);
            }
            else
            {
                return("");
            }
        }
Esempio n. 11
0
        public void Insert(int id,
                           string name,
                           string address,
                           string ownerName)
        {
            DBConst did        = DBConst.Int32(id);
            DBConst dname      = DBConst.String(name);
            DBConst daddress   = DBConst.String(address);
            DBConst downerName = DBConst.String(ownerName);
            DBConst createDate = DBConst.DateTime(DateTime.Now.Date);

            DBQuery insert = DBQuery.InsertInto(Schema, Schools.Table)
                             .Fields(Schools.Name.Name,
                                     Schools.ID.Name,
                                     Schools.Address.Name,
                                     Schools.OwnerName.Name, Schools.DateCreated.Name)
                             .Values(dname, did, daddress, downerName, createDate);

            using (DbTransaction trans = this.Database.BeginTransaction())
            {
                Database.ExecuteNonQuery(trans, insert);
                trans.Commit();
            }
        }
        public bool SaveViewSchema(string viewID, string compID, string childComp)
        {
            DBQuery insert = DBQuery.InsertInto(TalentozViewSchema.Table).
                             Field((TalentozViewSchema.ViewID.Name)).
                             Field((TalentozViewSchema.ComponentID.Name)).
                             Field((TalentozViewSchema.ChildComponentID.Name)).
                             Field((TalentozViewSchema.ComponentAlias.Name)).
                             Field((TalentozViewSchema.LastUPD.Name)).
                             Value(DBConst.String(viewID)).
                             Value(DBConst.String(compID)).
                             Value(DBConst.String(childComp)).
                             Value(DBConst.String("")).
                             Value(DBConst.DateTime(DateTime.Now))
            ;

            if (db.ExecuteNonQuery(insert) > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 13
0
        public void _11_UpdateSubSelectAndParameterXmlTest()
        {
            DBParam cid = DBParam.ParamWithValue("cid", 10);

            DBQuery thirtyDaysOrders = DBQuery.Select()
                                       .Sum(DBField.Field("order_value")).From("ORDER").As("O")
                                       .WhereField("order_date", Compare.GreaterThan, DBConst.DateTime(DateTime.Today.AddDays(-30)))
                                       .AndWhere("customer_id", Compare.Equals, cid);

            DBQuery q = DBQuery.Update("CUSTOMERS").Set("customer_name", DBConst.String("new name"))
                        .AndSet("customer_address", DBConst.String("new address"))
                        .AndSet("order_value", thirtyDaysOrders)
                        .WhereField("customer_id", Compare.Equals, cid);

            q = SerializeAndDeserialzeQueryToMatch(q, "Sub Select Update");
        }
Esempio n. 14
0
        public string Save(string clientid, string formName,
                           string componentid,
                           int formtype,
                           string formKeys,
                           string successmessage,
                           bool capturelocation,
                           bool captureip,
                           string errormessage,
                           bool enableDefault,
                           string submit,
                           string reset,
                           string update,
                           string cancel,
                           string description

                           )
        {
            DBDatabase db;

            db = base.Database;

            string  a      = Shared.generateID();
            DBQuery insert = DBQuery.InsertInto(TzAccount.Form.Table).Fields(
                TzAccount.Form.ClientID.Name,
                TzAccount.Form.FormID.Name,
                TzAccount.Form.ComponentID.Name,
                TzAccount.Form.Name.Name,
                TzAccount.Form.FormType.Name,
                TzAccount.Form.FormKeys.Name,

                TzAccount.Form.SuccessMessage.Name,
                TzAccount.Form.CaptureLocation.Name,
                TzAccount.Form.CaptureIPaddress.Name,
                TzAccount.Form.ErrorMessage.Name,
                TzAccount.Form.EnableDefaultAction.Name,
                TzAccount.Form.Submit.Name,
                TzAccount.Form.Reset.Name,
                TzAccount.Form.Update.Name,
                TzAccount.Form.Cancel.Name,
                TzAccount.Form.CreatedOn.Name,
                TzAccount.Form.LastUPD.Name,
                TzAccount.Form.Description.Name)
                             .Values(
                DBConst.String(clientid),
                DBConst.String(a),
                DBConst.String(componentid),
                DBConst.String(formName),
                DBConst.Int32(formtype),
                DBConst.String(formKeys),

                DBConst.String(successmessage),
                DBConst.Const(DbType.Boolean, capturelocation),
                DBConst.Const(DbType.Boolean, captureip),
                DBConst.String(errormessage),
                DBConst.Const(DbType.Boolean, enableDefault),
                DBConst.String(submit),
                DBConst.String(reset),
                DBConst.String(update),
                DBConst.String(cancel),

                DBConst.DateTime(DateTime.Now),
                DBConst.DateTime(DateTime.Now),
                DBConst.String(description)
                );
            int val = 0;

            using (DbTransaction trans = db.BeginTransaction())
            {
                val = db.ExecuteNonQuery(trans, insert);
                trans.Commit();
            }
            if (val > 0)
            {
                return(a);
            }
            else
            {
                return("");
            }
        }