void TasksTree_RemoteRename(object sender, RemoteEditEventArgs e) { try { int nodeId = int.Parse(e.NodeID); SimpleTasksDataContext ctx = this.DBContext; Category category = (from tl in ctx.Categories where tl.ID == nodeId select tl).First(); IEnumerable <Category> query = from tl in ctx.Categories where (tl.IsFolder == category.IsFolder && tl.ParentID == category.ParentID && tl.ID != category.ID && tl.Name == e.Value <string>()) select tl; if (query.Count() > 0) { e.Accept = false; e.RefusalMessage = "Such {0} is existing in the parent folder".FormatWith(category.IsFolder ? "folder" : "category"); return; } category.Name = e.Value <string>(); ctx.SubmitChanges(); e.Accept = true; } catch (Exception exception) { e.Accept = false; e.RefusalMessage = exception.Message; } }
private void TreePanelEx_RemoteEdit(object sender, RemoteEditEventArgs e) { if (!EnableEdit) { return; } string json = e.Json; string nodeID = e.NodeID; string str3 = e.ExtraParams["parentId"]; try { int parentId = Convert.ToInt32(str3); int id = Convert.ToInt32(nodeID); if (id == 0) { this._nodeHelper.CreateNode(json, parentId); } else { this._nodeHelper.UpdateNode(id, json); } e.Accept = true; } catch (ArgumentException exception) { this.ShowError(exception.Message, e); } catch (ApplicationException ae) { ShowError(ae.Message, e); } catch (DbException exception2) { this.ShowError(exception2.Message, e); } }
protected void RemoteEdit(object sender, RemoteEditEventArgs e) { e.Accept = true; foreach (RowChanges change in e.Changes) { if (change.Field == "text" && change.IsDirty <string>()) { change.SetValue(change.Value <string>() + "_echo"); } else if (change.Field == "number") { change.SetValue(change.Value <int>() * 10); } else if (change.Field == "date") { change.SetValue(change.Value <DateTime>().AddYears(10)); } } // You can refuse action // e.Accept = false; // e.RefusalMessage = "Error"; }
void TasksTree_RemoteRename(object sender, RemoteEditEventArgs e) { try { int nodeId = int.Parse(e.NodeID); SimpleTasksDataContext ctx = this.DBContext; Category category = (from tl in ctx.Categories where tl.ID == nodeId select tl).First(); IEnumerable<Category> query = from tl in ctx.Categories where (tl.IsFolder == category.IsFolder && tl.ParentID == category.ParentID && tl.ID != category.ID && tl.Name == e.Value<string>()) select tl; if (query.Count() > 0) { e.Accept = false; e.RefusalMessage = "Such {0} is existing in the parent folder".FormatWith(category.IsFolder ? "folder" : "category"); return; } category.Name = e.Value<string>(); ctx.SubmitChanges(); e.Accept = true; } catch (Exception exception) { e.Accept = false; e.RefusalMessage = exception.Message; } }
public void RaiseAjaxPostBackEvent(string eventArgument, ParameterCollection extraParams) { bool success = true; string msg = null; Response response = new Response(); try { if (eventArgument.IsEmpty()) { throw new ArgumentNullException("eventArgument"); } string data = null; if (this.DirectConfig != null) { JToken serviceToken = this.DirectConfig.SelectToken("config.serviceParams", false); if (serviceToken != null) { data = JSON.ToString(serviceToken); } } switch(eventArgument) { case "submit": SubmitEventArgs se = new SubmitEventArgs(extraParams, JSON.Deserialize<SubmittedNode>(data, new CamelCasePropertyNamesContractResolver())); this.OnSubmit(se); break; case "raEdit": RemoteEditEventArgs rr = new RemoteEditEventArgs(data,extraParams); this.OnRemoteEdit(rr); success = rr.Accept; msg = rr.RefusalMessage; break; case "raRemove": RemoteRemoveEventArgs rrm = new RemoteRemoveEventArgs(data, extraParams); this.OnRemoteRemove(rrm); success = rrm.Accept; msg = rrm.RefusalMessage; break; case "raInsert": case "raAppend": RemoteAppendEventArgs ra = new RemoteAppendEventArgs(eventArgument == "raInsert", data, extraParams); this.OnRemoteAppend(ra); success = ra.Accept; msg = ra.RefusalMessage; break; case "raMove": RemoteMoveEventArgs rm = new RemoteMoveEventArgs(data, extraParams); this.OnRemoteMove(rm); success = rm.Accept; msg = rm.RefusalMessage; break; } } catch (Exception ex) { success = false; msg = this.IsDebugging ? ex.ToString() : ex.Message; if (this.ResourceManager.RethrowAjaxExceptions) { throw; } } response.Success = success; response.Message = msg; ResourceManager.ServiceResponse = response; }
internal virtual void OnRemoteEdit(RemoteEditEventArgs e) { RemoteEditEventHandler handler = (RemoteEditEventHandler)Events[EventEdit]; if (handler != null) { handler(this, e); } }
protected void RemoteEdit(object sender, RemoteEditEventArgs e) { string pici = cmbpici.SelectedItem.Value; string pici1 = cmbpici.RawValue.ToString(); string pici2 = cmbpici.SelectedItem.Text; pici = pici1 == pici2 ? pici1 : pici2; string yearMonth = CurrentYear + "-" + cmbmon.SelectedItem.Value; if (hidflag.Text == "1") { X.Msg.Alert("申请月度用款计划", yearMonth + "月已经提交,不允许修改").Show(); return; } if (hidflag.Text == "4") { X.Msg.Alert("申请月度用款计划", "本月未审核通过,不允许为下月申请预算").Show(); return; } if (hidflag.Text == "5") { X.Msg.Alert("申请月度用款计划", "该退回申请已无效").Show(); return; } e.Accept = true; string[] idStrArr = HidSlist.Text.ToString().TrimEnd('&').Split('&'); List<int> slist = new List<int>(); foreach (string item in idStrArr) { int IntId = common.IntSafeConvert(item); if (!slist.Contains(IntId)) { slist.Add(IntId); } } int piid = common.IntSafeConvert(e.NodeID); RowChanges rc = e.Changes[0]; //if (rc.Value<float>() <= 0 && rc.OldValue<float>() <= 0) //{ // X.Msg.Alert("提示", "填写数字不能为0").Show(); // return; //} if (e.Json == null) { return; } if (!slist.Contains(piid)) { rc.SetValue(""); X.Msg.Alert("提示", "此处不可填写,请填写到正确位置").Show(); return; } else { decimal newValue = 0; decimal oldValue = 0; decimal balance = 0; decimal MPFundingAdd = 0; decimal Mon = 0; DataTable dt = BG_MonPayPlanLogic.GetMpFunding(piid, DepID, yearMonth, common.IntSafeConvert(pici)); if (rc.Field == "MPRemark") { if (!rc.IsDirty<string>()) { return; } if (dt.Rows.Count > 0) { int CPID = common.IntSafeConvert(dt.Rows[0][0]); BG_MonPayPlan mp = BG_MonPayPlanManager.GetBG_MonPayPlanByCPID(CPID); mp.MPRemark = rc.Value<string>(); BG_MonPayPlanManager.ModifyBG_MonPayPlan(mp); } else { BG_MonPayPlan mp = new BG_MonPayPlan(); mp.MPRemark = rc.Value<string>(); mp.DeptID = DepID; mp.PIID = piid; mp.MPFundingAdd = 0; mp.MPTime = Convert.ToDateTime(CurrentYear + "-" + cmbmon.SelectedItem.Value + "-01"); BG_MonPayPlanManager.AddBG_MonPayPlan(mp); } return; } DataTable dtdevide = BG_MonPayPlanGenerateLogic.GetMonPay(common.IntSafeConvert(CurrentYear), DepID); string PIEcoSubName = ""; PIEcoSubName = BG_PayIncomeManager.GetBG_PayIncomeByPIID(piid).PIEcoSubName; string sql = string.Format("PIEcoSubName='{0}'", PIEcoSubName); DataRow[] drdevide = dtdevide.Select(sql); if (drdevide.Length > 0) { for (int i = 0; i < drdevide.Length; i++) { Mon += ParToDecimal.ParToDel(drdevide[i]["BAAMon"].ToString()) + ParToDecimal.ParToDel(drdevide[i]["SuppMon"].ToString()); } } sql = string.Format("PIID={0}", piid); DataRow[] dr = dt.Select(sql); if (dr.Length > 0) { for (int i = 0; i < dr.Length; i++) { MPFundingAdd += ParToDecimal.ParToDel(dr[i]["MPFundingAdd"].ToString()); } } newValue = ParseUtil.ToDecimal(rc.Value<float>().ToString(), 0); oldValue = ParseUtil.ToDecimal(rc.OldValue<float>().ToString(), 0); //if (newValue==0) //{ // BG_MonPayPlan mppalert = new BG_MonPayPlan(); // mppalert = BG_MonPayPlanManager.GetBG_MonPayPlanByCPID(CPID); // mppalert.MPFundingAdd = newValue / 10000; // mppalert.MPFunding = mppalert.MPFunding + (newValue) / 10000 - oldValue / 10000; // mppalert.MPFundingAddTimes = common.IntSafeConvert(cmbpici.SelectedItem.Value); // BG_MonPayPlanManager.ModifyBG_MonPayPlan(mppalert); // string message = "<b>科目:</b> {0}<br /><b>原经费:</b> {1}<br /><b>更改经费:</b> {2}"; // X.Msg.Notify(new NotificationConfig() // { // Title = "申请月度用款计划", // Html = string.Format(message, PIEcoSubName, oldValue, newValue), // Width = 250 // }).Show(); // return; //} balance = Mon - MPFundingAdd; if (dt.Rows.Count > 0) { int CPID = common.IntSafeConvert(dt.Rows[0][0]); BG_MonPayPlan mp = BG_MonPayPlanManager.GetBG_MonPayPlanByCPID(CPID); foreach (RowChanges change in e.Changes) { if (change.Field == "MPFundingAdd" && change.IsDirty<float>()) { if (mp.MPFunding + newValue > Mon * 10000) { X.Msg.Alert("申请月度用款计划", "科目:" + PIEcoSubName + "经费不足,请调整经费").Show(); return; } mp.MPFundingAdd = newValue; if (hidflag.Text == "2" || hidflag.Text == "3") { string message = "<b>科目:</b> {0}<br /><b>原经费:</b> {1}<br /><b>更改经费:</b> {2}"; //if (oldValue > newValue) //{ // //X.Msg.Alert("提示", "修改提交或审核通过的经费必须大于现经费").Show(); // //rc.SetValue(rc.OldValue<float>()); // //return; //} //else //{ BG_MonPayPlan mppalert = new BG_MonPayPlan(); mppalert = BG_MonPayPlanManager.GetBG_MonPayPlanByCPID(CPID); mppalert.MPFundingAdd = newValue / 10000; mppalert.MPFunding = mppalert.MPFunding + (newValue) / 10000 - oldValue / 10000; mppalert.MPFundingAddTimes = common.IntSafeConvert(cmbpici.SelectedItem.Value); BG_MonPayPlanManager.ModifyBG_MonPayPlan(mppalert); // BG_MonPayPlan_His bgMonPayPlanHis = new BG_MonPayPlan_His(); // bgMonPayPlanHis.CPID = CPID; // bgMonPayPlanHis.DeptID = mppalert.DeptID; // bgMonPayPlanHis.MPFunding = mppalert.MPFunding; // bgMonPayPlanHis.MPPHisTime = DateTime.Now; // bgMonPayPlanHis.PIID = mppalert.PIID; // bgMonPayPlanHis.MPRemark = "修改"; // bgMonPayPlanHis.MPFundingAdd = mppalert.MPFundingAdd; // bgMonPayPlanHis.MPTime = mppalert.MPTime; // bgMonPayPlanHis.MPFundingAddTimes = mppalert.MPFundingAddTimes; // if (BG_MonPayPlan_HisManager.AddBG_MonPayPlan_His(bgMonPayPlanHis).MPPHis > 0) // { // GetGridPaneltotal(); // } X.Msg.Notify(new NotificationConfig() { Title = "申请月度用款计划", Html = string.Format(message, PIEcoSubName, oldValue, newValue), Width = 250 }).Show(); //return; //} } else if (hidflag.Text == "1") { X.Msg.Alert("申请月度用款计划", yearMonth + "月已经提交,不允许修改").Show(); rc.SetValue(rc.OldValue<float>()); return; } else if (hidflag.Text == "0") { string message = "<b>科目:</b> {0}<br /><b>原经费:</b> {1}<br /><b>更改经费:</b> {2}"; BG_MonPayPlan mpp = new BG_MonPayPlan(); mpp = BG_MonPayPlanManager.GetBG_MonPayPlanByCPID(CPID); if (mpp != null) { mpp.MPFundingAdd = newValue / 10000; mpp.MPFunding = mpp.MPFunding + (newValue) / 10000 - oldValue / 10000; mpp.MPFundingAddTimes = common.IntSafeConvert(cmbpici.SelectedItem.Value); BG_MonPayPlanManager.ModifyBG_MonPayPlan(mpp); // if (mpp.CPID > 0) // { // BG_MonPayPlan_His bgMonPayPlanHis = new BG_MonPayPlan_His(); // bgMonPayPlanHis.CPID = mpp.CPID; // bgMonPayPlanHis.DeptID = mpp.DeptID; // bgMonPayPlanHis.MPFunding = mpp.MPFunding; // bgMonPayPlanHis.MPPHisTime = DateTime.Now; // bgMonPayPlanHis.PIID = mpp.PIID; // bgMonPayPlanHis.MPRemark = "修改"; // bgMonPayPlanHis.MPFundingAdd = mpp.MPFundingAdd; // bgMonPayPlanHis.MPTime = mpp.MPTime; // bgMonPayPlanHis.MPFundingAddTimes = mpp.MPFundingAddTimes; // if (BG_MonPayPlan_HisManager.AddBG_MonPayPlan_His(bgMonPayPlanHis).MPPHis > 0) // { // GetGridPaneltotal(); // } // } X.Msg.Notify(new NotificationConfig() { Title = "申请月度用款计划", Html = string.Format(message, PIEcoSubName, oldValue, newValue), Width = 250 }).Show(); } else { mpp.MPRemark = ""; mpp.DeptID = DepID; mpp.PIID = piid; mpp.MPFundingAdd = newValue / 10000; mpp.MPFunding += newValue / 10000; mpp.MPTime = Convert.ToDateTime(CurrentYear + "-" + cmbmon.SelectedItem.Value + "-01"); mpp.MPFundingAddTimes = common.IntSafeConvert(cmbpici.SelectedItem.Value); BG_MonPayPlanManager.AddBG_MonPayPlan(mpp); // int cpid = BG_MonPayPlanManager.AddBG_MonPayPlan(mpp).CPID; // if (cpid > 0) // { // BG_MonPayPlan_His bgMonPayPlanHis = new BG_MonPayPlan_His(); // bgMonPayPlanHis.CPID = cpid; // bgMonPayPlanHis.DeptID = mpp.DeptID; // bgMonPayPlanHis.MPFunding = mpp.MPFunding; // bgMonPayPlanHis.MPPHisTime = DateTime.Now; // bgMonPayPlanHis.PIID = mpp.PIID; // bgMonPayPlanHis.MPRemark = "添加"; // bgMonPayPlanHis.MPFundingAdd = mpp.MPFundingAdd; // bgMonPayPlanHis.MPTime = mpp.MPTime; // bgMonPayPlanHis.MPFundingAddTimes = mpp.MPFundingAddTimes; // if (BG_MonPayPlan_HisManager.AddBG_MonPayPlan_His(bgMonPayPlanHis).MPPHis > 0) // { // GetGridPaneltotal(); // } // } X.Msg.Notify(new NotificationConfig() { Title = "申请月度用款计划", Html = string.Format(message, PIEcoSubName, oldValue, newValue), Width = 250 }).Show(); } } } } } else { if (newValue > Mon * 10000) { X.Msg.Alert("申请月度用款计划", "科目:" + PIEcoSubName + "经费不足,请调整经费").Show(); return; } string message = "<b>科目:</b> {0}<br /><b>原经费:</b> {1}<br /><b>更改经费:</b> {2}"; BG_MonPayPlan mpp = new BG_MonPayPlan(); mpp.DeptID = DepID; mpp.PIID = piid; mpp.MPFundingAdd = newValue / 10000; mpp.MPFunding += newValue / 10000; mpp.MPTime = Convert.ToDateTime(CurrentYear + "-" + cmbmon.SelectedItem.Value + "-01"); mpp.MPFundingAddTimes = 1; mpp.MPFundingAddTimes = common.IntSafeConvert(cmbpici.SelectedItem.Value); BG_MonPayPlanManager.AddBG_MonPayPlan(mpp); // int cpid = BG_MonPayPlanManager.AddBG_MonPayPlan(mpp).CPID; // if (cpid > 0) // { // BG_MonPayPlan_His bgMonPayPlanHis = new BG_MonPayPlan_His(); // bgMonPayPlanHis.CPID = cpid; // bgMonPayPlanHis.DeptID = mpp.DeptID; // bgMonPayPlanHis.MPFunding = mpp.MPFunding; // bgMonPayPlanHis.MPPHisTime = DateTime.Now; // bgMonPayPlanHis.PIID = mpp.PIID; // bgMonPayPlanHis.MPRemark = "添加"; // bgMonPayPlanHis.MPFundingAdd = mpp.MPFundingAdd; // bgMonPayPlanHis.MPTime = mpp.MPTime; // bgMonPayPlanHis.MPFundingAddTimes = mpp.MPFundingAddTimes; // if (BG_MonPayPlan_HisManager.AddBG_MonPayPlan_His(bgMonPayPlanHis).MPPHis > 0) // { // GetGridPaneltotal(); // } // // } hidflag.Text = "2"; X.Msg.Notify(new NotificationConfig() { Title = "申请月度用款计划", Html = string.Format(message, PIEcoSubName, oldValue, newValue), Width = 250 }).Show(); } } gettotal(); TPPlan.Listeners.AddScript("GettatolMon();"); }
//protected void GetSelect_DirectClick(object sender, DirectEventArgs e) //{ // string Strincome = Hidselector.Value.ToString(); // string[] income = Strincome.Split(','); // DataTable dt = null; // dt.Columns.Add(); // for (int i = 0; i < income.Count(); i++) // { // } //} protected void RemoteEdit(object sender, RemoteEditEventArgs e) { if (ParToDecimal.ParToDel(HidSupp.Text.ToString()) < 0 || ParToDecimal.ParToDel(HidBAA.Text.ToString()) < 0) { if (ParToDecimal.ParToDel(HidSupp.Text) < 0) { X.Msg.Alert("提示", "超过追加余额,请核实后修改数据!").Show(); return; } if (ParToDecimal.ParToDel(HidBAA.Text) < 0) { X.Msg.Alert("提示", "超过总余额,请核实后修改数据!").Show(); return; } } e.Accept = true; string[] idStrArr = HidSlist.Text.ToString().TrimEnd('&').Split('&'); List<int> slist = new List<int>(); foreach (string item in idStrArr) { int IntId = common.IntSafeConvert(item); if (!slist.Contains(IntId)) { slist.Add(IntId); } } int piid = common.IntSafeConvert(e.NodeID); RowChanges rc = e.Changes[0]; //if (rc.Value<float>() <= 0 && rc.OldValue<float>() <= 0) //{ // X.Msg.Alert("提示", "填写数字不能为0").Show(); // return; //} if (e.Json == null) { return; } if (!slist.Contains(piid)) { X.Msg.Alert("提示", "此处不可填写,请填写到正确位置").Show(); return; } else { int year = common.IntSafeConvert(CurrentYear); decimal baamon = 0; decimal suppmon = 0; BG_BudgetAllocation bg = BG_BudgetAllocationLogic.GetMonDT(year, piid, depid); if (bg == null) { BG_BudgetAllocation bgadd = new BG_BudgetAllocation(); foreach (RowChanges change in e.Changes) { if (change.Field == "BAAMon" && change.IsDirty<float>()) { bgadd.BAAMon = ParToDecimal.ParToDel(change.Value<float>().ToString()); baamon = ParToDecimal.ParToDel(HidBAA.Text.ToString()) - bgadd.BAAMon; if (baamon < 0) { X.Msg.Alert("提示", "超过总余额,请核实后修改数据!").Show(); rc.SetValue(rc.OldValue<float>()); return; } } else if (change.Field == "SuppMon" && change.IsDirty<float>()) { bgadd.SuppMon = ParToDecimal.ParToDel(change.Value<float>().ToString()); suppmon = ParToDecimal.ParToDel(HidSupp.Text) - bgadd.SuppMon; if (suppmon < 0) { X.Msg.Alert("提示", "超过追加余额,请核实后修改数据!").Show(); rc.SetValue(rc.OldValue<float>()); return; } } } bgadd.PIID = piid; bgadd.BAAYear = year; bgadd.DepID = depid; if (BG_BudgetAllocationManager.AddBG_BudgetAllocation(bgadd).BAAID>0) { BG_BudgetAllocationHis bgBudgetAllocationHis =new BG_BudgetAllocationHis(); bgBudgetAllocationHis.BAAID = bgadd.BAAID; bgBudgetAllocationHis.NewBAAMon = bgadd.BAAMon; bgBudgetAllocationHis.Crtime = DateTime.Now; bgBudgetAllocationHis.DepID = bgadd.DepID; bgBudgetAllocationHis.PIID = bgadd.PIID; bgBudgetAllocationHis.NewSuppMon = bgadd.SuppMon; bgBudgetAllocationHis.UserOp = UserName; bgBudgetAllocationHis.OldBAAMon = rc.Field == "BAAMon" && rc.IsDirty<float>() ? (decimal)rc.OldValue<float>() : bgadd.BAAMon; bgBudgetAllocationHis.OldSuppMon = rc.Field == "SuppMon" && rc.IsDirty<float>() ? (decimal)rc.OldValue<float>() : bgadd.SuppMon; bgBudgetAllocationHis.AddBAAMon = bgBudgetAllocationHis.NewBAAMon - bgBudgetAllocationHis.OldBAAMon; bgBudgetAllocationHis.AddSuppMon = bgBudgetAllocationHis.NewSuppMon - bgBudgetAllocationHis.OldSuppMon; bgBudgetAllocationHis.DepName = BG_DepartmentManager.GetBG_DepartmentByDepID(bgadd.DepID).DepName; BG_BudgetAllocationHisManager.AddBG_BudgetAllocationHis(bgBudgetAllocationHis); } DtDataBind(); //if (baamon < 0 || suppmon < 0) //{ // if (baamon > 0) // { // X.Msg.Alert("提示", "超过追加余额,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } // else if (suppmon > 0) // { // X.Msg.Alert("提示", "超过总余额,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } // else // { // X.Msg.Alert("提示", "追加余额或总余额不足,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } //} //else //{ // BG_BudgetAllocationManager.AddBG_BudgetAllocation(bgadd); // DtDataBind(); //} } else { decimal Mon = BG_MonPayPlanGenerateLogic.GetMonPayYear(piid, depid, year); decimal UseMon = BG_ApplyReimburLogic.GetARUseMon(piid, depid, year); //if (ParToDecimal.ParToDel(rc.OldValue<float>().ToString()) - ParToDecimal.ParToDel(rc.Value<float>().ToString())-(Mon - UseMon) > 0) //{ if (Mon>0) { X.Msg.Alert("提示", "分配金额小于期初分配金额,会影响月度用款申请及预算执行!").Show(); } foreach (RowChanges change in e.Changes) { if (change.Field == "BAAMon" && change.IsDirty<float>()) { bg.BAAMon = ParToDecimal.ParToDel(change.Value<float>().ToString()); baamon = ParToDecimal.ParToDel(HidBAA.Text.ToString()) + ParToDecimal.ParToDel(change.OldValue<float>().ToString()) - bg.BAAMon; if (baamon < 0) { X.Msg.Alert("提示", "超过总余额,请核实后修改数据!").Show(); rc.SetValue(rc.OldValue<float>()); return; } } else if (change.Field == "SuppMon" && change.IsDirty<float>()) { bg.SuppMon = ParToDecimal.ParToDel(change.Value<float>().ToString()); suppmon = ParToDecimal.ParToDel(HidSupp.Text.ToString()) + ParToDecimal.ParToDel(change.OldValue<float>().ToString()) - bg.SuppMon; if (suppmon < 0) { X.Msg.Alert("提示", "超过追加余额,请核实后修改数据!").Show(); rc.SetValue(rc.OldValue<float>()); return; } } } //} if (BG_BudgetAllocationManager.ModifyBG_BudgetAllocation(bg)) { BG_BudgetAllocationHis bgBudgetAllocationHis=new BG_BudgetAllocationHis(); bgBudgetAllocationHis.BAAID = bg.BAAID; bgBudgetAllocationHis.NewBAAMon = bg.BAAMon; bgBudgetAllocationHis.Crtime = DateTime.Now; bgBudgetAllocationHis.DepID = bg.DepID; bgBudgetAllocationHis.PIID = bg.PIID; bgBudgetAllocationHis.NewSuppMon = bg.SuppMon; bgBudgetAllocationHis.UserOp = UserName; bgBudgetAllocationHis.OldBAAMon = rc.Field == "BAAMon" && rc.IsDirty<float>() ? (decimal)rc.OldValue<float>() : bg.BAAMon; bgBudgetAllocationHis.OldSuppMon = rc.Field == "SuppMon" && rc.IsDirty<float>() ? (decimal)rc.OldValue<float>() : bg.SuppMon; bgBudgetAllocationHis.AddBAAMon = bgBudgetAllocationHis.NewBAAMon - bgBudgetAllocationHis.OldBAAMon; bgBudgetAllocationHis.AddSuppMon = bgBudgetAllocationHis.NewSuppMon - bgBudgetAllocationHis.OldSuppMon; bgBudgetAllocationHis.DepName = BG_DepartmentManager.GetBG_DepartmentByDepID(bg.DepID).DepName; BG_BudgetAllocationHisManager.AddBG_BudgetAllocationHis(bgBudgetAllocationHis); } DtDataBind(); //if (baamon < 0 || suppmon < 0) //{ // if (baamon > 0) // { // X.Msg.Alert("提示", "超过追加余额,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } // else if (suppmon > 0) // { // X.Msg.Alert("提示", "超过总余额,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } // else // { // X.Msg.Alert("提示", "追加余额或总余额不足,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } //} //else //{ // BG_BudgetAllocationManager.ModifyBG_BudgetAllocation(bg); // DtDataBind(); //} #region 8-8 修改后总分配额不能少于已经审核通过的金额 //if (Mon - ParToDecimal.ParToDel(rc.OldValue<float>().ToString()) + ParToDecimal.ParToDel(rc.Value<float>().ToString()) - UseMon < 0) //{ // X.Msg.Alert("提示", "修改后总分配额不能少于已经审核通过的金额").Show(); // rc.SetValue(rc.OldValue<float>()); //} //else //{ // foreach (RowChanges change in e.Changes) // { // if (change.Field == "BAAMon" && change.IsDirty<float>()) // { // bg.BAAMon = ParToDecimal.ParToDel(change.Value<float>().ToString()); // baamon = ParToDecimal.ParToDel(HidBAA.Text.ToString()) + ParToDecimal.ParToDel(change.OldValue<float>().ToString()) - bg.BAAMon; // } // else if (change.Field == "SuppMon" && change.IsDirty<float>()) // { // bg.SuppMon = ParToDecimal.ParToDel(change.Value<float>().ToString()); // suppmon = ParToDecimal.ParToDel(HidSupp.Text.ToString()) + ParToDecimal.ParToDel(change.OldValue<float>().ToString()) - bg.SuppMon; // } // } // if (baamon < 0 || suppmon < 0) // { // if (baamon > 0) // { // X.Msg.Alert("提示", "超过追加余额,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } // else if (suppmon > 0) // { // X.Msg.Alert("提示", "超过总余额,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } // else // { // X.Msg.Alert("提示", "追加余额或总余额不足,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } // } // else // { // BG_BudgetAllocationManager.ModifyBG_BudgetAllocation(bg); // DtDataBind(); // } //} #endregion } } HidBind(); TPPayIncome.Listeners.AddScript("GetTotal();"); }
//protected void GetSelect_DirectClick(object sender, DirectEventArgs e) //{ // string Strincome = Hidselector.Value.ToString(); // string[] income = Strincome.Split(','); // DataTable dt = null; // dt.Columns.Add(); // for (int i = 0; i < income.Count(); i++) // { // } //} protected void RemoteEdit(object sender, RemoteEditEventArgs e) { if (ParToDecimal.ParToDel(HidSupp.Text.ToString()) < 0 || ParToDecimal.ParToDel(HidBAA.Text.ToString()) < 0) { if (ParToDecimal.ParToDel(HidSupp.Text) < 0) { X.Msg.Alert("提示", "超过追加余额,请核实后修改数据!").Show(); return; } if (ParToDecimal.ParToDel(HidBAA.Text) < 0) { X.Msg.Alert("提示", "超过总余额,请核实后修改数据!").Show(); return; } } e.Accept = true; string[] idStrArr = HidSlist.Text.ToString().TrimEnd('&').Split('&'); List <int> slist = new List <int>(); foreach (string item in idStrArr) { int IntId = common.IntSafeConvert(item); if (!slist.Contains(IntId)) { slist.Add(IntId); } } int piid = common.IntSafeConvert(e.NodeID); RowChanges rc = e.Changes[0]; //if (rc.Value<float>() <= 0 && rc.OldValue<float>() <= 0) //{ // X.Msg.Alert("提示", "填写数字不能为0").Show(); // return; //} if (e.Json == null) { return; } if (!slist.Contains(piid)) { X.Msg.Alert("提示", "此处不可填写,请填写到正确位置").Show(); return; } else { int year = common.IntSafeConvert(CurrentYear); decimal baamon = 0; decimal suppmon = 0; BG_BudgetAllocation bg = BG_BudgetAllocationLogic.GetMonDT(year, piid, depid); if (bg == null) { BG_BudgetAllocation bgadd = new BG_BudgetAllocation(); foreach (RowChanges change in e.Changes) { if (change.Field == "BAAMon" && change.IsDirty <float>()) { bgadd.BAAMon = ParToDecimal.ParToDel(change.Value <float>().ToString()); baamon = ParToDecimal.ParToDel(HidBAA.Text.ToString()) - bgadd.BAAMon; if (baamon < 0) { X.Msg.Alert("提示", "超过总余额,请核实后修改数据!").Show(); rc.SetValue(rc.OldValue <float>()); return; } } else if (change.Field == "SuppMon" && change.IsDirty <float>()) { bgadd.SuppMon = ParToDecimal.ParToDel(change.Value <float>().ToString()); suppmon = ParToDecimal.ParToDel(HidSupp.Text) - bgadd.SuppMon; if (suppmon < 0) { X.Msg.Alert("提示", "超过追加余额,请核实后修改数据!").Show(); rc.SetValue(rc.OldValue <float>()); return; } } } bgadd.PIID = piid; bgadd.BAAYear = year; bgadd.DepID = depid; if (BG_BudgetAllocationManager.AddBG_BudgetAllocation(bgadd).BAAID > 0) { BG_BudgetAllocationHis bgBudgetAllocationHis = new BG_BudgetAllocationHis(); bgBudgetAllocationHis.BAAID = bgadd.BAAID; bgBudgetAllocationHis.NewBAAMon = bgadd.BAAMon; bgBudgetAllocationHis.Crtime = DateTime.Now; bgBudgetAllocationHis.DepID = bgadd.DepID; bgBudgetAllocationHis.PIID = bgadd.PIID; bgBudgetAllocationHis.NewSuppMon = bgadd.SuppMon; bgBudgetAllocationHis.UserOp = UserName; bgBudgetAllocationHis.OldBAAMon = rc.Field == "BAAMon" && rc.IsDirty <float>() ? (decimal)rc.OldValue <float>() : bgadd.BAAMon; bgBudgetAllocationHis.OldSuppMon = rc.Field == "SuppMon" && rc.IsDirty <float>() ? (decimal)rc.OldValue <float>() : bgadd.SuppMon; bgBudgetAllocationHis.AddBAAMon = bgBudgetAllocationHis.NewBAAMon - bgBudgetAllocationHis.OldBAAMon; bgBudgetAllocationHis.AddSuppMon = bgBudgetAllocationHis.NewSuppMon - bgBudgetAllocationHis.OldSuppMon; bgBudgetAllocationHis.DepName = BG_DepartmentManager.GetBG_DepartmentByDepID(bgadd.DepID).DepName; BG_BudgetAllocationHisManager.AddBG_BudgetAllocationHis(bgBudgetAllocationHis); } DtDataBind(); //if (baamon < 0 || suppmon < 0) //{ // if (baamon > 0) // { // X.Msg.Alert("提示", "超过追加余额,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } // else if (suppmon > 0) // { // X.Msg.Alert("提示", "超过总余额,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } // else // { // X.Msg.Alert("提示", "追加余额或总余额不足,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } //} //else //{ // BG_BudgetAllocationManager.AddBG_BudgetAllocation(bgadd); // DtDataBind(); //} } else { decimal Mon = BG_MonPayPlanGenerateLogic.GetMonPayYear(piid, depid, year); decimal UseMon = BG_ApplyReimburLogic.GetARUseMon(piid, depid, year); //if (ParToDecimal.ParToDel(rc.OldValue<float>().ToString()) - ParToDecimal.ParToDel(rc.Value<float>().ToString())-(Mon - UseMon) > 0) //{ if (Mon > 0) { X.Msg.Alert("提示", "分配金额小于期初分配金额,会影响月度用款申请及预算执行!").Show(); } foreach (RowChanges change in e.Changes) { if (change.Field == "BAAMon" && change.IsDirty <float>()) { bg.BAAMon = ParToDecimal.ParToDel(change.Value <float>().ToString()); baamon = ParToDecimal.ParToDel(HidBAA.Text.ToString()) + ParToDecimal.ParToDel(change.OldValue <float>().ToString()) - bg.BAAMon; if (baamon < 0) { X.Msg.Alert("提示", "超过总余额,请核实后修改数据!").Show(); rc.SetValue(rc.OldValue <float>()); return; } } else if (change.Field == "SuppMon" && change.IsDirty <float>()) { bg.SuppMon = ParToDecimal.ParToDel(change.Value <float>().ToString()); suppmon = ParToDecimal.ParToDel(HidSupp.Text.ToString()) + ParToDecimal.ParToDel(change.OldValue <float>().ToString()) - bg.SuppMon; if (suppmon < 0) { X.Msg.Alert("提示", "超过追加余额,请核实后修改数据!").Show(); rc.SetValue(rc.OldValue <float>()); return; } } } //} if (BG_BudgetAllocationManager.ModifyBG_BudgetAllocation(bg)) { BG_BudgetAllocationHis bgBudgetAllocationHis = new BG_BudgetAllocationHis(); bgBudgetAllocationHis.BAAID = bg.BAAID; bgBudgetAllocationHis.NewBAAMon = bg.BAAMon; bgBudgetAllocationHis.Crtime = DateTime.Now; bgBudgetAllocationHis.DepID = bg.DepID; bgBudgetAllocationHis.PIID = bg.PIID; bgBudgetAllocationHis.NewSuppMon = bg.SuppMon; bgBudgetAllocationHis.UserOp = UserName; bgBudgetAllocationHis.OldBAAMon = rc.Field == "BAAMon" && rc.IsDirty <float>() ? (decimal)rc.OldValue <float>() : bg.BAAMon; bgBudgetAllocationHis.OldSuppMon = rc.Field == "SuppMon" && rc.IsDirty <float>() ? (decimal)rc.OldValue <float>() : bg.SuppMon; bgBudgetAllocationHis.AddBAAMon = bgBudgetAllocationHis.NewBAAMon - bgBudgetAllocationHis.OldBAAMon; bgBudgetAllocationHis.AddSuppMon = bgBudgetAllocationHis.NewSuppMon - bgBudgetAllocationHis.OldSuppMon; bgBudgetAllocationHis.DepName = BG_DepartmentManager.GetBG_DepartmentByDepID(bg.DepID).DepName; BG_BudgetAllocationHisManager.AddBG_BudgetAllocationHis(bgBudgetAllocationHis); } DtDataBind(); //if (baamon < 0 || suppmon < 0) //{ // if (baamon > 0) // { // X.Msg.Alert("提示", "超过追加余额,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } // else if (suppmon > 0) // { // X.Msg.Alert("提示", "超过总余额,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } // else // { // X.Msg.Alert("提示", "追加余额或总余额不足,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } //} //else //{ // BG_BudgetAllocationManager.ModifyBG_BudgetAllocation(bg); // DtDataBind(); //} #region 8-8 修改后总分配额不能少于已经审核通过的金额 //if (Mon - ParToDecimal.ParToDel(rc.OldValue<float>().ToString()) + ParToDecimal.ParToDel(rc.Value<float>().ToString()) - UseMon < 0) //{ // X.Msg.Alert("提示", "修改后总分配额不能少于已经审核通过的金额").Show(); // rc.SetValue(rc.OldValue<float>()); //} //else //{ // foreach (RowChanges change in e.Changes) // { // if (change.Field == "BAAMon" && change.IsDirty<float>()) // { // bg.BAAMon = ParToDecimal.ParToDel(change.Value<float>().ToString()); // baamon = ParToDecimal.ParToDel(HidBAA.Text.ToString()) + ParToDecimal.ParToDel(change.OldValue<float>().ToString()) - bg.BAAMon; // } // else if (change.Field == "SuppMon" && change.IsDirty<float>()) // { // bg.SuppMon = ParToDecimal.ParToDel(change.Value<float>().ToString()); // suppmon = ParToDecimal.ParToDel(HidSupp.Text.ToString()) + ParToDecimal.ParToDel(change.OldValue<float>().ToString()) - bg.SuppMon; // } // } // if (baamon < 0 || suppmon < 0) // { // if (baamon > 0) // { // X.Msg.Alert("提示", "超过追加余额,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } // else if (suppmon > 0) // { // X.Msg.Alert("提示", "超过总余额,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } // else // { // X.Msg.Alert("提示", "追加余额或总余额不足,请核实后修改数据!").Show(); // rc.SetValue(rc.OldValue<float>()); // } // } // else // { // BG_BudgetAllocationManager.ModifyBG_BudgetAllocation(bg); // DtDataBind(); // } //} #endregion } } HidBind(); TPPayIncome.Listeners.AddScript("GetTotal();"); }