protected void RadGrid2_ItemCommand(object source, GridCommandEventArgs e) { if ((e.CommandName == "PerformInsert") || (e.CommandName == "Update")) { GridEditFormItem item = (GridEditFormItem)e.Item; int pathroutekey = 0; if (e.CommandName == "Update") { pathroutekey = Convert.ToInt32(item.GetDataKeyValue("path_route_key")); } int pathkey = Convert.ToInt32(hdpathkey.Value); int marketkey = Convert.ToInt32((item["market_key2"].FindControl("ddlmarket") as RadComboBox).SelectedValue); Bitcoin_Notify_DB.SPs.UpdatePathRoute(pathroutekey, pathkey, marketkey).Execute(); RadGrid2.MasterTableView.ClearEditItems(); //string firstname = (item["first_name"].Controls[0] as TextBox).Text; } else if (e.CommandName == "Delete") { GridDataItem item = (GridDataItem)e.Item; int pathroutekey = Convert.ToInt32(item.GetDataKeyValue("path_route_key")); Bitcoin_Notify_DB.SPs.DeletePathRoute(pathroutekey).Execute(); RadGrid2.Rebind(); //int userkey = Convert.ToInt32(item["user_key"].Text); } }
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) { if ((e.CommandName == "PerformInsert") || (e.CommandName == "Update")) { GridEditFormItem item = (GridEditFormItem)e.Item; int pathkey = 0; if (e.CommandName == "Update") { pathkey = Convert.ToInt32(item.GetDataKeyValue("path_key")); } int order = Convert.ToInt32((item["page_order"].Controls[0] as TextBox).Text); Bitcoin_Notify_DB.SPs.UpdatePath(pathkey, order).Execute(); RadGrid1.MasterTableView.ClearEditItems(); } else if (e.CommandName == "Route") { GridDataItem item = (GridDataItem)e.Item; int pathkey = Convert.ToInt32(item["path_key"].Text); string pathname = item["path_name"].Text; hdpathkey.Value = pathkey.ToString(); lblpath.Text = pathkey.ToString() + " - " + pathname; RadGrid2.Rebind(); } else if (e.CommandName == "Delete") { GridDataItem item = (GridDataItem)e.Item; int pathkey = Convert.ToInt32(item.GetDataKeyValue("path_key")); Bitcoin_Notify_DB.SPs.DeletePath(pathkey).Execute(); RadGrid1.MasterTableView.ClearEditItems(); } }
protected void UpdateDutyKSA(object sender, GridCommandEventArgs e) { GridEditFormItem editform = (GridEditFormItem)e.Item; long jQFactorID = (long)editform.GetDataKeyValue("JQFactorID"); if (jQFactorID > 0) { JobAnalysisDutyKSAFactor jaDutyKSAFactor = new JobAnalysisDutyKSAFactor(jQFactorID); AssignJADutyKSAFactorValues(jaDutyKSAFactor, e); jaDutyKSAFactor.Update(); } }
protected void rGrdExpenseSubType4DDL_NeedDataSource(object sender, GridNeedDataSourceEventArgs e) { RadGrid grid = sender as RadGrid; RadComboBox ddlExpSub = grid.Parent.Parent as RadComboBox; if (ddlExpSub != null) { GridEditFormItem editedItem = ddlExpSub.NamingContainer as GridEditFormItem; if (editedItem != null) { int id = (Int32)editedItem.GetDataKeyValue("exptidd"); htSearchParams = new Hashtable(); htSearchParams["@ID"] = id; grid.DataSource = clsDAL.GetDataSet_Payroll("sp_Payroll_Get_ExpenseSubType_Records", htSearchParams).Tables[0]; } } }
protected void RadTaskGrid_UpdateCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { GridEditFormItem item = e.Item as GridEditFormItem; RadComboBox rcbAssigned = item.FindControl("rcbAssigned") as RadComboBox; int taskID = Convert.ToInt32(item.GetDataKeyValue("taskId")); var task = _db.Tasks.Where(p => p.taskId == taskID).FirstOrDefault(); task.name = (item["name"].Controls[0] as TextBox).Text; task.description = (item["description"].Controls[0] as TextBox).Text; var userTasks = _db.UsersTasks.Where(p => p.taskId == taskID).FirstOrDefault(); userTasks.userId = Convert.ToInt32(rcbAssigned.SelectedValue); _db.SaveChanges(); }
private void UpdatePDCompetencyKSAFactor(object source, GridCommandEventArgs e) { try { DateTime createDate = DateTime.Now; if (source is RadGrid) { GridEditFormItem gridItem = e.Item as GridEditFormItem; RadComboBox _radComboQualID = gridItem.FindControl(RADCOMBOQUALID) as RadComboBox; RadEditor _radEditorQualDescription = gridItem.FindControl(RADEDITQUALDESCR) as RadEditor; int competencyKSAID = int.Parse(gridItem.GetDataKeyValue("CompetencyKSAID").ToString()); if (competencyKSAID > -1) { PositionCompetencyKSA positionCompetency = new PositionCompetencyKSA(competencyKSAID); positionCompetency.KSAID = 0; //Other KSA positionCompetency.PositionDescriptionID = CurrentJNP.FullPDID; positionCompetency.CompetencyKSA = _radEditorQualDescription.Content; positionCompetency.Certification = String.Empty; positionCompetency.QualificationTypeID = (int)enumQualificationType.ConditionOfEmployment; positionCompetency.CreatedByID = CurrentUser.UserID; positionCompetency.CreateDate = createDate; positionCompetency.UpdatedByID = CurrentUser.UserID; positionCompetency.UpdateDate = createDate; positionCompetency.QualificationID = Convert.ToInt32(_radComboQualID.SelectedValue); //Don't want to overwrite the exsiting value with null //positionCompetency.AssociatedPDDutyID = null; JQFactor jqFactor = new JQFactor(Convert.ToInt32(CurrentJNP.JQID)); jqFactor.JQFactorTypeID = (int)enumJQFactorType.ConditionOfEmployment; jqFactor.KSAID = 0; //Other KSA jqFactor.IsSF = false; jqFactor.JQID = CurrentJNP.JQID; positionCompetency.UpdatePDCompetencyKSAFactor(positionCompetency, jqFactor); } } } catch (Exception ex) { base.HandleException(ex); } }
protected void RadGrid1_UpdateCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { GridEditFormItem editForm = (GridEditFormItem)e.Item; Hashtable newValues = new Hashtable(); XMLContext context = new XMLContext(); XDocument document = context.LoadDocument(GetPath()); List <XElement> ordersTable = context.GetTable(document, "Orders").ToList(); //Extract the new values from the editor controls editForm.ExtractValues(newValues); //Get the "Primary key" value that will be used to perform CRUD operations string orderID = editForm.GetDataKeyValue(RadGrid1.MasterTableView.DataKeyNames[0]).ToString(); //Get a reference to the modified record XElement orderToUpdate = (from order in ordersTable where order.Attribute("OrderID").Value == orderID select order).FirstOrDefault(); context.UpdateElement(ordersTable, ApplyChanges(orderToUpdate, newValues)); context.SaveChanges(document, GetPath()); ; }
protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e) { try { if (e.CommandName == RadGrid.UpdateCommandName) { if (e.Item is GridEditFormItem) { GridEditFormItem item = (GridEditFormItem)e.Item; string riskCode = item.GetDataKeyValue("XRC_RiskClassCode").ToString(); //TextBox txtRiskCode = (TextBox)item.FindControl("txtRiskCode"); TextBox Description = (TextBox)item.FindControl("txtDescription"); modelPortfolioBo.InsertUpdateRiskGoalClass(riskCode, Description.Text, advisorVo.advisorId); bindRadGrid1(); } } } catch (Exception ex) { RadGrid1.Controls.Add(new LiteralControl("Unable to Insert Class. Reason: " + ex.Message)); e.Canceled = true; } }
protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e) { try { decimal RORPer = 0; int minTimeHorizon = 0; int maxTimeHorizon = 0; decimal allocation = 0; decimal riskPer = 0; bool chkFlag = false; DataSet ds = adviserFPConfigurationBo.GetAdviserAssumptions(advisorVo.advisorId); GridEditFormItem item = (GridEditFormItem)e.Item; string riskCode = item.GetDataKeyValue("XRC_RiskClassCode").ToString(); int code = Convert.ToInt32(item.GetDataKeyValue("XAMP_ModelPortfolioCode")); DropDownList ddl = (DropDownList)e.Item.FindControl("ddlPickRiskClass"); TextBox txtboxPortfolioName = (TextBox)e.Item.FindControl("txtNamePortfolio"); TextBox txtboxMinAUM = (TextBox)e.Item.FindControl("txtMinAUM"); TextBox txtboxMaxAUM = (TextBox)e.Item.FindControl("txtMaxAUM"); TextBox txtboxMinAge = (TextBox)e.Item.FindControl("txtMinAge"); TextBox txtboxMaxAge = (TextBox)e.Item.FindControl("txtMaxAge"); TextBox txtboxMinTimeHorizonYear = (TextBox)e.Item.FindControl("txtMinTimeHorizonYear"); TextBox txtboxMaxTimeHorizonYear = (TextBox)e.Item.FindControl("txtMaxTimeHorizonYear"); TextBox txtboxMinTimeHorizonMonth = (TextBox)e.Item.FindControl("txtMinTimeHorizonMonth"); TextBox txtboxMaxTimeHorizonMonth = (TextBox)e.Item.FindControl("txtMaxTimeHorizonMonth"); TextBox txtboxVariantdescription = (TextBox)e.Item.FindControl("txtDescription"); TextBox txtboxCashAllocation = (TextBox)e.Item.FindControl("txtCash"); TextBox txtboxAlternateAllocation = (TextBox)e.Item.FindControl("txtAlternate"); TextBox txtboxDebtAllocation = (TextBox)e.Item.FindControl("txtDebt"); TextBox txtboxEquityAllocation = (TextBox)e.Item.FindControl("txtEquity"); DropDownList ddlModelType = (DropDownList)e.Item.FindControl("ddlModelType"); TextBox txtIsRiskClass = (TextBox)e.Item.FindControl("txtIsRiskClass"); string isRiskClass = ""; if (txtIsRiskClass.Text == "Risk Profile") { isRiskClass = "RC"; } else if (txtIsRiskClass.Text == "Goal Profile") { isRiskClass = "GC"; } allocation = Convert.ToDecimal((txtboxCashAllocation.Text.Trim())) + Convert.ToDecimal(txtboxAlternateAllocation.Text.Trim()) + Convert.ToDecimal(txtboxDebtAllocation.Text.Trim()) + Convert.ToDecimal(txtboxEquityAllocation.Text.Trim()); if (allocation == 100) { DataTable dtGetMaxminAge = adviserFPConfigurationBo.GetMaxMinAgeModelPortFolio(advisorVo.advisorId, riskCode, code, isRiskClass); //int minAge = Convert.ToInt16(dtGetMaxminAge.Rows[0]["MinAge"].ToString()); //int maxAge = Convert.ToInt16(dtGetMaxminAge.Rows[0]["MaxAge"].ToString()); //int getminAge = int.Parse(txtboxMinAge.Text); //int getMaxAge = int.Parse(txtboxMaxAge.Text); int VarMinMonth = 0; int VarMaxMonth = 0; if (txtboxMinTimeHorizonMonth.Text != "") { VarMinMonth = Convert.ToInt32(txtboxMinTimeHorizonMonth.Text.Trim()); } if (txtboxMaxTimeHorizonMonth.Text != "") { VarMaxMonth = Convert.ToInt32(txtboxMaxTimeHorizonMonth.Text.Trim()); } minTimeHorizon = VarMinMonth; maxTimeHorizon = VarMaxMonth; double varMinAUM = 0; double varMaxAUM = 0; int varMinAge = 0; int varMaxAge = 0; if (txtboxMinAUM.Text != "") { varMinAUM = Convert.ToDouble(txtboxMinAUM.Text.Trim()); } if (txtboxMaxAUM.Text != "") { varMaxAUM = Convert.ToDouble(txtboxMaxAUM.Text.Trim()); } if (txtboxMinAge.Text != "") { varMinAge = Convert.ToInt32(txtboxMinAge.Text.Trim()); } if (txtboxMaxAge.Text != "") { varMaxAge = Convert.ToInt32(txtboxMaxAge.Text.Trim()); } int minAge = int.Parse(txtboxMinAge.Text); int maxAge = int.Parse(txtboxMaxAge.Text); int countDataset = dtGetMaxminAge.Rows.Count; int count = 0, countAge = 0, countTimeHorizon = 0, countInvestment = 0; if (dtGetMaxminAge.Rows.Count > 0) { if (isRiskClass == "RC") { foreach (DataRow dr in dtGetMaxminAge.Rows) { if ((int.Parse(dr["MinAge"].ToString()) < minAge && minAge < int.Parse(dr["MaxAge"].ToString())) || (int.Parse(dr["MinAge"].ToString()) < maxAge && maxAge < int.Parse(dr["MaxAge"].ToString()))) { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "alert('Model Can not be created Criteria overlapping with existing model Please try change the criteria');", true); return; } else if (maxAge < int.Parse(dr["MinAge"].ToString()) || minAge > int.Parse(dr["MaxAge"].ToString())) { count++; } else if (minAge < int.Parse(dr["MinAge"].ToString()) && maxAge < int.Parse(dr["MinAge"].ToString())) { count++; } } } else if (isRiskClass == "GC") { foreach (DataRow dr in dtGetMaxminAge.Rows) { if (maxAge < int.Parse(dr["MinAge"].ToString()) || minAge > int.Parse(dr["MaxAge"].ToString())) { countAge++; } else if (minAge < int.Parse(dr["MinAge"].ToString()) && maxAge < int.Parse(dr["MinAge"].ToString())) { countAge++; } if (varMaxAUM < double.Parse(dr["XAMP_MinAUM"].ToString()) || varMinAUM > double.Parse(dr["XAMP_MaxAUM"].ToString())) { countInvestment++; } else if (varMinAUM < double.Parse(dr["XAMP_MinAUM"].ToString()) && varMaxAUM < double.Parse(dr["XAMP_MinAUM"].ToString())) { countInvestment++; } if (VarMaxMonth < int.Parse(dr["XAMP_MinTimeHorizon"].ToString()) || VarMinMonth > int.Parse(dr["XAMP_MaxTimeHorizon"].ToString())) { countTimeHorizon++; } else if (VarMinMonth < int.Parse(dr["XAMP_MinTimeHorizon"].ToString()) && VarMinMonth < int.Parse(dr["XAMP_MinTimeHorizon"].ToString())) { countTimeHorizon++; } } } } if (isRiskClass == "RC") { if (count == countDataset) { chkFlag = true; } else { chkFlag = false; } } else if (isRiskClass == "GC") { if (countAge == countDataset || countInvestment == countDataset || countTimeHorizon == countDataset) { chkFlag = true; } else { chkFlag = false; } } if (chkFlag == true) { foreach (DataRow dr in ds.Tables[0].Rows) { switch (dr["WA_AssumptionId"].ToString()) { case "AR": { if (!string.IsNullOrEmpty(txtboxAlternateAllocation.Text.Trim())) { RORPer = (RORPer + (Convert.ToDecimal(txtboxAlternateAllocation.Text.Trim()) * Convert.ToDecimal((dr["AA_Value"].ToString()))) / 100); } break; } case "CR": { if (!string.IsNullOrEmpty(txtboxCashAllocation.Text.Trim())) { RORPer = (RORPer + (Convert.ToDecimal(txtboxCashAllocation.Text.Trim()) * Convert.ToDecimal((dr["AA_Value"].ToString()))) / 100); } break; } case "DR": { if (!string.IsNullOrEmpty(txtboxDebtAllocation.Text.Trim())) { RORPer = (RORPer + (Convert.ToDecimal(txtboxDebtAllocation.Text.Trim()) * Convert.ToDecimal((dr["AA_Value"].ToString()))) / 100); } break; } case "ER": { if (!string.IsNullOrEmpty(txtboxEquityAllocation.Text.Trim())) { RORPer = (RORPer + (Convert.ToDecimal(txtboxEquityAllocation.Text.Trim()) * Convert.ToDecimal((dr["AA_Value"].ToString()))) / 100); } break; } case "RIA": { if (!string.IsNullOrEmpty(txtboxAlternateAllocation.Text.Trim())) { riskPer = (riskPer + (Convert.ToDecimal(txtboxAlternateAllocation.Text.Trim()) * Convert.ToDecimal((dr["AA_Value"].ToString()))) / 100); } break; } case "RIC": { if (!string.IsNullOrEmpty(txtboxCashAllocation.Text.Trim())) { riskPer = (riskPer + (Convert.ToDecimal(txtboxCashAllocation.Text.Trim()) * Convert.ToDecimal((dr["AA_Value"].ToString()))) / 100); } break; } case "RID": { if (!string.IsNullOrEmpty(txtboxDebtAllocation.Text.Trim())) { riskPer = (riskPer + (Convert.ToDecimal(txtboxDebtAllocation.Text.Trim()) * Convert.ToDecimal((dr["AA_Value"].ToString()))) / 100); } break; } case "RIE": { if (!string.IsNullOrEmpty(txtboxEquityAllocation.Text.Trim())) { riskPer = (riskPer + (Convert.ToDecimal(txtboxEquityAllocation.Text.Trim()) * Convert.ToDecimal((dr["AA_Value"].ToString()))) / 100); } break; } } } if (isRiskClass == "RC") { modelPortfolioVo.MinAUM = 0; modelPortfolioVo.MaxAUM = 0; modelPortfolioVo.MinTimeHorizon = 0; modelPortfolioVo.MaxTimeHorizon = 0; } else { modelPortfolioVo.MinAUM = varMinAUM; modelPortfolioVo.MaxAUM = varMaxAUM; modelPortfolioVo.MinTimeHorizon = minTimeHorizon; modelPortfolioVo.MaxTimeHorizon = maxTimeHorizon; } modelPortfolioVo.ModelPortfolioCode = code; modelPortfolioVo.PortfolioName = txtboxPortfolioName.Text; modelPortfolioVo.RiskClassCode = riskCode; modelPortfolioVo.MinAge = varMinAge; modelPortfolioVo.MaxAge = varMaxAge; modelPortfolioVo.VariantDescription = txtboxVariantdescription.Text; modelPortfolioVo.AlternateAllocation = Convert.ToDecimal(txtboxAlternateAllocation.Text); modelPortfolioVo.DebtAllocation = Convert.ToDecimal(txtboxDebtAllocation.Text); modelPortfolioVo.EquityAllocation = Convert.ToDecimal(txtboxEquityAllocation.Text); modelPortfolioVo.CashAllocation = Convert.ToDecimal(txtboxCashAllocation.Text); modelPortfolioVo.ROR = RORPer; modelPortfolioVo.RiskPercentage = riskPer; modelPortfolioBo.UpdateVariantAssetPortfolio(modelPortfolioVo, advisorVo.advisorId, advisorVo.UserId); bindRadGrid1(); } else { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "alert('Model Can not be created Criteria overlapping with existing model Please try change the criteria');", true); return; } //else //{ // ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "alert('You dont have enough amount');", true); //} } else { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "alert('Allocation is not 100%');", true); return; } } catch (Exception ex) { RadGrid1.Controls.Add(new LiteralControl("Unable to Update Variant. Reason: " + ex.Message)); e.Canceled = true; } }