コード例 #1
0
        public void UpdateTemplate(UpdateTemplateDTO ObjUpdateTemplateDTO)
        {
            var myContent   = JsonConvert.SerializeObject(ObjUpdateTemplateDTO);
            var buffer      = System.Text.Encoding.UTF8.GetBytes(myContent);
            var byteContent = new ByteArrayContent(buffer);

            byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            var result = client.PutAsync("events/templates/" + ObjUpdateTemplateDTO.id, byteContent).Result;
        }
コード例 #2
0
        protected void BtnUpdateAllBrothers_Click(object sender, EventArgs e)
        {
            TemplateDetailPageManager ObjTemplateDetailPageManager = new TemplateDetailPageManager();

            try
            {
                //aggiorna la description del template
                UpdateTemplateDTO ObjUpdateTemplateDTO = new UpdateTemplateDTO();
                ObjUpdateTemplateDTO.id          = Convert.ToInt32(ViewState["MemIdTemp"]);
                ObjUpdateTemplateDTO.description = TxtTemplatesName.Text;

                ObjUpdateTemplateDTO.disabled = !(Convert.ToBoolean(CboEnable.SelectedValue));
                ObjTemplateDetailPageManager.UpdateTemplate(ObjUpdateTemplateDTO);
                BtnChkOk.Attributes.Add("style", "display:inline");
                //si scorre il repeater ed aggiorna i dati
                foreach (RepeaterItem item in RptSelEvt.Items)
                {
                    if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
                    {
                        var          TxtAmount      = (TextBox)item.FindControl("TxtAmount");
                        var          TxtDescription = (TextBox)item.FindControl("TxtDescription");
                        DropDownList CboCase        = (DropDownList)item.FindControl("CboCase");
                        int          idEvt          = Convert.ToInt32(CboCase.Attributes["MemIdEvt"]);
                        //MemIdEvt
                        //fa il put del dato
                        UpdateBrotherEvtDto ObjUpdateBrotherEvtDto = new UpdateBrotherEvtDto();
                        ObjUpdateBrotherEvtDto.id          = idEvt;
                        ObjUpdateBrotherEvtDto.amount      = Convert.ToDouble(TxtAmount.Text);
                        ObjUpdateBrotherEvtDto.description = TxtDescription.Text;
                        ObjTemplateDetailPageManager.UpdateAllTemplateEvt(ObjUpdateBrotherEvtDto, Convert.ToInt32(ViewState["MemIdTemp"]));
                    }
                }
                //messaggio di conferma salvataggio
                LitMessaggioInformativo.Text = "Events update successfully completed.";
                DivInformation.Attributes.Add("Class", "ParentDivDeleting Attivo");
            }
            catch (Exception ex)
            {
                PrintError(ex);
            }
        }