예제 #1
0
        public override void Selected(NSIndexPath indexPath)
        {
            InstallTypeBadgeElement selectedElement = (this.Root[0].Elements[indexPath.Row] as InstallTypeBadgeElement);
            InstallationType        insType         = selectedElement.ThisInstall;

            SaveInstallTypeToDatabase(insType.ID);

            jivc.AddPartsRangeToList(insType.PartsLink);
            jivc.GoChooseSaleOptions();

            // find if the database contains a roof install sale option
            InstallationType roofIns = InstallTypesDVC.dbInstallTypes.FindLast(
                delegate(InstallationType ins)
                { return(ins.Name == "Roof"); });

            // if it does, we must check if roof installation was chosen by the user
            if (roofIns != null)
            {
                // if a roof installation has been chosen, an extra fee must be applied to the job
                if (insType.ID == roofIns.ID)
                {
                    jivc.dvcSO.SaveOptionToDatabase(11);
                    jivc.dvcSO.ApplyExtraFeeForSaleOption(11);
                }
            }

            // base.Selected (indexPath);
        }
예제 #2
0
        public static List <InstallationType> ReadInstallTypes()
        {
            List <InstallationType> result = null;
            string dbPath = ServerClientViewController.dbFilePath;

            // read install types data here
            using (var dbConnection = new SqliteConnection("Data Source = " + dbPath))
            {
                dbConnection.Open();
                using (var dbCommand = dbConnection.CreateCommand())
                {
                    string sql = "SELECT * FROM INSTALL_TYPES WHERE IT_USED=1";
                    dbCommand.CommandText = sql;
                    using (var reader = dbCommand.ExecuteReader())
                    {
                        result = new List <InstallationType>();
                        while (reader.Read())
                        {
                            InstallationType type = new InstallationType()
                            {
                                ID        = (long)reader["it_id"],
                                Name      = (string)reader["it_name"],
                                Image     = UIImage.LoadFromData(NSData.FromArray((byte[])reader["picture"])),
                                PartsLink = (long)reader["stnd_oid"]
                            };

                            if (type.Image == null)
                            {
                                type.Image = UIImage.FromBundle("Images/puratap-logo");                                  //image;
                            }

                            result.Add(type);
                        }
                        if (!reader.IsClosed)
                        {
                            reader.Close();
                        }
                    }
                }
            }
            return(result);
        }
예제 #3
0
 public InstallTypeBadgeElement(InstallationType inst, Action tapped) : base(inst.Image, inst.Name, tapped)
 {
     ThisInstall = inst;
 }