protected void btn_AddSite_Click(object sender, EventArgs e)
        {
            if (Session["User"] == null)
            {
                if (txt_UserName.Text == "")
                {
                    JScript.ShowMessage(this, "请先登陆!");
                    return;
                }
                else
                {
                    CheckUser();
                }
            }
            TuanSite model = new TuanSite();

            model.UserID   = TryConvert.ToInt32(Session["User"]);
            model.CityID   = Utils.GetFormInt("ddl_City");
            model.SiteName = txt_SiteName.Value;
            model.SiteUrl  = txt_SiteUrl.Value;
            if (model.SiteUrl.EndsWith("/"))
            {
                model.SiteUrl = model.SiteUrl.TrimEnd('/');
            }
            model.LogoUrl  = txt_LogoUrl.Value;
            model.ApiUrl   = txt_ApiUrl.Value;
            model.QQ       = txt_QQ.Value;
            model.SiteType = rdb_SiteType_1.Checked == true ? (byte)1 : (byte)0;
            model.Rank     = TryConvert.ToByte(txt_Rank.Value);
            model.Trust    = TryConvert.ToByte(txt_Trust.Value);

            model.Description   = string.Empty;
            model.Master        = string.Empty;
            model.ContactPerson = string.Empty;
            model.Phone         = string.Empty;
            model.Email         = string.Empty;
            model.OpenDate      = DateTime.Now;
            model.AddDate       = DateTime.Now;
            model.IsVerify      = (byte)1;

            int ret = TuanSiteDAO.Instance.Add(model);

            if (ret > 0)
            {
                JScript.ShowMessage(this, "添加成功!");
            }
            else
            {
                JScript.ShowMessage(this, "添加失败!");
            }
        }
Exemple #2
0
        private void AddTuanGou()
        {
            TuanGou tuanGou = new TuanGou();

            tuanGou.Title           = Utils.GetFormString("txt_Title");
            tuanGou.CityID          = Utils.GetFormInt("ddl_City");
            tuanGou.SiteID          = Utils.GetFormInt("hid_SiteID");
            tuanGou.CategoryID      = Utils.GetFormInt("ddl_Category");
            tuanGou.Description     = Utils.GetFormString("txt_Description"); //如果有包含html标记需要htmldecode
            tuanGou.MarketPrice     = TryConvert.ToDecimal(Request.Form["txt_MarketPrice"]);
            tuanGou.TuanPrice       = TryConvert.ToDecimal(Request.Form["txt_TuanPrice"]);
            tuanGou.Rebate          = TryConvert.ToSingle(Request.Form["txt_Rebate"]);
            tuanGou.TotalCount      = Utils.GetFormInt("txt_TotalCount");
            tuanGou.BuyCount        = Utils.GetFormInt("txt_BuyCount");
            tuanGou.ClickCount      = Utils.GetFormInt("txt_ClickCount");
            tuanGou.CommentCount    = Utils.GetFormInt("txt_CommentCount");
            tuanGou.PointCount      = Utils.GetFormInt("txt_PointCount");
            tuanGou.BeginTime       = Convert.ToDateTime(Request.Form["txt_BeginTime"]);
            tuanGou.EndTime         = Convert.ToDateTime(Request.Form["txt_EndTime"]);
            tuanGou.TuanUrl         = Utils.GetFormString("txt_TuanUrl");
            tuanGou.ImageThumbUrl   = Utils.GetFormString("txt_ImageThumbUrl");
            tuanGou.ImageUrl        = Utils.GetFormString("txt_ImageUrl");
            tuanGou.MerchantName    = Utils.GetFormString("txt_MerchantName");
            tuanGou.MerchantPhone   = Utils.GetFormString("txt_MerchantPhone");
            tuanGou.MerchantAddress = Utils.GetFormString("txt_MerchantAddress");
            tuanGou.Longitude       = TryConvert.ToDouble(Request.Form["txt_Longitude"]);
            tuanGou.Latitude        = TryConvert.ToDouble(Request.Form["txt_Latitude"]);
            tuanGou.Rank            = TryConvert.ToByte(Request.Form["txt_Rank"]);
            tuanGou.OrderID         = Utils.GetFormInt("txt_OrderID");
            tuanGou.Statu           = TryConvert.ToByte(Request.Form["rdo_Statu"]);
            tuanGou.AddDate         = DateTime.Now;

            int result;

            tuanID = Utils.GetQueryInt("ID");
            if (tuanID < 1)
            {
                tuanGou.UserID = loginUser.UserID;
                result         = TuanGouDAO.Instance.Add(tuanGou);
            }
            else
            {
                tuanGou.TuanID = tuanID;
                result         = TuanGouDAO.Instance.Update(tuanGou);
            }

            Ajax.Message(result);
        }
        private void AddSite()
        {
            TuanSite model = new TuanSite();

            model.SiteID   = Utils.GetQueryInt("ID");
            model.UserID   = loginUser.UserID;
            model.CityID   = Utils.GetFormInt("ddl_City");
            model.SiteName = Utils.GetFormString("txt_SiteName");
            model.SiteUrl  = Utils.GetFormString("txt_SiteUrl");
            if (model.SiteUrl.EndsWith("/"))
            {
                model.SiteUrl = model.SiteUrl.TrimEnd('/');
            }
            model.LogoUrl   = Utils.GetFormString("txt_LogoUrl");
            model.ApiTypeID = (byte)Utils.GetFormInt("ddl_ApiTypeID");
            model.ApiUrl    = Utils.GetFormString("txt_ApiUrl");
            model.QQ        = Utils.GetFormString("txt_QQ");
            model.SiteType  = 1; //Utils.GetFormString("rdo_SiteType");
            model.Rank      = TryConvert.ToByte(Utils.GetFormInt("txt_Rank"));
            model.Trust     = TryConvert.ToByte(Utils.GetFormInt("txt_Trust"));

            model.Description   = string.Empty;
            model.Master        = string.Empty;
            model.ContactPerson = string.Empty;
            model.Phone         = string.Empty;
            model.Email         = string.Empty;
            model.OpenDate      = DateTime.Now;
            model.AddDate       = DateTime.Now;
            model.IsVerify      = 1;

            int result = 0;

            if (model.SiteID > 0)
            {
                result = TuanSiteDAO.Instance.Update(model);
            }
            else
            {
                result = TuanSiteDAO.Instance.Add(model);
            }
            Ajax.Message(result);
        }