public void TranslateRecipeMicrosoft(BusinessObjects.Recipe recipe) { CultureInfo currentCulture = System.Threading.Thread.CurrentThread.CurrentCulture; if (!currentCulture.TwoLetterISOLanguageName.ToLowerInvariant().Equals("es")) { if (traslator == null) { traslator = new MicrosoftTransProvider(KEY, SECRET); } string target = currentCulture.TwoLetterISOLanguageName; recipe.Title = traslator.Translate(HttpUtility.HtmlDecode(recipe.Title), target); recipe.MainIngredient = traslator.Translate(recipe.MainIngredient, target); recipe.Category = traslator.Translate(recipe.Category, target); if (!string.IsNullOrEmpty(recipe.Procedure)) { string procedure = recipe.Procedure.Replace("\r\n\r\n", " [n] ").Replace("\n ", " [n] "); procedure = traslator.Translate(procedure, target); procedure = HttpUtility.HtmlDecode(procedure); recipe.Procedure = procedure.Replace("[n] ", "\n").Replace("[N] ", "\n").Replace("[ n] ", "\n").Replace("[n ] ", "\n"); } if (recipe.Ingridients != null && recipe.Ingridients.Count > 0) { recipe.Ingridients = TranslateList(traslator, recipe.Ingridients, target); } if (recipe.Alarms != null && recipe.Alarms.Count > 0) { var list = new List<string>(); recipe.Alarms.ForEach(al => al.Name = traslator.Translate(al.Name, target)); } } }
protected static void HandleAlarms(string source, ref BusinessObjects.Recipe recipe) { recipe.Alarms = new List<BusinessObjects.Alarm>(); var alarmMinEx = new Regex(".(?<text>(\\w+\\s)+)(?<minutos>\\d+)\\sminutos"); if (alarmMinEx.IsMatch(source)) { foreach (Match match in alarmMinEx.Matches(source)) { var alarm = new BusinessObjects.Alarm { Minutes = double.Parse(match.Groups["minutos"].Value), Name = match.Groups["text"].Value }; recipe.Alarms.Add(alarm); } } var alarmHourEx = new Regex(".(?<text>(\\w+\\s)+)(?<hora>\\d+)\\shora(s*)"); if (alarmHourEx.IsMatch(source)) { foreach (Match match in alarmHourEx.Matches(source)) { var alarm = new BusinessObjects.Alarm { Minutes = double.Parse(match.Groups["hora"].Value) * 60, Name = match.Groups["text"].Value }; recipe.Alarms.Add(alarm); } } }
public void Add(BusinessObjects.GroupRelation entity) { //Add GroupRelation using (_GroupRelationRepository = new GenericRepository<DAL.DataEntities.GroupRelation>()) { _GroupRelationRepository.Add((DAL.DataEntities.GroupRelation)entity.InnerEntity); _GroupRelationRepository.SaveChanges(); } //Add GroupRelations_To_Features using (_GroupRelationsToFeaturesRepository = new GenericRepository<DAL.DataEntities.GroupRelation_To_Feature>()) { foreach (int childFeatureID in entity.ChildFeatureIDs) { DAL.DataEntities.GroupRelation_To_Feature grToFeature = new DAL.DataEntities.GroupRelation_To_Feature(); grToFeature.GroupRelationID = entity.ID; grToFeature.ParentFeatureID = entity.ParentFeatureID; grToFeature.ChildFeatureID = childFeatureID; _GroupRelationsToFeaturesRepository.Add(grToFeature); } _GroupRelationsToFeaturesRepository.SaveChanges(); } }
public SearchResult GetSeriesCatalogInRectangle(Box extentBox, string[] keywords, double tileWidth, double tileHeight, DateTime startDate, DateTime endDate, WebServiceNode[] serviceIDs, BusinessObjects.Models.IProgressHandler bgWorker) { if (extentBox == null) throw new ArgumentNullException("extentBox"); if (serviceIDs == null) throw new ArgumentNullException("serviceIDs"); if (bgWorker == null) throw new ArgumentNullException("bgWorker"); if (keywords == null || keywords.Length == 0) { keywords = new[] { String.Empty }; } bgWorker.CheckForCancel(); var extent = new Extent(extentBox.XMin, extentBox.YMin, extentBox.XMax, extentBox.YMax); var fullSeriesList = GetSeriesListForExtent(extent, keywords, tileWidth, tileHeight, startDate, endDate, serviceIDs, bgWorker, series => true); SearchResult resultFs = null; if (fullSeriesList.Count > 0) { bgWorker.ReportMessage("Calculating Points..."); resultFs = SearchHelper.ToFeatureSetsByDataSource(fullSeriesList); } bgWorker.CheckForCancel(); var message = string.Format("{0} Series found.", totalSeriesCount); bgWorker.ReportProgress(100, "Search Finished. " + message); return resultFs; }
private void btnRemoveUser_Click(object sender, EventArgs e) { if (lstUsers.SelectedIndices.Count == 0) { MessageBox.Show("You must select a user to delete.", "No user selected", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } DialogResult result = MessageBox.Show("Are you sure that you would like to remove this user?", "Confirm - DROP USER" , MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (result == DialogResult.No || result == DialogResult.Cancel) { return; } BusinessObjects _businessObjects = new BusinessObjects(); int returnValue = _businessObjects.DeleteUserAccount(lstUsers.SelectedItems[0].Text); if (returnValue == 0) { MessageBox.Show("User deleted successfully.", "Result" , MessageBoxButtons.OK, MessageBoxIcon.Information); } RefreshUserList(); }
public ActionResult EditOrCreate(BusinessObjects.WorkManagement.Customer newInstance) { string userID = "SYSTEM"; try { bool hasLocationContentChanged = false; if (newInstance.BillingAddress != null && newInstance.BillingAddress.ID > 0) { string serialized = (Server.HtmlDecode(Request["originalModel"])); /* // Test that Request["originalModel"] is actually a serialized Location instance System.Xml.XmlDocument xml = new System.Xml.XmlDocument(); xml.LoadXml(serialized); BusinessObjects.WorkManagement.Location originalContent = null; originalContent = (BusinessObjects.WorkManagement.Location)BusinessObjects.Base.Deserialize(typeof(BusinessObjects.WorkManagement.Location),xml); */ hasLocationContentChanged = (serialized != newInstance.BillingAddress.Serialize()); } newInstance.HasLocationChanged = hasLocationContentChanged; _modelContext.SaveCustomer(newInstance, userID); return RedirectToAction("Index"); } catch { return View(); } }
public static List <Customer> GetCustomerByCustomerId(Guid customerId) { BusinessObjects _businessObjects = new BusinessObjects(); List <Customer> customerList = _businessObjects.GetCustomerByCustomerId(customerId); return(customerList); }
public long CreateUserProfile(BusinessObjects.User User) { long flg = 0; List<SqlParameter> param1 = new List<SqlParameter>(); Dictionary<string, Object> dic1 = new Dictionary<string, Object>(); param1.Add(new SqlParameter("@PK_User_Id", User.PK_User_Id)); param1.Add(new SqlParameter("@FK_Utype_Id", User.UserType.PK_UserType_Id)); param1.Add(new SqlParameter("@LastName", User.LastName)); param1.Add(new SqlParameter("@FirstName", User.FirstName)); param1.Add(new SqlParameter("@BirthDate", User.Birthdate)); param1.Add(new SqlParameter("@Age", User.Age)); param1.Add(new SqlParameter("@Gender", User.Gender)); param1.Add(new SqlParameter("@UserEmpType", User.UserEmpType)); param1.Add(new SqlParameter("@Education", User.Education)); param1.Add(new SqlParameter("@Occupation", User.Occupation)); param1.Add(new SqlParameter("@MaritalStatus", User.MaritalStatus)); param1.Add(new SqlParameter("@City", User.City)); param1.Add(new SqlParameter("@State", User.State)); param1.Add(new SqlParameter("@Country", User.Country)); param1.Add(new SqlParameter("@Area", User.Area)); param1.Add(new SqlParameter("@IsOther", User.IsOther)); param1.Add(new SqlParameter("@OtherLocation", User.OtherLocation)); param1.Add(new SqlParameter("@ZipCode", User.ZipCode)); param1.Add(new SqlParameter("@Mobile1", User.Mobile1)); param1.Add(new SqlParameter("@Mobile2", User.Mobile2)); param1.Add(new SqlParameter("@Fax", User.Fax)); param1.Add(new SqlParameter("@IsVerified", User.IsVerified)); param1.Add(new SqlParameter("@RequestorId", User.Updated_By)); flg = Execute("SP_User_Create", param1.ToArray()); return flg; }
public void Add(BusinessObjects.FeatureSelection entity) { using (_FeatureSelectionRepository = new GenericRepository<DAL.DataEntities.FeatureSelection>()) { //Add the FeatureSelection _FeatureSelectionRepository.Add((DAL.DataEntities.FeatureSelection)entity.InnerEntity); _FeatureSelectionRepository.SaveChanges(); //Add AttributeValues using (_AttributeValuesRepository = new GenericRepository<DAL.DataEntities.AttributeValue>()) { for (int i = entity.AttributeValues.Count - 1; i >= 0; i--) { BLL.BusinessObjects.AttributeValue BLLAttributeValue = entity.AttributeValues[i]; BLLAttributeValue.FeatureSelectionID = entity.ID; //Add if (BLLAttributeValue.ToBeDeleted == false && BLLAttributeValue.ID == 0) { _AttributeValuesRepository.Add((DAL.DataEntities.AttributeValue)BLLAttributeValue.InnerEntity); } } _AttributeValuesRepository.SaveChanges(); } } }
protected void lnkSave2_Click(object sender, EventArgs e) { if (lnkSave2.Text == "[Edit]") { AddDDlItems("SubjectType"); ddlSubType.Visible = true; ddlSubType.Text = lblST.Text; lblST.Visible = false; lblST.Text = ""; lnkSave2.Text = "[Save]"; } else { if (ddlSubType.SelectedItem.Text == "Select") { Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox('Subject Type is Required')", true); return; } BusinessObjects bo = new BusinessObjects(); string strTicID = Request.QueryString["TicId"].ToString(); bool fl = bo.UpdateStatus(strTicID, ddlSubType.SelectedItem.Text, "SubjectType"); lblST.Visible = true; lblST.Text = ddlSubType.SelectedItem.Text; lnkSave2.Text = "[Edit]"; ddlSubType.Visible = false; if (fl == true) { Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox('Subject Type updated Successfully')", true); } //update field in sp } }
protected void lnkSave1_Click(object sender, EventArgs e) { if (lnkSave1.Text == "[Edit]") { AddDDlItems("ViewStatus"); ddlTicViewStatus.Visible = true; ddlTicViewStatus.Text = lblVS.Text; lblVS.Visible = false; lblVS.Text = ""; lnkSave1.Text = "[Save]"; } else { if (ddlTicViewStatus.SelectedItem.Text == "Select") { Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox('Please select ,who all can view this ticket')", true); return; } BusinessObjects bo = new BusinessObjects(); string strTicID = Request.QueryString["TicId"].ToString(); bool fl = bo.UpdateStatus(strTicID, ddlTicViewStatus.SelectedItem.Text, "ViewStatus"); lblVS.Visible = true; lblVS.Text = ddlTicViewStatus.SelectedItem.Text; lnkSave1.Text = "[Edit]"; ddlTicViewStatus.Visible = false; if (fl == true) { Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox('View Status updated Successfully')", true); } //update field in sp } }
// NOTIFICATION METHODS public static List <Notification> CheckNewNotifications(UserAccount user, bool isRead = false) { BusinessObjects _businessObjects = new BusinessObjects(); List <Notification> notificationList = _businessObjects.CheckNewNotifications(user, isRead); return(notificationList); }
public static List <Notification> CheckAllNotifications(UserAccount user) { BusinessObjects _businessObjects = new BusinessObjects(); List <Notification> notificationList = _businessObjects.CheckAllNotifications(user); return(notificationList); }
public int Create(BusinessObjects.User User,int isdirect=1) { int retVal = -1; SqlParameter sqlparm = new SqlParameter(); sqlparm.ParameterName = "@EffectiveUserId"; sqlparm.Direction = ParameterDirection.Output; sqlparm.DbType = DbType.Int32; List<string> outParmNames = new List<string>(); List<SqlParameter> param = new List<SqlParameter>(); outParmNames.Add(sqlparm.ParameterName); Dictionary<string, Object> dic = new Dictionary<string, Object>(); param.Add(new SqlParameter("@UserName", User.UserLogin.UserName)); param.Add(new SqlParameter("@Password", User.UserLogin.Password)); param.Add(new SqlParameter("@EmailId", User.UserLogin.EmailID)); param.Add(new SqlParameter("@AuthType", User.UserLogin.AuthType.Auth_Id)); param.Add(sqlparm); dic = Execute("SP_UserLogin_Create", param.ToArray(), outParmNames); retVal = (int)dic[sqlparm.ParameterName]; User.PK_User_Id = retVal; if (isdirect==1) { CreateUserProfile(User); } return retVal; }
public static List <Customer> GetCustomerByEmail(string emailAddress) { BusinessObjects _businessObjects = new BusinessObjects(); List <Customer> customerList = _businessObjects.GetCustomerByEmail(emailAddress); return(customerList); }
public static List <Customer> GetCustomerByPhoneNumber(string phoneNumber) { BusinessObjects _businessObjects = new BusinessObjects(); List <Customer> customerList = _businessObjects.GetCustomerByLastName(phoneNumber); return(customerList); }
public static List <Customer> GetCustomerByLastName(string lastName) { BusinessObjects _businessObjects = new BusinessObjects(); List <Customer> customerList = _businessObjects.GetCustomerByLastName(lastName); return(customerList); }
protected void btnSend_Click(object sender, EventArgs e) { string strTicID = Request.QueryString["TicId"].ToString(); string strCurUser = Convert.ToString(Session["CurrentUser"]); BusinessObjects bo = new BusinessObjects(); bool retval = bo.AddTicResponses(strTicID, lblTitle.Text, strCurUser, txtResponse.Text); string strRole = Convert.ToString(Session["Role"]); string strToMailAddr = ""; if (strRole.ToUpper() == "INSTRUCTOR") { strToMailAddr = bo.GetEmailByTicID(strTicID); SendMail(strTicID, "Instructor", strCurUser, strToMailAddr); } else if (strRole.ToUpper() == "STUDENT") { strToMailAddr = bo.GetEmailByUser(Convert.ToString(ViewState["InstID"])); SendMail(strTicID, "Student", strCurUser, strToMailAddr); } if (retval == true) { Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox('Responded Successfully')", true); } txtResponse.Text = ""; }
public ValidateCompare(BusinessObjects.BusinessObject otherObject, ValidationOperator @operator, String errorMessage) { OtherObject = otherObject; Operator = @operator; ErrorMessage = errorMessage; }
public void UpdateEmployee(BusinessObjects.Employee e) { var updatedEmployee = employeeAdapter.UpdateEmployeePerson(e.JobTitle, e.BusinessEntityId, e.FirstName, e.MiddleName, e.LastName); throw new NotImplementedException(); }
public static int NewNotification(Notification notification) { BusinessObjects _businessObjects = new BusinessObjects(); int returnValue = _businessObjects.InsertNotification(notification); return(returnValue); }
public static int NewUser(UserAccount user) { BusinessObjects _businessObjects = new BusinessObjects(); int returnValue = _businessObjects.NewUserAccount(user); return(returnValue); }
public static void RemoveInventoryItemFromInventory(InventoryItem item) { BusinessObjects _businessObjects = new BusinessObjects(); int returnValue; returnValue = _businessObjects.DeleteInventoryItem(item); DisplayDataStatus(returnValue); if (returnValue == 0) { int notificationReturnValue; BusinessObjects _notificationBusinessObject = new BusinessObjects(); Notification notification = new Notification(); notification.OrderId = item.OrderId; notification.NotificationId = Guid.NewGuid(); notification.NotificationMessage = ("Inventory item is en route : " + item.InventoryItemId.ToString()); notification.NotificationType = BusinessLayer.Enumerations.NotificationType.EnRoute; notification.IsRead = false; notification.PermissionScope = BusinessLayer.Enumerations.Permission.Manager; // INSERT notification to database notificationReturnValue = _notificationBusinessObject.InsertNotification(notification); if (notificationReturnValue == 0) { MessageBox.Show("A notification has been sent to the Work specialist", "Item Sent to Work Specialist", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (notificationReturnValue == 1) { MessageBox.Show("There was a problem sending a notification to the Work Specialist - please notify them manually that the item is on the way", "Item Sent to Work Specialist", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
public static void RemoveOrderItemsFromInventory(Order order) { BusinessObjects _businessObjects = new BusinessObjects(); using (TransactionScope scope = new TransactionScope()) { int returnValue = 1; foreach (OrderItem orderItem in order.ItemList) { //Get list of items in the inventory that match the catalog id and are on hold by this order List <InventoryItem> inventoryList = (List <InventoryItem>)ApplicationObjects.GetInventoryItemByCatalogItemId(orderItem.CatalogItem ).Where(o => o.OrderId == order.OrderId); returnValue = _businessObjects.DeleteInventoryItems(inventoryList); if (returnValue == 1) { scope.Dispose(); //kick transactionscope thus rolling back transaction. break; } } if (returnValue == 0) { scope.Complete(); //commit transaction } } }
public void Add(BusinessObjects.Model entity) { using (_ModelRepository = new GenericRepository<DAL.DataEntities.Model>()) { _ModelRepository.Add((DAL.DataEntities.Model)entity.InnerEntity); _ModelRepository.SaveChanges(); } }
public void Add(BusinessObjects.CustomRule entity) { using (_CustomRuleRepository = new GenericRepository<DAL.DataEntities.CustomRule>()) { _CustomRuleRepository.Add((DAL.DataEntities.CustomRule)entity.InnerEntity); _CustomRuleRepository.SaveChanges(); } }
public static CatalogItem GetCatalogItemByCatalogItemId(Guid catalogItemId) { BusinessObjects _businessObjects = new BusinessObjects(); return((catalogItemId != Guid.Empty) ? _businessObjects.GetCatalogItemByCatalogItemId(catalogItemId) : null); }
public void Add(BusinessObjects.Relation entity) { using (_RelationRepository = new GenericRepository<DAL.DataEntities.Relation>()) { _RelationRepository.Add((DAL.DataEntities.Relation)entity.InnerEntity); _RelationRepository.SaveChanges(); } }
public void Add(BusinessObjects.Constraint entity) { using (_ConstraintRepository = new GenericRepository<DAL.DataEntities.Constraint>()) { _ConstraintRepository.Add((DAL.DataEntities.Constraint)entity.InnerEntity); _ConstraintRepository.SaveChanges(); } }
public BusinessObjects.WorkManagement.Job UpdateTasks(BusinessObjects.WorkManagement.Job targetJob, BusinessObjects.WorkManagement.EngineerFeedback feedback) { // Tasks ActivityTaskCollection activityTaskCollection = new ActivityTaskCollection(); ActivityTask activityTask = null; /* foreach (TaskUpdate taskUpdate in feedback.Tasks) { if (targetJob.Tasks != null && targetJob.Tasks.Count > 0 && targetJob.Tasks.Find("ID", taskUpdate.ID) >= 0) { // Update to existing Task activityTask = targetJob.Tasks.Find(taskUpdate.ID); } else { // Adding a new Task activityTask = new ActivityTask(); activityTask.Description = taskUpdate.Comments[0].Text; } activityTask.IsComplete = taskUpdate.IsComplete; activityTask.IsDatabaseComplete = activityTask.IsComplete; activityTask.LastUpdatedDate = feedback.EndDateTime != null ? feedback.EndDateTime.Value : this.EndDateTime.Value; activityTaskCollection.Add(activityTask); } foreach (ActivityTask updatedActivityTask in activityTaskCollection) { if (updatedActivityTask.ID > 0) { targetJob.Tasks.Replace(targetJob.Tasks.Find(updatedActivityTask.ID), updatedActivityTask); } else { targetJob.Tasks.Add(updatedActivityTask); } } */ foreach (TaskUpdate taskUpdate in feedback.Tasks) { activityTask = new ActivityTask(); if (taskUpdate.ID <= 0) { activityTask.Description = taskUpdate.Comments[0].Text; } activityTask.IsComplete = taskUpdate.IsComplete; activityTask.IsDatabaseComplete = activityTask.IsComplete; activityTask.LastUpdatedDate = feedback.EndDateTime != null ? feedback.EndDateTime.Value : this.EndDateTime.Value; activityTask.MaterialsRequired = taskUpdate.MaterialsUsed; activityTask.MeasurementsRequired = taskUpdate.MeasurementsTaken; activityTaskCollection.Add(activityTask); } targetJob.Tasks = activityTaskCollection; return targetJob; }
public void AddPhoneNumber(BusinessObjects.PersonPhone phoneNumber) { // SQL query adding new row to Person.PersonPhone string query = "INSERT INTO Person.PersonPhone (BusinessEntityID, PhoneNumber, PhoneNumberTypeID) " + "VALUES (@BusinessEntityID, @PhoneNumber, @PhoneNumberTypeID)"; // Execute query cnn.Execute(query, phoneNumber.MapToParams()); }
public bool Delete(BusinessObjects.State State) { long retVal = -1; List<SqlParameter> param = new List<SqlParameter>(); Dictionary<string, Object> dic = new Dictionary<string, Object>(); param.Add(new SqlParameter("@StateID", State.ID)); retVal = Execute("SP_State_Delete", param.ToArray()); return retVal > 0; }
public void DeletePhoneNumber(BusinessObjects.PersonPhone phoneNumber) { // SQL query deleting row from Person.PersonPhone string query = "DELETE FROM Person.PersonPhone " + "WHERE BusinessEntityID = @BusinessEntityID AND PhoneNumber = @PhoneNumber AND PhoneNumberTypeID = @PhoneNumberTypeID"; // Execute query cnn.Execute(query, phoneNumber.MapToParams()); }
public void Add(BusinessObjects.Attribute entity) { using (_AttributeRepository = new GenericRepository<DAL.DataEntities.Attribute>()) { //Add the Attribute _AttributeRepository.Add((DAL.DataEntities.Attribute)entity.InnerEntity); _AttributeRepository.SaveChanges(); } }
public bool Delete(BusinessObjects.User User) { long retVal = -1; List<SqlParameter> param = new List<SqlParameter>(); Dictionary<string, Object> dic = new Dictionary<string, Object>(); param.Add(new SqlParameter("@PK_User_ID", User.PK_User_Id)); retVal = Execute("SP_User_Delete", param.ToArray()); return retVal > 0; }
public void Insert(BusinessObjects.Product entity) { // Get the highest Id for the Products and increment it, // then assign it to the new entity before adding to the repository. var maxId = _products.Select(c => c.Id).Max(); entity.Id = maxId + 1; _products.Add(entity); }
public bool Delete(BusinessObjects.Country Country) { long retVal = -1; List<SqlParameter> param = new List<SqlParameter>(); Dictionary<string, Object> dic = new Dictionary<string, Object>(); param.Add(new SqlParameter("@CountryID", Country.ID)); retVal = Execute("SP_Country_Delete", param.ToArray()); return retVal > 0; }
public void Add(BusinessObjects.Feature entity) { using (_FeatureRepository = new GenericRepository<DAL.DataEntities.Feature>()) { //Add the Feature _FeatureRepository.Add((DAL.DataEntities.Feature)entity.InnerEntity); _FeatureRepository.SaveChanges(); } }
public static DataAccessLayer.Category To_DAO(BusinessObjects.Category categoryBO) { DataAccessLayer.Category categoryDAO = new DataAccessLayer.Category(); categoryDAO.ID = categoryBO.ID; categoryDAO.Name = categoryBO.Name; return categoryDAO; }
public void UpdateEmployee(BusinessObjects.Employee employee) { // Paramaterised SQL query, update both tables string query = "UPDATE HumanResources.Employee SET JobTitle = @JobTitle WHERE BusinessEntityID = @BusinessEntityID; " + "UPDATE Person.Person SET FirstName = @FirstName, MiddleName = @MiddleName, LastName = @LastName WHERE BusinessEntityID = @BusinessEntityID"; // Send SQL to DB int rowsAffected = cnn.Execute(query, employee.MapToParams()); }
// gets the catelog information from the database and displays the information on the page. public void SetCatelogInfo(string ItemName) { BusinessObjects _businessObjects = new BusinessObjects(); CatelogItem = _businessObjects.GetCatalogItemByItemName(ItemName); lblItemCost.Text = "Cost: " + CatelogItem.ItemCost.ToString(); string InstriptionTypes = CatelogItem.InscriptionType.ToString(); lblInscriptionType.Text = "Inscryption Type: " + InstriptionTypes; }
public void Update(BusinessObjects.Product entityToUpdate) { Product product = _products.Where(p => p.Id == entityToUpdate.Id).SingleOrDefault(); product.Name = entityToUpdate.Name; product.Price = entityToUpdate.Price; product.Category.CategoryName = entityToUpdate.Category.CategoryName; product.Category.Id = entityToUpdate.Category.Id; // Update the repository here. }
public void UpdateEmployee(BusinessObjects.Employee employee) { // Get the current employee entity var entity = Db.Employees.Find(employee.BusinessEntityId); // Map our business object onto the entity employee.MapOntoEntity(entity); // Save the changes to the entity Db.SaveChanges(); }
// this event is triggered when the order button is clicked on the customer page. protected void btnOrderNow_Click(object sender, EventArgs e) { if ((txtDesiredText.Text == null) || (txtDesiredText.Text == string.Empty)) { lblError.Text = "Error: You need to enter your desired text"; lblError.Visible = true; return; } BusinessObjects _businessObjects = new BusinessObjects(); string strLastName = lastnamelbl.Text; // create new order and newitem objects Order newOrder = new Order(); OrderItem newItem = new OrderItem(); // populate the new order and newitem objects with data from the database string ItemName = ItemDPList.Items[ItemDPList.SelectedIndex].Text; CatelogItem = _businessObjects.GetCatalogItemByItemName(ItemName); Customer = _businessObjects.GetCustomerByLastName(strLastName); Customer ActualCustomer = new Customer(); foreach (Customer Cust in Customer) { if (Cust.PersonType.ToString() == "Customer") { ActualCustomer = Cust; } } lastnamelbl.Text = ActualCustomer.PersonType.ToString(); // fill new item object with data newItem.CatalogItem = CatelogItem; newItem.ItemInscription = txtDesiredText.Text; newOrder.ItemList.Add(newItem); newOrder.OrderEntryDate = DateTime.Now; newOrder.Person = ActualCustomer; OrderStatus orderstatus = (OrderStatus)Enum.Parse(typeof(OrderStatus), "Submitted"); newOrder.OrderStatus = orderstatus; // call the createorder method to create new order int returnValue = ApplicationObjects.CreateOrder(newOrder); if (returnValue == 0) { ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Your Order is complete!" + "');", true); } Response.Redirect(Request.RawUrl); txtDesiredText = null; lblInscriptionType = null; lblItemCost = null; }
public bool Delete(BusinessObjects.City CityItem) { bool retVal = false; try { retVal = (new DataAccess.City()).Delete(CityItem); } catch (Exception ex) { throw ex; } return retVal; }
public int CreateUpdate(BusinessObjects.City CityItem) { int retVal = -1; try { retVal = (new DataAccess.City()).Create(CityItem); } catch (Exception ex) { throw ex; } return retVal; }
public bool Delete(BusinessObjects.Category category) { bool retVal = false; try { retVal = (new DataAccess.Category()).Delete(category); } catch (Exception ex) { throw ex; } return retVal; }
public static List <InventoryItem> GetInventoryItemByCatalogItemId(InventoryItem inventoryItem) { if (inventoryItem != null) { BusinessObjects _businessObjects = new BusinessObjects(); return((inventoryItem.CatalogItemId != null && inventoryItem.CatalogItemId != Guid.Empty) ? _businessObjects.GetInventoryItemByCatalogItemId(inventoryItem.CatalogItemId) : null); } else { return(null); } }
public static CatalogItem GetCatalogItemByCatalogItemId(CatalogItem catalogItem) { if (catalogItem != null) { BusinessObjects _businessObjects = new BusinessObjects(); return((catalogItem.CatalogItemId != null && catalogItem.CatalogItemId != Guid.Empty) ? _businessObjects.GetCatalogItemByCatalogItemId(catalogItem.CatalogItemId) : null); } else { return(null); } }
public static List <InventoryItem> GetInventoryItemByCatalogItemIdAndInventoryItemStatusId(CatalogItem catalogItem, int inventoryItemStatus) { if (catalogItem != null) { BusinessObjects _businessObjects = new BusinessObjects(); return((catalogItem.CatalogItemId != null && catalogItem.CatalogItemId != Guid.Empty) ? _businessObjects.GetInventoryItemByCatalogItemIdAndInventoryItemStatusId(catalogItem.CatalogItemId, inventoryItemStatus) : null); } else { return(null); } }
protected void ddlDept_SelectedIndexChanged(object sender, EventArgs e) { if (ddlDept.SelectedItem.Text != "Select") { BusinessObjects bo = new BusinessObjects(); DataSet ds = bo.GetInstByDept(ddlDept.SelectedItem.Text); DataRow newRow = ds.Tables[0].NewRow(); newRow[0] = "Select"; ds.Tables[0].Rows.InsertAt(newRow, 0); ddlInst.DataSource = ds.Tables[0]; ddlInst.DataTextField = "User_ID"; ddlInst.DataValueField = "User_ID"; ddlInst.DataBind(); } }
protected void btnPost_Click(object sender, EventArgs e) { BusinessObjects bo = new BusinessObjects(); var rnd = new Random(DateTime.Now.Millisecond); int ticid = rnd.Next(0, 3000); string strTic_ID = "TIC" + ticid.ToString(); string strCurUser = Convert.ToString(Session["CurrentUser"]); bool retVal = bo.PostTicket(strTic_ID, txtTitle.Text, strCurUser, "Open", txtDesc.Text, ddlInst.SelectedItem.Text); string strToMailAddr = bo.GetEmailByUser(ddlInst.SelectedItem.Text); //SendMail(strTic_ID, strCurUser, strToMailAddr);//Uncomment123 if (retVal == true) { Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox('Ticket Created Successfully')", true); } }
// USER RELATED METHODS public static UserAccount AuthenticateUser(string userName, string password) { /// Accepts login input and sets the appropriate UserAccount object and permissions token BusinessObjects _businessObjects = new BusinessObjects(); UserAccount userAccount = _businessObjects.GetUserAccountByUserName(userName); if (userAccount == null) { userAccount = new UserAccount("invalid", "invalid", true); } if (!userAccount.MatchPassword(password)) { userAccount.ClearPermissionSet(); } return(userAccount); }
protected void btnAdd_Click(object sender, EventArgs e) { try { BusinessObjects bo = new BusinessObjects(); if (Page.IsValid) { //check whether user id already exists int retValue = bo.CheckDupUser(txtUserID.Text); if (retValue > 0) { ViewState["UserState"] = "User ID already exists"; Page.Validate(); } else { //Add user string strSex = ""; if (chkMale.Checked == true) { strSex = "M"; } else if (chkFemale.Checked == true) { strSex = "F"; } else if (chkOther.Checked == true) { strSex = "O"; } string strName = txtFirstName.Text + " " + txtLastName.Text; //EncryptDecrypt crypt = new EncryptDecrypt(); string strEncryptedPwd = EncryptDecrypt.Encrypt(txtPwd.Text); bool blRetval = bo.CreateInst(txtUserID.Text, strEncryptedPwd, strName, "Student", "Student", txtPhone.Text, txtEmail.Text, strSex); Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox()", true); //Response.Redirect("Login.aspx"); } } } catch { } }
protected void btnSend_Click(object sender, EventArgs e) { string strRole = Convert.ToString(Session["Role"]); if (strRole.ToUpper() != "STUDENT") { if (ddlTicViewStatus.SelectedItem.Text == "Select") { Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox('Please select ,who all can view this ticket')", true); return; } if (ddlSubType.SelectedItem.Text == "Select") { Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox('Subject Type is Required')", true); return; } } string strTicID = Request.QueryString["TicId"].ToString(); string strCurUser = Convert.ToString(Session["CurrentUser"]); BusinessObjects bo = new BusinessObjects(); bool retval = bo.AddTicResponses(strTicID, lblTitle.Text, strCurUser, txtResponse.Text); string strToMailAddr = ""; if (strRole.ToUpper() == "INSTRUCTOR") { strToMailAddr = bo.GetEmailByTicID(strTicID); //SendMail(strTicID, "Instructor", strCurUser, strToMailAddr);//Uncomment123 } else if (strRole.ToUpper() == "STUDENT") { strToMailAddr = bo.GetEmailByUser(Convert.ToString(ViewState["InstID"])); //SendMail(strTicID, "Student", strCurUser, strToMailAddr);//Uncomment123 } if (retval == true) { Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox('Responded Successfully')", true); } txtResponse.Text = ""; }
private void RefreshUserList() { BusinessObjects _businessObjects = new BusinessObjects(); List <UserAccount> users = _businessObjects.GetAllUserAccounts(); lstUsers.Items.Clear(); if (users != null) { foreach (UserAccount user in users) { ListViewItem item = new ListViewItem( new string[] { user.UserName, user.HighestPermission.ToString() } ); this.lstUsers.Items.Add(item); } } }
// CUSTOMER METHODS public static int UpdateCustomer(Customer customer) { // Transaction to perform 4 inter-related data inserts on multiple database tables using (TransactionScope scope = new TransactionScope()) { int returnValue = 1; // Write PERSON record to database BusinessObjects _personBusinessObject = new BusinessObjects(); returnValue = _personBusinessObject.UpdatePersonFromCustomer(customer); if (returnValue == 1) { // If insert fails, rollback transaction & display error message scope.Dispose(); ApplicationObjects.DisplayDataStatus(returnValue); return(1); } // Write MAILING ADDRESS record to database BusinessObjects _mailingAddressBusinessObject = new BusinessObjects(); returnValue = _mailingAddressBusinessObject.UpdateAddress(customer.MailingAddress); if (returnValue == 1) { // If insert fails, rollback transaction & display error message scope.Dispose(); ApplicationObjects.DisplayDataStatus(returnValue); return(1); } // Write BILLING ADDRESS record to database BusinessObjects _billingAddressBusinessObject = new BusinessObjects(); returnValue = _billingAddressBusinessObject.UpdateAddress(customer.BillingAddress); if (returnValue == 1) { // If insert fails, rollback transaction & display error message scope.Dispose(); ApplicationObjects.DisplayDataStatus(returnValue); return(1); } // Committ data transaction & display success message scope.Complete(); ApplicationObjects.DisplayDataStatus(returnValue); return(0); }// End transaction }
protected void btnSubmit_Click(object sender, EventArgs e) { if (txtUsername.Text == "" && txtEmail.Text == "") { Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox('User ID or Email ID is Required')", true); return; } BusinessObjects bo = new BusinessObjects(); string strPwd = bo.ForgotPwd(txtUsername.Text, txtEmail.Text); //EncryptionDecryption crypt = new EncryptionDecryption(); string strDecryptedPwd = EncryptDecrypt.Decrypt(strPwd); if (strDecryptedPwd == "" || strDecryptedPwd == null) { Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox('Invalid User ID or Email ID')", true); return; } string strEmail = ""; if (txtUsername.Text != "") { strEmail = bo.GetEmailByUser(txtUsername.Text); if (strEmail == "" || strEmail == null) { Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox('Invalid User ID')", true); return; } } if (txtEmail.Text != "") { int retVal = bo.ChkEmailID(txtEmail.Text); if (retVal == 1) { Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox('Invalid Email ID')", true); return; } strEmail = txtEmail.Text; } //SendMail(strEmail, strDecryptedPwd);Uncomment123 Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "ReAlertBox()", true); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string strTicID = Convert.ToString(Request.QueryString["TicID"]); string strDeptID = Convert.ToString(Request.QueryString["DeptID"]); string strStatus = Convert.ToString(Request.QueryString["Status"]); BusinessObjects bo = new BusinessObjects(); DataTable dt = bo.GetReportData(strTicID, strDeptID, strStatus); dt.TableName = "TicketMasterTbl"; RptViewer.Reset(); RptViewer.LocalReport.DataSources.Clear(); ReportDataSource datasource = new ReportDataSource("DataSet1", dt); RptViewer.ProcessingMode = ProcessingMode.Local; RptViewer.LocalReport.ReportPath = Server.MapPath("~/Report/RptTic.rdlc"); RptViewer.LocalReport.DataSources.Add(datasource); RptViewer.ZoomMode = ZoomMode.PageWidth; //RptViewer.ReportRefresh(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ODS_TicSummary.Select(); string strTicID = Request.QueryString["TicId"].ToString(); lblTicID.Text = strTicID; BusinessObjects bo = new BusinessObjects(); DataSet ds = bo.GetStudTic_details(strTicID); if (ds.Tables[0].Rows.Count > 0) { lblTitle.Text = ds.Tables[0].Rows[0]["Ticket_Title"].ToString(); //lblInst.Text = ds.Tables[0].Rows[0]["Instructor_ID"].ToString(); ViewState["InstID"] = ds.Tables[0].Rows[0]["Instructor_ID"].ToString(); } if (gv_TicSummary.Rows.Count == 0) { btnRespond.Visible = false; } else { btnRespond.Visible = true; } if (Request.QueryString["AllTics"] != null) { string strAllTics = Request.QueryString["AllTics"].ToString(); if (strAllTics == "Yes") { btnRespond.Visible = false; } } string strCurUser = Convert.ToString(Session["CurrentUser"]); if (strCurUser.ToUpper() == "ADMIN") { btnRespond.Visible = false; gv_TicSummary.Columns[4].Visible = true; } lblLoggedID.Text = strCurUser; } }