Esempio n. 1
0
    public static void Load()
    {
        // Load Accounts;
        foreach (Database.Account account in Database.ActiveRecord.Load <Database.Account>())
        {
            Accounts.Add(account.id, account);
        }

        // Load Characters;
        foreach (Database.Character character in Database.ActiveRecord.Load <Database.Character>())
        {
            Characters.Add(character.id, character);
        }

        // Load Npcs;
        foreach (Database.Npc npc in Database.ActiveRecord.Load <Database.Npc>())
        {
            Npcs.Add(npc.id, npc);
        }

        // Load Npcs In World;
        foreach (NpcSpawn npcSpawn in Database.ActiveRecord.Load <NpcSpawn>())
        {
            NpcSpawns.Add(npcSpawn.id, npcSpawn);
        }

        // Load Scenery In World;
        foreach (ScenerySpawnPoint scenery in ActiveRecord.Load <ScenerySpawnPoint>())
        {
            scenery.Instantiate();
        }
    }
Esempio n. 2
0
        private bool deleteDatabaseUser(string userId)
        {
            ActiveRecord record        = new ActiveRecord();
            string       datosConexion = this.cadenaConexion;

            try
            {
                using (SqlConnection con = new SqlConnection(datosConexion))
                {
                    //Paso 2 - Abrir la conexión
                    con.Open();

                    string     textoCmd = "DELETE * FROM CuentaGastosUsuarios WHERE Usuario = '" + userId + "'";
                    SqlCommand cmd      = new SqlCommand(textoCmd, con);

                    SqlDataReader reader = cmd.ExecuteReader();

                    if (reader.RecordsAffected > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch (Exception e)
            {
                return(false);
            }
        }
Esempio n. 3
0
        public void Acc_Products_NullCrud()
        {
            //add a new product
            Product product = new Product();

            product.CategoryID      = 1;
            product.Discontinued    = false;
            product.ProductName     = "Unit Test Product";
            product.QuantityPerUnit = null;
            product.ReorderLevel    = null;
            product.SupplierID      = null;
            product.UnitPrice       = null;
            product.UnitsInStock    = null;
            product.UnitsOnOrder    = null;

            product.Save("");

            //get the new id
            int newID = product.ProductID;

            product = new Product(newID);
            product.ReorderLevel = 100;
            product.Save("unit test");

            //pull it out to confirm
            product = new Product(newID);
            Assert.IsTrue(product.ReorderLevel == 100, "Bad Save");
            Assert.IsTrue(product.SupplierID == null, "Bad Save, Null not inserted");

            //delete it
            ActiveRecord <Product> .Delete(newID);
        }
Esempio n. 4
0
        public void Show()
        {
            try
            {
                var connection = ActiveRecord.Open();

                using (connection)
                {
                    connection.Open();
                    var sqlCommand = new SqlCommand();
                    sqlCommand.Connection  = connection;
                    sqlCommand.CommandText = "SELECT * FROM Prescriptions";

                    SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();

                    while (sqlDataReader.Read())
                    {
                        Console.WriteLine();
                        Console.WriteLine("ID: " + sqlDataReader["ID"]);
                        Console.WriteLine("Nazwa Klienta: " + sqlDataReader["CustomerName"]);
                        Console.WriteLine("Pesel: " + sqlDataReader["PESEL"]);
                        Console.WriteLine("Numer recepty: " + sqlDataReader["PrescriptionNumber"]);



                        Console.WriteLine();
                    }
                    Console.ReadLine();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Esempio n. 5
0
 public ActionResult MapLocationEditPanel(ActiveRecord record, string latitudeFieldName, string longitudeFieldName, string addressFieldNamesPipeSeparated)
 {
     return(View(new MapLocationViewData()
     {
         DataRecord = record, LatitudeFieldName = latitudeFieldName, LongitudeFieldName = longitudeFieldName, AddressFieldName = addressFieldNamesPipeSeparated
     }));
 }
Esempio n. 6
0
        public void AddRow(DynamicTableEntity result)
        {
            Dictionary <string, object> values = new Dictionary <string, object>();

            foreach (var column in _dbTableSchema.Columns)
            {
                values.Add(column.ColumnName, null);
            }

            foreach (var property in result.Properties)
            {
                try
                {
                    values[property.Key] = property.Value.PropertyAsObject;
                }
                catch (Exception e)
                {
                    Console.WriteLine("Schema broken.");
                }
            }

            var row = ActiveRecord.Create(_dbTableSchema, values);

            Rows.Add(row);
        }
Esempio n. 7
0
        /// <summary>
        /// If a file was uploaded, this is where it is saved to the disk in the attachments folder.
        /// </summary>
        public override void PrepareForSave(ActiveRecord record)
        {
            this.wasPosted = false;                             // set to false, but back to true if file supplied
            if (toDelete || (fileData != null && this.OriginalValue.IsNotBlank()))
            {
                PrepareForDelete(true);
                this.wasPosted = true;
            }

            if (fileData != null && this.FileName != null && !this.savedAlready)
            {
                //save the file if just been uploaded
                using (var stream = fileData.InputStream) {
                    if (stream != null && (stream.Position == 0 || (stream.Length > 0 && stream.Position != stream.Length)))                     //JN only save if not already saved (eg my picture control)
                    //if (true) // do we need the line above?
                    {
                        // correct filename
                        MakeUniqueFilename();
                        //this.FileName = FileSystem.GetUniqueFilename(Web.Attachments, this.FileName, this.MaxLength);
                        string fullPath = Web.MapPath(Web.Attachments + this.FileName);
                        stream.SaveStreamToFile(fullPath);
                        this.wasPosted = true;
                        stream.Close();
                        stream.Dispose();
                        this.savedAlready = true;
                    }
                }
            }
            base.PrepareForSave(record);
        }
Esempio n. 8
0
 public static void AssertFieldsExist(ActiveRecord person)
 {
     // check person record is OK
     if (!person.FieldExists("Email") || !person.FieldExists("PersonID") || !person.FieldExists("DoubleOptInEmailSentDate") || !person.FieldExists("SubscribeDate") || !person.FieldExists("UnsubscribeDate") || !person.FieldExists("HasValidatedEmail"))
     {
         throw new Exception("NewsletterDoubleOptIn - fields missing from person record. The following fields must exists: Email, PersonID, DoubleOptInEmailSentDate, SubscribeDate, UnsubscribeDate, HasValidatedEmail");
     }
 }
Esempio n. 9
0
 public ActionResult ModificationHistoryPanel(ActiveRecord record, bool showHeader)
 {
     CheckForNoShowHeader(record, ref showHeader);
     return(View(new ModificationHistoryViewData()
     {
         DataRecord = record, ShowHeader = showHeader
     }));
 }
Esempio n. 10
0
 private static void CheckForNoShowHeader(ActiveRecord record, ref bool showHeader)
 {
     if (record.Advanced.ExpiryDateField == null && record.Advanced.PublishDateField == null &&
         record.Advanced.IsActiveFields.Count == 0)
     {
         showHeader = false;
     }
 }
Esempio n. 11
0
 public virtual string RowClass(ActiveRecord record)
 {
     if (record == null)
     {
         return("row-" + Html.OddEven);
     }
     return("row-" + Html.OddEven + (record.GetIsActive() ? "" : " inactive"));
 }
Esempio n. 12
0
        public void delete(ActiveRecord item)
        {
            DeleteQuery query = new DeleteQuery(item.GetType());

            query.addWhere("id", item.id.ToString());
            Console.WriteLine(query.build());
            query.exec();
        }
Esempio n. 13
0
        public ActionResult GetChildNav(int id)
        {
            string sql = @"select ID, Title, ParentID, ActiveFlag, OrderID, LevelID, ShowAssets, ViewType, Created
                    from PPSNav where ParentID = '" + id + "' and ActiveFlag = '1'";

            var page = ActiveRecord.GetAllWithSQL <PPSNav>(sql);

            return(Json(JsonConvert.SerializeObject(page), JsonRequestBehavior.AllowGet));
        }
Esempio n. 14
0
 public static bool RemoveFromCach(ActiveRecord record)
 {
     if (cache.ContainsKey(GetCacheKey(record)))
     {
         cache.Remove(GetCacheKey(record));
         return true;
     }
     return false;
 }
Esempio n. 15
0
        public ActionResult PublishSettingsEditPanel(ActiveRecord record, bool showHeader, string cssTablerowClass)
        {
            CheckForNoShowHeader(record, ref showHeader);

            return(View(new PublishSettingsViewData()
            {
                DataRecord = record, ShowHeader = showHeader, CssTablerowClass = cssTablerowClass
            }));
        }
Esempio n. 16
0
        /// <summary>
        /// Deletes a User by their id
        /// </summary>
        /// <param name="id">user id</param>
        /// <returns>true if successfull</returns>
        public override void Delete(int id)
        {
            _userController.Delete(id);
            _profileController.Delete(id);

            ActiveRecord <ManagerAssignment> .Delete(ManagerAssignment.Columns.UserID, id);

            ActiveRecord <ProjectAssignment> .Delete(ProjectAssignment.Columns.UserID, id);
        }
Esempio n. 17
0
            public string GetValue(ActiveRecord record, string fieldName)
            {
                string result = "";

                try {
                    result = record[fieldName] + "";
                } catch (Exception) {
                }
                return(result);
            }
        private void Editar(DTOFrete frete)
        {
            var freteModel = FreteModel.Transform(frete);
            var sql        = ActiveRecord.Update(freteModel);

            using (var contexto = new Contexto())
            {
                contexto.ExecutaComando(sql);
            }
        }
Esempio n. 19
0
        public void logicalDelete(ActiveRecord item)
        {
            UpdateQuery query = new UpdateQuery(item.GetType());

            query.addKeyValue("estado", "0");

            query.addWhere("id", item.id.ToString());
            Console.WriteLine(query.build());
            query.exec();
        }
        private void Editar(DTORota rota)
        {
            var transporteModel = RotaModel.Transform(rota);
            var sql             = ActiveRecord.Update(transporteModel);

            using (var contexto = new Contexto())
            {
                contexto.ExecutaComando(sql);
            }
        }
Esempio n. 21
0
        public void RemoteTwitchLogin(Security s, string username, ref string pCode)
        {
            if (username.ToLower().EndsWith("@beweb.co.nz"))
            {
                var remoteLogin         = "******";
                var isRemoteLoginOnline = false;

                try {
                    var twitchKey = Util.GetSetting("TwitchKey", "dsigbsd9uFSdsg897gasiu%%$#*gas79%*gakisfaf");
                    remoteLogin         = Http.Get("http://twitch.beweb.co.nz/Security/RemoteLogin?EncEmail=" + Crypto.Encrypt(username, twitchKey) + "&EncPassword="******"&EncRemembered=" + Crypto.Encrypt(Crypto.Decrypt(pCode), twitchKey));
                    isRemoteLoginOnline = true;
                } catch { }

                var localPerson  = new ActiveRecord(Security.PersonTableName, Security.PersonTableName + "ID");
                var personExists = localPerson.LoadData(new Sql("where Email = ", username.SqlizeText()));

                // If twitch is online and rejects the user login, then setup to fail the login
                if (isRemoteLoginOnline && remoteLogin == "Failed")
                {
                    pCode           = "invalid user " + Crypto.Random();
                    s.ResultMessage = "Invalid Twitch login";

                    if (personExists)
                    {
                        localPerson["IsActive"].ValueObject = false;
                        localPerson.Save();
                    }
                }

                if (remoteLogin != "Failed")
                {
                    if (!personExists)
                    {
                        localPerson["FirstName"].ValueObject = remoteLogin.Split("|")[0];
                        localPerson["LastName"].ValueObject  = remoteLogin.Split("|")[1] + "*";
                        localPerson["Email"].ValueObject     = username;
                        localPerson["Role"].ValueObject      = "administrators,superadmins,developers";
                        localPerson["Password"].ValueObject  = Security.CreateSecuredPassword(RandomPassword.Generate(5, 7));
                        localPerson["IsActive"].ValueObject  = true;
                        localPerson.Save();

                        s.ResultMessage = "Logged in via Twitch";
                    }
                    else
                    {
                        // log user in with existing account
                        localPerson["IsActive"].ValueObject = true;
                        localPerson.Save();
                        s.ResultMessage = "Logged in via Twitch, using local person";
                    }

                    pCode = Security.DecryptPassword(localPerson["Password"].ToString());
                }
            }
        }
Esempio n. 22
0
        public int insert(ActiveRecord item)
        {
            item.preInsert();
            InsertQuery query = new InsertQuery(item.GetType());

            foreach (KeyValuePair <string, string> properties in getProperties(item))
            {
                query.addKeyValue(properties.Key, properties.Value);
            }
            return(query.exec());
        }
Esempio n. 23
0
    /// <summary>
    /// The Subscribe page must call this function if Request["optin"]!=null to provide the completion of double opt in.
    /// </summary>
    /// <example>if (Request["optin"]!=null) { Models.TextBlock myTextBlock = VerificationLinkClicked(Request["optin"]) }</example>
    /// <param name="optInCode">You need to pass in Request["optin"]</param>
    /// <returns>Returns a Models.TextBlock containing the title and body text to be displayed to the user</returns>
    public static Models.TextBlock VerificationLinkClicked(string optInCode)
    {
        Models.TextBlock textBlock;
        //Web.Write("optinCode: "+Crypto.DecryptID(optInCode));
        //Web.End();
        //var person = Person.LoadID(Crypto.DecryptID(optInCode));
        var person = new ActiveRecord <int>("Person", "PersonID");

        AssertFieldsExist(person);
        bool exists = person.LoadID(Crypto.DecryptID(optInCode));

        if (!exists)
        {
            // not on database, show error
            // get text to display on screen
            textBlock = Models.TextBlock.LoadBySectionCode("Double_OptIn_Error");
            // create if not found
            if (textBlock == null)
            {
                textBlock = new Models.TextBlock {
                    SectionCode      = "Double_OptIn_Error",
                    Title            = "Problem with confirmation link",
                    IsTitleAvailable = true,
                    IsBodyPlainText  = false,
                    BodyTextHtml     = "Sorry, the link you clicked did not work. Your record was not found in our database.<br><br>If you would like to subscribe to our email newsletter, please use the subscribe panel on the right and try the process again."
                };

                textBlock.Save();
            }
        }
        else
        {
            // opt in
            person["SubscribeDate"].ValueObject     = DateTime.Now;
            person["HasValidatedEmail"].ValueObject = true;
            person.Save();

            // get text to display on screen
            textBlock = Models.TextBlock.LoadBySectionCode("Double_OptIn_Confirmed");
            // create if not found
            if (textBlock == null)
            {
                textBlock = new Models.TextBlock {
                    SectionCode      = "Double_OptIn_Confirmed",
                    IsBodyPlainText  = false,
                    IsTitleAvailable = true,
                    Title            = "Subscribe Confirmed",
                    BodyTextHtml     = "Thanks very much for confirming your subscription.<br><br>You are now subscribed to our email newsletter."
                };
                textBlock.Save();
            }
        }
        return(textBlock);
    }
Esempio n. 24
0
 /// <summary>
 /// prepare each field for save
 /// </summary>
 /// <param name="record"></param>
 public virtual void PrepareForSave(ActiveRecord record)
 {
     if (IsDateField && Name == "DateModified")
     {
         ValueObject = DateTime.Now;
     }
     else if (IsDateField && Name == "DateAdded" && record.IsNewRecord)
     {
         ValueObject = DateTime.Now;
     }
 }
        public void Excluir(int id)
        {
            var freteModel = new FreteModel {
                Id = id.ToString()
            };
            var sql = ActiveRecord.Delete(freteModel);

            using (var contexto = new Contexto())
            {
                contexto.ExecutaComando(sql);
            }
        }
Esempio n. 26
0
 protected void CheckLock(ActiveRecord record)
 {
     if (record == null)
     {
         return;
     }
     lockobj.InitLocking(Security.LoggedInUserID);
     if (!lockobj.LockTable(record.GetTableName(), (record[record.GetPrimaryKeyName()] + "").ToIntOrDie(), record.GetName()))
     {
         Web.ErrorMessage = lockobj.LockMessage;
     }
 }
Esempio n. 27
0
        public int update(ActiveRecord item)
        {
            UpdateQuery query = new UpdateQuery(item.GetType());

            foreach (KeyValuePair <string, string> properties in getProperties(item))
            {
                query.addKeyValue(properties.Key, properties.Value);
            }
            query.addWhere("id", item.id.ToString());
            Console.WriteLine(query.build());
            return(query.exec());
        }
Esempio n. 28
0
        public static Dictionary<string, object> GetData(ActiveRecord inst)
        {
            var t = inst.GetType();
            if (!rowCreators.ContainsKey(t))
                throw new Exception("No creator has been added for Type [" + t.FullName + "]");

            var rc = rowCreators[t];

            if( rc.GetDataFunction == null )
                throw new Exception( "No {GetData} Delegate has been added for Type [" + t.FullName + "]" );

            return rowCreators[t].GetDataFunction(inst);
        }
Esempio n. 29
0
        public static void InitialzeAR()
        {
            XmlConfigurator.Configure();
            if (!ActiveRecordStarter.IsInitialized)
            {
                var activeRecord = new ActiveRecord();
                activeRecord.Assemblies = activeRecord.Assemblies.Concat(new[] { "Test.Support" }).ToArray();
                activeRecord.Initialize(ActiveRecordSectionHandler.Instance);
                var admin = new Seed().Run();

                SecurityContext.GetAdministrator = () => admin;
                Administrator.GetHost            = () => "localhost";
            }
        }
Esempio n. 30
0
 public static void AddPhrase(ActiveRecord record, string phrase = null, bool splitPhrase = false, string delimiter = ",")
 {
     if (phrase == null)
     {
         phrase = record.GetName();
     }
     if (record.GetIsActive())
     {
         AddPhrase(record.GetTableName(), record.ID_Field.ToInt(), phrase, splitPhrase, delimiter);
     }
     else
     {
         DeletePhrase(record);
     }
 }
Esempio n. 31
0
        public void save(ActiveRecord item)
        {
            item.preSave();

            if (item.id != 0)
            {
                this.update(item);
            }
            else
            {
                item.id = this.insert(item);
            }

            item.afterSave();
        }
Esempio n. 32
0
        /// <summary>
        /// Аутентификация пользователя
        /// </summary>
        private void LoginClick(object obj)
        {
            RowMapper <User>    rowMapper = RowMapper;
            ActiveRecord <User> dao       = new ActiveRecord <User>("User", rowMapper);
            User us = dao.Select(Login);

            if (us != null)
            {
                User.SharedUser = us;
                MenuWindow    menu      = new MenuWindow();
                MenuViewModel viewModel = new MenuViewModel(menu);
                menu.DataContext = viewModel;
                menu.Show();
            }
        }
Esempio n. 33
0
 public static bool InCache(ActiveRecord record)
 {
     return cache.ContainsKey(GetCacheKey(record));
 }
Esempio n. 34
0
 private static string GetCacheKey(ActiveRecord record)
 {
     return record.GetType().Name + " " + record.Id;
 }
Esempio n. 35
0
 public static List<Person> GetContacts(ActiveRecord obj)
 {
     return ActiveRecord.Find<Person>("AssociatedKey", obj.GetType().Name + " " + obj.Id);
 }
Esempio n. 36
0
 public bool SetAssociatedKey(ActiveRecord obj)
 {
     return obj != null ? (AssociatedKey = obj.GetType().Name + " " + obj.Id) != null : false;
 }
 public void SetUDT(ActiveRecord rec)
 {
     this._target = rec;
     this.FillData();
 }
Esempio n. 38
0
 public Sync()
 {
     this.snackthatClient = new SnackthatServiceClient.SnackthatServiceSoapClient();
     this.aR = new ActiveRecord();
 }
Esempio n. 39
0
        public void receiveData(int idSeller)
        {
            try
            {
                Clients.addMessage(0);

                this.snackthatClient = new SnackthatServiceClient.SnackthatServiceSoapClient();
                this.aR = new ActiveRecord();

                Clients.addMessage(5);
                DataTable dtUsers = this.snackthatClient.getSellers();

                if (dtUsers != null)
                {
                    this.aR.callProcedure("deleteUsers");

                    for (int i = 0; i < dtUsers.Rows.Count; i++)
                    {
                        ArrayList parametersUser = new ArrayList();

                        parametersUser.Add(dtUsers.Rows[i].ItemArray[0].ToString());
                        parametersUser.Add(dtUsers.Rows[i].ItemArray[1].ToString());
                        parametersUser.Add(dtUsers.Rows[i].ItemArray[2].ToString());
                        parametersUser.Add(dtUsers.Rows[i].ItemArray[3].ToString());
                        parametersUser.Add(dtUsers.Rows[i].ItemArray[4].ToString());
                        parametersUser.Add(dtUsers.Rows[i].ItemArray[5].ToString());
                        parametersUser.Add(dtUsers.Rows[i].ItemArray[6].ToString());
                        parametersUser.Add(dtUsers.Rows[i].ItemArray[7].ToString());
                        parametersUser.Add(dtUsers.Rows[i].ItemArray[8].ToString());
                        parametersUser.Add(dtUsers.Rows[i].ItemArray[9].ToString());

                        this.aR.callProcedure("setUser", parametersUser);
                    }
                }

                Clients.addMessage(15);
                DataTable dtProducts = this.snackthatClient.getProductsBySeller(idSeller);

                Clients.addMessage(25);
                if (dtProducts != null)
                {
                    this.aR.callProcedure("deleteProductsContent");
                    Clients.addMessage(30);
                    for (int i = 0; i < dtProducts.Rows.Count; i++)
                    {
                        ArrayList parametersProduct = new ArrayList();

                        parametersProduct.Add(dtProducts.Rows[i].ItemArray[0].ToString()); //ID
                        parametersProduct.Add(dtProducts.Rows[i].ItemArray[2].ToString()); //Presentation
                        parametersProduct.Add(dtProducts.Rows[i].ItemArray[1].ToString()); //Name
                        parametersProduct.Add(dtProducts.Rows[i].ItemArray[5].ToString()); //Amount
                        parametersProduct.Add(dtProducts.Rows[i].ItemArray[3].ToString()); //Price
                        parametersProduct.Add(HttpUtility.HtmlDecode(dtProducts.Rows[i].ItemArray[4].ToString())); //Description

                        this.aR.callProcedure("setProduct", parametersProduct);
                    }
                }

                Clients.addMessage(50);
                DataTable dtRoute = this.snackthatClient.getRouteBySeller(idSeller); //id
                ArrayList parametersRoute = new ArrayList();

                Clients.addMessage(65);
                if (dtRoute != null)
                {
                    parametersRoute.Add(dtRoute.Rows[0].ItemArray[0].ToString()); //ID
                    parametersRoute.Add(dtRoute.Rows[0].ItemArray[1].ToString()); //Name

                    this.aR.callProcedure("setRoute", parametersRoute);
                }

                Clients.addMessage(75);
                DataTable dtCustomers = this.snackthatClient.getCustomersByRoute(int.Parse(parametersRoute[0].ToString())); //id

                Clients.addMessage(80);
                if (dtCustomers != null)
                {
                    for (int i = 0; i < dtCustomers.Rows.Count; i++)
                    {
                        ArrayList parametersCustomer = new ArrayList();
                        parametersCustomer.Add(dtCustomers.Rows[i].ItemArray[0].ToString()); //IdCustomer
                        parametersCustomer.Add(dtCustomers.Rows[i].ItemArray[1].ToString()); //Name
                        parametersCustomer.Add(dtCustomers.Rows[i].ItemArray[2].ToString()); //LastName
                        parametersCustomer.Add(dtCustomers.Rows[i].ItemArray[3].ToString()); //eMail
                        parametersCustomer.Add(dtCustomers.Rows[i].ItemArray[4].ToString()); //RFC

                        //Parametros de la tabla addressescustomer
                        ArrayList parametersCustomerAddresses = new ArrayList();
                        parametersCustomerAddresses.Add(dtCustomers.Rows[i].ItemArray[5].ToString()); //IdAddressCustomer
                        parametersCustomerAddresses.Add(dtCustomers.Rows[i].ItemArray[6].ToString()); //IdCustomer
                        parametersCustomerAddresses.Add(dtCustomers.Rows[i].ItemArray[7].ToString()); //Address
                        parametersCustomerAddresses.Add(dtCustomers.Rows[i].ItemArray[8].ToString()); //Phone

                        //Parametros de la tabla customersroutes
                        ArrayList parametersRouteCustomers = new ArrayList();
                        parametersRouteCustomers.Add(dtCustomers.Rows[i].ItemArray[9].ToString()); //IdCustomerRoute
                        parametersRouteCustomers.Add(dtCustomers.Rows[i].ItemArray[10].ToString()); //IdRoute
                        parametersRouteCustomers.Add(dtCustomers.Rows[i].ItemArray[11].ToString()); //IdAddressCustomer
                        parametersRouteCustomers.Add(dtCustomers.Rows[i].ItemArray[12].ToString()); //EstimatedTime

                        try
                        {
                            parametersRouteCustomers[parametersRouteCustomers.Count - 1] = Convert.ToDateTime(parametersRouteCustomers[parametersRouteCustomers.Count - 1].ToString());
                        }
                        catch (Exception ex)
                        {
                            parametersRouteCustomers[parametersRouteCustomers.Count - 1] = null;
                        }

                        //Se llenan las tablas de customer, addressescustomers y customersroutes
                        this.aR.callProcedure("setCustomer", parametersCustomer);
                        this.aR.callProcedure("setAddressesCustomer", parametersCustomerAddresses);
                        this.aR.callProcedure("setCustomersRoutes", parametersRouteCustomers);
                    }
                    Clients.addMessage(100);
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException ex)
            {
                Clients.addMessage(1000);
            }
            catch (Exception ex)
            {
                Clients.addMessage(3000);
            }
        }
Esempio n. 40
0
        // Generates content of documentSettingsPart1.
        private void GenerateDocumentSettingsPart1Content(DocumentSettingsPart documentSettingsPart1)
        {
            Settings settings1 = new Settings() {MCAttributes = new MarkupCompatibilityAttributes() {Ignorable = "w14"}};
            settings1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            settings1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
            settings1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            settings1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
            settings1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
            settings1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
            settings1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
            settings1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
            settings1.AddNamespaceDeclaration("sl", "http://schemas.openxmlformats.org/schemaLibrary/2006/main");
            Zoom zoom1 = new Zoom() {Percent = "100"};
            ProofState proofState1 = new ProofState() {Spelling = ProofingStateValues.Clean, Grammar = ProofingStateValues.Clean};

            MailMerge mailMerge1 = new MailMerge();
            MainDocumentType mainDocumentType1 = new MainDocumentType() {Val = MailMergeDocumentValues.FormLetter};
            DataType dataType1 = new DataType() {Val = MailMergeDataValues.TextFile};
            ActiveRecord activeRecord1 = new ActiveRecord() {Val = -1};

            mailMerge1.Append(mainDocumentType1);
            mailMerge1.Append(dataType1);
            mailMerge1.Append(activeRecord1);
            DefaultTabStop defaultTabStop1 = new DefaultTabStop() {Val = 720};
            CharacterSpacingControl characterSpacingControl1 = new CharacterSpacingControl()
                                                               {Val = CharacterSpacingValues.DoNotCompress};

            HeaderShapeDefaults headerShapeDefaults1 = new HeaderShapeDefaults();
            Ovml.ShapeDefaults shapeDefaults1 = new Ovml.ShapeDefaults()
                                                {Extension = V.ExtensionHandlingBehaviorValues.Edit, MaxShapeId = 6145};

            headerShapeDefaults1.Append(shapeDefaults1);

            FootnoteDocumentWideProperties footnoteDocumentWideProperties1 = new FootnoteDocumentWideProperties();
            FootnoteSpecialReference footnoteSpecialReference1 = new FootnoteSpecialReference() {Id = -1};
            FootnoteSpecialReference footnoteSpecialReference2 = new FootnoteSpecialReference() {Id = 0};

            footnoteDocumentWideProperties1.Append(footnoteSpecialReference1);
            footnoteDocumentWideProperties1.Append(footnoteSpecialReference2);

            EndnoteDocumentWideProperties endnoteDocumentWideProperties1 = new EndnoteDocumentWideProperties();
            EndnoteSpecialReference endnoteSpecialReference1 = new EndnoteSpecialReference() {Id = -1};
            EndnoteSpecialReference endnoteSpecialReference2 = new EndnoteSpecialReference() {Id = 0};

            endnoteDocumentWideProperties1.Append(endnoteSpecialReference1);
            endnoteDocumentWideProperties1.Append(endnoteSpecialReference2);

            Compatibility compatibility1 = new Compatibility();
            CompatibilitySetting compatibilitySetting1 = new CompatibilitySetting()
                                                         {
                                                         	Name = CompatSettingNameValues.CompatibilityMode,
                                                         	Uri = "http://schemas.microsoft.com/office/word",
                                                         	Val = "14"
                                                         };
            CompatibilitySetting compatibilitySetting2 = new CompatibilitySetting()
                                                         {
                                                         	Name =
                                                         		CompatSettingNameValues.OverrideTableStyleFontSizeAndJustification,
                                                         	Uri = "http://schemas.microsoft.com/office/word",
                                                         	Val = "1"
                                                         };
            CompatibilitySetting compatibilitySetting3 = new CompatibilitySetting()
                                                         {
                                                         	Name = CompatSettingNameValues.EnableOpenTypeFeatures,
                                                         	Uri = "http://schemas.microsoft.com/office/word",
                                                         	Val = "1"
                                                         };
            CompatibilitySetting compatibilitySetting4 = new CompatibilitySetting()
                                                         {
                                                         	Name = CompatSettingNameValues.DoNotFlipMirrorIndents,
                                                         	Uri = "http://schemas.microsoft.com/office/word",
                                                         	Val = "1"
                                                         };

            compatibility1.Append(compatibilitySetting1);
            compatibility1.Append(compatibilitySetting2);
            compatibility1.Append(compatibilitySetting3);
            compatibility1.Append(compatibilitySetting4);

            Rsids rsids1 = new Rsids();
            RsidRoot rsidRoot1 = new RsidRoot() {Val = "002307CA"};
            Rsid rsid25 = new Rsid() {Val = "00021925"};
            Rsid rsid26 = new Rsid() {Val = "0005059E"};
            Rsid rsid27 = new Rsid() {Val = "002307CA"};
            Rsid rsid28 = new Rsid() {Val = "00267818"};
            Rsid rsid29 = new Rsid() {Val = "002E2CE3"};
            Rsid rsid30 = new Rsid() {Val = "00367B71"};
            Rsid rsid31 = new Rsid() {Val = "003C716F"};
            Rsid rsid32 = new Rsid() {Val = "00442AD3"};
            Rsid rsid33 = new Rsid() {Val = "00485B24"};
            Rsid rsid34 = new Rsid() {Val = "004B0395"};
            Rsid rsid35 = new Rsid() {Val = "005A7CCB"};
            Rsid rsid36 = new Rsid() {Val = "00664E23"};
            Rsid rsid37 = new Rsid() {Val = "006D0F9D"};
            Rsid rsid38 = new Rsid() {Val = "006F12E1"};
            Rsid rsid39 = new Rsid() {Val = "00731A43"};
            Rsid rsid40 = new Rsid() {Val = "00736D14"};
            Rsid rsid41 = new Rsid() {Val = "007977E5"};
            Rsid rsid42 = new Rsid() {Val = "007B10F8"};
            Rsid rsid43 = new Rsid() {Val = "007C67E7"};
            Rsid rsid44 = new Rsid() {Val = "00960953"};
            Rsid rsid45 = new Rsid() {Val = "009F02C7"};
            Rsid rsid46 = new Rsid() {Val = "00A056C7"};
            Rsid rsid47 = new Rsid() {Val = "00B32099"};
            Rsid rsid48 = new Rsid() {Val = "00B92CF0"};
            Rsid rsid49 = new Rsid() {Val = "00BC57A3"};
            Rsid rsid50 = new Rsid() {Val = "00BE6B68"};
            Rsid rsid51 = new Rsid() {Val = "00BF235B"};
            Rsid rsid52 = new Rsid() {Val = "00BF5126"};
            Rsid rsid53 = new Rsid() {Val = "00C91302"};
            Rsid rsid54 = new Rsid() {Val = "00CA68EB"};
            Rsid rsid55 = new Rsid() {Val = "00E33AA1"};
            Rsid rsid56 = new Rsid() {Val = "00E40D36"};
            Rsid rsid57 = new Rsid() {Val = "00E7460D"};
            Rsid rsid58 = new Rsid() {Val = "00E95156"};
            Rsid rsid59 = new Rsid() {Val = "00F06304"};
            Rsid rsid60 = new Rsid() {Val = "00FA5EBC"};
            Rsid rsid61 = new Rsid() {Val = "00FB1F22"};

            rsids1.Append(rsidRoot1);
            rsids1.Append(rsid25);
            rsids1.Append(rsid26);
            rsids1.Append(rsid27);
            rsids1.Append(rsid28);
            rsids1.Append(rsid29);
            rsids1.Append(rsid30);
            rsids1.Append(rsid31);
            rsids1.Append(rsid32);
            rsids1.Append(rsid33);
            rsids1.Append(rsid34);
            rsids1.Append(rsid35);
            rsids1.Append(rsid36);
            rsids1.Append(rsid37);
            rsids1.Append(rsid38);
            rsids1.Append(rsid39);
            rsids1.Append(rsid40);
            rsids1.Append(rsid41);
            rsids1.Append(rsid42);
            rsids1.Append(rsid43);
            rsids1.Append(rsid44);
            rsids1.Append(rsid45);
            rsids1.Append(rsid46);
            rsids1.Append(rsid47);
            rsids1.Append(rsid48);
            rsids1.Append(rsid49);
            rsids1.Append(rsid50);
            rsids1.Append(rsid51);
            rsids1.Append(rsid52);
            rsids1.Append(rsid53);
            rsids1.Append(rsid54);
            rsids1.Append(rsid55);
            rsids1.Append(rsid56);
            rsids1.Append(rsid57);
            rsids1.Append(rsid58);
            rsids1.Append(rsid59);
            rsids1.Append(rsid60);
            rsids1.Append(rsid61);

            M.MathProperties mathProperties1 = new M.MathProperties();
            M.MathFont mathFont1 = new M.MathFont() {Val = "Cambria Math"};
            M.BreakBinary breakBinary1 = new M.BreakBinary() {Val = M.BreakBinaryOperatorValues.Before};
            M.BreakBinarySubtraction breakBinarySubtraction1 = new M.BreakBinarySubtraction()
                                                               {Val = M.BreakBinarySubtractionValues.MinusMinus};
            M.SmallFraction smallFraction1 = new M.SmallFraction() {Val = M.BooleanValues.Zero};
            M.DisplayDefaults displayDefaults1 = new M.DisplayDefaults();
            M.LeftMargin leftMargin1 = new M.LeftMargin() {Val = (UInt32Value) 0U};
            M.RightMargin rightMargin1 = new M.RightMargin() {Val = (UInt32Value) 0U};
            M.DefaultJustification defaultJustification1 = new M.DefaultJustification() {Val = M.JustificationValues.CenterGroup};
            M.WrapIndent wrapIndent1 = new M.WrapIndent() {Val = (UInt32Value) 1440U};
            M.IntegralLimitLocation integralLimitLocation1 = new M.IntegralLimitLocation()
                                                             {Val = M.LimitLocationValues.SubscriptSuperscript};
            M.NaryLimitLocation naryLimitLocation1 = new M.NaryLimitLocation() {Val = M.LimitLocationValues.UnderOver};

            mathProperties1.Append(mathFont1);
            mathProperties1.Append(breakBinary1);
            mathProperties1.Append(breakBinarySubtraction1);
            mathProperties1.Append(smallFraction1);
            mathProperties1.Append(displayDefaults1);
            mathProperties1.Append(leftMargin1);
            mathProperties1.Append(rightMargin1);
            mathProperties1.Append(defaultJustification1);
            mathProperties1.Append(wrapIndent1);
            mathProperties1.Append(integralLimitLocation1);
            mathProperties1.Append(naryLimitLocation1);
            ThemeFontLanguages themeFontLanguages1 = new ThemeFontLanguages() {Val = "en-US"};
            ColorSchemeMapping colorSchemeMapping1 = new ColorSchemeMapping()
                                                     {
                                                     	Background1 = ColorSchemeIndexValues.Light1,
                                                     	Text1 = ColorSchemeIndexValues.Dark1,
                                                     	Background2 = ColorSchemeIndexValues.Light2,
                                                     	Text2 = ColorSchemeIndexValues.Dark2,
                                                     	Accent1 = ColorSchemeIndexValues.Accent1,
                                                     	Accent2 = ColorSchemeIndexValues.Accent2,
                                                     	Accent3 = ColorSchemeIndexValues.Accent3,
                                                     	Accent4 = ColorSchemeIndexValues.Accent4,
                                                     	Accent5 = ColorSchemeIndexValues.Accent5,
                                                     	Accent6 = ColorSchemeIndexValues.Accent6,
                                                     	Hyperlink = ColorSchemeIndexValues.Hyperlink,
                                                     	FollowedHyperlink = ColorSchemeIndexValues.FollowedHyperlink
                                                     };

            ShapeDefaults shapeDefaults2 = new ShapeDefaults();
            Ovml.ShapeDefaults shapeDefaults3 = new Ovml.ShapeDefaults()
                                                {Extension = V.ExtensionHandlingBehaviorValues.Edit, MaxShapeId = 6145};

            Ovml.ShapeLayout shapeLayout1 = new Ovml.ShapeLayout() {Extension = V.ExtensionHandlingBehaviorValues.Edit};
            Ovml.ShapeIdMap shapeIdMap1 = new Ovml.ShapeIdMap() {Extension = V.ExtensionHandlingBehaviorValues.Edit, Data = "1"};

            shapeLayout1.Append(shapeIdMap1);

            shapeDefaults2.Append(shapeDefaults3);
            shapeDefaults2.Append(shapeLayout1);
            DecimalSymbol decimalSymbol1 = new DecimalSymbol() {Val = "."};
            ListSeparator listSeparator1 = new ListSeparator() {Val = ","};

            settings1.Append(zoom1);
            settings1.Append(proofState1);
            settings1.Append(mailMerge1);
            settings1.Append(defaultTabStop1);
            settings1.Append(characterSpacingControl1);
            settings1.Append(headerShapeDefaults1);
            settings1.Append(footnoteDocumentWideProperties1);
            settings1.Append(endnoteDocumentWideProperties1);
            settings1.Append(compatibility1);
            settings1.Append(rsids1);
            settings1.Append(mathProperties1);
            settings1.Append(themeFontLanguages1);
            settings1.Append(colorSchemeMapping1);
            settings1.Append(shapeDefaults2);
            settings1.Append(decimalSymbol1);
            settings1.Append(listSeparator1);

            documentSettingsPart1.Settings = settings1;
        }
Esempio n. 41
0
 public static void AddToCache(ActiveRecord record)
 {
     cache[GetCacheKey(record)] = record;
 }
Esempio n. 42
0
 /// <summary>
 /// Constructor of the class, initialize the instance of the ActiveRecord Object
 /// </summary>
 public Data()
 {
     this.aR = new ActiveRecord();
 }
Esempio n. 43
0
        public void sendData()
        {
            try
            {
                Clients.addMessage(0);

                this.snackthatClient = new SnackthatServiceClient.SnackthatServiceSoapClient();
                this.aR = new ActiveRecord();

                Clients.addMessage(25);
                DataTable dt = new Customers().getAllCustomers(1);
                DataTable route = new Routes().getAllRoutes();

                Clients.addMessage(50);
                dt.TableName = "ClientesChofer";
                this.snackthatClient.setCustomers(dt, Convert.ToInt16(route.Rows[0].ItemArray[0].ToString()));

                DataTable dtProducts = new Products().getAllProducts(), dtSells = this.aR.callProcedure("getAllSells"), dtProductsSells = this.aR.callProcedure("getAllProductsSell");
                Clients.addMessage(75);

                dtProducts.TableName = "Productos";
                dtSells.TableName = "RegistroVentas";
                dtProductsSells.TableName = "ProductsSells";
                this.snackthatClient.setSells(dtProducts, dtSells, dtProductsSells, Convert.ToInt16(route.Rows[0].ItemArray[0].ToString()));

                Clients.addMessage(90);
                this.aR.callProcedure("cleanAll");
                Clients.addMessage(100);
            }
            catch (System.ServiceModel.EndpointNotFoundException ex)
            {
                Clients.addMessage(1000);
            }
            catch (Exception ex)
            {
                Clients.addMessage(2000);
            }
        }