// GET: FindPizza public IActionResult Index() { DbViewModel dvm = new DbViewModel(); dvm.MyPizzaPlacesItems = _context.MyPizzaPlaces.ToList(); return(View(dvm)); }
public ActionResult Edit(int id, DbViewModel collection) { try { //Select the Person and Contact of that Id var person = _phoneBookDb.People.Single(m => m.PersonId == id); //Update the Person DB person.FirstName = collection.Person.FirstName; person.MiddleName = collection.Person.MiddleName; person.LastName = collection.Person.LastName; person.DateOfBirth = collection.Person.DateOfBirth; person.HomeAddress = collection.Person.HomeAddress; person.HomeCity = collection.Person.HomeCity; person.FaceBookAccountId = collection.Person.FaceBookAccountId; person.LinkedInId = collection.Person.LinkedInId; person.TwitterId = collection.Person.TwitterId; person.EmailId = collection.Person.EmailId; //Add Update Time to Person Table _phoneBookDb.People.Single(m => m.PersonId == id).UpdateOn = DateTime.Now.Date; _phoneBookDb.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
/// <summary> /// 取得 Excel 內資料 /// </summary> /// <param name="sheet"></param> /// <returns></returns> private List <DbViewModel> GetData(ISheet sheet) { List <DbViewModel> ListPrice = new List <DbViewModel>(); for (int row = 1; row <= sheet.LastRowNum; row++) { DataFormatter formatter = new DataFormatter(); String listPrice = formatter.FormatCellValue(sheet.GetRow(row).GetCell(9)); String ERPPrice = formatter.FormatCellValue(sheet.GetRow(row).GetCell(10)); var data = new DbViewModel() { LicenseType = sheet.GetRow(row).GetCell(0).StringCellValue, ValidFromDate = DateTime.ParseExact(sheet.GetRow(row).GetCell(1).StringCellValue, "yyyyMMdd", null, System.Globalization.DateTimeStyles.AllowWhiteSpaces), ValidToDate = DateTime.ParseExact(sheet.GetRow(row).GetCell(2).StringCellValue, "yyyyMMdd", null, System.Globalization.DateTimeStyles.AllowWhiteSpaces), OfferDisplayName = sheet.GetRow(row).GetCell(3).StringCellValue, OfferID = sheet.GetRow(row).GetCell(4).StringCellValue, LicenseAgreement = sheet.GetRow(row).GetCell(5).StringCellValue, PurchaseUnit = sheet.GetRow(row).GetCell(6).StringCellValue, SecondaryLicenseType = sheet.GetRow(row).GetCell(7).StringCellValue, EndCustomerType = sheet.GetRow(row).GetCell(8).StringCellValue, ListPrice_TWD = decimal.Parse(listPrice), ERPPrice_TWD = decimal.Parse(ERPPrice), Material = sheet.GetRow(row).GetCell(11).StringCellValue, }; ListPrice.Add(data); } return(ListPrice); }
public void AuthenticateUser(ref AuthenticationModel authenticationModel, ref string sMsjError) { #region Local variables string sNombreTabla, sNombreSP, sEncryptedPass = authenticationModel.UserPassword; DbModel dbModel = new DbModel(); DbViewModel dbViewModel = new DbViewModel(); EncryptionViewModel encryptionViewModel = new EncryptionViewModel(); #endregion encryptionViewModel.EncryptString(ref sEncryptedPass); dbViewModel.GenerarDataTableParametros(ref dbModel); DataRow dr1 = dbModel.dtParametros.NewRow(); dr1["Nombre"] = "@email"; dr1["TipoDato"] = "4"; dr1["Valor"] = authenticationModel.UserName; DataRow dr2 = dbModel.dtParametros.NewRow(); dr2["Nombre"] = "@s_contrasena"; dr2["TipoDato"] = "4"; dr2["Valor"] = sEncryptedPass; dbModel.dtParametros.Rows.Add(dr1); dbModel.dtParametros.Rows.Add(dr2); sNombreTabla = (App.Current as App).TblAuthentication.ToString(); sNombreSP = (App.Current as App).SpAuthentication.ToString(); dbViewModel.ExecuteFill(sNombreTabla, sNombreSP, ref dbModel); if (dbModel.sMsjError != string.Empty) { sMsjError = dbModel.sMsjError; authenticationModel.UserProfile = String.Empty; } else { sMsjError = string.Empty; if (dbModel.DS.Tables[sNombreTabla].Rows.Count > 0) { authenticationModel.UserProfile = dbModel.DS.Tables[sNombreTabla].Rows[0][0].ToString(); if (authenticationModel.UserProfile == "Invalid Credentials") { authenticationModel.IsErrorMessageVisible = true; authenticationModel.UserProfile = ""; } } else { authenticationModel.UserProfile = string.Empty; authenticationModel.IsErrorMessageVisible = true; } } }
private async Task AutorizeAsync() { try { credPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); credPath = Path.Combine(credPath, ".credentials/drive-dotnet-quickstart.json"); UserCredential credential = GetCredentials(); service = new DriveService(new BaseClientService.Initializer() { HttpClientInitializer = credential, ApplicationName = ApplicationName, }); var fluentMainWindow = Activator.CreateInstance <MainMenu>(); fluentMainWindow.Show(); fluentMainWindow.Activate(); exit = true; DbViewModel.getInstance(); var request = ModelLogin.service.About.Get(); request.Fields = "user"; var user = request.Execute().User; await DbViewModel.AddUserAsync(user.EmailAddress); foreach (Window win in System.Windows.Application.Current.Windows) { if (win.Title == "Login") { win.Close(); } } } catch (Exception er) { } }
/// <summary> /// This method is used to create a new user in the data base /// </summary> /// <param name="sMsjError"></param> /// <param name="usersModel"></param> public void CreateNewUser(ref string sMessage, ref UsersModel usersModel) { #region Local variables string sNombreSP, sEncryptedEmailPass = usersModel.PasswordEmail, sEncryptedUserPass = "", sResultado = string.Empty; DbModel dbModel = new DbModel(); DbViewModel dbViewModel = new DbViewModel(); EncryptionViewModel encryptionViewModel = new EncryptionViewModel(); #endregion if (!IsEmailGood(usersModel.UserEmail)) { sMessage = "Por favor verifique que el correo electrónico se haya ingresado en el formato correcto"; } else if (usersModel.PasswordEmail == string.Empty || usersModel.PasswordEmail is null) { sMessage = "Por favor ingrese la contraseña del correo electrónico"; } else if (usersModel.UserIdType == "Nacional" && !IsIdNumberGood(usersModel.UserIdNumber)) { sMessage = "Por favor verifique que el número de identificación se haya ingresado en el formato correcto"; } else if (usersModel.UserAddress == string.Empty || usersModel.UserAddress is null || usersModel.UserProvince == string.Empty || usersModel.UserProvince is null || usersModel.UserCanton == string.Empty || usersModel.UserCanton is null || usersModel.UserDistrict == string.Empty || usersModel.UserDistrict is null) { sMessage = "Por favor ingrese una dirección de residencia"; }
public UCDbView() { InitializeComponent(); var vm = new DbViewModel(); vm.SetDatabaseAbility(new DbDapperAccess()); this.DataContext = vm; }
public void LoadServices(ref string sMsjError, ref CasesModel casesModel) { #region Local variables string sNombreTabla, sNombreSP; DbModel dbModel = new DbModel(); DbViewModel dbViewModel = new DbViewModel(); #endregion dbViewModel.GenerarDataTableParametros(ref dbModel); DataRow dr1 = dbModel.dtParametros.NewRow(); dr1["Nombre"] = "@id_area"; dr1["TipoDato"] = "9"; dr1["Valor"] = casesModel.IdServiceArea; dbModel.dtParametros.Rows.Add(dr1); sNombreTabla = (App.Current as App).TblServices.ToString(); sNombreSP = (App.Current as App).SpListServices.ToString(); dbViewModel.ExecuteFill(sNombreTabla, sNombreSP, ref dbModel); if (dbModel.sMsjError != string.Empty) { sMsjError = dbModel.sMsjError; } else { sMsjError = string.Empty; if (dbModel.DS.Tables[sNombreTabla].Rows.Count > 0) { casesModel.DataTableServices = dbModel.DS.Tables[sNombreTabla]; if (casesModel.ServicesList is null) { casesModel.ServicesList = new List <CasesModel>(); } else { casesModel.ServicesList.Clear(); } for (int i = 0; i < casesModel.DataTableServices.Rows.Count; i++) { CasesModel service = new CasesModel(); service.IdCaseService = Convert.ToInt16(casesModel.DataTableServices.Rows[i]["ID_SERVICIO"]); service.IdServiceArea = Convert.ToInt16(casesModel.DataTableServices.Rows[i]["ID_AREA"]); service.DescriptionCaseService = casesModel.DataTableServices.Rows[i]["NOMBRE"].ToString(); casesModel.ServicesList.Add(service); } } } }
// GET: ContactInfoes public IActionResult Index() { // Instantiating and Setting the DbViewModel Properties DbViewModel dbvm = new DbViewModel(); dbvm.ContactItems = _context.ContactInfoes.ToList(); return(View(dbvm)); }
public void LoadUserRoles(ref string sMsjError, ref UsersModel usersModel) { #region Local variables string sNombreTabla, sNombreSP; DbModel dbModel = new DbModel(); DbViewModel dbViewModel = new DbViewModel(); #endregion //dbViewModel.GenerarDataTableParametros(ref dbModel); //DataRow dr1 = dbModel.dtParametros.NewRow(); //dr1["Nombre"] = "@email"; //dr1["TipoDato"] = "4"; //dr1["Valor"] = authenticationModel.UserName; //DataRow dr2 = dbModel.dtParametros.NewRow(); //dr2["Nombre"] = "@s_contrasena"; //dr2["TipoDato"] = "4"; //dr2["Valor"] = sEncryptedPass; //dbModel.dtParametros.Rows.Add(dr1); //dbModel.dtParametros.Rows.Add(dr2); sNombreTabla = (App.Current as App).TblProfiles.ToString(); sNombreSP = (App.Current as App).SpListProfiles.ToString(); dbViewModel.ExecuteFill(sNombreTabla, sNombreSP, ref dbModel); if (dbModel.sMsjError != string.Empty) { sMsjError = dbModel.sMsjError; } else { sMsjError = string.Empty; if (dbModel.DS.Tables[sNombreTabla].Rows.Count > 0) { usersModel.DataTableProfiles = dbModel.DS.Tables[sNombreTabla]; usersModel.ProfilesList = new List <UsersModel>(); for (int i = 0; i < usersModel.DataTableProfiles.Rows.Count; i++) { UsersModel profile = new UsersModel(); profile.UserProfileId = Convert.ToInt32(usersModel.DataTableProfiles.Rows[i][0]); profile.UserProfileName = usersModel.DataTableProfiles.Rows[i][1].ToString(); usersModel.ProfilesList.Add(profile); } } } }
/// <summary> /// 儲存多筆上傳檔案時的名稱 /// </summary> /// <param name="Name"></param> /// <returns></returns> public List <DbViewModel> ExcelName(string Name) { List <DbViewModel> ExcelName = new List <DbViewModel>(); var name = new DbViewModel() { ExcelName = Name }; ExcelName.Add(name); return(ExcelName); }
// GET: Person/Edit/5 public ActionResult Edit(int id) { var persons = _phoneBookDb.People.SingleOrDefault(c => c.PersonId == id); //Add these to the View Model var viewList = new DbViewModel { Person = persons, }; return(View(viewList)); }
public void GetDdlTest2() { var dbVm = new DbViewModel(); var table = new TableViewModel("TEST"); dbVm.Tables.Add(table); var col1 = new ColumInfo("COL1", new FieldType(8, null, null, null, null), new ConstraintsInfo(ConstraintsKind.Primary), "RDB$1", false); table.Colums.Add(new ColumViewMoodel(col1)); var col2 = new ColumInfo("COL2", new FieldType(37, null, 100, null, null), new ConstraintsInfo(ConstraintsKind.Primary), "RDB$2", false); table.Colums.Add(new ColumViewMoodel(col2)); var col3 = new ColumInfo("COL3", new FieldType(35, null, null, null, null), new ConstraintsInfo(ConstraintsKind.None), "RDB$3", false); table.Colums.Add(new ColumViewMoodel(col3)); var col4 = new ColumInfo("COL4", new FieldType(261, null, null, null, null), new ConstraintsInfo(ConstraintsKind.None), "RDB$4", true); table.Colums.Add(new ColumViewMoodel(col4)); var col5 = new ColumInfo("COL5", new FieldType(7, 1, null, 4, 0), new ConstraintsInfo(ConstraintsKind.None), "RDB$4", true); table.Colums.Add(new ColumViewMoodel(col5)); var col6 = new ColumInfo("COL6", new FieldType(8, 2, null, 4, -2), new ConstraintsInfo(ConstraintsKind.None), "RDB$4", true); table.Colums.Add(new ColumViewMoodel(col6)); var col7 = new ColumInfo("COL7", new FieldType(16, 2, null, 10, -4), new ConstraintsInfo(ConstraintsKind.None), "RDB$4", true); table.Colums.Add(new ColumViewMoodel(col7)); var idx = new IndexInfo(); idx.Name = "COMPLEXKEY"; idx.TableName = table.TableName; idx.Kind = ConstraintsKind.Primary; idx.FieldNames.Add(col1.ColumName); idx.FieldNames.Add(col2.ColumName); var idxVm = new IndexViewModel(idx); dbVm.Indexes.Add(idxVm); table.Indexs.Add(idxVm); table.GetDdl(dbVm).Is( "CREATE TABLE TEST (" + Environment.NewLine + " COL1 INTEGER NOT NULL," + Environment.NewLine + " COL2 VARCHAR(100) NOT NULL," + Environment.NewLine + " COL3 TIMESTAMP NOT NULL," + Environment.NewLine + " COL4 BLOB," + Environment.NewLine + " COL5 NUMERIC(4)," + Environment.NewLine + " COL6 DECIMAL(4,2)," + Environment.NewLine + " COL7 DECIMAL(10,4)," + Environment.NewLine + " CONSTRAINT COMPLEXKEY PRIMARY KEY (COL1, COL2)" + Environment.NewLine + ")"); }
public DatabaseControl() { InitializeComponent(); viewModel = new DbViewModel() { Dbs = new List <NodeInfo>() }; this.Loaded += (s, e) => { this.DataContext = viewModel; InitMongoDb(); }; }
public void LoadCasesStatus(ref string sMsjError, ref CasesModel casesModel) { #region Local variables string sNombreTabla, sNombreSP; DbModel dbModel = new DbModel(); DbViewModel dbViewModel = new DbViewModel(); #endregion dbViewModel.GenerarDataTableParametros(ref dbModel); sNombreTabla = (App.Current as App).TblStatus.ToString(); sNombreSP = (App.Current as App).SpListPossibleCaseStatus.ToString(); dbViewModel.ExecuteFill(sNombreTabla, sNombreSP, ref dbModel); if (dbModel.sMsjError != string.Empty) { sMsjError = dbModel.sMsjError; } else { sMsjError = string.Empty; if (dbModel.DS.Tables[sNombreTabla].Rows.Count > 0) { casesModel.DataTableStatus = dbModel.DS.Tables[sNombreTabla]; if (casesModel.StatusList is null) { casesModel.StatusList = new List <CasesModel>(); } else { casesModel.StatusList.Clear(); } for (int i = 0; i < casesModel.DataTableStatus.Rows.Count; i++) { CasesModel status = new CasesModel(); status.IdCaseStatus = Convert.ToInt16(casesModel.DataTableStatus.Rows[i]["ID_ESTADO"]); status.DescriptionCaseStatus = casesModel.DataTableStatus.Rows[i]["NOMBRE_ESTADO"].ToString(); casesModel.StatusList.Add(status); } } } }
public void CreateNewCustomerRecord(ref string sMessage, ref RecordsModel recordsModel) { #region Local variables string sNombreSP, sResult = string.Empty; DbModel dbModel = new DbModel(); DbViewModel dbViewModel = new DbViewModel(); #endregion if (recordsModel.CustomerEmail is null || !IsCustomerEmailGood(recordsModel.CustomerEmail)) { sMessage = "Por favor verifique que el correo electrónico se haya ingresado en el formato correcto"; }
public void GetDdlTest3() { var dbVm = new DbViewModel(); var table = new TableViewModel("TEST"); dbVm.Tables.Add(table); var col1 = new ColumInfo("COL1", new FieldType(8, null, null, null, null), new ConstraintsInfo(ConstraintsKind.Primary), "SARARY", false); table.Colums.Add(new ColumViewMoodel(col1)); var col2 = new ColumInfo("COL2", new FieldType(37, null, 100, null, null), new ConstraintsInfo(ConstraintsKind.Primary), "NAME", false); table.Colums.Add(new ColumViewMoodel(col2)); var col3 = new ColumInfo("COL3", new FieldType(35, null, null, null, null), new ConstraintsInfo(ConstraintsKind.None), "RDB$3", false); table.Colums.Add(new ColumViewMoodel(col3)); var col4 = new ColumInfo("COL4", new FieldType(261, null, null, null, null), new ConstraintsInfo(ConstraintsKind.None), "RDB$4", true); table.Colums.Add(new ColumViewMoodel(col4)); var idx = new IndexInfo(); idx.Name = "COMPLEXKEY"; idx.TableName = table.TableName; idx.Kind = FAManagementStudio.Common.ConstraintsKind.Primary; idx.FieldNames.Add(col1.ColumName); idx.FieldNames.Add(col2.ColumName); var idxVm = new IndexViewModel(idx); dbVm.Indexes.Add(idxVm); table.Indexs.Add(idxVm); table.GetDdl(dbVm).Is( "CREATE DOMAIN SARARY AS INTEGER;" + Environment.NewLine + "CREATE DOMAIN NAME AS VARCHAR(100);" + Environment.NewLine + "CREATE TABLE TEST (" + Environment.NewLine + " COL1 SARARY NOT NULL," + Environment.NewLine + " COL2 NAME NOT NULL," + Environment.NewLine + " COL3 TIMESTAMP NOT NULL," + Environment.NewLine + " COL4 BLOB," + Environment.NewLine + " CONSTRAINT COMPLEXKEY PRIMARY KEY (COL1, COL2)" + Environment.NewLine + ")"); }
public void GetDdlTest4() { var dbVm = new DbViewModel(); var table = new TableViewViewModel("SNOW_LINE", "SELECT CITY, STATE, ALTITUDE FROM CITIES WHERE ALTITUDE > 5000"); dbVm.Tables.Add(table); var col1 = new ColumInfo("CITY", new FieldType(8, null, null, null, null), new ConstraintsInfo(ConstraintsKind.Primary), "SARARY", false); table.Colums.Add(new ColumViewMoodel(col1)); var col2 = new ColumInfo("STATE", new FieldType(37, null, 100, null, null), new ConstraintsInfo(ConstraintsKind.Primary), "NAME", false); table.Colums.Add(new ColumViewMoodel(col2)); var col3 = new ColumInfo("SNOW_ALTITUDE", new FieldType(35, null, null, null, null), new ConstraintsInfo(ConstraintsKind.None), "RDB$3", false); table.Colums.Add(new ColumViewMoodel(col3)); table.GetDdl(dbVm).Is( "CREATE VIEW SNOW_LINE (CITY, STATE, SNOW_ALTITUDE) AS" + Environment.NewLine + "SELECT CITY, STATE, ALTITUDE FROM CITIES WHERE ALTITUDE > 5000"); }
public void GetDdlTest1() { var dbVm = new DbViewModel(); var table = new TableViewModel("TEST"); dbVm.Tables.Add(table); var col1 = new ColumInfo("COL1", new FieldType(8, null, null, null, null), new ConstraintsInfo(ConstraintsKind.Primary), "RDB$1", false); table.Colums.Add(new ColumViewMoodel(col1)); var col2 = new ColumInfo("COL2", new FieldType(37, null, 100, null, null), new ConstraintsInfo(ConstraintsKind.None), "RDB$2", false); table.Colums.Add(new ColumViewMoodel(col2)); var col3 = new ColumInfo("COL3", new FieldType(35, null, null, null, null), new ConstraintsInfo(ConstraintsKind.None), "RDB$3", false); table.Colums.Add(new ColumViewMoodel(col3)); var col4 = new ColumInfo("COL4", new FieldType(261, null, null, null, null), new ConstraintsInfo(ConstraintsKind.None), "RDB$4", true); table.Colums.Add(new ColumViewMoodel(col4)); var idx = new IndexInfo(); idx.Name = "RDB$PRIMARYKEY1"; idx.TableName = table.TableName; idx.Kind = ConstraintsKind.Primary; idx.FieldNames.Add(col1.ColumName); var idxVm = new IndexViewModel(idx); dbVm.Indexes.Add(idxVm); table.Indexs.Add(idxVm); table.GetDdl(dbVm).Is( "CREATE TABLE TEST (" + Environment.NewLine + " COL1 INTEGER NOT NULL," + Environment.NewLine + " COL2 VARCHAR(100) NOT NULL," + Environment.NewLine + " COL3 TIMESTAMP NOT NULL," + Environment.NewLine + " COL4 BLOB," + Environment.NewLine + " PRIMARY KEY (COL1)" + Environment.NewLine + ")"); }
public ActionResult Create(DbViewModel collection) { string user = User.Identity.GetUserId(); try { //Data Enter in the form added to this Person present in DB var person = new Person(); person.FirstName = collection.Person.FirstName; person.MiddleName = collection.Person.MiddleName; person.LastName = collection.Person.LastName; person.DateOfBirth = collection.Person.DateOfBirth; person.AddedOn = DateTime.Now; person.AddedBy = user; person.HomeAddress = collection.Person.HomeAddress; person.HomeCity = collection.Person.HomeCity; person.FaceBookAccountId = collection.Person.FaceBookAccountId; person.LinkedInId = collection.Person.LinkedInId; person.TwitterId = collection.Person.TwitterId; person.EmailId = collection.Person.EmailId; _phoneBookDb.People.Add(person); //Data Enter in the form added to this Contact present in DB //var contact = new Contact(); //contact.ContactNumber = collection.Contact.ContactNumber; //contact.Type = collection.Contact.Type; //contact.PersonId = collection.Person.PersonId; //_phoneBookDb.Contacts.Add(contact); //Save Changes to the Database _phoneBookDb.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
public void CreateNewCase(ref string sMessage, ref CasesModel casesModel) { #region Local variables string sNombreSP, sResult = string.Empty; DbModel dbModel = new DbModel(); DbViewModel dbViewModel = new DbViewModel(); #endregion if (casesModel.IdCaseService == 0) { sMessage = "Por favor seleccione un tipo de caso"; } else if (casesModel.CaseTitle == string.Empty || casesModel.CaseTitle is null) { sMessage = "Por favor ingrese un título para el caso"; } else if (casesModel.IdServiceArea == 1 && (casesModel.SuedPartyName == string.Empty || casesModel.SuedPartyName is null || casesModel.SuedPartyIdNumber == string.Empty || casesModel.SuedPartyIdNumber is null)) { sMessage = "Por favor ingrese los datos del demandado"; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return(DbViewModel.GetUserIdByName(int.Parse(value.ToString()))); }
public DbFiles() { InitializeComponent(); this.DataContext = DbViewModel.getInstance(); }