コード例 #1
0
ファイル: AcceptJson.aspx.cs プロジェクト: flxc11/TerminalMS
        private void Delete()
        {
            string guidList = Request.Params["AcceptGuid"];
            string rslt = string.Empty;
            if (!string.IsNullOrEmpty(guidList))
            {
                Hashtable hs = new Hashtable();
                HD.Model.AD ad = new HD.Model.AD();
                HD.Model.Publish publish = new HD.Model.Publish();
                string[] guid = guidList.Split(',');
                foreach (var item in guid)
                {
                    //accept.AcceptGuid = item;
                    hs.Clear();
                    hs.Add("AcceptGuid", item);
                    HD.Model.AcceptForm accept = HD.Model.AcceptForm.Instance.GetModelById(hs);
                    try
                    {
                        accept.Delete(accept.AcceptGuid);
                        ad.Delete(accept.ADGuid);
                        hs.Clear();
                        hs.Add("ADGuid", accept.ADGuid);
                        publish.Delete(hs);
                        rslt = "1";
                    }
                    catch (Exception e)
                    {
                        rslt = "0";
                    }
                    finally
                    {

                    }
                }
                Response.Write("{\"result\":\"" + rslt + "\"}");
                Response.End();
            }
        }
コード例 #2
0
ファイル: AcceptAdd.aspx.cs プロジェクト: flxc11/TerminalMS
        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");

        }