public async Task <IHttpActionResult> PutItemComment(int id, ItemComment itemComment) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != itemComment.Id) { return(BadRequest()); } db.Entry(itemComment).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ItemCommentExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
/// <summary> /// /// </summary> /// <param name="node"></param> /// <param name="list"></param> /// <param name="inside"></param> private static void TraverseItemComments(XElement node, List <ItemComment> list, ref bool inside) { if (node.Name == "h4") { if (node.Value == "Parameters") { inside = true; var comment = new ItemComment(); list.Add(comment); } else if (node.Value == "Description") { inside = false; } } else if (node.Name == "p") { if (inside) { ItemComment comment = list[list.Count - 1]; string text = node.ToString(); text = text.Substring("<p>".Length, text.Length - "<p></p>".Length); text = text.Trim(); comment.lstComment.Add(text); } } foreach (XElement item in node.Elements()) { TraverseItemComments(item, list, ref inside); } }
/// <summary> /// Muestra el formulario para realizar responder la pregunta. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected override void PerformGenericAction(object sender, UbiquicityEventArg e) { int id = Convert.ToInt32(e.TheObject.ToString()); ItemCommentManager itemCommentManager = new ItemCommentManager(); ItemComment itemComment = itemCommentManager.Get(id); if (itemComment == null && itemCommentManager.HasErrors) { Alert.ShowUP("Error", itemCommentManager.ErrorDescription); } else { //Si existe la referencia, entonces a sido respondida if (itemComment.SentenceReference == null) { UCFormInquiry.CleanForm(); UCFormInquiry.FillForm(itemComment); SessionUtilHelper.KeepInSession(id.ToString(), Session); ScriptManager.RegisterStartupScript(upUCModalForm, upUCModalForm.GetType(), "openModalCreate", "$('#modalInquiry').modal('show');", true); upUCModalForm.Update(); } else { Alert.ShowUP("Respuesta", "Esta pregunta ya ha sido respondida; no hay acciones disponibles."); } } }
/// <summary> /// Se encarga de persistir los datos. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void PerformAnswer(object sender, EventArgs e) { try { //Una implementación no muy buena int id = Convert.ToInt32(SessionUtilHelper.GetIdFromSession(Session)); ItemCommentManager itemCommentManager = new ItemCommentManager(); ItemComment itemommentRef = itemCommentManager.Get(id); ItemComment itemComment = new ItemComment(); itemComment.Resource = itemommentRef.Resource; itemComment.SentenceReference = itemommentRef; UCFormInquiry.PopulateModel(itemComment); bool success = itemCommentManager.Save(itemComment); if (!success && itemCommentManager.HasErrors) { Alert.Show("Error", itemCommentManager.ErrorDescription); } else { LoadGridView(); } } catch (Exception exception) { Alert.Show("Excepción", exception.Message); } SessionUtilHelper.FlushId(Session); }
public static WcfService1.ItemComment GetWcf_itemcomment(ItemComment input) { WcfService1.ItemComment result = new WcfService1.ItemComment(); result.Author = input.Author; result.CommentString = input.CommentString; result.DataPost = input.DataPost; return(result); }
public static ItemComment convertItemCommnet(WcfService1.ItemComment data) { ItemComment result = new ItemComment(); result.Author = data.Author; result.CommentString = data.CommentString; result.DataPost = (DateTime)data.DataPost; return(result); }
public async Task <IHttpActionResult> GetItemComment(int id) { ItemComment itemComment = await db.ItemComments.FindAsync(id); if (itemComment == null) { return(NotFound()); } return(Ok(itemComment)); }
public void FillForm(ItemComment itemComment) { //El formulario se llena con la pregunta. txtTitle.InnerText = "¡Hey! el usuario " + itemComment.User.Lastname + " realizó una consulta sobre el siguiente producto:"; txtInquiry.Value = itemComment.Sentence; txtProduct.InnerText = "Producto: " + itemComment.Resource.Name; txtCategory.InnerText = "Categoría: " + itemComment.Resource.CategoryName; txtRanking.InnerText = "Ranking: " + itemComment.Resource.Ranking; //txtCategory.InnerText = itemComment.Resource.Id.ToString(); //if (itemComment.SentenceReference != null) txtAnswer.Value = itemComment.SentenceReference.Sentence; }
internal static ItemCommentEntity ItemComment(ItemComment ent) { ItemCommentEntity data = new ItemCommentEntity(); data.itemCommentId = ent.Id; data.itemFK = ent.ItemFK; data.commentorFK = ent.CommentorFK; data.commentText = ent.CommentText; data.isHiddenFromOwner = ent.IsHiddenFromOwner; data.updateTimestamp = ent.UpdateTimestamp; data.updatePersonFK = ent.UpdatePersonFK; return data; }
internal static ItemComment ItemComment(ItemCommentEntity data) { ItemComment ent = new ItemComment(); ent.Id = data.itemCommentId; ent.ItemFK = data.itemFK; ent.CommentorFK = data.commentorFK; ent.CommentText = data.commentText; ent.IsHiddenFromOwner = data.isHiddenFromOwner; ent.UpdateTimestamp = data.updateTimestamp; ent.UpdatePersonFK = data.updatePersonFK; return ent; }
public async Task <IHttpActionResult> DeleteItemComment(int id) { ItemComment itemComment = await db.ItemComments.FindAsync(id); if (itemComment == null) { return(NotFound()); } db.ItemComments.Remove(itemComment); await db.SaveChangesAsync(); return(Ok(itemComment)); }
public bool Save(ItemComment comment) { base.Save(comment); Dal dal = new Dal(); Hashtable table = new Hashtable(); table.Add("@messageId", comment.Id); table.Add("@resourceId", comment.Resource.Id); if (comment.SentenceReference != null) { table.Add("@messageRefId", comment.SentenceReference.Id); } comment.Id = dal.Write(table, "spWriteItemComment"); return(comment.Id > 0); }
/// <summary> /// Devuelve un objeto modelado con los valores del dataRow que recibe por parámetro. /// </summary> /// <param name="data"></param> /// <returns></returns> private ItemComment ConvertToModel(DataRow data) { ItemComment itemComment = new ItemComment(); itemComment.Id = int.Parse(data["id"].ToString()); itemComment.Sentence = data["sentence"].ToString(); itemComment.Date = Convert.ToDateTime(data["date"]); itemComment.User.Id = int.Parse(data["userid"].ToString()); itemComment.Resource.Id = int.Parse(data["resourceId"].ToString()); if (data["messageRefId"] != DBNull.Value) { itemComment.SentenceReference = new ItemComment(); itemComment.SentenceReference.Id = int.Parse(data["messageRefId"].ToString()); } return(itemComment); }
public ItemComment GetReference(int id) { Dal dal = new Dal(); Hashtable table = new Hashtable(); ItemComment itemComment = null; table.Add("@messageRefId", id); DataSet result = dal.Read(table, "spReadItemComment"); if (result != null && result.Tables[0].Rows.Count > 0) { itemComment = ConvertToModel(result.Tables[0].Rows[0]); } return(itemComment); }
public void GrabItem(ItemType type) { InventoryItem item = allItems.Where(x => x.Type == type).FirstOrDefault(); if (item == null) { Debug.Log("Error: item config is missing item type: " + type.ToString()); return; } ItemComment itemComment = Configs.main.UI.ItemComments.Where(ic => ic.Item == item.Type).First(); if (itemComment != null) { UIManager.main.ShowDialog(itemComment.Comment, Tools.GetPlayerPosition()); } playerItems.Add(item); }
/// <summary> /// Guarda el item en la base. /// </summary> /// <param name="itemComment"></param> /// <returns></returns> public bool Save(ItemComment itemComment) { if (!IsValid(itemComment)) { return(false); } ItemCommentMapper commentMapper = new ItemCommentMapper(); itemComment.Date = DateTime.Now; if (!commentMapper.Save(itemComment)) { string errorDescription = "No se ha podido guardar el comentario."; log.AddLogCritical("Save", errorDescription, this); AddError(new ResultBE(ResultBE.Type.FAIL, errorDescription)); return(false); } return(true); }
/// <summary> /// Crea un comentario. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnComentar_Click(object sender, EventArgs e) { try { ItemCommentManager commentManager = new ItemCommentManager(); ItemComment itemComment = new ItemComment(); itemComment.Sentence = commentInput.InnerText; itemComment.User = (User)Session["SessionCreated"]; itemComment.Resource.Id = Convert.ToInt32(((Button)sender).CommandArgument); commentManager.Save(itemComment); LoadComments(Convert.ToInt32(SessionUtilHelper.GetIdFromSession(Session))); //upItemShop.Update(); } catch (Exception exception) { //TODO - agregar control de error //((front)Master).Alert.Show("Exception", exception.Message); } }
public async Task <IHttpActionResult> PostItemComment(ItemCommentBindModel itemComment) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } string UserId = User.Identity.GetUserId(); var claims = await UserManager.GetClaimsAsync(UserId); bool ReadonlyComments = claims.Where(c => c.Type == "comments" && c.Value == "readonly").Any(); if (ReadonlyComments) { return(BadRequest("You may only read.")); } ItemComment comment = new ItemComment() { ItemId = itemComment.ItemId, Text = itemComment.Text, UserId = UserId, Date = DateTime.UtcNow, }; db.ItemComments.Add(comment); await db.SaveChangesAsync(); var commentView = new ItemCommentViewModel() { Id = comment.Id, ItemId = comment.ItemId, Date = comment.Date, Text = comment.Text, UserName = UserManager.FindById(comment.UserId).UserName, }; return(CreatedAtRoute("DefaultApi", new { id = comment.Id }, commentView)); }
public async Task <IActionResult> Comment(ItemViewModel model, string CommentButton, int Id) { if (!string.IsNullOrEmpty(CommentButton) && User.Identity.Name != null) { if (ModelState.IsValid) { ItemComment comment = new ItemComment { Text = model.Text, ItemId = Id, UserName = User.Identity.Name, }; db.ItemComments.Add(comment); await db.SaveChangesAsync(); } return(RedirectToAction("Item", "Collections", new { Id = Id })); } else { return(RedirectToAction("Login", "Account")); } }
/// <summary> /// Recupera un comentario en particular y su repsuesta asociada. /// </summary> /// <param name="id"></param> /// <returns></returns> public ItemComment Get(int id) { UserManager userManager = new UserManager(); MapManager mapManager = new MapManager(); ItemCommentMapper commentMapper = new ItemCommentMapper(); ItemComment comment = commentMapper.Get(id); if (comment == null) { string errorDescription = "No se ha podido recuperar el comentario con id " + id + "."; log.AddLogCritical("Get", errorDescription, this); AddError(new ResultBE(ResultBE.Type.FAIL, errorDescription)); } else { //Todo - implementar control de error comment.User = userManager.Get(comment.User.Id); comment.Resource = mapManager.Get(comment.Resource.Id); comment.SentenceReference = commentMapper.GetReference(comment.Id); } return(comment); }
private bool IsValid(ItemComment itemComment) { return(VLetterNumbers(itemComment.Sentence, 1, 250, "Comentario", "IsValid")); }
public bool ProcessInfoCode(IPosTransaction posTransaction, decimal quantity, decimal amount, string refRelation, string refRelation2, string refRelation3, InfoCodeTableRefType tableRefId, string linkedInfoCodeId, IInfoCodeLineItem orgInfoCode, InfoCodeType infoCodeType) { RetailTransaction retailTransaction = posTransaction as RetailTransaction; TenderCountTransaction tenderCountTransaction = posTransaction as TenderCountTransaction; // Other possible transaction types at this point include CustomerPayment if (refRelation == null) { refRelation = string.Empty; } if (refRelation2 == null) { refRelation2 = string.Empty; } if (refRelation3 == null) { refRelation3 = string.Empty; } //Infocode IInfoCodeSystem infoCodeSystem = this.Application.BusinessLogic.InfoCodeSystem; IInfoCodeLineItem[] infoCodes = new IInfoCodeLineItem[0]; if (!string.IsNullOrEmpty(linkedInfoCodeId)) { infoCodes = infoCodeSystem.GetInfocodes(linkedInfoCodeId); } else if (tableRefId == InfoCodeTableRefType.FunctionalityProfile) { infoCodes = infoCodeSystem.GetInfocodes(refRelation2); refRelation2 = string.Empty; } else if (tableRefId == InfoCodeTableRefType.PreItem) { // Pre item is just a table ref id of item, but handled during different processing infoCodes = infoCodeSystem.GetInfocodes(refRelation, refRelation2, refRelation3, InfoCodeTableRefType.Item); } else { infoCodes = infoCodeSystem.GetInfocodes(refRelation, refRelation2, refRelation3, tableRefId); } foreach (InfoCodeLineItem infoCode in infoCodes) { if (infoCode.InfocodeId == null) { return(false); } //If no infocode is found // Process age limit info codes as pre item. I.e. stop processing on this info code if it is pre item // and not of type age limit. // Low impact fix that should be reevaluated if any info code other than age limit is ever added // pre item. Using continue because indentation of if/else sequence already too much. if (((tableRefId == InfoCodeTableRefType.PreItem) && (infoCode.InputType != InfoCodeInputType.AgeLimit))) { continue; } //If bug in data, fixes division by zero if (infoCode.RandomFactor == 0) { infoCode.RandomFactor = 100; } infoCode.OriginType = infoCodeType; infoCode.RefRelation = refRelation; infoCode.RefRelation2 = refRelation2; infoCode.RefRelation3 = refRelation3; switch (infoCode.OriginType) { case InfoCodeType.Header: infoCode.Amount = amount; break; case InfoCodeType.Sales: infoCode.Amount = (amount * -1); break; case InfoCodeType.Payment: infoCode.Amount = amount; break; case InfoCodeType.IncomeExpense: infoCode.Amount = amount; break; } int randomFactor = (int)(100 / infoCode.RandomFactor); //infoCode.RandomFactor = 100 means ask 100% for a infocode Random random = new Random(); int randomNumber = random.Next(randomFactor); //Creates numbers from 0 to randomFactor-1 //Only get the infocode if randomfactor is set to zero or generated random number is the sama as the randomfactor-1 if (infoCode.RandomFactor == 100 || randomNumber == (randomFactor - 1)) { Boolean infoCodeNeeded = true; if (infoCode.OncePerTransaction) { if (tenderCountTransaction != null) { infoCodeNeeded = tenderCountTransaction.InfoCodeNeeded(infoCode.InfocodeId); } else { infoCodeNeeded = retailTransaction.InfoCodeNeeded(infoCode.InfocodeId); } } if (infoCodeNeeded) { // If the required type is negative but the quantity is positive, do not continue if (infoCode.InputRequiredType == InfoCodeInputRequiredType.Negative && quantity > 0) { infoCodeNeeded = false; } // If the required type is positive but the quantity is negative, do not continue if (infoCode.InputRequiredType == InfoCodeInputRequiredType.Positive && quantity < 0) { infoCodeNeeded = false; } } // If there is some infocodeID existing, and infocod is needed if (infoCode.InfocodeId != null && infoCodeNeeded == true) { #region Text and General if (infoCode.InputType == InfoCodeInputType.Text || infoCode.InputType == InfoCodeInputType.General) { Boolean inputValid = true; bool abort = false; // Get a infocode text do { inputValid = true; InputConfirmation inputConfirmation = new InputConfirmation() { MaxLength = MaxInfocodeInformationLengh, PromptText = infoCode.Prompt, }; InteractionRequestedEventArgs request = new InteractionRequestedEventArgs(inputConfirmation, () => { if (inputConfirmation.Confirmed) { if (string.IsNullOrEmpty(inputConfirmation.EnteredText)) { abort = true; POSFormsManager.ShowPOSMessageDialog(3593); } else { int textId = 0; if (inputConfirmation.EnteredText.Length == 0 && infoCode.InputRequired) { textId = 3590; //The input text is required inputValid = false; } if (inputValid && infoCode.MinimumLength > 0 && inputConfirmation.EnteredText.Length < infoCode.MinimumLength) { textId = 3591; //The input text is too short. inputValid = false; } if (inputValid && infoCode.MaximumLength > 0 && inputConfirmation.EnteredText.Length > infoCode.MaximumLength) { textId = 3592; //The input text exceeds the maximum length. inputValid = false; } if (inputValid && infoCode.AdditionalCheck == 1) { inputValid = CheckKennitala(inputConfirmation.EnteredText); if (!inputValid) { textId = 3603; } } if (!inputValid) { POSFormsManager.ShowPOSMessageDialog(textId); } } infoCode.Information = inputConfirmation.EnteredText; } else { inputValid = infoCode.InputRequired; } } ); Application.Services.Interaction.InteractionRequest(request); if (abort) { return(false); } } while (!inputValid); //Adding the result to the infocode } #endregion #region Date else if (infoCode.InputType == InfoCodeInputType.Date) { Boolean inputValid = true; do { inputValid = true; string inputText; //Show the input form using (frmInputNumpad inputDialog = new frmInputNumpad()) { inputDialog.EntryTypes = NumpadEntryTypes.Date; inputDialog.PromptText = infoCode.Prompt; POSFormsManager.ShowPOSForm(inputDialog); // Quit if cancel is pressed... if (inputDialog.DialogResult == System.Windows.Forms.DialogResult.Cancel && !infoCode.InputRequired) { return(false); } inputText = inputDialog.InputText; } //Is input valid? if (!string.IsNullOrEmpty(inputText)) { int textId = 0; bool isDate = true; DateTime infoDate = DateTime.Now; try { infoDate = Convert.ToDateTime(inputText, (IFormatProvider)Thread.CurrentThread.CurrentCulture.DateTimeFormat); } catch { isDate = false; } if (!isDate) { textId = 3602; //Date entered is not valid inputValid = false; } if (inputText.Length == 0 && infoCode.InputRequired) { textId = 3594; //A number input is required inputValid = false; } if (!inputValid) { POSFormsManager.ShowPOSMessageDialog(textId); } else { //Setting the result to the infocode infoCode.Information = infoDate.ToString(Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern); } } else if (infoCode.InputRequired) { inputValid = false; POSFormsManager.ShowPOSMessageDialog(3597);//A number input is required } } while (!inputValid); } #endregion #region Numeric and Operator/Staff else if (infoCode.InputType == InfoCodeInputType.Numeric || infoCode.InputType == InfoCodeInputType.Operator) { Boolean inputValid = true; do { inputValid = true; string inputText = string.Empty; //Show the input form using (frmInputNumpad inputDialog = new frmInputNumpad()) { inputDialog.EntryTypes = NumpadEntryTypes.Price; inputDialog.PromptText = infoCode.Prompt; POSFormsManager.ShowPOSForm(inputDialog); // Quit if cancel is pressed and input not required... if (inputDialog.DialogResult == System.Windows.Forms.DialogResult.Cancel && !infoCode.InputRequired) { return(false); } // If input required then only valid result is Ok. if (inputDialog.DialogResult == System.Windows.Forms.DialogResult.OK) { inputText = inputDialog.InputText; } } //Is input empty? if (!string.IsNullOrWhiteSpace(inputText)) { int textId = 0; if (inputText.Length == 0 && infoCode.InputRequired) { textId = 3594; //A number input is required inputValid = false; } if (infoCode.MinimumValue != 0 && Convert.ToDecimal(inputText) < infoCode.MinimumValue) { textId = 3595; //The number is lower than the minimum value inputValid = false; } if (infoCode.MaximumValue != 0 && Convert.ToDecimal(inputText) > infoCode.MaximumValue) { textId = 3596; //The number exceeds the maximum value inputValid = false; } if (!inputValid) { POSFormsManager.ShowPOSMessageDialog(textId); } } else { inputValid = false; POSFormsManager.ShowPOSMessageDialog(3597); //A number input is required } //Setting the result to the infocode infoCode.Information = inputText; } while (!inputValid); } #endregion #region Customer else if (infoCode.InputType == InfoCodeInputType.Customer) { bool inputValid = true; do { inputValid = true; Contracts.DataEntity.ICustomer customer = this.Application.Services.Customer.Search(); if (customer != null) { infoCode.Information = customer.CustomerId; inputValid = true; } else { if (infoCode.InputRequired) { inputValid = false; POSFormsManager.ShowPOSMessageDialog(3598); //A customer needs to be selected } } } while (!inputValid); } #endregion #region Item else if (infoCode.InputType == InfoCodeInputType.Item) { Boolean inputValid = true; do { string selectedItemID = string.Empty; DialogResult dialogResult = this.Application.Services.Dialog.ItemSearch(500, ref selectedItemID); // Quit if cancel is pressed... if (dialogResult == System.Windows.Forms.DialogResult.Cancel && !infoCode.InputRequired) { return(false); } if (!string.IsNullOrEmpty(selectedItemID)) { infoCode.Information = selectedItemID; inputValid = true; } else { if (infoCode.InputRequired) { inputValid = false; POSFormsManager.ShowPOSMessageDialog(3599);//A items needs to be selected } } } while (!inputValid); } #endregion #region SubCode else if ((infoCode.InputType == InfoCodeInputType.SubCodeList) || (infoCode.InputType == InfoCodeInputType.SubCodeButtons)) { FormInfoCodeSubCodeBase infoSubCodeDialog; if (infoCode.InputType == InfoCodeInputType.SubCodeList) { infoSubCodeDialog = new FormInfoCodeSubCodeList(); } else { infoSubCodeDialog = new FormInfoSubCode(); } using (infoSubCodeDialog) { bool inputValid = false; do { infoSubCodeDialog.InfoCodePrompt = infoCode.Prompt; infoSubCodeDialog.InfoCodeId = infoCode.InfocodeId; infoSubCodeDialog.InputRequired = infoCode.InputRequired; POSFormsManager.ShowPOSForm(infoSubCodeDialog); switch (infoSubCodeDialog.DialogResult) { case DialogResult.OK: inputValid = true; break; case DialogResult.No: return(false); default: if (!infoCode.InputRequired) { return(false); } break; } //if InputValid is false then nothing was selected in the dialog and there is no point in going through this code if (inputValid) { infoCode.Information = infoSubCodeDialog.SelectedDescription; infoCode.Subcode = infoSubCodeDialog.SelectedSubcodeId; //TenderDeclarationTransaction also has infocodes but it can't have any sale items so no need //to go through this code. if (retailTransaction != null) { //Look through the information on the subcode that was selected and see if an item is to be sold //and if a discount and/or price needs to be modified //foreach (SubcodeInfo subcodeInfo in infoSubCodeDialog.SubCodes) //{ if ((infoSubCodeDialog.SelectedTriggerFunction == (int)TriggerFunctionEnum.Item) && (infoSubCodeDialog.SelectedTriggerCode.Length != 0)) { OperationInfo opInfo = new OperationInfo(); ItemSale itemSale = new ItemSale(); itemSale.OperationID = PosisOperations.ItemSale; itemSale.OperationInfo = opInfo; itemSale.Barcode = infoSubCodeDialog.SelectedTriggerCode; itemSale.POSTransaction = retailTransaction; itemSale.RunOperation(); //The infocode item has been added. //Look at the last item on the transaction and if it is the same item that the ItemSale was supposed to sell //then check to see if it is to have a special price or discount if (retailTransaction.SaleItems.Last.Value.ItemId == infoSubCodeDialog.SelectedTriggerCode) { //set the property of that item to being an infocode item such that if the same item is added again, then //these will not be aggregated (since the item as infocode item might receive a different discount than the same //item added regularly. retailTransaction.SaleItems.Last.Value.IsInfoCodeItem = true; infoCode.SubcodeSaleLineId = retailTransaction.SaleItems.Last.Value.LineId; if (infoSubCodeDialog.SelectedPriceType == (int)PriceTypeEnum.Price) { PriceOverride priceOverride = new PriceOverride(); opInfo.NumpadValue = infoSubCodeDialog.SelectedAmountPercent.ToString("n2"); opInfo.ItemLineId = retailTransaction.SaleItems.Last.Value.LineId; priceOverride.OperationInfo = opInfo; priceOverride.OperationID = PosisOperations.PriceOverride; priceOverride.POSTransaction = retailTransaction; priceOverride.LineId = retailTransaction.SaleItems.Last.Value.LineId; priceOverride.RunOperation(); } else if (infoSubCodeDialog.SelectedPriceType == (int)PriceTypeEnum.Percent) { LineDiscountPercent lineDiscount = new LineDiscountPercent(); opInfo.NumpadValue = infoSubCodeDialog.SelectedAmountPercent.ToString("n2"); opInfo.ItemLineId = retailTransaction.SaleItems.Last.Value.LineId; lineDiscount.OperationInfo = opInfo; lineDiscount.OperationID = PosisOperations.LineDiscountPercent; lineDiscount.POSTransaction = retailTransaction; lineDiscount.RunOperation(); } } } } } } while (!inputValid); } } #endregion #region Age limit else if ((infoCode.InputType == InfoCodeInputType.AgeLimit)) { int ageLimit = (int)infoCode.MinimumValue; if (ageLimit >= 0) { //Calculate birthdate corresponding to minimum age limit DateTime dtBirthDate = DateTime.Today.AddYears(-ageLimit); //Convert the date time value according to the current culture information string birthDate = dtBirthDate.ToString(System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern); string msg = ApplicationLocalizer.Language.Translate(3606, ageLimit, birthDate); // Process age limit info codes if it is pre item and prompt the message to user for processing. // Also Info Code type is an item and Age Limit is a link to reason code then process the info code with prompt to user. if (((tableRefId == InfoCodeTableRefType.PreItem) && (infoCode.InputType == InfoCodeInputType.AgeLimit)) || (!string.IsNullOrEmpty(linkedInfoCodeId) && tableRefId == InfoCodeTableRefType.Item)) { using (frmMessage frmMsg = new frmMessage(msg, MessageBoxButtons.YesNo, MessageBoxIcon.Information, false)) { POSFormsManager.ShowPOSForm(frmMsg); if (frmMsg.DialogResult != DialogResult.Yes) { return(false); } } } infoCode.Information = msg; } } #endregion else { POSFormsManager.ShowPOSMessageDialog(3589); return(false); } // Add the infocode to the transaction if (infoCode.Information != null && infoCode.Information.Length > 0) { string infoComment = string.Empty; if (infoCode.PrintPromptOnReceipt || infoCode.PrintInputOnReceipt || infoCode.PrintInputNameOnReceipt) { if (infoCode.PrintPromptOnReceipt && (infoCode.Prompt.Length != 0)) { infoComment = infoCode.Prompt; } if (infoCode.PrintInputOnReceipt && (infoCode.Subcode != null) && (infoCode.Subcode.Length != 0)) { if (infoComment.Length != 0) { infoComment += " - " + infoCode.Subcode; } else { infoComment = infoCode.Subcode; } } if (infoCode.PrintInputNameOnReceipt && (infoCode.Information.Length != 0)) { if (infoComment.Length != 0) { infoComment += " - " + infoCode.Information; } else { infoComment = infoCode.Information; } } } if (infoCodeType == InfoCodeType.Sales) { int lineId; if (infoCode.SubcodeSaleLineId != -1) { SaleLineItem saleLineItem = retailTransaction.GetItem(infoCode.SubcodeSaleLineId - 1); saleLineItem.Add(infoCode); lineId = saleLineItem.LineId; } else { // don't save if this is pre-item. the same infocodes will be found next pass for normal item infocodes. if (tableRefId == InfoCodeTableRefType.PreItem) { continue; } else { LinkedListNode <SaleLineItem> saleLineItem = retailTransaction.SaleItems.Last; saleLineItem.Value.Add(infoCode); lineId = saleLineItem.Value.LineId; } } if (infoComment.Trim().Length != 0) { OperationInfo opInfo = new OperationInfo(); opInfo.NumpadValue = infoComment.Trim(); opInfo.ItemLineId = lineId; ItemComment itemComment = new ItemComment(); itemComment.OperationID = PosisOperations.ItemComment; itemComment.POSTransaction = (PosTransaction)posTransaction; itemComment.OperationInfo = opInfo; itemComment.RunOperation(); } } else if (infoCodeType == InfoCodeType.Payment) { if (retailTransaction != null) { LinkedListNode <TenderLineItem> tenderLineItem = retailTransaction.TenderLines.Last; tenderLineItem.Value.Add(infoCode); if (infoComment.Trim().Length != 0) { tenderLineItem.Value.Comment = infoComment.Trim(); } } else { LSRetailPosis.Transaction.CustomerPaymentTransaction custPayTrans = posTransaction as LSRetailPosis.Transaction.CustomerPaymentTransaction; LinkedListNode <TenderLineItem> tenderLineItem = custPayTrans.TenderLines.Last; tenderLineItem.Value.Add(infoCode); if (infoComment.Trim().Length != 0) { tenderLineItem.Value.Comment = infoComment.Trim(); } } //LinkedListNode<TenderLineItem> tenderLineItem = retailTransaction.TenderLines.Last; // //tenderLineItem.Value.Add(infoCode); //if (infoComment.Trim().Length != 0) //{ // tenderLineItem.Value.Comment = infoComment.Trim(); //} } else { if (retailTransaction != null) { retailTransaction.Add(infoCode); if (infoComment.Trim().Length != 0) { retailTransaction.InvoiceComment += infoComment.Trim(); } } else { tenderCountTransaction.Add(infoCode); //No invoice comment on TenderDeclarationTransaction } } } } } } return(true); }
private OperationReturn LoadCommentItem(SessionInfo session, ItemComment itemComment) { OperationReturn optReturn = new OperationReturn(); optReturn.Result = true; optReturn.Code = 0; try { string rentToken = session.RentInfo.Token; ScoreSheet scoreSheet = itemComment.ScoreSheet; if (scoreSheet == null) { optReturn.Result = false; optReturn.Code = Defines.RET_OBJECT_NULL; optReturn.Message = string.Format("ScoreSheet is null"); return(optReturn); } string strSql; DataSet objDataSet; switch (session.DBType) { case 2: strSql = string.Format( "SELECT * FROM T_31_005_{0} WHERE C002 = {1}", rentToken, itemComment.ID); optReturn = MssqlOperation.GetDataSet(session.DBConnectionString, strSql); if (!optReturn.Result) { return(optReturn); } objDataSet = optReturn.Data as DataSet; break; case 3: strSql = string.Format( "SELECT * FROM T_31_005_{0} WHERE C002 = {1}", rentToken, itemComment.ID); optReturn = OracleOperation.GetDataSet(session.DBConnectionString, strSql); if (!optReturn.Result) { return(optReturn); } objDataSet = optReturn.Data as DataSet; break; default: optReturn.Result = false; optReturn.Code = Defines.RET_PARAM_INVALID; optReturn.Message = string.Format("DBType invalid"); return(optReturn); } if (objDataSet == null || objDataSet.Tables.Count <= 0) { optReturn.Result = false; optReturn.Code = Defines.RET_OBJECT_NULL; optReturn.Message = string.Format("DataSet is null or DataTables empty"); return(optReturn); } List <CommentItem> listCommentItems = new List <CommentItem>(); for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++) { DataRow dr = objDataSet.Tables[0].Rows[i]; CommentItem commentItem = new CommentItem(); commentItem.Type = ScoreObjectType.CommentItem; commentItem.ID = Convert.ToInt64(dr["C001"]); commentItem.Comment = itemComment; commentItem.OrderID = Convert.ToInt32(dr["C003"]); commentItem.Text = dr["C005"].ToString(); listCommentItems.Add(commentItem); } optReturn.Data = listCommentItems; } catch (Exception ex) { optReturn.Result = false; optReturn.Code = Defines.RET_FAIL; optReturn.Message = ex.Message; } return(optReturn); }
private OperationReturn LoadComment(SessionInfo session, ScoreItem scoreItem) { OperationReturn optReturn = new OperationReturn(); optReturn.Result = true; optReturn.Code = 0; try { string rentToken = session.RentInfo.Token; ScoreSheet scoreSheet = scoreItem.ScoreSheet; if (scoreSheet == null) { optReturn.Result = false; optReturn.Code = Defines.RET_OBJECT_NULL; optReturn.Message = string.Format("ScoreSheet is null"); return(optReturn); } string strSql; DataSet objDataSet; switch (session.DBType) { case 2: strSql = string.Format( "SELECT * FROM T_31_004_{0} WHERE C002 = {1} AND C003 = {2}", rentToken, scoreItem.ID, scoreSheet.ID); optReturn = MssqlOperation.GetDataSet(session.DBConnectionString, strSql); if (!optReturn.Result) { return(optReturn); } objDataSet = optReturn.Data as DataSet; break; case 3: strSql = string.Format( "SELECT * FROM T_31_004_{0} WHERE C002 = {1} AND C003 = {2}", rentToken, scoreItem.ID, scoreSheet.ID); optReturn = OracleOperation.GetDataSet(session.DBConnectionString, strSql); if (!optReturn.Result) { return(optReturn); } objDataSet = optReturn.Data as DataSet; break; default: optReturn.Result = false; optReturn.Code = Defines.RET_PARAM_INVALID; optReturn.Message = string.Format("DBType invalid"); return(optReturn); } if (objDataSet == null || objDataSet.Tables.Count <= 0) { optReturn.Result = false; optReturn.Code = Defines.RET_OBJECT_NULL; optReturn.Message = string.Format("DataSet is null or DataTables empty"); return(optReturn); } List <Comment> listComments = new List <Comment>(); for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++) { DataRow dr = objDataSet.Tables[0].Rows[i]; Comment comment; int intCommentStyle = Convert.ToInt32(dr["C008"]); switch (intCommentStyle) { case (int)CommentStyle.Text: TextComment textComment = new TextComment(); textComment.Type = ScoreObjectType.TextComment; textComment.DefaultText = dr["C005"].ToString(); comment = textComment; break; case (int)CommentStyle.Item: ItemComment itemComment = new ItemComment(); itemComment.Type = ScoreObjectType.ItemComment; comment = itemComment; break; default: optReturn.Result = false; optReturn.Code = Defines.RET_NOT_EXIST; optReturn.Message = string.Format("CommentStyle not exist"); return(optReturn); } comment.Style = (CommentStyle)intCommentStyle; comment.ID = Convert.ToInt64(dr["C001"]); comment.ScoreItem = scoreItem; comment.ScoreSheet = scoreSheet; comment.OrderID = Convert.ToInt32(dr["C004"]); comment.Title = dr["C009"].ToString(); #region 样式 OperationReturn styleReturn; styleReturn = LoadVisualStyle(session, comment, "T"); if (!styleReturn.Result) { if (styleReturn.Code != Defines.RET_NOT_EXIST) { return(styleReturn); } comment.TitleStyle = null; } else { VisualStyle style = styleReturn.Data as VisualStyle; if (style != null) { style.ScoreSheet = scoreSheet; comment.TitleStyle = style; } } styleReturn = LoadVisualStyle(session, comment, "P"); if (!styleReturn.Result) { if (styleReturn.Code != Defines.RET_NOT_EXIST) { return(styleReturn); } comment.PanelStyle = null; } else { VisualStyle style = styleReturn.Data as VisualStyle; if (style != null) { style.ScoreSheet = scoreSheet; comment.PanelStyle = style; } } #endregion #region 子项 var temp = comment as ItemComment; if (temp != null) { OperationReturn commentItemReturn; commentItemReturn = LoadCommentItem(session, temp); if (!commentItemReturn.Result) { return(commentItemReturn); } List <CommentItem> listItems = commentItemReturn.Data as List <CommentItem>; if (listItems == null) { commentItemReturn.Result = false; commentItemReturn.Code = Defines.RET_OBJECT_NULL; commentItemReturn.Message = string.Format("ListCommentItems is null"); return(commentItemReturn); } for (int j = 0; j < listItems.Count; j++) { temp.ValueItems.Add(listItems[j]); } temp.ValueItems = temp.ValueItems.OrderBy(j => j.OrderID).ToList(); } #endregion listComments.Add(comment); } optReturn.Data = listComments; } catch (Exception ex) { optReturn.Result = false; optReturn.Code = Defines.RET_FAIL; optReturn.Message = ex.Message; } return(optReturn); }
public void AddComment(ItemComment comment) { Db.itemComments.Add(comment); Db.SaveChanges(); }
public static void Dump() { XElement root = XElement.Load(filename); var lstDefinition = new List <Definition>(); bool inside = false; TraverseDefinitions(root, lstDefinition, ref inside); var lstItemComment = new List <ItemComment>(); inside = false; TraverseItemComments(root, lstItemComment, ref inside); var lstComment = new List <string>(); inside = false; TraverseComments(root, lstComment, ref inside); //var lstItemDescription = new List<ItemDescription>(); inside = false; //TraverseDescriptions(root, lstItemDescription, ref inside); using (var sw = new System.IO.StreamWriter("Commands.GetInstanceProcAddr.gen.cs")) { for (int i = 0, t = 0; i < lstDefinition.Count; i++) { Definition definition = lstDefinition[i]; //sw.WriteLine(definition.raw); string[] definitionLines = definition.Dump(); ItemComment itemComment = lstItemComment[i]; Dictionary <string, string> item2Comment = itemComment.Dump(); //ItemDescription itemDescription = lstItemDescription[i]; { string line = definitionLines[0]; if (line.StartsWith("public static extern")) { continue; } sw.WriteLine($"// Command: {i}"); sw.WriteLine($"// GetInstanceProcAddr: {t}"); t++; } string comment = lstComment[i]; sw.WriteLine($"/// <summary>{comment}"); // description is too long. //foreach (var item in itemDescription.lstComment) { // string s = item.Replace("\r", ""); // s = s.Replace("\n", ""); // string c = Helper.RemoveBraces(s); // sw.WriteLine($"/// <para>{c}</para>"); //} sw.WriteLine($"/// </summary>"); // /// <param name="device"></param> for (int j = 1; j < definitionLines.Length; j++) { string line = definitionLines[j]; if (item2Comment != null) { string key; string strComment = ParseItemComment(line, item2Comment, out key); if (strComment != string.Empty) { strComment = strComment.Replace("\r\n", "\n"); strComment = strComment.Replace("\r", "\n"); strComment = strComment.Replace("\n", $"{Environment.NewLine} /// "); strComment = Helper.RemoveBraces(strComment); sw.WriteLine(string.Format("/// <param name=\"{0}\">{1}</param>", key, strComment)); } } } { string line = definitionLines[0]; line = line.Trim(); if (line.StartsWith("public static extern")) { sw.WriteLine("[DllImport(VulkanLibrary, CallingConvention = CallingConvention.Winapi)]"); } var l = line.Replace("const char* ", "IntPtr "); l = l.Replace("const*", "/*-const-*/ *"); l = l.Replace("const ", "/*-const-*/ "); l = l.Replace(" const", " /*-const-*/"); l = l.Replace("size_t ", "Int32 "); l = l.Replace("size_t*", "Int32*"); l = l.Replace("uint8_t* ", "byte* "); l = l.Replace("uint8_t ", " byte "); l = l.Replace("uint16_t* ", "UInt16* "); l = l.Replace("uint16_t ", "UInt16 "); l = l.Replace("uint32_t* ", "UInt32* "); l = l.Replace("uint32_t ", "UInt32 "); l = l.Replace("uint64_t* ", "UInt64* "); l = l.Replace("uint64_t ", "UInt64 "); l = l.Replace("int32_t* ", "Int32* "); l = l.Replace("int32_t ", "Int32 "); l = l.Replace("int64_t* ", "Int64* "); l = l.Replace("int64_t ", "Int64 "); l = l.Replace("struct ", "/*-struct-*/ "); l = l.Replace(" object", " _object"); l = l.Replace(" event", " _event"); l = l.Replace(" vk", " "); sw.WriteLine(l); // public static extern VkResult vkAcquireFullScreenExclusiveModeEXT( ... } { sw.WriteLine(" this VkInstance instance,"); } for (int j = 1; j < definitionLines.Length; j++) { string line = definitionLines[j]; if (line.Contains("VkInstance")) { continue; } line = line.Trim(); var l = line.Replace("const char* ", "IntPtr "); l = l.Replace("const*", "/*-const-*/ *"); l = l.Replace("const ", "/*-const-*/ "); l = l.Replace(" const", " /*-const-*/"); l = l.Replace("size_t ", "Int32 "); l = l.Replace("size_t*", "Int32*"); l = l.Replace("uint8_t* ", "byte* "); l = l.Replace("uint8_t ", " byte "); l = l.Replace("uint16_t* ", "UInt16* "); l = l.Replace("uint16_t ", "UInt16 "); l = l.Replace("uint32_t* ", "UInt32* "); l = l.Replace("uint32_t ", "UInt32 "); l = l.Replace("uint64_t* ", "UInt64* "); l = l.Replace("uint64_t ", "UInt64 "); l = l.Replace("int32_t* ", "Int32* "); l = l.Replace("int32_t ", "Int32 "); l = l.Replace("int64_t* ", "Int64* "); l = l.Replace("int64_t ", "Int64 "); l = l.Replace("struct ", "/* struct */ "); l = l.Replace(" object", " _object"); l = l.Replace(" event", " _event"); l = l.Replace("Display* ", "/*Display*-*/IntPtr "); l = l.Replace("AHardwareBuffer** ", "/*AHardwareBuffer**-*/IntPtr "); l = l.Replace("AHardwareBuffer* ", "/*AHardwareBuffer*-*/IntPtr "); l = l.Replace("wl_display* ", "/*wl_display*-*/IntPtr "); l = l.Replace("xcb_connection_t* ", "/*xcb_connection_t*-*/IntPtr "); l = l.Replace("xcb_visualid_t ", "/*xcb_visualid_t*/IntPtr "); l = l.Replace("VisualID ", "/*VisualID*/IntPtr "); l = l.Replace("RROutput ", "/*RROutput*/IntPtr "); if (j == definitionLines.Length - 1) { l = l.Replace(";", " {"); } l = " " + l; sw.WriteLine(l); } string funcName = string.Empty; string returnType = string.Empty; { char[] chars = new char[] { ',', '(', ')', ';', ' ' }; string[] parts = definitionLines[0].Split(chars, StringSplitOptions.RemoveEmptyEntries); returnType = parts[2]; funcName = parts[3]; } string leftBigBrace = "{", rightBigBrace = "}"; { //IntPtr procHandle = vkAPI.vkGetInstanceProcAddr(instance, "vkCreateDebugReportCallbackEXT"); sw.WriteLine($"IntPtr addr = vkAPI.vkGetInstanceProcAddr(instance, \"{funcName}\");"); //delCreateDebugReportCallbackEXT = (vkCreateDebugReportCallbackEXT)Marshal.GetDelegateForFunctionPointer(procHandle, typeof(vkCreateDebugReportCallbackEXT)); sw.WriteLine($"var func = ({funcName})Marshal.GetDelegateForFunctionPointer(addr, typeof({funcName}));"); sw.WriteLine(); sw.WriteLine($"if (func != null) {leftBigBrace}"); string starter = (returnType != "void") ? "return " : ""; sw.Write($"{starter}func("); char[] chars = new char[] { ',', '(', ')', ';', ' ' }; for (int j = 1; j < definitionLines.Length; j++) { string[] parts = definitionLines[j].Trim().Split(chars, StringSplitOptions.RemoveEmptyEntries); string paramName = parts[parts.Length - 1]; paramName = paramName.Replace("object", "_object"); paramName = paramName.Replace("event", "_event"); sw.Write(paramName); if (j != definitionLines.Length - 1) { sw.Write(", "); } } sw.WriteLine($");"); sw.WriteLine($"{rightBigBrace}"); if (returnType == "VkResult") { sw.WriteLine($"else {leftBigBrace}"); sw.WriteLine($"return VkResult.ErrorExtensionNotPresent;"); sw.WriteLine($"{rightBigBrace}"); } else if (returnType == "VkDeviceAddress") { sw.WriteLine($"else {leftBigBrace}"); sw.WriteLine($"return 0;"); sw.WriteLine($"{rightBigBrace}"); } } sw.WriteLine("}"); //private static vkCreateDebugReportCallbackEXT delCreateDebugReportCallbackEXT; //sw.WriteLine($"private static {funcName} del{funcName};"); sw.WriteLine(); } } Console.WriteLine("Done"); }
public static void Dump() { XElement root = XElement.Load(filename); var lstDefinition = new List <Definition>(); bool inside = false; TraverseDefinitions(root, lstDefinition, ref inside); var lstItemComment = new List <ItemComment>(); inside = false; TraverseItemComments(root, lstItemComment, ref inside); var lstComment = new List <string>(); inside = false; TraverseComments(root, lstComment, ref inside); //var lstItemDescription = new List<ItemDescription>(); inside = false; //TraverseDescriptions(root, lstItemDescription, ref inside); using (var sw = new System.IO.StreamWriter("Commands.Delegates.gen.cs")) { sw.WriteLine("const string VulkanLibrary = \"vulkan-1\";"); for (int i = 0, t = 0; i < lstDefinition.Count; i++) { Definition definition = lstDefinition[i]; //sw.WriteLine(definition.raw); string[] definitionLines = definition.Dump(); ItemComment itemComment = lstItemComment[i]; Dictionary <string, string> item2Comment = itemComment.Dump(); //ItemDescription itemDescription = lstItemDescription[i]; { string line = definitionLines[0]; if (line.StartsWith("public static extern")) { continue; } sw.WriteLine($"// Command: {i}"); sw.WriteLine($"// Delegate: {t}"); t++; } string comment = lstComment[i]; sw.WriteLine($"/// <summary>{comment}"); // description is too long. //foreach (var item in itemDescription.lstComment) { // string s = item.Replace("\r", ""); // s = s.Replace("\n", ""); // string c = Helper.RemoveBraces(s); // sw.WriteLine($"/// <para>{c}</para>"); //} sw.WriteLine($"/// </summary>"); // /// <param name="device"></param> for (int j = 1; j < definitionLines.Length; j++) { string line = definitionLines[j]; if (item2Comment != null) { string key; string strComment = ParseItemComment(line, item2Comment, out key); if (strComment != string.Empty) { strComment = strComment.Replace("\r\n", "\n"); strComment = strComment.Replace("\r", "\n"); strComment = strComment.Replace("\n", $"{Environment.NewLine} /// "); strComment = Helper.RemoveBraces(strComment); sw.WriteLine(string.Format("/// <param name=\"{0}\">{1}</param>", key, strComment)); } } } { string line = definitionLines[0]; line = line.Trim(); if (line.StartsWith("public static extern")) { sw.WriteLine("[DllImport(VulkanLibrary, CallingConvention = CallingConvention.Winapi)]"); } var l = line.Replace("const char* ", "IntPtr "); l = l.Replace("const*", "/*-const-*/ *"); l = l.Replace("const ", "/*-const-*/ "); l = l.Replace(" const", " /*-const-*/"); l = l.Replace("size_t ", "Int32 "); l = l.Replace("size_t*", "Int32*"); l = l.Replace("uint8_t* ", "byte* "); l = l.Replace("uint8_t ", " byte "); l = l.Replace("uint16_t* ", "UInt16* "); l = l.Replace("uint16_t ", "UInt16 "); l = l.Replace("uint32_t* ", "UInt32* "); l = l.Replace("uint32_t ", "UInt32 "); l = l.Replace("uint64_t* ", "UInt64* "); l = l.Replace("uint64_t ", "UInt64 "); l = l.Replace("int32_t* ", "Int32* "); l = l.Replace("int32_t ", "Int32 "); l = l.Replace("int64_t* ", "Int64* "); l = l.Replace("int64_t ", "Int64 "); l = l.Replace("struct ", "/*-struct-*/ "); l = l.Replace(" object", " _object"); l = l.Replace(" event", " _event"); sw.WriteLine(l); // public static extern VkResult vkAcquireFullScreenExclusiveModeEXT( ... } for (int j = 1; j < definitionLines.Length; j++) { string line = definitionLines[j]; line = line.Trim(); var l = line.Replace("const char* ", "IntPtr "); l = l.Replace("const*", "/*-const-*/ *"); l = l.Replace("const ", "/*-const-*/ "); l = l.Replace(" const", " /*-const-*/"); l = l.Replace("size_t ", "Int32 "); l = l.Replace("size_t*", "Int32*"); l = l.Replace("uint8_t* ", "byte* "); l = l.Replace("uint8_t ", " byte "); l = l.Replace("uint16_t* ", "UInt16* "); l = l.Replace("uint16_t ", "UInt16 "); l = l.Replace("uint32_t* ", "UInt32* "); l = l.Replace("uint32_t ", "UInt32 "); l = l.Replace("uint64_t* ", "UInt64* "); l = l.Replace("uint64_t ", "UInt64 "); l = l.Replace("int32_t* ", "Int32* "); l = l.Replace("int32_t ", "Int32 "); l = l.Replace("int64_t* ", "Int64* "); l = l.Replace("int64_t ", "Int64 "); l = l.Replace("struct ", "/* struct */ "); l = l.Replace(" object", " _object"); l = l.Replace(" event", " _event"); l = l.Replace("Display* ", "/*Display*-*/IntPtr "); l = l.Replace("AHardwareBuffer** ", "/*AHardwareBuffer**-*/IntPtr "); l = l.Replace("AHardwareBuffer* ", "/*AHardwareBuffer*-*/IntPtr "); l = l.Replace("wl_display* ", "/*wl_display*-*/IntPtr "); l = l.Replace("xcb_connection_t* ", "/*xcb_connection_t*-*/IntPtr "); l = l.Replace("xcb_visualid_t ", "/*xcb_visualid_t*/IntPtr "); l = l.Replace("VisualID ", "/*VisualID*/IntPtr "); l = l.Replace("RROutput ", "/*RROutput*/IntPtr "); l = " " + l; sw.WriteLine(l); } } } Console.WriteLine("Done"); }
public void PopulateModel(ItemComment itemComment) { //Lo que interesa es la respuesta itemComment.Sentence = txtAnswer.Value; itemComment.User = SessionHelper.GetUser(); }
async Task GetCommentsR(ItemComment item) { var countComments = item?.thread?.count; if (countComments > 0) { var inc = 0; do { Comment_.CommentToComment.RootObject serResponce = null; var responce = ""; try { responce = await requester .Request(requsetBuilder.GetCommentsToCommentOffset(idUser, post_id, item.id, token, inc)); serResponce = serialyzerToComment.Serialyz(responce); } catch (Exception) { serResponce = null; } if (serResponce != null) { foreach (var i in serResponce?.response?.items) { if (i != null) { var o = new ItemComment { date = i.date, from_id = i.from_id, id = i.id, owner_id = i.owner_id, parents_stack = new List <ItemComment>(), post_id = i.post_id, text = i.text, thread = new Thread(), }; await GetCommentsR(o); } } var oo = serResponce?.response?.items? .Where(i => i != null) .Select(i => new ItemComment { date = i.date, from_id = i.from_id, id = i.id, owner_id = i.owner_id, parents_stack = new List <ItemComment>(), post_id = i.post_id, text = i.text, thread = new Thread(), }) .ToList(); if (oo != null) { item.thread.items.AddRange(oo); } } inc += 100; } while (countComments >= inc); } }