private void InsertCashierData() { using (RestaurantDBEntities db = new RestaurantDBEntities()) { RestaurantEmployeeModel EmpModel = new RestaurantEmployeeModel(); var GetEmpData = (from b in db.msemployees orderby b.employeeid descending select b).FirstOrDefault(); string GetEmployeeId = EmpModel.EmployeeId; if (GetEmployeeId == null) { int CashierId = 0 + 1; string GetCashierId = "CA" + CashierId++; RestaurantEmployeeModel SendToEmployeeModel = new RestaurantEmployeeModel( GetCashierId, EmployeeNameTextBox.Text, EmployeeEmailTextBox.Text, EmployeePasswordTextBox.Text, EmployeeHandphoneTextBox.Text, EmployeePositionValue.Text); GlobalConfig.Connection.RestaurantEmpData(EmpModel); } else { var GetData = (from b in db.msemployees where b.position == "cashier" orderby b.employeeid descending select b).First(); string GetlastId = EmpModel.EmployeeId; string SubstringCashierId = GetData.employeeid.Substring(2, 2); int ConvertAIC = Convert.ToInt32(SubstringCashierId) + 1; string CombineCashierId = SubstringCashierId + "" + ConvertAIC; RestaurantEmployeeModel SendToEmployeeModel = new RestaurantEmployeeModel( GetlastId, EmployeeNameTextBox.Text, EmployeeEmailTextBox.Text, EmployeePasswordTextBox.Text, EmployeeHandphoneTextBox.Text, EmployeePositionValue.Text); GlobalConfig.Connection.RestaurantEmpData(EmpModel); } MessageBox.Show("Data Berhasil Di Input !!"); } }
private void ManageEmployeeForm_Load(object sender, EventArgs e) { using (RestaurantDBEntities db = new RestaurantDBEntities()) { } }