private void Save() { HD.Model.Client client = new HD.Model.Client(); client.UpdateModel(); client.ClientPGuid = Public.GetGuID; client.ClientPostTime = DateTime.Now; client.Insert(); MessageBox.ShowMessage("客户添加成功!", "clientadd.aspx"); }
private void AddAccept() { string adArea = Request.Params["checkTermi"]; //受理单内容 HD.Model.AcceptForm accept = new HD.Model.AcceptForm(); HD.Model.AD ad = new HD.Model.AD(); HD.Model.Client client = new HD.Model.Client(); HD.Model.Publish publish = new HD.Model.Publish(); accept.UpdateModel(); ad.UpdateModel(); client.UpdateModel(); publish.UpdateModel(); accept.AcceptGuid = Public.GetGuID; ad.ADPGuid = Public.GetGuID; //获取广告投放区域 //string areaId = string.Empty; //foreach (ListItem item in CheckBoxList1.Items) //{ // if (item.Selected) // { // areaId += item.Value + ","; // } //} //areaId = areaId.Substring(0, areaId.Length - 1); if (!string.IsNullOrEmpty(adArea)) { adArea = "," + adArea + ","; } ad.ADArea = adArea; accept.ADGuid = ad.ADPGuid; accept.Status = 0; //客户信息插入或更新 Hashtable hs = new Hashtable(); hs.Add("ClientName", client.ClientName); //如果客户已存在,则更新客户信息,并且获取已存在的ClientPGuid插入到AcceptForm的ClientGuid里面 if (client.IsExist(hs)) { client.Update( "ClientName='" + client.ClientName + "',Tel='" + client.Tel + "',Mobile='" + client.Mobile + "',Operator='" + client.Operator + "',AgencyCompany='" + client.AgencyCompany + "'", " and ClientName ='" + client.ClientName + "'"); HD.Model.Client newClient = HD.Model.Client.Instance.GetModelById(hs); accept.ClientGuid = newClient.ClientPGuid; } else { client.ClientPGuid = Public.GetGuID; client.ClientPostTime = DateTime.Now; client.Insert(); accept.ClientGuid = client.ClientPGuid; } if (string.IsNullOrEmpty(accept.TotalPrice)) { accept.TotalPrice = "0"; } if (string.IsNullOrEmpty(accept.Discount.ToString())) { accept.Discount = 0; } //广告内容 publish.ADGuid = ad.ADPGuid; publish.PublishType = Request.Params["CheckBoxList2"]; publish.PublishQuantity = pubNum; HD.Data.AcceptForm bll = new HD.Data.AcceptForm(); bll.Add(accept, ad, publish); MessageBox.ShowMessage("受理单信息添加成功!", "AcceptAdd.aspx"); }