protected void RadGrid1_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) { Int32 KasId = 0; GridEditableItem editedItem = e.Item as GridEditableItem; UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID); Kas kas = new Kas(); KasId = Convert.ToInt32((userControl.FindControl("txtBkuId") as RadTextBox).Text.Trim()); if (kas.LoadByPrimaryKey(KasId)) { kas.KaName = (userControl.FindControl("txtKaName") as RadTextBox).Text.Trim(); kas.SaldoAwal = Convert.ToDecimal((userControl.FindControl("txtSaldo") as RadTextBox).Text.Trim()); kas.Save(); } MutasiKasQuery mkQ = new MutasiKasQuery(); mkQ.SelectAll(); mkQ.Where(mkQ.Code == "0.0.1", mkQ.PeriodId == (Int32)HttpContext.Current.Session["_periodeId"]); MutasiKasCollection mkC = new MutasiKasCollection(); mkC.Load(mkQ); if (mkC.Count > 0) { KasQuery kasQ = new KasQuery(); kasQ.Select(kasQ.SaldoAwal.Sum()); kasQ.Where(kasQ.PeriodeId == (Int32)HttpContext.Current.Session["_periodeId"]); } }
protected void RadGrid1_InsertCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) { GridEditableItem editedItem = e.Item as GridEditableItem; UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID); Kas kas = new Kas(); kas.KaCode = (userControl.FindControl("txtKasCode") as RadTextBox).Text.Trim().ToUpper(); kas.KaName = (userControl.FindControl("txtKaName") as RadTextBox).Text.Trim().ToUpper(); kas.SaldoAwal = Convert.ToDecimal((userControl.FindControl("txtSaldo") as RadTextBox).Text.Trim()); kas.PeriodeId = Convert.ToInt32(HttpContext.Current.Session["_periodeId"]); kas.Save(); }
protected void RadGrid1_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) { Int32 KasId = 0; GridEditableItem editedItem = e.Item as GridEditableItem; UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID); Kas kas = new Kas(); KasId = Convert.ToInt32((userControl.FindControl("txtBkuId") as RadTextBox).Text.Trim()); if (kas.LoadByPrimaryKey(KasId)) { kas.KaName = (userControl.FindControl("txtKaName") as RadTextBox).Text.Trim().ToUpper(); kas.SaldoAwal = Convert.ToDecimal((userControl.FindControl("txtSaldo") as RadTextBox).Text.Trim()); kas.Save(); } }
virtual public Kas AttachEntity(Kas entity) { return(base.AttachEntity(entity) as Kas); }
protected void RadGrid1_PreRender(object sender, EventArgs e) { foreach (GridDataItem item in RadGrid1.MasterTableView.Items) { Kas kas = new Kas(); if (kas.LoadByPrimaryKey(long.Parse(item["id"].Text))) { if ((bool)kas.IsVerified) { item["btnVerify"].Enabled = false; //GridButtonColumn img = (item //item["btnVerify"].Style.Add(HtmlTextWriterStyle.Display, "none"); } } } if (RadGrid1.EditItems.Count > 0) { foreach (GridDataItem item in RadGrid1.MasterTableView.Items) { if (item != RadGrid1.EditItems[0]) { item.Visible = false; } Kas kas = new Kas(); if (kas.LoadByPrimaryKey(long.Parse(item["id"].Text))) { } } } if (RadGrid1.MasterTableView.IsItemInserted) { foreach (GridItem item in RadGrid1.Items) { item.Visible = false; } } if (!IsPostBack) { this.RadGrid1.MasterTableView.Rebind(); } }
//Verify Routine, memanfaatkan event delete protected void RadGrid1_DeleteCommand(object source, GridCommandEventArgs e) { long IdKas = (long)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["id"]; Kas kas = new Kas(); if (kas.LoadByPrimaryKey(IdKas)) { kas.IsVerified = true; kas.Save(); } }