public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value != null) { using (entity.db db = new entity.db()) { int costcenter_id = (int)value; if (db.app_cost_center.Where(x => x.id_cost_center == costcenter_id).FirstOrDefault() != null) { if (db.app_cost_center.Where(x => x.id_cost_center == costcenter_id).FirstOrDefault().is_product == true) { return(false); } else { return(true); } } else { return(true); } } } else { return(true); } }
private void cbxTag_Checked(object sender, RoutedEventArgs e) { using (entity.db db = new entity.db()) { cbTag.ItemsSource = db.item_tag.Where(x => x.id_company == entity.CurrentSession.Id_Company && x.is_active); } }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value == null) { return(Visibility.Hidden); } using (entity.db db = new entity.db()) { int item_id = (int)value; if (db.item_product.Where(x => x.id_item == item_id).FirstOrDefault() != null) { if (db.item_product.Where(x => x.id_item == item_id).FirstOrDefault().can_expire == false) { return(Visibility.Hidden); } else { return(Visibility.Visible); } } else { return(Visibility.Hidden); } } }
public Security(App.Names AppName) { view = true; create = true; edit = true; delete = true; approve = true; annul = true; if (CurrentSession.UserRole == null) { db db = new entity.db(); security_role security_role = new security_role(); security_role.name = "Master"; security_role.is_active = true; security_role.is_master = true; db.security_role.Add(security_role); db.SaveChanges(); CurrentSession.UserRole = security_role; } if (CurrentSession.UserRole.is_master == false) { if (CurrentSession.Security_CurdList.Where(x => x.id_application == AppName).FirstOrDefault() != null) { security_curd security_curd = CurrentSession.Security_CurdList.Where(x => x.id_application == AppName).FirstOrDefault(); view = security_curd.can_read; create = security_curd.can_create; edit = security_curd.can_update; delete = security_curd.can_delete; approve = security_curd.can_approve; annul = security_curd.can_annul; } } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { decimal money_value; if (decimal.TryParse(parameter.ToString(), out money_value)) { } else { return(parameter); } int id_currencyFx; if (int.TryParse(value.ToString(), out id_currencyFx)) { } else { return(parameter); } if (value != null && parameter != null) { using (entity.db db = new entity.db()) { decimal rate = 1; rate = db.app_currencyfx.Where(x => x.id_currency == id_currencyFx).FirstOrDefault().buy_value; return(money_value / rate); } } return(parameter); }
public Version() { using (entity.db db = new entity.db()) { UserNumber = db.security_user.Where(x => x.id_company == entity.CurrentSession.Id_Company).Count(); } InitializeComponent(); }
public override void Up() { db db = new entity.db(); if (db.sales_packing.Count() > 0) { List <sales_packing> sales_packing = db.sales_packing.ToList(); db.sales_packing.RemoveRange(sales_packing); db.SaveChanges(); } AlterColumn("sales_packing_detail", "id_location", c => c.Int()); CreateIndex("sales_packing_detail", "id_location"); AddForeignKey("sales_packing_detail", "id_location", "app_location", "id_location"); }
public DebeHaberLogIn() { InitializeComponent(); using (entity.db db = new entity.db()) { entity.app_company company = db.app_company.Where(x => x.id_company == entity.CurrentSession.Id_Company).FirstOrDefault(); if (company != null) { Company_RUC = company.gov_code; Company_Name = company.name; } if (company.hash_debehaber != null) { tabUpLoad.IsSelected = true; } } }
private async void btnApprove_Click(object sender, MouseButtonEventArgs e) { try { string server = Cognitivo.Properties.Settings.Default.DebeHaberConnString + "/api/registration/54HY3kXgamBsJ94hhd1DYsFSWzlI4KtF7aJMDxO9D4wnTVaEoqtuI42eC1sM5NMqFvZsHhYPgsudolP8Ug1JhKPyBMKxfbvGSnON/" + Company_RUC; var json = await DownloadPage(server); string Hash = JsonConvert.DeserializeObject <DebeHaberRegistration>(json).hash_integretion; using (entity.db db = new entity.db()) { entity.app_company company = db.app_company.Where(x => x.id_company == entity.CurrentSession.Id_Company).FirstOrDefault(); company.hash_debehaber = Hash; db.SaveChanges(); } tabUpLoad.IsSelected = true; frameDebeHaberIntg.Refresh(); } catch (Exception ex) { MessageBox.Show("Connection Error: " + ex.Message); return; } }