Example #1
0
        public static bool AddBankInfo(BankInfo record)
        {
            using (DeneysanContext db = new DeneysanContext())
            {
                try
                {
                    
                    record.Online = true;
                    db.BankInfo.Add(record);
                    db.SaveChanges();

                    LogtrackManager logkeeper = new LogtrackManager();
                    logkeeper.LogDate = DateTime.Now;
                    logkeeper.LogProcess = EnumLogType.BankaBilgisi.ToString();
                    logkeeper.Message = LogMessages.BankAdded;
                    logkeeper.User = HttpContext.Current.User.Identity.Name;
                    logkeeper.Data = record.BankName;
                    logkeeper.AddInfoLog(logger);


                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }
            }

        }
        public ActionResult AddBank(BankInfo bank,HttpPostedFileBase uploadfile)
        {
            var languages = LanguageManager.GetLanguages();
            var list = new SelectList(languages, "Culture", "Language");
            ViewBag.LanguageList = list;
            if (ModelState.IsValid)
            {
                if (uploadfile != null && uploadfile.ContentLength > 0)
                {
                    Random random = new Random();
                    int rand = random.Next(1000, 99999999);
                    new ImageHelper(280, 80).SaveThumbnail(uploadfile, "/Content/images/bankinfo/", Utility.SetPagePlug(bank.BankName) + "_" + rand + Path.GetExtension(uploadfile.FileName));
                    bank.Logo = "/Content/images/bankinfo/" + Utility.SetPagePlug(bank.BankName) + "_" + rand + Path.GetExtension(uploadfile.FileName);
                }
                else
                {
                    bank.Logo = "/Content/images/front/noimage.jpeg";
                }

                
                ViewBag.ProcessMessage = BankManager.AddBankInfo(bank);
                ModelState.Clear();
                // Response.Redirect("/yonetim/haberduzenle/" + newsmodel.NewsId);
                return View();
            }
            else
                return View();
        }
Example #3
0
        public BankDAL()
        {
            bankModel = new BankModel();
            bankEntity = new BankInfo();
            tbankData = new TBankData();
            tbankData.bankModel = new BankModel();

            _dataContext = new MDKDBMLDataContext();
        }
Example #4
0
        public bool Bind(BankCardInfo card)
        {
            card.CardNo = card.CardNo.Replace(" ", "");//删除空格
            City city = ChinaArea.GetCity(card.City_Id);

            if (city == null)
            {
                Alert((ResultType)409, "选择的城市有误");
                return(false);
            }
            Province province = ChinaArea.GetProvince(city.Province_ID);

            if (province == null)
            {
                Alert((ResultType)409, "选择的城市有误");
                return(false);
            }
            var fac = UserModuleFactory.GetUserModuleInstance();

            if (fac == null)
            {
                Alert((ResultType)500, "系统错误");
                return(false);
            }
            IUser user = fac.GetUserByCode(card.UserCode);

            if (user == null)
            {
                Alert((ResultType)404, "找不到用户信息");
                return(false);
            }
            if (user.Auth_Status != Interface.Enums.Auth_Status.已认证)
            {
                Alert((ResultType)403, "绑定银行卡必须先认证");
                return(false);
            }
            if (!string.Equals(user.UserName, card.CardHolder))
            {
                Alert((ResultType)403, "持卡人户名与认证姓名不符");
                return(false);
            }
            BankInfo bank = xUtils.GetBankInfoById(card.BankId);

            if (bank == null)
            {
                Alert((ResultType)409, "银行类型有误");
                return(false);
            }
            Tnet_Bank_Account daAcct = new Tnet_Bank_Account();

            daAcct.Account_Name   = card.CardHolder;
            daAcct.Account_Type   = 1;
            daAcct.Bank_Id        = card.BankId;
            daAcct.Bank_Name      = bank.BankName;
            daAcct.Branch_No      = card.BranchNo;
            daAcct.Branch_Bank    = card.BranchName;
            daAcct.Card_No        = card.CardNo;
            daAcct.City_Name      = city.City_Name;
            daAcct.Image_Fullpath = card.CardImage;
            daAcct.Province_Name  = province.Province_Name;
            daAcct.Remarks        = null;
            daAcct.Status         = (int)ValidateStatus.审核中;
            daAcct.User_Id        = user.UserId;
            daAcct.Province_Id    = province.Province_Id;
            daAcct.City_Id        = city.City_ID;
            if (!daAcct.Insert())
            {
                Alert((ResultType)501, "系统错误");
                return(false);
            }
            if (string.Equals(user.UserName, card.CardHolder))//认证名称与绑卡名称一致,自动审核通过
            {
                BankCardProvider bcp = new BankCardProvider();
                bool             res = bcp.Validate(daAcct.Id, true, "系统自动审核", 0);
                Log.Info($"户名验证通过,自动审核!审核结果:{res},错误信息:{bcp.PromptInfo.CustomMessage}");
            }
            return(true);
        }
Example #5
0
        /// <summary>
        /// Instruments changed.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void InstrumentsChanged(object sender, EventArgs e)
        {
            //Writing info.
            if (WritingInfo)
            {
                return;
            }
            WritingInfo = true;

            //Ids.
            List <int> ids = new List <int>();

            ids.Add(-1);

            //For each instrument.
            for (int i = 1; i < instruments.Rows.Count; i++)
            {
                //Get the cells.
                var bankCell    = (DataGridViewComboBoxCell)instruments.Rows[i - 1].Cells["bank"];
                var instCell    = (DataGridViewComboBoxCell)instruments.Rows[i - 1].Cells["instrument"];
                var idCell      = (DataGridViewTextBoxCell)instruments.Rows[i - 1].Cells["newId"];
                var warModeCell = (DataGridViewComboBoxCell)instruments.Rows[i - 1].Cells["waveArchiveMode"];

                //Test.
                if (bankCell.Value == null)
                {
                    bankCell.Value = (instruments.Columns["bank"] as DataGridViewComboBoxColumn).Items[0];
                }
                if (instCell.Items.Count < 1)
                {
                    PopulateInstrumentBox(SA.Banks.Where(x => x.Index == int.Parse(((string)bankCell.Value).Split('[')[1].Split(']')[0])).FirstOrDefault().File, instCell, false);
                }
                string instBak = "";
                try { instBak = (string)instCell.Value; } catch { }
                instCell.Value = instCell.Items[0];
                while (instCell.Items.Count > 1)
                {
                    instCell.Items.RemoveAt(instCell.Items.Count - 1);
                }
                if (instBak == null)
                {
                    instBak = "";
                }
                PopulateInstrumentBox(SA.Banks.Where(x => x.Index == int.Parse(((string)bankCell.Value).Split('[')[1].Split(']')[0])).FirstOrDefault().File, instCell, true);
                if (instCell.Items.Contains(instBak))
                {
                    instCell.Value = instBak;
                }
                else
                {
                    instCell.Value = instCell.Items[0];
                }
                if (idCell.Value == null || idCell.Value.ToString() == "")
                {
                    int newId = ids.Last() + 1;
                    while (ids.Contains(newId))
                    {
                        newId++;
                    }
                    idCell.Value = newId;
                    ids.Add(newId);
                }
                else
                {
                    if (ids.Contains(int.Parse(idCell.Value.ToString())))
                    {
                        int newId = ids.Last() + 1;
                        while (ids.Contains(newId))
                        {
                            newId++;
                        }
                        idCell.Value = newId;
                        ids.Add(newId);
                    }
                    ids.Add(int.Parse(idCell.Value.ToString()));
                }
                if (warModeCell.Value == null)
                {
                    warModeCell.Value = (instruments.Columns["waveArchiveMode"] as DataGridViewComboBoxColumn).Items[0];
                }

                //Set war mode cell values.
                bool          warModeSecond = warModeCell.Value != warModeCell.Items[0];
                BankInfo      b             = SA.Banks.Where(x => x.Index == int.Parse(((string)bankCell.Value).Split('[')[1].Split(']')[0])).FirstOrDefault();
                Instrument    inst          = b.File.Instruments.Where(x => x.Index == int.Parse(((string)instCell.Value).Split('[')[1].Split(']')[0])).FirstOrDefault();
                List <string> wars          = new List <string>();
                foreach (var n in inst.NoteInfo)
                {
                    if (n.InstrumentType == InstrumentType.PCM)
                    {
                        string name = "Null";
                        try {
                            name = b.WaveArchives[n.WarId].Name;
                        } catch {}
                        if (!wars.Contains(name))
                        {
                            wars.Add(name);
                        }
                    }
                }
                string newWarModeName = "Use Existing Wave Archive" + (wars.Count > 1 ? "s" : "") + " " + "(";
                if (wars.Count < 1)
                {
                    newWarModeName += "None)";
                }
                else
                {
                    for (int j = 0; j < wars.Count - 1; j++)
                    {
                        newWarModeName += wars[j] + ", ";
                    }
                    newWarModeName += wars.Last() + ")";
                }
                warModeCell.Items[1] = newWarModeName;
                if (warModeSecond)
                {
                    warModeCell.Value = warModeCell.Items[1];
                }
            }

            //Writing info.
            WritingInfo = false;
        }
        private static async Task Seed(DatabaseContext databaseContext)
        {
            Console.WriteLine("Start of seed");
            Address[] addresses =
            {
                new Address {
                    street  = "Solvgade 1, 3tv",
                    city    = "Horsens",
                    zipCode = 8700,
                },
            };
            foreach (var address in addresses)
            {
                databaseContext.addresses.Add(address);
            }
            Console.WriteLine("2");

            BankInfo[] bankInfos =
            {
                new BankInfo {
                    cardNumber = 1234123412341234,
                    cardHolder = "Pawel Skrzypkowski"
                },
            };
            foreach (var bankInfo in bankInfos)
            {
                databaseContext.bankInfos.Add(bankInfo);
            }
            Console.WriteLine("3");


            Account[] acs =
            {
                new Account {
                    username = "******",
                    password = "******",
                    email    = "*****@*****.**",
                },
            };

            foreach (var account in acs)
            {
                databaseContext.accounts.Add(account);
            }
            Console.WriteLine("4");

            Category[] categories =
            {
                new Category()
                {
                    categoryName = "Italian",
                },
                new Category()
                {
                    categoryName = "Greek",
                },
            };

            foreach (var cat in categories)
            {
                databaseContext.categories.Add(cat);
            }
            Console.WriteLine("5");


            Recipe[] recipes =
            {
                new Recipe()
                {
                    recipeName   = "Arrabbiata",
                    recipeId     = 1,
                    description  = "Arrabbiata sauce, or sugo all'arrabbiata in Italian, is a spicy sauce for pasta made from garlic, tomatoes, and dried red chili peppers cooked in olive oil. The sauce originates from the Lazio region, around Rome. Arrabbiata literally means 'angry' in Italian; the name of the sauce refers to the spiciness of the chili peppers.",
                    instructions = "Sauté the crushed red pepper flakes: Heat the butter (or olive oil) in a large saucepan or deep sauté pan.  Add the crushed red pepper flakes and sauté for about 2 minutes, to help toast and bring out their flavor.\nAdd onion and garlic: Add in the onions and sauté until softened, followed by the garlic.\nAdd tomatoes:  Then add in the cans of whole tomatoes, juices included.  And as they begin to heat up, use a wooden spoon or a potato masher to carefully break up the tomatoes.  (Just wear an apron so that those juices inside of the tomatoes don’t accidentally splatter you!)\nSimmer: Continue heating the sauce until it comes to a simmer.  Then reduce heat to medium (or medium-low) to maintain a low simmer, and let the sauce cook for about 30 minutes, or until it reaches your desired consistency.\nStir in the basil, salt and pepper.  Then taste the sauce, and season with any extra salt, pepper and/or crushed red pepper flakes as needed.\nServe warm.  Or let the sauce cool and then refrigerate it in a sealed container for up to 4 days.",
                    cookingTime  = 40,
                    imageName    = "Arrabiata.jpg"
                },

                new Recipe()
                {
                    recipeName   = "Pizza",
                    recipeId     = 2,
                    description  = "Pizza, dish of Italian origin consisting of a flattened disk of bread dough topped with some combination of olive oil, oregano, tomato, olives, mozzarella or other cheese, and many other ingredients, baked quickly—usually, in a commercial setting, using a wood-fired oven heated to a very high temperature—and served hot.",
                    instructions = "Add warm water to the bowl of a stand mixer with the dough attachment, and sprinkle the yeast on top of the water.  Give the yeast a quick stir to mix it in with the water.  Then let it sit for 5-10 minute until the yeast is foamy.\nTurn the mixer onto low speed, and add gradually flour, honey, olive oil and salt.  Increase speed to medium-low, and continue mixing the dough for 5 minutes.\nRemove dough from the mixing bowl, and use your hands to shape it into a ball.  Grease the mixing bowl (or a separate bowl) with olive oil or cooking spray, then place the dough ball back in the bowl and cover it with a damp towel.  Place in a warm location (I set mine by the window) and let it rise for 30-45 minutes until the dough has nearly doubled in size.\nPreheat oven to 450 degrees F.  Turn the dough onto a floured surface, and roll the dough into a 12- to 14-inch round for a thick-crusted pizza.  (Or cut the dough in half, and roll it into two 12-inch rounds for two thin crust pizzas.)  Sprinkle a baking sheet or pizza stone evenly with the cornmeal, then place the dough on the baking sheet.\nTop the dough with your desired sauce and toppings.  (And for extra-golden crust, brush the crust with an extra few teaspoons of olive oil or butter.)\nFor thick crust, bake for 16-18 minutes, or until the crust is golden brown and the toppings are melted and cooked.  For the (two) thin crusts, bake for 14-16 minutes, or until the crust is golden brown and the toppings are melted and cooked.\nSlice and serve pizza warm.",
                    cookingTime  = 75,
                    imageName    = "Pizza.jpeg"
                },
            };
            foreach (var rec in recipes)
            {
                databaseContext.recipes.Add(rec);
            }
            Console.WriteLine("6");

            Ingredient[] ingredients =
            {
                new Ingredient()
                {
                    ingredientId   = 1,
                    ingredientName = "Garlic",
                    number         = 3,
                    unitType       = "cloves"
                },
                new Ingredient()
                {
                    ingredientId   = 2,
                    ingredientName = "Pasta",
                    number         = 0.5,
                    unitType       = "kg"
                }
            };

            foreach (var ing in ingredients)
            {
                databaseContext.ingredients.Add(ing);
            }
            Console.WriteLine("8");

            databaseContext.SaveChanges();

            Shop[] shops =
            {
                new Shop {
                    shopId      = 1,
                    shopName    = "Lidl",
                    shopAddress = addresses[0]
                },
            };

            foreach (var shop in shops)
            {
                databaseContext.shops.Add(shop);
            }
            Console.WriteLine("9");

            ShopIngredient[] shopIngredients =
            {
                new ShopIngredient()
                {
                    id       = 1,
                    name     = "Garlic",
                    price    = 3,
                    amount   = 3,
                    unitType = "cloves"
                },
                new ShopIngredient()
                {
                    id       = 2,
                    name     = "Pasta",
                    price    = 2,
                    amount   = 0.2,
                    unitType = "kg"
                },
            };

            foreach (var shoping in shopIngredients)
            {
                databaseContext.shopIngredients.Add(shoping);
            }
            Console.WriteLine("10");

            databaseContext.SaveChanges();

            Account steve = await databaseContext.accounts.FirstAsync(s => s.username.Equals("Jannik"));

            Address tek = await databaseContext.addresses.FirstAsync(c => c.street.Equals("Solvgade 1, 3tv"));

            AccountAddress sc = new AccountAddress()
            {
                address = tek,
                account = steve
            };

            steve.AccountAddresses = new List <AccountAddress>();
            steve.AccountAddresses.Add(sc);
            databaseContext.Update(steve);

            // ctx.Set<StudentCourse>().Add(sc); This is an alternative
            await databaseContext.SaveChangesAsync();

            Account steve2 = await databaseContext.accounts.FirstAsync(s => s.username.Equals("Jannik"));

            BankInfo bankInfo2 = await databaseContext.bankInfos.FirstAsync(c => c.cardNumber == 1234123412341234);

            AccountBankInfo sc2 = new AccountBankInfo()
            {
                account  = steve2,
                bankInfo = bankInfo2
            };

            steve.AccountBankInfos = new List <AccountBankInfo>();
            steve.AccountBankInfos.Add(sc2);
            databaseContext.Update(steve2);

            // ctx.Set<StudentCourse>().Add(sc); This is an alternative
            await databaseContext.SaveChangesAsync();

            //Connecting ingredients with recipes

            Recipe steve1 = await databaseContext.recipes.FirstAsync(s => s.recipeId == 1);

            Ingredient tek1 = await databaseContext.ingredients.FirstAsync(c => c.ingredientId == 1);

            IngredientRecipe sc1 = new IngredientRecipe()
            {
                ingredient = tek1,
                recipe     = steve1
            };

            steve1.IngredientRecipes = new List <IngredientRecipe>();
            steve1.IngredientRecipes.Add(sc1);
            databaseContext.Update(steve1);

            // ctx.Set<StudentCourse>().Add(sc); This is an alternative
            await databaseContext.SaveChangesAsync();

            Recipe steve3 = await databaseContext.recipes.FirstAsync(s => s.recipeId == 1);

            Category bankInfo3 = await databaseContext.categories.FirstAsync(c => c.categoryName.Equals("Italian"));

            RecipeCategory sc3 = new RecipeCategory()
            {
                recipe   = steve3,
                category = bankInfo3
            };

            steve3.RecipeCategories = new List <RecipeCategory>();
            steve3.RecipeCategories.Add(sc3);
            databaseContext.Update(steve3);

            // ctx.Set<StudentCourse>().Add(sc); This is an alternative
            await databaseContext.SaveChangesAsync();


            //connecting second recipe
            Recipe steve5 = await databaseContext.recipes.FirstAsync(s => s.recipeId == 2);

            Ingredient tek5 = await databaseContext.ingredients.FirstAsync(c => c.ingredientId == 1);

            IngredientRecipe sc5 = new IngredientRecipe()
            {
                ingredient = tek5,
                recipe     = steve5
            };

            steve5.IngredientRecipes = new List <IngredientRecipe>();
            steve5.IngredientRecipes.Add(sc5);
            databaseContext.Update(steve5);

            // ctx.Set<StudentCourse>().Add(sc); This is an alternative
            await databaseContext.SaveChangesAsync();

            //adding second ingredient
            Recipe steve7 = await databaseContext.recipes.FirstAsync(s => s.recipeId == 2);

            Ingredient tek7 = await databaseContext.ingredients.FirstAsync(c => c.ingredientId == 2);

            IngredientRecipe sc7 = new IngredientRecipe()
            {
                ingredient = tek7,
                recipe     = steve7
            };

            if (steve7.IngredientRecipes == null)
            {
                steve7.IngredientRecipes = new List <IngredientRecipe>();
            }
            steve7.IngredientRecipes.Add(sc7);
            databaseContext.Update(steve7);

            // ctx.Set<StudentCourse>().Add(sc); This is an alternative
            await databaseContext.SaveChangesAsync();

            Recipe steve6 = await databaseContext.recipes.FirstAsync(s => s.recipeId == 2);

            Category bankInfo6 = await databaseContext.categories.FirstAsync(c => c.categoryName.Equals("Greek"));

            RecipeCategory sc6 = new RecipeCategory()
            {
                recipe   = steve6,
                category = bankInfo6
            };

            steve6.RecipeCategories = new List <RecipeCategory>();
            steve6.RecipeCategories.Add(sc6);
            databaseContext.Update(steve6);

            // ctx.Set<StudentCourse>().Add(sc); This is an alternative
            await databaseContext.SaveChangesAsync();

            //shops


            //adding shopingredients
            Shop shop1 = await databaseContext.shops.FirstAsync(s => s.shopId == 1);

            ShopIngredient shopIngredient1 = await databaseContext.shopIngredients.FirstAsync(c => c.id == 1);

            ShopVare ss1 = new ShopVare()
            {
                shop           = shop1,
                shopIngredient = shopIngredient1
            };

            if (shop1.shopVares == null)
            {
                shop1.shopVares = new List <ShopVare>();
            }
            shop1.shopVares.Add(ss1);
            databaseContext.Update(shop1);

            // ctx.Set<StudentCourse>().Add(sc); This is an alternative
            await databaseContext.SaveChangesAsync();

            Shop shop2 = await databaseContext.shops.FirstAsync(s => s.shopId == 1);

            ShopIngredient shopIngredient2 = await databaseContext.shopIngredients.FirstAsync(c => c.id == 2);

            ShopVare ss2 = new ShopVare()
            {
                shop           = shop2,
                shopIngredient = shopIngredient2
            };

            if (shop2.shopVares == null)
            {
                shop2.shopVares = new List <ShopVare>();
            }
            shop2.shopVares.Add(ss2);
            databaseContext.Update(shop2);

            // ctx.Set<StudentCourse>().Add(sc); This is an alternative
            await databaseContext.SaveChangesAsync();

            //update categories in recipes
            Recipe          recipeUp1    = recipes[0];
            Recipe          recipeUp2    = recipes[1];
            List <Category> categoriesUp = await databaseContext.categories.ToListAsync();

            recipeUp1.category = categoriesUp[0];
            recipeUp2.category = categoriesUp[1];
            databaseContext.recipes.Update(recipeUp1);
            databaseContext.recipes.Update(recipeUp2);
            await databaseContext.SaveChangesAsync();

            Console.WriteLine("Finished seeding");
        }
Example #7
0
 /// <summary>
 /// 添加
 /// </summary>
 /// zouql   16.07.26
 /// <param name="bankInfo">账户</param>
 /// <returns>添加结果</returns>
 public bool Add(BankInfo bankInfo)
 {
     bankMapper.Insert(bankInfo);
     return(bankInfo.BankId > 0);
 }
Example #8
0
        private bool UpdateAllThresholds(System.Collections.Generic.List <ThresholdMessage> thresholdMessageList)
        {
            bool   result = false;
            DBConn dBConn = null;

            System.Collections.Hashtable deviceCache     = DBCache.GetDeviceCache();
            System.Collections.Hashtable portCache       = DBCache.GetPortCache();
            System.Collections.Hashtable bankCache       = DBCache.GetBankCache();
            System.Collections.Hashtable sensorCache     = DBCache.GetSensorCache();
            System.Collections.Hashtable deviceBankMap   = DBCache.GetDeviceBankMap();
            System.Collections.Hashtable devicePortMap   = DBCache.GetDevicePortMap();
            System.Collections.Hashtable deviceSensorMap = DBCache.GetDeviceSensorMap();
            if (dBConn == null)
            {
                dBConn = DBConnPool.getConnection();
            }
            foreach (ThresholdMessage current in thresholdMessageList)
            {
                if (current != null && current.DeviceReplyMac.Equals(current.DeviceMac))
                {
                    if (!string.IsNullOrEmpty(current.AutoBasicInfo) && !string.IsNullOrEmpty(current.AutoRatingInfo))
                    {
                        try
                        {
                            DevAccessCfg.GetInstance().updateAutoModelList2Database(dBConn, current.ModelName, current.DeviceFWVer, current.AutoBasicInfo, current.AutoRatingInfo);
                        }
                        catch (System.Exception)
                        {
                        }
                    }
                    if (deviceCache != null && deviceCache.Count >= 1 && deviceCache.ContainsKey(current.DeviceID))
                    {
                        DeviceInfo deviceInfo = (DeviceInfo)deviceCache[current.DeviceID];
                        if (deviceInfo != null)
                        {
                            deviceInfo.FWVersion  = current.DeviceFWVer;
                            deviceInfo.DeviceName = current.DeviceName;
                            if (current.DeviceThreshold.MaxCurrentMT != -500f)
                            {
                                deviceInfo.Max_current = current.DeviceThreshold.MaxCurrentMT;
                            }
                            if (current.DeviceThreshold.MaxPowerMT != -500f)
                            {
                                deviceInfo.Max_power = current.DeviceThreshold.MaxPowerMT;
                            }
                            if (current.DeviceThreshold.MaxPowerDissMT != -500f)
                            {
                                deviceInfo.Max_power_diss = current.DeviceThreshold.MaxPowerDissMT;
                            }
                            if (current.DeviceThreshold.MaxVoltageMT != -500f)
                            {
                                deviceInfo.Max_voltage = current.DeviceThreshold.MaxVoltageMT;
                            }
                            if (current.DeviceThreshold.MinCurrentMT != -500f)
                            {
                                deviceInfo.Min_current = current.DeviceThreshold.MinCurrentMT;
                            }
                            if (current.DeviceThreshold.MinPowerMT != -500f)
                            {
                                deviceInfo.Min_power = current.DeviceThreshold.MinPowerMT;
                            }
                            if (current.DeviceThreshold.MinVoltageMT != -500f)
                            {
                                deviceInfo.Min_voltage = current.DeviceThreshold.MinVoltageMT;
                            }
                            deviceInfo.POPThreshold        = current.DeviceThreshold.PopThreshold;
                            deviceInfo.POPEnableMode       = current.DeviceThreshold.PopEnableMode;
                            deviceInfo.OutletPOPMode       = current.DeviceThreshold.PopModeOutlet;
                            deviceInfo.BankPOPLIFOMode     = current.DeviceThreshold.PopModeLIFO;
                            deviceInfo.BankPOPPriorityMode = current.DeviceThreshold.PopModePriority;
                            if (current.DeviceThreshold.DoorSensorType != -500)
                            {
                                deviceInfo.DoorSensor = current.DeviceThreshold.DoorSensorType;
                            }
                            deviceInfo.UpdateDeviceThreshold(dBConn);
                            if (current.SensorThreshold != null && current.SensorThreshold.Count > 0)
                            {
                                if (sensorCache == null || sensorCache.Count < 1 || deviceSensorMap == null || deviceSensorMap.Count < 1 || !deviceSensorMap.ContainsKey(current.DeviceID))
                                {
                                    continue;
                                }
                                System.Collections.Generic.IEnumerator <int> enumerator2 = current.SensorThreshold.Keys.GetEnumerator();
                                while (enumerator2.MoveNext())
                                {
                                    SensorThreshold sensorThreshold = current.SensorThreshold[enumerator2.Current];
                                    SensorInfo      sensor          = this.getSensor(sensorCache, (System.Collections.Generic.List <int>)deviceSensorMap[current.DeviceID], enumerator2.Current);
                                    if (sensor != null)
                                    {
                                        if (sensorThreshold.MaxHumidityMT != -500f)
                                        {
                                            sensor.Max_humidity = sensorThreshold.MaxHumidityMT;
                                        }
                                        if (sensorThreshold.MaxPressMT != -500f)
                                        {
                                            sensor.Max_press = sensorThreshold.MaxPressMT;
                                        }
                                        if (sensorThreshold.MaxTemperatureMT != -500f)
                                        {
                                            sensor.Max_temperature = sensorThreshold.MaxTemperatureMT;
                                        }
                                        if (sensorThreshold.MinHumidityMT != -500f)
                                        {
                                            sensor.Min_humidity = sensorThreshold.MinHumidityMT;
                                        }
                                        if (sensorThreshold.MinPressMT != -500f)
                                        {
                                            sensor.Min_press = sensorThreshold.MinPressMT;
                                        }
                                        if (sensorThreshold.MinTemperatureMT != -500f)
                                        {
                                            sensor.Min_temperature = sensorThreshold.MinTemperatureMT;
                                        }
                                        sensor.UpdateSensorThreshold(dBConn);
                                    }
                                }
                            }
                            if (current.OutletThreshold != null && current.OutletThreshold.Count > 0)
                            {
                                if (portCache == null || portCache.Count < 1 || devicePortMap == null || devicePortMap.Count < 1 || !devicePortMap.ContainsKey(current.DeviceID))
                                {
                                    continue;
                                }
                                System.Collections.Generic.IEnumerator <int> enumerator3 = current.OutletThreshold.Keys.GetEnumerator();
                                while (enumerator3.MoveNext())
                                {
                                    OutletThreshold outletThreshold = current.OutletThreshold[enumerator3.Current];
                                    PortInfo        port            = this.getPort(portCache, (System.Collections.Generic.List <int>)devicePortMap[current.DeviceID], enumerator3.Current);
                                    if (port != null)
                                    {
                                        port.PortName = outletThreshold.OutletName;
                                        if (outletThreshold.MaxCurrentMT != -500f)
                                        {
                                            port.Max_current = outletThreshold.MaxCurrentMT;
                                        }
                                        if (outletThreshold.MaxPowerMT != -500f)
                                        {
                                            port.Max_power = outletThreshold.MaxPowerMT;
                                        }
                                        if (outletThreshold.MaxPowerDissMT != -500f)
                                        {
                                            port.Max_power_diss = outletThreshold.MaxPowerDissMT;
                                        }
                                        if (outletThreshold.MaxVoltageMT != -500f)
                                        {
                                            port.Max_voltage = outletThreshold.MaxVoltageMT;
                                        }
                                        if (outletThreshold.MinCurrentMt != -500f)
                                        {
                                            port.Min_current = outletThreshold.MinCurrentMt;
                                        }
                                        if (outletThreshold.MinPowerMT != -500f)
                                        {
                                            port.Min_power = outletThreshold.MinPowerMT;
                                        }
                                        if (outletThreshold.MinVoltageMT != -500f)
                                        {
                                            port.Min_voltage = outletThreshold.MinVoltageMT;
                                        }
                                        port.OutletConfirmation   = (int)outletThreshold.Confirmation;
                                        port.OutletOffDelayTime   = outletThreshold.OffDelayTime;
                                        port.OutletOnDelayTime    = outletThreshold.OnDelayTime;
                                        port.OutletShutdownMethod = (int)outletThreshold.ShutdownMethod;
                                        port.OutletMAC            = outletThreshold.MacAddress;
                                        port.UpdatePortThreshold(dBConn);
                                    }
                                }
                            }
                            if (current.BankThreshold != null && current.BankThreshold.Count > 0 && bankCache != null && bankCache.Count >= 1 && deviceBankMap != null && deviceBankMap.Count >= 1 && deviceBankMap.ContainsKey(current.DeviceID))
                            {
                                System.Collections.Generic.IEnumerator <int> enumerator4 = current.BankThreshold.Keys.GetEnumerator();
                                while (enumerator4.MoveNext())
                                {
                                    BankThreshold bankThreshold = current.BankThreshold[enumerator4.Current];
                                    BankInfo      bank          = this.getBank(bankCache, (System.Collections.Generic.List <int>)deviceBankMap[current.DeviceID], enumerator4.Current);
                                    if (bank != null)
                                    {
                                        bank.BankName = bankThreshold.BankName;
                                        if (bankThreshold.MaxCurrentMT != -500f)
                                        {
                                            bank.Max_current = bankThreshold.MaxCurrentMT;
                                        }
                                        if (bankThreshold.MinCurrentMt != -500f)
                                        {
                                            bank.Min_current = bankThreshold.MinCurrentMt;
                                        }
                                        if (bankThreshold.MaxVoltageMT != -500f)
                                        {
                                            bank.Max_voltage = bankThreshold.MaxVoltageMT;
                                        }
                                        if (bankThreshold.MinVoltageMT != -500f)
                                        {
                                            bank.Min_voltage = bankThreshold.MinVoltageMT;
                                        }
                                        if (bankThreshold.MaxPowerMT != -500f)
                                        {
                                            bank.Max_power = bankThreshold.MaxPowerMT;
                                        }
                                        if (bankThreshold.MinPowerMT != -500f)
                                        {
                                            bank.Min_power = bankThreshold.MinPowerMT;
                                        }
                                        if (bankThreshold.MaxPowerDissMT != -500f)
                                        {
                                            bank.Max_power_diss = bankThreshold.MaxPowerDissMT;
                                        }
                                        bank.UpdateBankThreshold(dBConn);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (dBConn != null)
            {
                dBConn.close();
            }
            return(result);
        }
Example #9
0
        public static bool EditBank(BankInfo model)
        {
            using (DeneysanContext db = new DeneysanContext())
            {
                try
                {
                    BankInfo record = db.BankInfo.Where(d => d.BankId == model.BankId ).SingleOrDefault();
                    if (record != null)
                    {
                        record.BankName = model.BankName;
                        record.Language = model.Language;
                        record.BankNumber = model.BankNumber;
                        
                        record.IBAN = model.IBAN;
                        if (!string.IsNullOrEmpty(model.Logo))
                        {
                            record.Logo = model.Logo;
                        }
                        
                        db.SaveChanges();

                        LogtrackManager logkeeper = new LogtrackManager();
                        logkeeper.LogDate = DateTime.Now;
                        logkeeper.LogProcess = EnumLogType.BankaBilgisi.ToString();
                        logkeeper.Message = LogMessages.BankEdited;
                        logkeeper.User = HttpContext.Current.User.Identity.Name;
                        logkeeper.Data = record.BankName;
                        logkeeper.AddInfoLog(logger);

                        return true;
                    }
                    else
                        return false;

                }
                catch (Exception ex)
                {
                    return false;
                }
            }
        }
Example #10
0
        public int UpBnak(BankInfo bank)
        {
            var count = _business.UpBnak(bank);

            return(count);
        }
Example #11
0
 private void butBankSave_Click(object sender, System.EventArgs e)
 {
     try
     {
         string         value             = this.labDevModel.Tag.ToString();
         int            num               = System.Convert.ToInt32(value);
         DeviceInfo     deviceByID        = DeviceOperation.getDeviceByID(num);
         DevModelConfig deviceModelConfig = DevAccessCfg.GetInstance().getDeviceModelConfig(deviceByID.ModelNm, deviceByID.FWVersion);
         if (this.bankCheck(deviceModelConfig))
         {
             string        text          = this.tbBankNm.Text;
             string        text2         = this.labBankNo.Text;
             int           num2          = System.Convert.ToInt32(text2);
             BankInfo      bankInfo      = new BankInfo(num, num2);
             DevSnmpConfig sNMPpara      = commUtil.getSNMPpara(deviceByID);
             BankThreshold bankThreshold = new BankThreshold(num2);
             bankThreshold.BankName = text;
             if (this.gbThreshold.Visible)
             {
                 bankInfo.Min_current    = ThresholdUtil.UI2DB(this.tbOMinCurrent, bankInfo.Min_current, 0);
                 bankInfo.Max_current    = ThresholdUtil.UI2DB(this.tbOMaxCurrent, bankInfo.Max_current, 0);
                 bankInfo.Min_voltage    = ThresholdUtil.UI2DB(this.tbOMinVoltage, bankInfo.Min_voltage, 0);
                 bankInfo.Max_voltage    = ThresholdUtil.UI2DB(this.tbOMaxVoltage, bankInfo.Max_voltage, 0);
                 bankInfo.Min_power      = ThresholdUtil.UI2DB(this.tbOMinPower, bankInfo.Min_power, 0);
                 bankInfo.Max_power      = ThresholdUtil.UI2DB(this.tbOMaxPower, bankInfo.Max_power, 0);
                 bankInfo.Min_power_diss = ThresholdUtil.UI2DB(this.tbOMinPowerDiss, bankInfo.Min_power_diss, 0);
                 bankInfo.Max_power_diss = ThresholdUtil.UI2DB(this.tbOMaxPowerDiss, bankInfo.Max_power_diss, 0);
                 int thflg = devcfgUtil.ThresholdFlg(deviceModelConfig, "bank");
                 bankThreshold.MinCurrentMt   = bankInfo.Min_current;
                 bankThreshold.MaxCurrentMT   = bankInfo.Max_current;
                 bankThreshold.MinVoltageMT   = bankInfo.Min_voltage;
                 bankThreshold.MaxVoltageMT   = bankInfo.Max_voltage;
                 bankThreshold.MinPowerMT     = bankInfo.Min_power;
                 bankThreshold.MaxPowerMT     = bankInfo.Max_power;
                 bankThreshold.MaxPowerDissMT = bankInfo.Max_power_diss;
                 ThresholdUtil.UI2Dev(thflg, bankThreshold);
             }
             bool flag = true;
             if (deviceModelConfig.commonThresholdFlag != Constant.EatonPDUThreshold)
             {
                 DevAccessAPI devAccessAPI = new DevAccessAPI(sNMPpara);
                 flag = devAccessAPI.SetBankThreshold(bankThreshold, deviceByID.Mac);
             }
             if (flag)
             {
                 if (bankInfo != null)
                 {
                     bankInfo.BankName = text;
                     bankInfo.Update();
                     EcoGlobalVar.setDashBoardFlg(128uL, string.Concat(new object[]
                     {
                         "#UPDATE#D",
                         bankInfo.DeviceID,
                         ":B",
                         bankInfo.ID,
                         ";"
                     }), 2);
                     string valuePair = ValuePairs.getValuePair("Username");
                     if (!string.IsNullOrEmpty(valuePair))
                     {
                         LogAPI.writeEventLog("0630010", new string[]
                         {
                             bankInfo.BankName,
                             bankInfo.PortLists,
                             deviceByID.DeviceIP,
                             deviceByID.DeviceName,
                             valuePair
                         });
                     }
                     else
                     {
                         LogAPI.writeEventLog("0630010", new string[]
                         {
                             bankInfo.BankName,
                             bankInfo.PortLists,
                             deviceByID.DeviceIP,
                             deviceByID.DeviceName
                         });
                     }
                 }
                 EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.Dev_ThresholdSucc, new string[0]));
             }
             else
             {
                 EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_ThresholdFail, new string[0]));
             }
         }
     }
     catch (System.Exception ex)
     {
         System.Console.WriteLine("PropBank Exception" + ex.Message);
         EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_ThresholdFail, new string[0]));
     }
 }
Example #12
0
        public ActionResult <BankInfo> Update([FromBody] BankInfo info)
        {
            var result = _bank.Update(info);

            return(Ok(result));
        }
Example #13
0
 public void SaveBank(BankInfo bank)
 {
     Storage.UpdateBank(bank);
 }
Example #14
0
        public static void Initialize(ProgrammerContext context)
        {
            context.Database.EnsureCreated();

            // Look for any students.
            if (context.Programmer.Any())
            {
                return;   // DB has been seeded
            }

            var availability = new Availability[] {
                new Availability {
                    Op1 = true, Op2 = false, Op3 = false, Op4 = false, Op5 = false
                },
                new Availability {
                    Op1 = false, Op2 = true, Op3 = false, Op4 = false, Op5 = false
                },
                new Availability {
                    Op1 = false, Op2 = false, Op3 = true, Op4 = false, Op5 = false
                }
            };
            var bankinfo = new BankInfo[] {
                new BankInfo {
                    Name      = "Teste 1",
                    Cpf       = "987654321-1",
                    Bank      = "TestBank1",
                    Agency    = "123-1",
                    AccType   = 0,
                    AccNumber = "321-1"
                },
                new BankInfo {
                    Name      = "Teste 2",
                    Cpf       = "987654321-2",
                    Bank      = "TestBank2",
                    Agency    = "123-2",
                    AccType   = 0,
                    AccNumber = "321-2"
                },
                new BankInfo {
                    Name      = "Teste 3",
                    Cpf       = "987654321-3",
                    Bank      = "TestBank3",
                    Agency    = "123-3",
                    AccType   = 1,
                    AccNumber = "321-3"
                }
            };
            var besttime = new BestTime[] {
                new BestTime {
                    Op1 = true, Op2 = false, Op3 = false, Op4 = false, Op5 = false
                },
                new BestTime {
                    Op1 = false, Op2 = true, Op3 = false, Op4 = false, Op5 = false
                },
                new BestTime {
                    Op1 = false, Op2 = false, Op3 = true, Op4 = false, Op5 = false
                }
            };
            var knoledge = new Knoledge[] {
                new Knoledge {
                    Ionic       = "1",
                    Android     = "1",
                    Ios         = "1",
                    Html        = "1",
                    Css         = "1",
                    Bootstrap   = "1",
                    Jquery      = "1",
                    Angular     = "1",
                    Java        = "1",
                    Aspnet      = "1",
                    C           = "1",
                    Cpp         = "1",
                    Cake        = "1",
                    Django      = "1",
                    Majento     = "1",
                    Php         = "1",
                    Wordpress   = "1",
                    Python      = "1",
                    Ruby        = "1",
                    Sqls        = "1",
                    Mysql       = "1",
                    Salesforce  = "1",
                    Photoshop   = "1",
                    Illustrator = "1",
                    Seo         = "1",
                    Other       = "1"
                },
                new Knoledge {
                    Ionic       = "2",
                    Android     = "2",
                    Ios         = "2",
                    Html        = "2",
                    Css         = "2",
                    Bootstrap   = "2",
                    Jquery      = "2",
                    Angular     = "2",
                    Java        = "2",
                    Aspnet      = "2",
                    C           = "2",
                    Cpp         = "2",
                    Cake        = "2",
                    Django      = "2",
                    Majento     = "2",
                    Php         = "2",
                    Wordpress   = "2",
                    Python      = "2",
                    Ruby        = "2",
                    Sqls        = "2",
                    Mysql       = "2",
                    Salesforce  = "2",
                    Photoshop   = "2",
                    Illustrator = "2",
                    Seo         = "2",
                    Other       = "2"
                },
                new Knoledge {
                    Ionic       = "3",
                    Android     = "3",
                    Ios         = "3",
                    Html        = "3",
                    Css         = "3",
                    Bootstrap   = "3",
                    Jquery      = "3",
                    Angular     = "3",
                    Java        = "3",
                    Aspnet      = "3",
                    C           = "3",
                    Cpp         = "3",
                    Cake        = "3",
                    Django      = "3",
                    Majento     = "3",
                    Php         = "3",
                    Wordpress   = "3",
                    Python      = "3",
                    Ruby        = "3",
                    Sqls        = "3",
                    Mysql       = "3",
                    Salesforce  = "3",
                    Photoshop   = "3",
                    Illustrator = "3",
                    Seo         = "3",
                    Other       = "3"
                }
            };
            var programmer = new Programmer[] {
                new Programmer {
                    Email        = "*****@*****.**",
                    Name         = "Test 1",
                    Skype        = "test1.skp",
                    Phone        = "+123456",
                    Linkedin     = "linkedin.com/test1",
                    City         = "TestCity1",
                    State        = "TestState1",
                    Portfolio    = "test1.com",
                    Salary       = 80,
                    Bank         = "TestBank1",
                    Link         = "test1crud.com",
                    BankInfo     = bankinfo[0],
                    Knoledge     = knoledge[0],
                    BestTime     = besttime[0],
                    Availability = availability[0]
                },
                new Programmer {
                    Email        = "*****@*****.**",
                    Name         = "Test 2",
                    Skype        = "test2.skp",
                    Phone        = "+123456",
                    Linkedin     = "linkedin.com/test2",
                    City         = "TestCity2",
                    State        = "TestState2",
                    Portfolio    = "test2.com",
                    Salary       = 90,
                    Bank         = "TestBank2",
                    Link         = "test2crud.com",
                    BankInfo     = bankinfo[1],
                    Knoledge     = knoledge[1],
                    BestTime     = besttime[1],
                    Availability = availability[1]
                },
                new Programmer {
                    Email        = "*****@*****.**",
                    Name         = "Test 3",
                    Skype        = "test3.skp",
                    Phone        = "+123456",
                    Linkedin     = "linkedin.com/test3",
                    City         = "TestCity3",
                    State        = "TestState3",
                    Portfolio    = "test3.com",
                    Salary       = 100,
                    Bank         = "TestBank3",
                    Link         = "test3crud.com",
                    BankInfo     = bankinfo[2],
                    Knoledge     = knoledge[2],
                    BestTime     = besttime[2],
                    Availability = availability[2]
                }
            };

            // foreach (Availability s in availability)
            // {
            //         context.Availability.Add(s);
            // }
            // foreach (BankInfo s in bankinfo)
            // {
            //         context.BankInfo.Add(s);
            // }
            // foreach (BestTime s in besttime)
            // {
            //         context.BestTime.Add(s);
            // }
            // foreach (Knoledge s in knoledge)
            // {
            //         context.Knoledge.Add(s);
            // }
            foreach (Programmer p in programmer)
            {
                context.Programmer.Add(p);
            }
            context.SaveChanges();
        }
 public Transfer2ndPage(string amount, FullUserInformation userInfo, AccountInfo toAccountInfo, BankInfo selectedTransferToBank) : this()
 {
     this.amount                 = amount;
     this.userInfo               = userInfo;
     this.toAccountInfo          = toAccountInfo;
     this.selectedTransferToBank = selectedTransferToBank;
 }
 public bool InsertBankInfo(BankInfo bankInfo)
 {
     return(rs.InsertBankInfo(bankInfo.BankName, bankInfo.BranchName, bankInfo.IfscCode, Convert.ToInt64(bankInfo.AccountNumber)));
 }
Example #17
0
        /// <summary>
        /// Create bank.
        /// </summary>
        private void CreateBnk_Click(object sender, EventArgs e)
        {
            //New bank and wave archive.
            BankInfo bnk = new BankInfo()
            {
                File = new Bank()
            };
            WaveArchiveInfo war = new WaveArchiveInfo()
            {
                File = new WaveArchive()
            };
            bool usesGen;

            //Get each instrument.
            List <InstrumentInfo> insts = new List <InstrumentInfo>();
            List <string>         wars  = new List <string>();

            for (int i = 0; i < instruments.Rows.Count - 1; i++)
            {
                //Get the cells.
                var bankCell    = (DataGridViewComboBoxCell)instruments.Rows[i].Cells["bank"];
                var instCell    = (DataGridViewComboBoxCell)instruments.Rows[i].Cells["instrument"];
                var idCell      = (DataGridViewTextBoxCell)instruments.Rows[i].Cells["newId"];
                var warModeCell = (DataGridViewComboBoxCell)instruments.Rows[i].Cells["waveArchiveMode"];

                //Check.
                if (bankCell.Value == null || instCell.Value == null || idCell.Value == null || !int.TryParse(idCell.Value.ToString(), out _) || warModeCell.Value == null)
                {
                    MessageBox.Show("Grid contains invalid data.");
                    return;
                }

                //Get the bank.
                BankInfo   b              = SA.Banks.Where(x => x.Index == int.Parse(((string)bankCell.Value).Split('[')[1].Split(']')[0])).FirstOrDefault();
                Instrument inst           = b.File.Instruments.Where(x => x.Index == int.Parse(((string)instCell.Value).Split('[')[1].Split(']')[0])).FirstOrDefault();
                int        id             = int.Parse(idCell.Value.ToString());
                bool       useExistingWar = warModeCell.Value != ((DataGridViewComboBoxColumn)instruments.Columns["waveArchiveMode"]).Items[0];

                //Add the instrument.
                insts.Add(new InstrumentInfo()
                {
                    Bank = b, Inst = Bank.DuplicateInstrument(inst), NewId = id, UseExistingWar = useExistingWar
                });

                //Get wars.
                foreach (var n in inst.NoteInfo)
                {
                    if (warModeCell.Value != warModeCell.Items[0] && n.InstrumentType == InstrumentType.PCM)
                    {
                        string name = "Null";
                        try {
                            name = b.WaveArchives[n.WarId].Name;
                        } catch { }
                        if (!wars.Contains(name) && !name.Equals("Null"))
                        {
                            wars.Add(name);
                        }
                    }
                }
            }

            //Make sure amount of WARs is not over 4.
            if (wars.Count > 4)
            {
                MessageBox.Show("You can't generate a new bank that uses more than 4 wave archives.");
                return;
            }

            //Uses generated instrument.
            usesGen = insts.Where(x => x.UseExistingWar == false).Count() > 0;

            //Make sure amount of WARs is not over 3 if generated instrument.
            if (wars.Count > 3)
            {
                MessageBox.Show("You can't generate a new bank that uses more than 3 wave archives when creating a generated wave archive.");
                return;
            }

            //Get name and index.
            try { bnk.Index = SA.Banks.Last().Index + 1; } catch { }
            while (SA.Banks.Where(x => x.Index == bnk.Index).Count() > 0)
            {
                bnk.Index++;
            }
            try { war.Index = SA.WaveArchives.Last().Index + 1; } catch { }
            while (SA.WaveArchives.Where(x => x.Index == war.Index).Count() > 0)
            {
                war.Index++;
            }
            bnk.Name = "GENERATED_BANK_" + bnk.Index;
            war.Name = "GENERATED_WAR_" + war.Index;

            //Add instruments.
            Dictionary <ushort, ushort> warLinks = new Dictionary <ushort, ushort>();

            if (usesGen)
            {
                warLinks.Add((ushort)war.Index, (ushort)warLinks.Count);
            }
            Dictionary <uint, ushort> swavLinks = new Dictionary <uint, ushort>();
            ushort swarNum = usesGen ? (ushort)1 : (ushort)0;
            ushort swavNum = 0;

            foreach (var i in insts)
            {
                //Adjust wave info for note info.
                foreach (var n in i.Inst.NoteInfo.Where(x => x.InstrumentType == InstrumentType.PCM))
                {
                    //Get the hash for the true wave archive Id and wave Id.
                    uint hash;
                    try {
                        hash = (uint)(i.Bank.WaveArchives[n.WarId].Index << 16) | n.WaveId;
                    } catch { continue; }

                    //Use the original wave archive.
                    if (i.UseExistingWar)
                    {
                        if (!warLinks.ContainsKey((ushort)i.Bank.WaveArchives[n.WarId].Index))
                        {
                            warLinks.Add((ushort)i.Bank.WaveArchives[n.WarId].Index, swarNum++);
                        }
                        n.WarId = warLinks[(ushort)i.Bank.WaveArchives[n.WarId].Index];
                    }

                    //Use a new wave archive.
                    else
                    {
                        if (!swavLinks.ContainsKey(hash))
                        {
                            //Get the physical wave, and add it.
                            try {
                                //Add the swav.
                                war.File.Waves.Add(i.Bank.WaveArchives[n.WarId].File.Waves[n.WaveId]);

                                //Add the hash.
                                swavLinks.Add(hash, swavNum++);
                            } catch { }
                        }
                        n.WarId  = 0;
                        n.WaveId = swavLinks[hash];
                    }
                }

                //Set the new index.
                i.Inst.Index = i.NewId;

                //Finally add the instrument.
                bnk.File.Instruments.Add(i.Inst);
            }

            //Add the bank.
            if (warLinks.Count() > 4)
            {
                MessageBox.Show("Something went wrong, and the max number of wave archives (4) has been exceeded.");
                return;
            }
            int bnkWarId = 0;

            foreach (var w in warLinks)
            {
                switch (bnkWarId)
                {
                case 0:
                    bnk.WaveArchives[0] = SA.WaveArchives.Where(x => x.Index == w.Key).FirstOrDefault();
                    bnk.ReadingWave0Id  = w.Key;
                    break;

                case 1:
                    bnk.WaveArchives[1] = SA.WaveArchives.Where(x => x.Index == w.Key).FirstOrDefault();
                    bnk.ReadingWave1Id  = w.Key;
                    break;

                case 2:
                    bnk.WaveArchives[2] = SA.WaveArchives.Where(x => x.Index == w.Key).FirstOrDefault();
                    bnk.ReadingWave2Id  = w.Key;
                    break;

                case 3:
                    bnk.WaveArchives[3] = SA.WaveArchives.Where(x => x.Index == w.Key).FirstOrDefault();
                    bnk.ReadingWave3Id  = w.Key;
                    break;
                }
                bnkWarId++;
            }
            SA.Banks.Add(bnk);

            //Add the wave archive.
            if (usesGen)
            {
                SA.WaveArchives.Add(war);
            }

            //Close.
            Close();
            MainWindow.UpdateNodes();
            MainWindow.DoInfoStuff();
        }
Example #18
0
        //修改银行卡余额
        public int UpBnak(BankInfo bank)
        {
            var up = Ban.Modify(bank);

            return(up);
        }
Example #19
0
 public TransferAmountPage(FullUserInformation user, AccountInfo toAccountIno, BankInfo SelectedTransferToBank) : this()
 {
     this.userInfo               = user;
     this.toAccountInfo          = toAccountIno;
     this.SelectedTransferToBank = SelectedTransferToBank;
 }
Example #20
0
 public abstract void Create(Payment payment, BankInfo bank, string appDataPath, out string reportPath);
Example #21
0
        private void butBankAssign_Click(object sender, System.EventArgs e)
        {
            bool   flag   = false;
            DBConn dBConn = null;
            string text   = this.labDevModel.Tag.ToString();

            try
            {
                int            num               = System.Convert.ToInt32(text);
                DeviceInfo     deviceByID        = DeviceOperation.getDeviceByID(num);
                DevModelConfig deviceModelConfig = DevAccessCfg.GetInstance().getDeviceModelConfig(deviceByID.ModelNm, deviceByID.FWVersion);
                if (this.bankCheck(deviceModelConfig))
                {
                    DialogResult dialogResult = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.Dev_ApplyBank, new string[0]), MessageBoxButtons.OKCancel);
                    if (dialogResult != DialogResult.Cancel)
                    {
                        string        text2         = this.tbBankNm.Text;
                        string        text3         = this.labBankNo.Text;
                        int           num2          = System.Convert.ToInt32(text3);
                        BankInfo      bankInfo      = new BankInfo(num, num2);
                        DevSnmpConfig sNMPpara      = commUtil.getSNMPpara(deviceByID);
                        BankThreshold bankThreshold = new BankThreshold(1);
                        if (this.gbThreshold.Visible)
                        {
                            bankInfo.Min_current    = ThresholdUtil.UI2DB(this.tbOMinCurrent, bankInfo.Min_current, 0);
                            bankInfo.Max_current    = ThresholdUtil.UI2DB(this.tbOMaxCurrent, bankInfo.Max_current, 0);
                            bankInfo.Min_voltage    = ThresholdUtil.UI2DB(this.tbOMinVoltage, bankInfo.Min_voltage, 0);
                            bankInfo.Max_voltage    = ThresholdUtil.UI2DB(this.tbOMaxVoltage, bankInfo.Max_voltage, 0);
                            bankInfo.Min_power      = ThresholdUtil.UI2DB(this.tbOMinPower, bankInfo.Min_power, 0);
                            bankInfo.Max_power      = ThresholdUtil.UI2DB(this.tbOMaxPower, bankInfo.Max_power, 0);
                            bankInfo.Min_power_diss = ThresholdUtil.UI2DB(this.tbOMinPowerDiss, bankInfo.Min_power_diss, 0);
                            bankInfo.Max_power_diss = ThresholdUtil.UI2DB(this.tbOMaxPowerDiss, bankInfo.Max_power_diss, 0);
                            int thflg = devcfgUtil.ThresholdFlg(deviceModelConfig, "bank");
                            bankThreshold.MinCurrentMt   = bankInfo.Min_current;
                            bankThreshold.MaxCurrentMT   = bankInfo.Max_current;
                            bankThreshold.MinVoltageMT   = bankInfo.Min_voltage;
                            bankThreshold.MaxVoltageMT   = bankInfo.Max_voltage;
                            bankThreshold.MinPowerMT     = bankInfo.Min_power;
                            bankThreshold.MaxPowerMT     = bankInfo.Max_power;
                            bankThreshold.MaxPowerDissMT = bankInfo.Max_power_diss;
                            ThresholdUtil.UI2Dev(thflg, bankThreshold);
                        }
                        DevAccessAPI devAccessAPI = new DevAccessAPI(sNMPpara);
                        string       myMac        = deviceByID.Mac;
                        System.Collections.Generic.List <BankInfo> bankInfo2 = deviceByID.GetBankInfo();
                        dBConn = DBConnPool.getConnection();
                        foreach (BankInfo current in bankInfo2)
                        {
                            BankThreshold bankThreshold2 = new BankThreshold(System.Convert.ToInt32(current.PortLists));
                            if (num2 == System.Convert.ToInt32(current.PortLists))
                            {
                                current.BankName = text2;
                            }
                            bankThreshold2.BankName = current.BankName;
                            if (this.gbThreshold.Visible)
                            {
                                bankThreshold2.MaxCurrentMT   = bankThreshold.MaxCurrentMT;
                                bankThreshold2.MinCurrentMt   = bankThreshold.MinCurrentMt;
                                bankThreshold2.MaxPowerMT     = bankThreshold.MaxPowerMT;
                                bankThreshold2.MinPowerMT     = bankThreshold.MinPowerMT;
                                bankThreshold2.MaxVoltageMT   = bankThreshold.MaxVoltageMT;
                                bankThreshold2.MinVoltageMT   = bankThreshold.MinVoltageMT;
                                bankThreshold2.MaxPowerDissMT = bankThreshold.MaxPowerDissMT;
                            }
                            bool flag2 = true;
                            if (deviceModelConfig.commonThresholdFlag != Constant.EatonPDUThreshold)
                            {
                                flag2 = devAccessAPI.SetBankThreshold(bankThreshold2, myMac);
                            }
                            if (!flag2)
                            {
                                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_ThresholdFail, new string[0]));
                                return;
                            }
                            if (this.gbThreshold.Visible)
                            {
                                current.CopyThreshold(bankInfo);
                            }
                            current.UpdateBankThreshold(dBConn);
                            flag  = true;
                            myMac = "";
                        }
                        if (dBConn != null)
                        {
                            dBConn.close();
                        }
                        string valuePair = ValuePairs.getValuePair("Username");
                        if (!string.IsNullOrEmpty(valuePair))
                        {
                            LogAPI.writeEventLog("0630011", new string[]
                            {
                                deviceByID.ModelNm,
                                deviceByID.DeviceIP,
                                deviceByID.DeviceName,
                                valuePair
                            });
                        }
                        else
                        {
                            LogAPI.writeEventLog("0630011", new string[]
                            {
                                deviceByID.ModelNm,
                                deviceByID.DeviceIP,
                                deviceByID.DeviceName
                            });
                        }
                        EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.Dev_ThresholdSucc, new string[0]));
                    }
                }
            }
            catch (System.Exception ex)
            {
                System.Console.WriteLine("butBankAssign_Click Exception" + ex.Message);
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_ThresholdFail, new string[0]));
            }
            finally
            {
                if (dBConn != null)
                {
                    dBConn.close();
                }
                DeviceOperation.RefreshDBCache(false);
                if (flag)
                {
                    EcoGlobalVar.setDashBoardFlg(128uL, "#UPDATE#D" + text + ":B*;", 2);
                }
            }
        }
Example #22
0
 public int Insert_Bank(BankInfo _bankInfo)
 {
     return(_bankRepo.Insert(_bankInfo));
 }
Example #23
0
 public static void UpdateBank(this BanksClient client, BankInfo bank)
 {
     Task.Run(() => client.UpdateBankAsync(bank).GetAwaiter().GetResult()).GetAwaiter().GetResult();
 }
        public ActionResult EditBank(BankInfo bank, HttpPostedFileBase uploadfile)
        {
            var languages = LanguageManager.GetLanguages();
            var list = new SelectList(languages, "Culture", "Language");
            ViewBag.LanguageList = list;
            if (ModelState.IsValid)
            {
                if (uploadfile != null && uploadfile.ContentLength > 0)
                {
                    Random random = new Random();
                    int rand = random.Next(1000, 99999999);
                    new ImageHelper(280, 240).SaveThumbnail(uploadfile, "/Content/images/bankinfo/", Utility.SetPagePlug(bank.BankName) + "_" + rand + Path.GetExtension(uploadfile.FileName));
                    bank.Logo = "/Content/images/bankinfo/" + Utility.SetPagePlug(bank.BankName) + "_" + rand + Path.GetExtension(uploadfile.FileName);
                }

                if (RouteData.Values["id"] != null)
                {
                    int nid = 0;
                    bool isnumber = int.TryParse(RouteData.Values["id"].ToString(), out nid);
                    if (isnumber)
                    {
                        bank.BankId = nid;
                        ViewBag.ProcessMessage = BankManager.EditBank(bank); 
                        return View(bank);
                    }
                    else
                    {
                        ViewBag.ProcessMessage = false;
                        return View(bank);
                    }
                }
                else       
                    return View();
            }
            else
                return View();



        }
Example #25
0
        private void cmbBankFile_Format(object sender, ListControlConvertEventArgs e)
        {
            BankInfo bankInfo = (BankInfo)e.ListItem;

            e.Value = bankInfo.Name;
        }
 public void Insert(BankInfo info)
 {
     _bankInfoRepository.Insert(info);
 }
Example #27
0
 public void Update_Bank(BankInfo _bankInfo)
 {
     _bankRepo.Update(_bankInfo);
 }
Example #28
0
        public bool UpdateBank(BankInfo bank)
        {
            var ress = _dal.UpdateBankInfo(bank);

            return(ress);
        }
Example #29
0
        public bool Add(BankInfo bankInfo)
        {
            Parameters cmdParams = GetParameters(bankInfo);

            return(DBHelper.ExecuteProc("PR_Accessories_Bank_Add", cmdParams));
        }
Example #30
0
        public void AddNullBankInfoItem()
        {
            BankInfo bankInfo = null;

            exchangeRate.AddBankInfo(bankInfo); //trying to add null object to collection
        }
Example #31
0
        public IHttpActionResult SaveBank(BankInfo bank)
        {
            BanksService.SaveBank(bank);

            return(Ok());
        }
Example #32
0
 public ConfirmPage(string amount, FullUserInformation userInfo, AccountInfo toAccountInfo, BankInfo selectedTransferToBank, string note) : this()
 {
     this.amount                 = amount;
     this.userInfo               = userInfo;
     this.toAccountInfo          = toAccountInfo;
     this.selectedTransferToBank = selectedTransferToBank;
     this.note = note;
 }