void IBasicCommand.Save() { Page.Validate("AddEdit"); if (Page.IsValid) { string userName = ViewState["_UserName"].ToString(); try { if (String.IsNullOrEmpty(userName)) { UserManagement.CreateUserWithRole( txtUserName.Text, txtPassword.Text, txtEmail.Text, ddlRole.SelectedValue); employeeProvider.Add( txtUserName.Text, txtBarcode.Text, txtUserName.Text, Convert.ToInt32(ddlHomeBranch.SelectedValue), txtEmail.Text, false); IList <int> branchesID = new List <int>(); branchesID.Add(Convert.ToInt32(ddlHomeBranch.SelectedValue)); userProvider.UpdateUserAtBranch(txtUserName.Text, branchesID); } else { UserManagement.UpdateUserDetail( txtUserName.Text, txtEmail.Text, ddlRole.SelectedValue); employeeProvider.Update( txtUserName.Text, txtBarcode.Text, txtUserName.Text, Convert.ToInt32(ddlHomeBranch.SelectedValue), txtEmail.Text); } userProvider.UpdateUserAtBranch(txtUserName.Text, new List <int>() { Convert.ToInt32(ddlHomeBranch.SelectedValue) }); } catch (Exception ex) { lblStatus.Text = String.Format("Cannot add/edit user information: {0}", ex.Message); } mvwForm.ActiveViewIndex = 0; ((IBasicCommand)this).Refresh(); } }
public string myfirst() { EmployeeProvider employeeProvider = new EmployeeProvider(); Employees employees = new Employees(); employees.Name = "Dilip"; employees.Description = "Backend Developer"; employees.Experience = "2 years"; employees.Salary = 30000; Employees employees1 = new Employees(); employees1.Name = "Thulasi"; employees1.Description = "Backend Developer"; employees1.Experience = "3 years"; employees1.Salary = 40000; Employees employees2 = new Employees(); employees2.Name = "Mohammad Ali"; employees2.Description = "FullStack Developer"; employees2.Experience = "2 years"; employees2.Salary = 45000; Employees employees3 = new Employees(); employees3.Name = "Bhanu"; employees3.Description = "Backend Developer"; employees3.Experience = "2 years"; employees3.Salary = 30000; Employees employees4 = new Employees(); employees4.Name = "Jaheer"; employees4.Description = "Backend Developer"; employees4.Experience = "2 years"; employees4.Salary = 35000; Employees employees5 = new Employees(); employees5.Name = "Durga"; employees5.Description = "Digital Marketing"; employees5.Experience = "4 years"; employees5.Salary = 50000; Employees employees6 = new Employees(); employees6.Name = "Darshan"; employees6.Description = "Offline Marketing"; employees6.Experience = "2 years"; employees6.Salary = 40000; Employees employees7 = new Employees(); employees7.Name = "Naveen"; employees7.Description = "Graphic designer"; employees7.Experience = "4 years"; employees7.Salary = 35000; Employees employees8 = new Employees(); employees8.Name = "Bhuvan"; employees8.Description = "Online Marketing"; employees8.Experience = "2 years"; employees8.Salary = 30000; employeeProvider.Add(employees); employeeProvider.Add(employees1); employeeProvider.Add(employees2); employeeProvider.Add(employees3); employeeProvider.Add(employees4); employeeProvider.Add(employees5); employeeProvider.Add(employees6); employeeProvider.Add(employees7); employeeProvider.Add(employees8); employeeProvider.SaveChanges(); return("Updated"); }