private string updateaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); int flag = 0; try { Business.Base.BusinessService bs = new project.Business.Base.BusinessService(); bs.load(jp.getValue("id")); collection.Add(new JsonStringValue("data", JsonConvert.SerializeObject(bs.Entity))); } catch (Exception ex) { flag = 2; collection.Add(new JsonStringValue("ex", ex.ToString())); } collection.Add(new JsonStringValue("type", "update")); collection.Add(new JsonNumericValue("flag", flag)); return(collection.ToString()); }
private string deleteaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); int flag = 0; try { Business.Base.BusinessService bs = new project.Business.Base.BusinessService(); bs.load(jp.getValue("id")); if (bs.delete() <= 0) { flag = 1; } } catch (Exception ex) { flag = 2; collection.Add(new JsonStringValue("ex", ex.ToString())); } collection.Add(new JsonStringValue("type", "delete")); collection.Add(new JsonNumericValue("flag", flag)); return(collection.ToString()); }
private string validaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); int flag = 0; try { Business.Base.BusinessService bc = new project.Business.Base.BusinessService(); bc.load(jp.getValue("id")); bc.Entity.SRVStatus = !bc.Entity.SRVStatus; if (bc.valid() <= 0) { flag = 1; } else { if (bc.Entity.SRVStatus) { collection.Add(new JsonStringValue("stat", "<span class=\"label label-success radius\">有效</span>")); } else { collection.Add(new JsonStringValue("stat", "<span class=\"label radius\">已失效</span>")); } } } catch (Exception ex) { flag = 2; collection.Add(new JsonStringValue("ex", ex.ToString())); } collection.Add(new JsonStringValue("id", jp.getValue("id"))); collection.Add(new JsonStringValue("type", "valid")); collection.Add(new JsonNumericValue("flag", flag)); return(collection.ToString()); }
public string GenOrderFromConferenceRepair(string ResourceNo, string ResourceName, decimal amount, string Remark, string KEY) { if (KEY != "6E5F0C851FD4") { return(""); } string InfoMsg = ""; try { string prefix = GetDate().ToString("yyyyMM"); string OrderNo = ""; DataTable dt = obj.PopulateDataSet("select top 1 OrderNo from Op_OrderHeader where OrderNo like '" + prefix + "%' order by OrderNo desc").Tables[0]; if (dt.Rows.Count > 0) { try { long num = long.Parse(dt.Rows[0]["OrderNo"].ToString()); OrderNo = (num + 1).ToString(); } catch { OrderNo = prefix + "00001"; } } else { OrderNo = prefix + "00001"; } DateTime now = GetDate(); string id = System.Guid.NewGuid().ToString(); project.Business.Op.BusinessOrderHeader bc = new project.Business.Op.BusinessOrderHeader(); bc.Entity.RowPointer = id; bc.Entity.OrderNo = OrderNo; bc.Entity.OrderType = "10"; bc.Entity.CustNo = "22222"; bc.Entity.OrderTime = now.AddDays(-now.Day + 1); bc.Entity.DaysofMonth = ParseDateForString(now.AddMonths(1).ToString("yyyy-MM") + "-01").AddDays(-1).Day; bc.Entity.ARDate = now; bc.Entity.ARAmount = amount; bc.Entity.ReduceAmount = 0; bc.Entity.PaidinAmount = 0; bc.Entity.Remark = Remark; bc.Entity.OrderCreator = "艾众管家"; bc.Entity.OrderCreateDate = now; bc.Entity.OrderLastReviser = "艾众管家"; bc.Entity.OrderLastRevisedDate = now; bc.Entity.OrderStatus = "0"; bc.Save("insert"); project.Business.Base.BusinessService bs = new project.Business.Base.BusinessService(); bs.load("HYSZJ-59"); project.Business.Op.BusinessOrderDetail detail = new project.Business.Op.BusinessOrderDetail(); detail.Entity.RefRP = id; detail.Entity.ODSRVTypeNo1 = bs.Entity.SRVTypeNo1; detail.Entity.ODSRVTypeNo2 = bs.Entity.SRVTypeNo2; detail.Entity.ODSRVNo = bs.Entity.SRVNo; detail.Entity.ODContractSPNo = bs.Entity.SRVSPNo; detail.Entity.ResourceNo = ResourceNo; detail.Entity.ResourceName = ResourceName; detail.Entity.ODFeeStartDate = now; detail.Entity.ODFeeEndDate = now; detail.Entity.BillingDays = 1; detail.Entity.ODQTY = 1; detail.Entity.ODUnit = ""; detail.Entity.ODUnitPrice = amount; detail.Entity.ODARAmount = amount; detail.Entity.ODCANo = bs.Entity.CANo; detail.Entity.ODCreator = "艾众管家"; detail.Entity.ODCreateDate = now; detail.Entity.ODLastReviser = "艾众管家"; detail.Entity.ODLastRevisedDate = now; detail.Entity.ODTaxRate = bs.Entity.SRVTaxRate; detail.Entity.ODTaxAmount = amount - Math.Round(amount / (1 + bs.Entity.SRVTaxRate), 2); detail.Save(); } catch (Exception ex) { InfoMsg = ex.Message; } return(InfoMsg); }