private void SaveDiaryDetails() { try { for (int i = 0; i < this.gvwDiaryDetails.Rows.Count; i++) { GridViewRow gridViewRow = this.gvwDiaryDetails.Rows[i]; string inDiaryDetailsId = gridViewRow.Attributes["id"]; BudIndirectDiaryDetails byId = this.detailSer.GetById(inDiaryDetailsId); TextBox textBox = gridViewRow.FindControl("txtAuditAmount") as TextBox; if (textBox != null && byId != null) { decimal auditAmount = System.Convert.ToDecimal(textBox.Text); byId.AuditAmount = auditAmount; this.detailSer.Update(byId); } } } catch { } }
protected void SaveEditData() { if (this.gvDiaryDetails.EditIndex != -1) { int editIndex = this.gvDiaryDetails.EditIndex; GridViewRow gridViewRow = this.gvDiaryDetails.Rows[editIndex]; System.Collections.Generic.List <BudIndirectDiaryDetails> list = this.ViewState["details"] as System.Collections.Generic.List <BudIndirectDiaryDetails>; BudIndirectDiaryDetails budIndirectDiaryDetails = list[gridViewRow.RowIndex]; BudIndirectDiaryCost budIndirectDiaryCost = new BudIndirectDiaryCost(); this.costType = budIndirectDiaryCost.CostType; budIndirectDiaryDetails.No = editIndex + 1; TextBox textBox = gridViewRow.Cells[2].FindControl("txtgvCode") as TextBox; if (textBox != null) { budIndirectDiaryDetails.IndetailsCode = textBox.Text.Trim(); } TextBox textBox2 = gridViewRow.Cells[3].FindControl("txtgvName") as TextBox; if (textBox2 != null) { budIndirectDiaryDetails.Name = textBox2.Text.Trim(); } TextBox textBox3 = gridViewRow.Cells[4].FindControl("txtgvAmount") as TextBox; if (textBox3 != null) { budIndirectDiaryDetails.Amount = decimal.Parse(textBox3.Text.Trim()); } DropDownList dropDownList = gridViewRow.Cells[5].FindControl("ddlCBSCode") as DropDownList; if (dropDownList != null) { budIndirectDiaryDetails.CBSCode = dropDownList.SelectedValue; } TextBox textBox4 = gridViewRow.Cells[6].FindControl("txtgvNote") as TextBox; if (textBox4 != null) { budIndirectDiaryDetails.Note = textBox4.Text.Trim(); } this.ViewState["details"] = list; } }
private bool RemoveSearch(BudIndirectDiaryDetails indirectDetail) { System.Collections.Generic.List <string> listFromJson = JsonHelper.GetListFromJson(this.hfldCheckedIds.Value); return(this.IsExist(indirectDetail.InDiaryDetailsId, listFromJson)); }