Exemplo n.º 1
0
        protected void Unnamed1_Click(object sender, EventArgs e)
        {
            SYS_DistrictMod m_area = new SYS_DistrictMod();

            if (type == "EDIT")
            {
                if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
                {
                    SysNo = int.Parse(Request.QueryString["id"]);
                }
                m_area = SYS_DistrictBll.GetInstance().GetModel(SysNo);
            }
            try
            {
                m_area.Name        = txtName.Text.Trim();
                m_area.EnglishName = txtEnglishName.Text.Trim();
                m_area.DR          = int.Parse(drpStatus.SelectedValue);
                SYS_DistrictBll.GetInstance().Update(m_area);
                LogManagement.getInstance().WriteTrace(m_area.SysNo, "District.Update", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username);

                ltrNotice.Text = "该记录已保存成功!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true);
            }
            catch
            {
                ltrError.Text = "输入资料格式有误,请检查!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                return;
            }
        }
Exemplo n.º 2
0
        public SYS_DistrictMod GetNearestByPoi(string lng, string lat)
        {
            DataTable       table  = new DataTable();
            SYS_DistrictMod m_dist = new SYS_DistrictMod();

            using (SQLData data = new SQLData())
            {
                StringBuilder builder = new StringBuilder();
                builder.Append(@"select top 1 sysno 
                 from [Sys_District] where level=3 and englishname is null and ABS([longitude]-").Append(SQLData.SQLFilter(lng)).Append(")<3 and ABS([Latitude]-").Append(SQLData.SQLFilter(lat)).Append(")<3 order by SQUARE([longitude]-").Append(SQLData.SQLFilter(lng)).Append(")+ SQUARE([Latitude]-").Append(SQLData.SQLFilter(lat)).Append(")");

                //try
                //{
                table = data.CmdtoDataTable(builder.ToString());
                //}
                //catch (Exception exception)
                //{
                //    throw exception;
                //}
                if (table.Rows.Count > 0)
                {
                    m_dist      = GetModel(int.Parse(table.Rows[0]["sysno"].ToString()));
                    table       = data.CmdtoDataTable("select * from [District3Level] where SysNo3=" + m_dist.SysNo);
                    m_dist.Name = (table.Rows[0]["Name1"].ToString() + "-" + table.Rows[0]["Name2"].ToString() + "-" + table.Rows[0]["Name3"].ToString()).Replace("市辖区-", "");
                }
                else
                {
                    return(null);
                }
            }
            return(m_dist);
        }
Exemplo n.º 3
0
        protected void PrepareForm()
        {
            if (type == "EDIT")
            {
                if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
                {
                    try
                    {
                        SysNo = int.Parse(Request.QueryString["id"]);
                        SYS_DistrictMod m_area = SYS_DistrictBll.GetInstance().GetModel(SysNo);
                        ltrParent.Text          = "";
                        txtName.Text            = m_area.Name;
                        txtEnglishName.Text     = m_area.EnglishName;
                        drpStatus.SelectedIndex = drpStatus.Items.IndexOf(drpStatus.Items.FindByValue(m_area.DR.ToString()));

                        DataTable m_child = SYS_DistrictBll.GetInstance().GetSubLevel(SysNo);
                        rptFamous.DataSource = m_child;
                        rptFamous.DataBind();

                        if (m_area.Level == 3)
                        {
                            DataTable m_parent = SYS_DistrictBll.GetInstance().GetTreeDetail(SysNo);
                            if (m_parent.Rows.Count > 0)
                            {
                                ltrParent.Text = m_parent.Rows[0]["Name1"].ToString() + "—" + m_parent.Rows[0]["Name2"].ToString() + "—" + m_parent.Rows[0]["Name3"].ToString();
                            }
                        }
                        else if (m_area.Level == 2)
                        {
                            DataTable m_parent = SYS_DistrictBll.GetInstance().GetTreeDetail(SysNo);
                            if (m_parent.Rows.Count > 0)
                            {
                                ltrParent.Text = m_parent.Rows[0]["Name1"].ToString() + "—" + m_parent.Rows[0]["Name2"].ToString();
                            }
                        }
                        else if (m_area.Level == 1)
                        {
                            ltrParent.Text = "此地区为一级地区";
                        }
                        fieldset1.Style["display"] = "";
                        fieldset2.Style["display"] = "";
                    }
                    catch
                    {
                        Response.Redirect("../Error.aspx?msg=");
                        return;
                    }
                }
            }
            else if (type == "TOP")
            {
                DataTable m_child = SYS_DistrictBll.GetInstance().GetFirstLevel(0);
                rptFamous.DataSource = m_child;
                rptFamous.DataBind();
                fieldset1.Style["display"] = "none";
                fieldset2.Style["display"] = "none";
            }
        }
Exemplo n.º 4
0
 protected void drpDistrict3_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (drpDistrict3.SelectedValue != "0")
     {
         SYS_DistrictMod m_area = SYS_DistrictBll.GetInstance().GetModel(int.Parse(drpDistrict3.SelectedValue));
         lblPosition.Text    = "北纬" + m_area.Latitude + ",东经" + m_area.longitude;
         lblPosition.Visible = true;
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>

        public SYS_DistrictMod GetModel(int SysNo)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select SysNo, UpSysNo, Name, EnglishName, Level, UseType, DR, TS, Latitude, longitude, TopSysNo from  SYS_District");
            strSql.Append(" where SysNo=@SysNo ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@SysNo", SqlDbType.Int, 4)
            };
            parameters[0].Value = SysNo;
            SYS_DistrictMod model = new SYS_DistrictMod();
            DataSet         ds    = SqlHelper.ExecuteDataSet(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["SysNo"].ToString() != "")
                {
                    model.SysNo = int.Parse(ds.Tables[0].Rows[0]["SysNo"].ToString());
                }
                if (ds.Tables[0].Rows[0]["UpSysNo"].ToString() != "")
                {
                    model.UpSysNo = int.Parse(ds.Tables[0].Rows[0]["UpSysNo"].ToString());
                }
                model.Name        = ds.Tables[0].Rows[0]["Name"].ToString();
                model.EnglishName = ds.Tables[0].Rows[0]["EnglishName"].ToString();
                if (ds.Tables[0].Rows[0]["Level"].ToString() != "")
                {
                    model.Level = int.Parse(ds.Tables[0].Rows[0]["Level"].ToString());
                }
                if (ds.Tables[0].Rows[0]["UseType"].ToString() != "")
                {
                    model.UseType = int.Parse(ds.Tables[0].Rows[0]["UseType"].ToString());
                }
                if (ds.Tables[0].Rows[0]["DR"].ToString() != "")
                {
                    model.DR = int.Parse(ds.Tables[0].Rows[0]["DR"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TS"].ToString() != "")
                {
                    model.TS = DateTime.Parse(ds.Tables[0].Rows[0]["TS"].ToString());
                }
                model.Latitude  = ds.Tables[0].Rows[0]["Latitude"].ToString();
                model.longitude = ds.Tables[0].Rows[0]["longitude"].ToString();
                if (ds.Tables[0].Rows[0]["TopSysNo"].ToString() != "")
                {
                    model.TopSysNo = int.Parse(ds.Tables[0].Rows[0]["TopSysNo"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 6
0
 protected void drpDistrict3_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (drpDistrict3.SelectedValue != "0")
     {
         m_area                = SYS_DistrictBll.GetInstance().GetModel(int.Parse(drpDistrict3.SelectedValue));
         ltrLatLng.Text        = "北纬" + m_area.Latitude + " 东经" + m_area.longitude;
         ltrLatLng.Visible     = true;
         ViewState["district"] = m_area;
     }
     //ScriptManager.RegisterStartupScript(drpDistrict3, this.GetType(), "refreshdrop", "$(function () { $('.select_item').scrollablecombo(); });", true);
 }
Exemplo n.º 7
0
        public ReturnValue <SYS_DistrictMod> GetDistrictByPoi(string longitude, string latitude)
        {
            if (string.IsNullOrEmpty(longitude) || string.IsNullOrEmpty(latitude))
            {
                throw new BusinessException("经纬度不可为空");
            }

            SYS_DistrictMod m_dist = SYS_DistrictBll.GetInstance().GetNearestByPoi(longitude, latitude);

            if (m_dist == null)
            {
                throw new BusinessException("无法搜到结果!");
            }
            return(ReturnValue <SYS_DistrictMod> .Get200OK(m_dist));
        }
Exemplo n.º 8
0
 public LatLng(SYS_DistrictMod area)
 {
     try
     {
         _area = area;
         latitude = decimal.Parse(area.Latitude);
         longitude = decimal.Parse(area.longitude);
         if (latitude < 0)
         {
             Lat = (0 - latitude).ToString("0.00").Replace(".", "S");
         }
         else
         {
             Lat = latitude.ToString("0.00").Replace(".", "N");
         }
         if (longitude < 0)
         {
             Lng = (0 - longitude).ToString("0.00").Replace(".", "W");
         }
         else
         {
             Lng = longitude.ToString("0.00").Replace(".", "E");
         }
         DataTable m_dt = SYS_DistrictBll.GetInstance().GetTreeDetail(area.SysNo);
         StringBuilder m_sb = new StringBuilder();
         m_sb.Append(m_dt.Rows[0]["Name1"].ToString());
         if (!string.IsNullOrEmpty(m_dt.Rows[0]["Name2"].ToString()))
         {
             m_sb.Append("-").Append(m_dt.Rows[0]["Name2"].ToString());
         }
         if (!string.IsNullOrEmpty(m_dt.Rows[0]["Name3"].ToString()))
         {
             m_sb.Append("-").Append(m_dt.Rows[0]["Name3"].ToString());
         }
         name = m_sb.ToString();
     }
     catch { }
 }
Exemplo n.º 9
0
 public LatLng(SYS_DistrictMod area)
 {
     try
     {
         _area     = area;
         latitude  = decimal.Parse(area.Latitude);
         longitude = decimal.Parse(area.longitude);
         if (latitude < 0)
         {
             Lat = (0 - latitude).ToString("0.00").Replace(".", "S");
         }
         else
         {
             Lat = latitude.ToString("0.00").Replace(".", "N");
         }
         if (longitude < 0)
         {
             Lng = (0 - longitude).ToString("0.00").Replace(".", "W");
         }
         else
         {
             Lng = longitude.ToString("0.00").Replace(".", "E");
         }
         DataTable     m_dt = SYS_DistrictBll.GetInstance().GetTreeDetail(area.SysNo);
         StringBuilder m_sb = new StringBuilder();
         m_sb.Append(m_dt.Rows[0]["Name1"].ToString());
         if (!string.IsNullOrEmpty(m_dt.Rows[0]["Name2"].ToString()))
         {
             m_sb.Append("-").Append(m_dt.Rows[0]["Name2"].ToString());
         }
         if (!string.IsNullOrEmpty(m_dt.Rows[0]["Name3"].ToString()))
         {
             m_sb.Append("-").Append(m_dt.Rows[0]["Name3"].ToString());
         }
         name = m_sb.ToString();
     }
     catch { }
 }
Exemplo n.º 10
0
        protected void Unnamed1_Click(object sender, EventArgs e)
        {
            AstroMod m_astro = new AstroMod();

            m_astro.type = PublicValue.AstroType.benming;
            #region 设置实体各种参数
            m_astro.birth = DateTime.Parse(HiddenField4.Value);
            SYS_DistrictMod dis = SYS_DistrictBll.GetInstance().GetModel(int.Parse(HiddenField2.Value));
            if (string.IsNullOrEmpty(dis.Latitude) || string.IsNullOrEmpty(dis.longitude))
            {
                SYS_DistrictMod tmp = SYS_DistrictBll.GetInstance().GetModel(dis.UpSysNo);
                dis.Latitude  = tmp.Latitude;
                dis.longitude = tmp.longitude;
            }
            m_astro.position = new LatLng(dis);
            if (HiddenField1.Value == "1")
            {
                m_astro.IsDayLight = AppEnum.BOOL.True;
            }
            else if (HiddenField1.Value == "0")
            {
                m_astro.IsDayLight = AppEnum.BOOL.False;
            }
            else
            {
                m_astro.IsDayLight = (AppEnum.BOOL)Convert.ToInt16(PublicDeal.GetInstance().IsDayLight(m_astro.birth, 0));
            }
            if (HiddenField6.Value == "g1")
            {
                m_astro.Gender = AppEnum.Gender.male;
            }
            else
            {
                m_astro.Gender = AppEnum.Gender.female;
            }

            m_astro.zone = -8;

            for (int i = 1; i < 21; i++)
            {
                m_astro.startsShow.Add(i, "");
            }
            m_astro.aspectsShow.Clear();
            for (int i = 1; i < 6; i++)
            {
                m_astro.aspectsShow.Add(i, 5);
            }
            #endregion

            AstroBiz.GetInstance().GetParamters(ref m_astro);
            Dictionary <PublicValue.AstroStar, Star> m_star = new Dictionary <PublicValue.AstroStar, Star>();
            foreach (Star tmpstar in m_astro.Stars)
            {
                m_star.Add(tmpstar.StarName, tmpstar);
            }
            string jsstr = "";
            //吉星
            List <PublicValue.AstroStar> goodstars = new List <PublicValue.AstroStar>();
            goodstars.Add(PublicValue.AstroStar.Jup);
            goodstars.Add(PublicValue.AstroStar.Ven);
            //凶星
            Dictionary <PublicValue.AstroStar, int> badstars = new Dictionary <PublicValue.AstroStar, int>();
            List <PublicValue.AstroStar>            tmpbad   = new List <PublicValue.AstroStar>();
            tmpbad.Add(PublicValue.AstroStar.Mar);
            tmpbad.Add(PublicValue.AstroStar.Sat);
            tmpbad.Add(PublicValue.AstroStar.Ura);
            tmpbad.Add(PublicValue.AstroStar.Nep);
            tmpbad.Add(PublicValue.AstroStar.Plu);
            List <PublicValue.AstroStar> twelve = PublicDeal.GetInstance().GetGongMasters(m_astro.Stars, 12, false);
            List <PublicValue.AstroStar> eight  = PublicDeal.GetInstance().GetGongMasters(m_astro.Stars, 8, false);
            List <PublicValue.AstroStar> seven  = PublicDeal.GetInstance().GetGongMasters(m_astro.Stars, 7, false);
            List <PublicValue.AstroStar> two    = PublicDeal.GetInstance().GetGongMasters(m_astro.Stars, 2, false);
            foreach (PublicValue.AstroStar tmp in tmpbad)
            {
                badstars.Add(tmp, 1);
            }
            foreach (PublicValue.AstroStar tmp in eight)
            {
                if (!tmpbad.Contains(tmp))
                {
                    if (!badstars.ContainsKey(tmp))
                    {
                        badstars.Add(tmp, 1);
                    }
                }
                else
                {
                    badstars[tmp]++;
                }
            }
            foreach (PublicValue.AstroStar tmp in twelve)
            {
                if (!tmpbad.Contains(tmp))
                {
                    if (!badstars.ContainsKey(tmp))
                    {
                        badstars.Add(tmp, 1);
                    }
                }
                else
                {
                    badstars[tmp]++;
                }
            }
            List <PublicValue.AstroStar> mingzhu = PublicDeal.GetInstance().GetGongMasters(m_astro.Stars, 1, false);
            foreach (PublicValue.AstroStar tmp in mingzhu)
            {
                if (!tmpbad.Contains(tmp))
                {
                    if (!badstars.ContainsKey(tmp))
                    {
                        badstars.Add(tmp, 1);
                    }
                }
                else
                {
                    badstars[tmp]++;
                }
            }


            #region 花
            //Label1.Text = "1.金星星座为:" + PublicValue.GetConstellation(m_star[PublicValue.AstroStar.Ven].Constellation) + "<br/>";
            jsstr           += "showItem('hua', " + (int)m_star[PublicValue.AstroStar.Ven].Constellation + ");";
            ViewState["hua"] = (int)m_star[PublicValue.AstroStar.Ven].Constellation;
            #endregion

            #region 金星元素
            int venusEle = 0;
            venusEle = (int)PublicDeal.GetInstance().GetConstellationElement(m_star[PublicValue.AstroStar.Ven].Constellation);
            //Label1.Text += "2.金星星座元素为:" + PublicValue.GetElement(PublicDeal.GetInstance().GetConstellationElement(m_star[PublicValue.AstroStar.Ven].Constellation)) + "<br />";
            #endregion

            #region 红杏
            bool hongxing = false;
            if (PublicDeal.GetInstance().HasPhase(m_star[PublicValue.AstroStar.Ven], m_star[PublicValue.AstroStar.Jun], PublicValue.Phase.he, AppConst.DecimalNull) ||
                PublicDeal.GetInstance().HasPhase(m_star[PublicValue.AstroStar.Ven], m_star[PublicValue.AstroStar.Jun], PublicValue.Phase.chong, AppConst.DecimalNull) ||
                PublicDeal.GetInstance().HasPhase(m_star[PublicValue.AstroStar.Ven], m_star[PublicValue.AstroStar.Jun], PublicValue.Phase.xing, AppConst.DecimalNull))
            {
                hongxing = true;
            }
            ////Label1.Text += "金星:" + ((int)m_star[PublicValue.AstroStar.Ven].Constellation) * 30 + " " + m_star[PublicValue.AstroStar.Ven].Degree + " " + m_star[PublicValue.AstroStar.Ven].Cent / 60 * 100;
            ////Label1.Text += "婚神:" + ((int)m_star[PublicValue.AstroStar.Jun].Constellation) * 30 + " " + m_star[PublicValue.AstroStar.Jun].Degree + " " + m_star[PublicValue.AstroStar.Jun].Cent / 60 * 100;
            //Label1.Text += "3.是否有红杏:" + (hongxing==true ? "有" : "没有") + "<br />";
            jsstr += "showItem('hongxing', " + (hongxing == true ? "1" : "0") + ");";
            if (hongxing)
            {
                li5.Style["display"] = "";
            }
            #endregion

            #region 蜜蜂
            int beecount = 0;
            List <PublicValue.AstroStar> beestars = PublicDeal.GetInstance().GetGongMasters(m_astro.Stars, 7, false);
            //Label1.Text += "7宫主:";
            foreach (PublicValue.AstroStar tmpstar in beestars)
            {
                //Label1.Text += PublicValue.GetAstroStar(tmpstar);
            }
            //Label1.Text += "<br />";
            //Label1.Text += "凶星:";
            foreach (PublicValue.AstroStar tmpstar in badstars.Keys)
            {
                //Label1.Text += PublicValue.GetAstroStar(tmpstar);
            }
            //Label1.Text += "<br />";
            beestars.Add(PublicValue.AstroStar.Des);
            beestars.Add(PublicValue.AstroStar.Jun);
            foreach (PublicValue.AstroStar tmpstar in beestars)
            {
                int tmpflag = 0;
                if (tmpstar != goodstars[0] && PublicDeal.GetInstance().HasAnyMainPhase(m_star[tmpstar], m_star[goodstars[0]]))
                {
                    beecount++;
                    tmpflag = 1;
                }
                if (tmpstar != goodstars[1] && PublicDeal.GetInstance().HasAnyMainPhase(m_star[tmpstar], m_star[goodstars[1]]))
                {
                    beecount++;
                    if (tmpflag == 1)
                    {
                        beecount++;
                    }
                }
            }

            //Label1.Text += "4.蜜蜂指数为:" + beecount + "<br />";
            jsstr += "showItem('mifeng', " + (beecount + 1 > 3 ? 4 : beecount + 1) + ");";
            li1.Style["display"] = "";
            ViewState["bee"]     = beecount;
            #endregion



            #region 负面
            Dictionary <string, int> showele = new Dictionary <string, int>();
            showele.Add("paopao", 0);
            showele.Add("chongzi", 0);
            showele.Add("cu", 0);
            showele.Add("liehen", 0);
            showele.Add("bingdong", 0);
            showele.Add("zhezhi", 0);
            showele.Add("kuye", 0);

            List <PublicValue.AstroStar> breakstars = PublicDeal.GetInstance().GetGongMasters(m_astro.Stars, 7, false);
            breakstars.Add(PublicValue.AstroStar.Ven);
            breakstars.Add(PublicValue.AstroStar.Jun);
            breakstars.Add(PublicValue.AstroStar.Des);
            breakstars = breakstars.Distinct().ToList();
            foreach (PublicValue.AstroStar tmp in badstars.Keys)
            {
                //if (tmp != goodstars[0])
                //    continue;
                int tmpflag = 0;
                for (int i = 0; i < breakstars.Count; i++)
                {
                    if (PublicDeal.GetInstance().HasAnyBadPhase(m_star[tmp], m_star[breakstars[i]]))
                    {
                        bool Exact = false;
                        if (PublicDeal.GetInstance().HasAnyBadPhase(m_star[tmp], m_star[breakstars[i]], 1))
                        {
                            Exact = true;
                        }
                        switch (tmp)
                        {
                        case PublicValue.AstroStar.Mar:
                        case PublicValue.AstroStar.Sun:
                            showele["zhezhi"] += badstars[tmp];
                            if (Exact)
                            {
                                showele["zhezhi"]++;
                            }
                            break;

                        case PublicValue.AstroStar.Jup:
                        case PublicValue.AstroStar.Ven:
                            showele["kuye"] += badstars[tmp];
                            if (Exact)
                            {
                                showele["kuye"]++;
                            }
                            break;

                        case PublicValue.AstroStar.Sat:
                            showele["liehen"] += badstars[tmp];
                            if (Exact)
                            {
                                showele["liehen"]++;
                            }
                            break;

                        case PublicValue.AstroStar.Ura:
                            showele["bingdong"] += badstars[tmp];
                            if (Exact)
                            {
                                showele["bingdong"]++;
                            }
                            break;

                        case PublicValue.AstroStar.Nep:
                            showele["paopao"] += badstars[tmp];
                            if (Exact)
                            {
                                showele["paopao"]++;
                            }
                            break;

                        case PublicValue.AstroStar.Plu:
                        case PublicValue.AstroStar.Moo:
                            showele["cu"] += badstars[tmp];
                            if (Exact)
                            {
                                showele["cu"]++;
                            }
                            break;

                        case PublicValue.AstroStar.Mer:
                            showele["chongzi"] += badstars[tmp];
                            if (Exact)
                            {
                                showele["chongzi"]++;
                            }
                            break;
                        }
                        tmpflag++;
                        if (tmpflag > 1)
                        {
                            switch (tmp)
                            {
                            case PublicValue.AstroStar.Mar:
                            case PublicValue.AstroStar.Sun:
                                showele["zhezhi"]++;
                                break;

                            case PublicValue.AstroStar.Jup:
                            case PublicValue.AstroStar.Ven:
                                showele["kuye"]++;
                                break;

                            case PublicValue.AstroStar.Sat:
                                showele["liehen"]++;
                                break;

                            case PublicValue.AstroStar.Ura:
                                showele["bingdong"]++;
                                break;

                            case PublicValue.AstroStar.Nep:
                                showele["paopao"]++;
                                break;

                            case PublicValue.AstroStar.Plu:
                            case PublicValue.AstroStar.Moo:
                                showele["cu"]++;
                                break;

                            case PublicValue.AstroStar.Mer:
                                showele["chongzi"]++;
                                break;
                            }
                        }
                    }
                }
            }
            ////Label1.Text += "4.裂痕指数为:" + breakcount + "<br />";
            jsstr += "showItem('liehen', " + (showele["liehen"] > 3 ? 4 : showele["liehen"]) + ");";
            if (showele["liehen"] > 0)
            {
                li7.Style["display"] = "";
            }
            jsstr += "showItem('paopao', " + (showele["paopao"] > 3 ? 4 : showele["paopao"]) + ");";
            if (showele["paopao"] > 0)
            {
                li2.Style["display"] = "";
            }
            jsstr += "showItem('chongzi', " + (showele["chongzi"] > 2 ? 3 : showele["chongzi"]) + ");";
            if (showele["chongzi"] > 0)
            {
                li4.Style["display"] = "";
            }
            jsstr += "showItem('cu', " + (showele["cu"] > 2 ? 3 : showele["cu"]) + ");";
            if (showele["cu"] > 0)
            {
                li8.Style["display"] = "";
            }
            jsstr += "showItem('bingdong', " + (showele["bingdong"] > 2 ? 3 : showele["bingdong"]) + ");";
            if (showele["bingdong"] > 0)
            {
                li6.Style["display"] = "";
            }
            jsstr += "showItem('zhezhi', " + (showele["zhezhi"] > 4 ? 4 : showele["zhezhi"]) + ");";
            if (showele["zhezhi"] > 0)
            {
                li3.Style["display"] = "";
            }
            jsstr += "showItem('kuzhi', " + (showele["kuye"] > 3 ? 3 : showele["kuye"]) + ");";
            if (showele["kuye"] > 0)
            {
                li9.Style["display"] = "";
            }
            int totalbad = showele["paopao"] + showele["chongzi"] + showele["cu"] + showele["liehen"] + showele["bingdong"] + showele["zhezhi"] + showele["kuye"];
            span1.Style["width"] = ((4096 - totalbad * 128) / 32).ToString() + "px";
            ltr1.Text            = ((3200 - totalbad * 100) / 32).ToString();
            if (ltr1.Text == "0")
            {
                span1.Style["width"] = (1 * 128 / 100).ToString() + "px";
                ltr1.Text            = "1";
            }
            if (hongxing && int.Parse(ltr1.Text) >= 70)
            {
                ltr1.Text            = (int.Parse(ltr1.Text) - 15).ToString();
                span1.Style["width"] = (int.Parse(ltr1.Text) * 128 / 100).ToString() + "px";
            }
            if (int.Parse(ltr1.Text) > 100)
            {
                span1.Style["width"] = "128px";
                ltr1.Text            = "100";
            }
            ViewState["fumian"] = showele;
            ////Label1.Text += "5.泡泡:" + showele["paopao"] + "; 虫子:" + showele["chongzi"] + "; 醋:" + showele["cu"] + "; 裂痕:" + showele["liehen"] + "; 冰冻:" + showele["bingdong"] + "; 折枝:" + showele["zhezhi"] + "; 枯叶:" + showele["kuye"] + "<br />";
            #endregion

            #region 花盆
            int huapen = 1;
            if (totalbad >= 20)
            {
                huapen = 3;
            }
            else if ((totalbad >= 13 && totalbad < 20) || (hongxing && totalbad > 6))
            {
                huapen = 2;
            }
            //Label1.Text += "5.花盆为:" + huapen + "<br />";
            jsstr += "showItem('huapen', " + huapen + ");";
            #endregion

            #region 花心指数
            int flowercount = 0;
            foreach (PublicValue.AstroStar tmpstar in goodstars)
            {
                if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[tmpstar]))
                {
                    flowercount++;
                }
                if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Chi], m_star[tmpstar]))
                {
                    flowercount++;
                }
                foreach (PublicValue.AstroStar tmpstarr in eight)
                {
                    if (tmpstar != tmpstarr && PublicDeal.GetInstance().HasAnyMainPhase(m_star[tmpstarr], m_star[tmpstar]))
                    {
                        flowercount++;
                    }
                }
            }
            if (m_star[PublicValue.AstroStar.Moo].Constellation == PublicValue.Constellation.Gem ||
                m_star[PublicValue.AstroStar.Moo].Constellation == PublicValue.Constellation.Sag ||
                m_star[PublicValue.AstroStar.Moo].Constellation == PublicValue.Constellation.Pis)
            {
                flowercount++;
            }
            if (m_star[PublicValue.AstroStar.Ven].Constellation == PublicValue.Constellation.Gem ||
                m_star[PublicValue.AstroStar.Ven].Constellation == PublicValue.Constellation.Sag ||
                m_star[PublicValue.AstroStar.Ven].Constellation == PublicValue.Constellation.Pis)
            {
                flowercount++;
            }
            if (m_star[PublicValue.AstroStar.Des].Constellation == PublicValue.Constellation.Gem ||
                m_star[PublicValue.AstroStar.Des].Constellation == PublicValue.Constellation.Sag ||
                m_star[PublicValue.AstroStar.Des].Constellation == PublicValue.Constellation.Pis)
            {
                flowercount++;
            }
            if (m_star[PublicValue.AstroStar.Moo].Gong == 12)
            {
                flowercount++;
            }
            if (m_star[PublicValue.AstroStar.Ven].Gong == 12)
            {
                flowercount++;
            }
            if (PublicDeal.GetInstance().GetConstellationElement(m_star[PublicValue.AstroStar.Sun].Constellation) == PublicValue.Element.wind && PublicDeal.GetInstance().GetConstellationElement(m_star[PublicValue.AstroStar.Moo].Constellation) == PublicValue.Element.earth)
            {
                flowercount++;
            }
            if (PublicDeal.GetInstance().GetConstellationElement(m_star[PublicValue.AstroStar.Sun].Constellation) == PublicValue.Element.fire && PublicDeal.GetInstance().GetConstellationElement(m_star[PublicValue.AstroStar.Moo].Constellation) == PublicValue.Element.wind)
            {
                flowercount++;
            }
            if (m_astro.Gender == AppEnum.Gender.male)
            {
                flowercount++;
            }
            span3.Style["width"] = (flowercount * 128 / 10).ToString() + "px";
            ltr3.Text            = (flowercount * 100 / 10).ToString();
            if (ltr3.Text == "0")
            {
                span3.Style["width"] = (1 * 128 / 100).ToString() + "px";
                ltr3.Text            = "1";
            }
            if (int.Parse(ltr3.Text) > 100)
            {
                span3.Style["width"] = "128px";
                ltr3.Text            = "100";
            }
            //Label1.Text += "5.花心指数为:" + flowercount + "<br />";
            #endregion

            #region 魅力指数
            int meilicount = beecount;
            if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Ura], m_star[PublicValue.AstroStar.For]))
            {
                meilicount++;
            }
            if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Ura], m_star[PublicValue.AstroStar.Ven]))
            {
                meilicount++;
            }
            if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.For], m_star[PublicValue.AstroStar.Ven]))
            {
                meilicount++;
            }
            if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Sun], m_star[PublicValue.AstroStar.Jup]))
            {
                meilicount++;
            }
            span2.Style["width"] = (meilicount * 128 / 12).ToString() + "px";
            ltr2.Text            = (meilicount * 100 / 12).ToString();
            if (ltr2.Text == "0")
            {
                span2.Style["width"] = (1 * 128 / 100).ToString() + "px";
                ltr2.Text            = "1";
            }
            if (int.Parse(ltr2.Text) > 100)
            {
                span2.Style["width"] = "128px";
                ltr2.Text            = "100";
            }

            #endregion

            #region 对方有钱
            int richcount = PublicDeal.GetInstance().GetGongPower(m_astro.Stars, 8);
            if (richcount > 15)
            {
                richcount = 15;
            }
            foreach (PublicValue.AstroStar tmpstar in seven)
            {
                if (m_star[tmpstar].Gong == 8 || m_star[tmpstar].Gong == 7)
                {
                    richcount = richcount + 5;
                }
            }
            foreach (PublicValue.AstroStar tmpstar in eight)
            {
                if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[tmpstar]) && PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.For], m_star[tmpstar]))
                {
                    richcount = richcount + 5;
                }
                if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.For], m_star[tmpstar]) && PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[PublicValue.AstroStar.For]))
                {
                    richcount = richcount + 5;
                }
                if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[tmpstar]) && PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[PublicValue.AstroStar.For]))
                {
                    richcount = richcount + 5;
                }
            }
            foreach (PublicValue.AstroStar tmpstar in two)
            {
                if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[tmpstar]) && PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.For], m_star[tmpstar]))
                {
                    richcount = richcount + 5;
                }
                if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.For], m_star[tmpstar]) && PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[PublicValue.AstroStar.For]))
                {
                    richcount = richcount + 5;
                }
                if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[tmpstar]) && PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[PublicValue.AstroStar.For]))
                {
                    richcount = richcount + 5;
                }
            }
            if (m_star[PublicValue.AstroStar.Jun].Gong == 11)
            {
                richcount = richcount + 5;
            }
            if (m_star[PublicValue.AstroStar.Ura].Gong == 8)
            {
                richcount = richcount + 5;
            }

            span4.Style["width"] = (richcount * 128 / 30).ToString() + "px";
            ltr4.Text            = (richcount * 100 / 30).ToString();
            if (ltr4.Text == "0")
            {
                span4.Style["width"] = (1 * 128 / 100).ToString() + "px";
                ltr4.Text            = "1";
            }
            if (int.Parse(ltr4.Text) > 100)
            {
                span4.Style["width"] = "128px";
                ltr4.Text            = "100";
            }
            //Label1.Text += "6.对方有钱指数为:" + richcount + "<br />";
            //测试显示互溶关系
            List <List <PublicValue.AstroStar> > hurong = PublicDeal.GetInstance().GetHuRong(m_astro.Stars, true);
            foreach (List <PublicValue.AstroStar> tmplist in hurong)
            {
                foreach (PublicValue.AstroStar tmpstar in tmplist)
                {
                    //Label1.Text += PublicValue.GetAstroStar(tmpstar) + "->";
                }
                //Label1.Text += "<br />";
            }
            #endregion
            jsstr += @"$("".f-box"").children(""div:not(0)"").children(""div"").each(function () {
                                        if (!$(this).is(':has(a)')&&$(this).attr(""id"")!='nohover') {
                                            $(this).bind(""mouseenter"", function () {
                                                $(this).css(""cursor"", ""pointer"")
                                                var bgimg = $(this).css(""background-image"");
                                                bgimg = bgimg.replace("".png"", ""_on.png"");
                                                $(this).css(""background-image"", bgimg);
                                            }).bind(""mouseleave"", function () { 
                                                $(this).attr(""style"", "" "");
                                                $(this).css(""display"", ""block"");
                                            })
                                        }
                                        else {
                                            //蜜蜂等区域热点
                                            $(this).children(""a"").bind(""mouseenter"", function () {
                                                var bgimg = $(this).parent().css(""background-image"");
                                                bgimg = bgimg.replace("".png"", ""_on.png"");
                                                $(this).parent().css(""background-image"", bgimg);
                                            }).bind(""mouseleave"", function () {
                                                $(this).parent().attr(""style"", "" "");
                                                $(this).parent().css(""display"", ""block"");
                                            })

                                        }

                                    })";
            ScriptManager.RegisterStartupScript(Page, this.GetType(), "show", jsstr, true);
            tip.Style["display"]       = "none";
            ViewState["jsstr"]         = jsstr;
            MultiView1.ActiveViewIndex = 1;

            //Page.ClientScript.RegisterStartupScript(this.GetType(), "showflash",
            //        @"swfobject.embedSWF('LoveRose.swf', 'flashmov', '816', '459', '9.0.0',null,{ele:'"+ele+"'});",true);

            #region 记录用户数据
            LoveRoseMod m_record = new LoveRoseMod();
            m_record.Area      = int.Parse(HiddenField2.Value);
            m_record.BirthTime = m_astro.birth;
            m_record.Source    = (int)AppEnum.AppsSourceType.qq;
            m_record.TS        = DateTime.Now;
            LoveRoseBll.GetInstance().Add(m_record);
            #endregion

            #region 显示信息
            ltrInfo.Text = m_astro.birth.ToString("yyyy年MM月dd日 HH:mm") + @"
                    <br />
                    性别:" + AppEnum.GetGender(m_astro.Gender) + @"<br />
                    所属时区: " + (m_astro.zone > 0 ? "西" + m_astro.zone.ToString() : "东" + m_astro.zone.ToString()) + @"区<br />
                    夏令时:" + (((int)m_astro.IsDayLight) == 1 ? "是" : "否") + @"
                    <br />
                    出生地: " + m_astro.position.name.Remove(m_astro.position.name.LastIndexOf("-")) + @"
                    <br />
                    (经度" + m_astro.position.Lng + @"&nbsp;纬度" + m_astro.position.Lat + @")
                    <br />";
            #endregion

            HyperLink1.NavigateUrl = "http://share.v.t.qq.com/index.php?c=share&a=index&url=" + Server.UrlEncode("http://astro.fashion.qq.com/app/aiqinghua.htm") +
                                     "&pic=" + Server.UrlEncode("../WebResources/Images/LoveRose/img/share" + ViewState["hua"].ToString() + ".jpg") + "&appkey=801402959&title=" + Server.UrlEncode("#腾讯星座爱情花# " + AppCmn.CommonTools.CutStr(content[int.Parse(ViewState["hua"].ToString()) - 1, 0], 50) + " 嘿嘿~这是我的爱情花!我的爱情婚姻原来是这样的。挺有意思,你也来玩玩吧!") + "&line1=&line2=&line3=";
        }
Exemplo n.º 11
0
 protected void drpDistrict3_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (drpDistrict3.SelectedValue != "0")
     {
         m_area = SYS_DistrictBll.GetInstance().GetModel(int.Parse(drpDistrict3.SelectedValue));
         ltrLatLng.Text = "北纬" + m_area.Latitude + " 东经" + m_area.longitude;
         ltrLatLng.Visible = true;
         ViewState["district"] = m_area;
     }
     //ScriptManager.RegisterStartupScript(drpDistrict3, this.GetType(), "refreshdrop", "$(function () { $('.select_item').scrollablecombo(); });", true);
 }
Exemplo n.º 12
0
        protected void Unnamed1_Click(object sender, EventArgs e)
        {
            SYS_DistrictMod m_area = new SYS_DistrictMod();
            if (type == "EDIT")
            {
                if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
                {
                    SysNo = int.Parse(Request.QueryString["id"]);
                }
                m_area = SYS_DistrictBll.GetInstance().GetModel(SysNo);
            }
            try
            {
                m_area.Name = txtName.Text.Trim();
                m_area.EnglishName = txtEnglishName.Text.Trim();
                m_area.DR = int.Parse(drpStatus.SelectedValue);
                SYS_DistrictBll.GetInstance().Update(m_area);
                LogManagement.getInstance().WriteTrace(m_area.SysNo, "District.Update", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username);

                ltrNotice.Text = "该记录已保存成功!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true);
            }
            catch
            {
                ltrError.Text = "输入资料格式有误,请检查!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                return;
            }
        }
Exemplo n.º 13
0
        public SYS_DistrictMod GetNearestByPoi(string lng, string lat)
        {
            DataTable table = new DataTable();
            SYS_DistrictMod m_dist = new SYS_DistrictMod();
            using (SQLData data = new SQLData())
            {
                StringBuilder builder = new StringBuilder();
                builder.Append(@"select top 1 sysno
                 from [Sys_District] where level=3 and englishname is null and ABS([longitude]-").Append(SQLData.SQLFilter(lng)).Append(")<3 and ABS([Latitude]-").Append(SQLData.SQLFilter(lat)).Append(")<3 order by SQUARE([longitude]-").Append(SQLData.SQLFilter(lng)).Append(")+ SQUARE([Latitude]-").Append(SQLData.SQLFilter(lat)).Append(")");

                //try
                //{
                    table = data.CmdtoDataTable(builder.ToString());
                //}
                //catch (Exception exception)
                //{
                //    throw exception;
                //}
                if (table.Rows.Count > 0)
                {
                    m_dist = GetModel(int.Parse(table.Rows[0]["sysno"].ToString()));
                    table = data.CmdtoDataTable("select * from [District3Level] where SysNo3="+m_dist.SysNo);
                    m_dist.Name = (table.Rows[0]["Name1"].ToString() +"-"+ table.Rows[0]["Name2"].ToString()+"-" + table.Rows[0]["Name3"].ToString()).Replace("市辖区-","");
                }
                else
                {
                    return null;
                }
            }
            return m_dist;
        }
Exemplo n.º 14
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(SYS_DistrictMod model)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("update SYS_District set ");
     strSql.Append("UpSysNo=@UpSysNo,");
     strSql.Append("Name=@Name,");
     strSql.Append("EnglishName=@EnglishName,");
     strSql.Append("Level=@Level,");
     strSql.Append("UseType=@UseType,");
     strSql.Append("DR=@DR,");
     strSql.Append("TS=@TS,");
     strSql.Append("Latitude=@Latitude,");
     strSql.Append("longitude=@longitude,");
     strSql.Append("TopSysNo=@TopSysNo");
     strSql.Append(" where SysNo=@SysNo ");
     SqlCommand cmd = new SqlCommand(strSql.ToString());
     SqlParameter[] parameters = {
          new SqlParameter("@SysNo",SqlDbType.Int,4),
          new SqlParameter("@UpSysNo",SqlDbType.Int,4),
          new SqlParameter("@Name",SqlDbType.NVarChar,100),
          new SqlParameter("@EnglishName",SqlDbType.VarChar,100),
          new SqlParameter("@Level",SqlDbType.Int,4),
          new SqlParameter("@UseType",SqlDbType.Int,4),
          new SqlParameter("@DR",SqlDbType.TinyInt,1),
          new SqlParameter("@TS",SqlDbType.DateTime),
          new SqlParameter("@Latitude",SqlDbType.VarChar,50),
          new SqlParameter("@longitude",SqlDbType.VarChar,50),
          new SqlParameter("@TopSysNo",SqlDbType.Int,4)
      };
     if (model.SysNo != AppConst.IntNull)
         parameters[0].Value = model.SysNo;
     else
         parameters[0].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[0]);
     if (model.UpSysNo != AppConst.IntNull)
         parameters[1].Value = model.UpSysNo;
     else
         parameters[1].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[1]);
     if (model.Name != AppConst.StringNull)
         parameters[2].Value = model.Name;
     else
         parameters[2].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[2]);
     if (model.EnglishName != AppConst.StringNull)
         parameters[3].Value = model.EnglishName;
     else
         parameters[3].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[3]);
     if (model.Level != AppConst.IntNull)
         parameters[4].Value = model.Level;
     else
         parameters[4].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[4]);
     if (model.UseType != AppConst.IntNull)
         parameters[5].Value = model.UseType;
     else
         parameters[5].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[5]);
     if (model.DR != AppConst.IntNull)
         parameters[6].Value = model.DR;
     else
         parameters[6].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[6]);
     if (model.TS != AppConst.DateTimeNull)
         parameters[7].Value = model.TS;
     else
         parameters[7].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[7]);
     if (model.Latitude != AppConst.StringNull)
         parameters[8].Value = model.Latitude;
     else
         parameters[8].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[8]);
     if (model.longitude != AppConst.StringNull)
         parameters[9].Value = model.longitude;
     else
         parameters[9].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[9]);
     if (model.TopSysNo != AppConst.IntNull)
         parameters[10].Value = model.TopSysNo;
     else
         parameters[10].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[10]);
     return SqlHelper.ExecuteNonQuery(cmd,parameters);
 }
Exemplo n.º 15
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(SYS_DistrictMod model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into SYS_District(");
            strSql.Append("UpSysNo,Name,EnglishName,Level,UseType,Latitude,longitude,TopSysNo)");
            strSql.Append(" values (");
            strSql.Append("@UpSysNo,@Name,@EnglishName,@Level,@UseType,@Latitude,@longitude,@TopSysNo)");
            strSql.Append(";select SCOPE_IDENTITY()");
            SqlCommand cmd = new SqlCommand(strSql.ToString());
            SqlParameter[] parameters = {
                 new SqlParameter("@UpSysNo",SqlDbType.Int,4),
                 new SqlParameter("@Name",SqlDbType.NVarChar,100),
                 new SqlParameter("@EnglishName",SqlDbType.VarChar,100),
                 new SqlParameter("@Level",SqlDbType.Int,4),
                 new SqlParameter("@UseType",SqlDbType.Int,4),
                 new SqlParameter("@DR",SqlDbType.TinyInt,1),
                 new SqlParameter("@TS",SqlDbType.DateTime),
                 new SqlParameter("@Latitude",SqlDbType.VarChar,50),
                 new SqlParameter("@longitude",SqlDbType.VarChar,50),
                 new SqlParameter("@TopSysNo",SqlDbType.Int,4),
             };
            if (model.UpSysNo != AppConst.IntNull)
                parameters[0].Value = model.UpSysNo;
            else
                parameters[0].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[0]);
            if (model.Name != AppConst.StringNull)
                parameters[1].Value = model.Name;
            else
                parameters[1].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[1]);
            if (model.EnglishName != AppConst.StringNull)
                parameters[2].Value = model.EnglishName;
            else
                parameters[2].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[2]);
            if (model.Level != AppConst.IntNull)
                parameters[3].Value = model.Level;
            else
                parameters[3].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[3]);
            if (model.UseType != AppConst.IntNull)
                parameters[4].Value = model.UseType;
            else
                parameters[4].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[4]);
            if (model.DR != AppConst.IntNull)
                parameters[5].Value = model.DR;
            else
                parameters[5].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[5]);
            if (model.TS != AppConst.DateTimeNull)
                parameters[6].Value = model.TS;
            else
                parameters[6].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[6]);
            if (model.Latitude != AppConst.StringNull)
                parameters[7].Value = model.Latitude;
            else
                parameters[7].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[7]);
            if (model.longitude != AppConst.StringNull)
                parameters[8].Value = model.longitude;
            else
                parameters[8].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[8]);
            if (model.TopSysNo != AppConst.IntNull)
                parameters[9].Value = model.TopSysNo;
            else
                parameters[9].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[9]);

            return SqlHelper.ExecuteNonQuery(cmd,parameters);
        }
Exemplo n.º 16
0
        /// <summary>
        /// 增加一条数据
        /// </summary>

        public int Add(SYS_DistrictMod model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into SYS_District(");
            strSql.Append("UpSysNo,Name,EnglishName,Level,UseType,Latitude,longitude,TopSysNo)");
            strSql.Append(" values (");
            strSql.Append("@UpSysNo,@Name,@EnglishName,@Level,@UseType,@Latitude,@longitude,@TopSysNo)");
            strSql.Append(";select SCOPE_IDENTITY()");
            SqlCommand cmd = new SqlCommand(strSql.ToString());

            SqlParameter[] parameters =
            {
                new SqlParameter("@UpSysNo",     SqlDbType.Int,         4),
                new SqlParameter("@Name",        SqlDbType.NVarChar,  100),
                new SqlParameter("@EnglishName", SqlDbType.VarChar,   100),
                new SqlParameter("@Level",       SqlDbType.Int,         4),
                new SqlParameter("@UseType",     SqlDbType.Int,         4),
                new SqlParameter("@DR",          SqlDbType.TinyInt,     1),
                new SqlParameter("@TS",          SqlDbType.DateTime),
                new SqlParameter("@Latitude",    SqlDbType.VarChar,    50),
                new SqlParameter("@longitude",   SqlDbType.VarChar,    50),
                new SqlParameter("@TopSysNo",    SqlDbType.Int,         4),
            };
            if (model.UpSysNo != AppConst.IntNull)
            {
                parameters[0].Value = model.UpSysNo;
            }
            else
            {
                parameters[0].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[0]);
            if (model.Name != AppConst.StringNull)
            {
                parameters[1].Value = model.Name;
            }
            else
            {
                parameters[1].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[1]);
            if (model.EnglishName != AppConst.StringNull)
            {
                parameters[2].Value = model.EnglishName;
            }
            else
            {
                parameters[2].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[2]);
            if (model.Level != AppConst.IntNull)
            {
                parameters[3].Value = model.Level;
            }
            else
            {
                parameters[3].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[3]);
            if (model.UseType != AppConst.IntNull)
            {
                parameters[4].Value = model.UseType;
            }
            else
            {
                parameters[4].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[4]);
            if (model.DR != AppConst.IntNull)
            {
                parameters[5].Value = model.DR;
            }
            else
            {
                parameters[5].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[5]);
            if (model.TS != AppConst.DateTimeNull)
            {
                parameters[6].Value = model.TS;
            }
            else
            {
                parameters[6].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[6]);
            if (model.Latitude != AppConst.StringNull)
            {
                parameters[7].Value = model.Latitude;
            }
            else
            {
                parameters[7].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[7]);
            if (model.longitude != AppConst.StringNull)
            {
                parameters[8].Value = model.longitude;
            }
            else
            {
                parameters[8].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[8]);
            if (model.TopSysNo != AppConst.IntNull)
            {
                parameters[9].Value = model.TopSysNo;
            }
            else
            {
                parameters[9].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[9]);

            return(SqlHelper.ExecuteNonQuery(cmd, parameters));
        }
Exemplo n.º 17
0
        /// <summary>
        /// 更新一条数据
        /// </summary>

        public int Update(SYS_DistrictMod model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update SYS_District set ");
            strSql.Append("UpSysNo=@UpSysNo,");
            strSql.Append("Name=@Name,");
            strSql.Append("EnglishName=@EnglishName,");
            strSql.Append("Level=@Level,");
            strSql.Append("UseType=@UseType,");
            strSql.Append("DR=@DR,");
            strSql.Append("TS=@TS,");
            strSql.Append("Latitude=@Latitude,");
            strSql.Append("longitude=@longitude,");
            strSql.Append("TopSysNo=@TopSysNo");
            strSql.Append(" where SysNo=@SysNo ");
            SqlCommand cmd = new SqlCommand(strSql.ToString());

            SqlParameter[] parameters =
            {
                new SqlParameter("@SysNo",       SqlDbType.Int,         4),
                new SqlParameter("@UpSysNo",     SqlDbType.Int,         4),
                new SqlParameter("@Name",        SqlDbType.NVarChar,  100),
                new SqlParameter("@EnglishName", SqlDbType.VarChar,   100),
                new SqlParameter("@Level",       SqlDbType.Int,         4),
                new SqlParameter("@UseType",     SqlDbType.Int,         4),
                new SqlParameter("@DR",          SqlDbType.TinyInt,     1),
                new SqlParameter("@TS",          SqlDbType.DateTime),
                new SqlParameter("@Latitude",    SqlDbType.VarChar,    50),
                new SqlParameter("@longitude",   SqlDbType.VarChar,    50),
                new SqlParameter("@TopSysNo",    SqlDbType.Int, 4)
            };
            if (model.SysNo != AppConst.IntNull)
            {
                parameters[0].Value = model.SysNo;
            }
            else
            {
                parameters[0].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[0]);
            if (model.UpSysNo != AppConst.IntNull)
            {
                parameters[1].Value = model.UpSysNo;
            }
            else
            {
                parameters[1].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[1]);
            if (model.Name != AppConst.StringNull)
            {
                parameters[2].Value = model.Name;
            }
            else
            {
                parameters[2].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[2]);
            if (model.EnglishName != AppConst.StringNull)
            {
                parameters[3].Value = model.EnglishName;
            }
            else
            {
                parameters[3].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[3]);
            if (model.Level != AppConst.IntNull)
            {
                parameters[4].Value = model.Level;
            }
            else
            {
                parameters[4].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[4]);
            if (model.UseType != AppConst.IntNull)
            {
                parameters[5].Value = model.UseType;
            }
            else
            {
                parameters[5].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[5]);
            if (model.DR != AppConst.IntNull)
            {
                parameters[6].Value = model.DR;
            }
            else
            {
                parameters[6].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[6]);
            if (model.TS != AppConst.DateTimeNull)
            {
                parameters[7].Value = model.TS;
            }
            else
            {
                parameters[7].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[7]);
            if (model.Latitude != AppConst.StringNull)
            {
                parameters[8].Value = model.Latitude;
            }
            else
            {
                parameters[8].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[8]);
            if (model.longitude != AppConst.StringNull)
            {
                parameters[9].Value = model.longitude;
            }
            else
            {
                parameters[9].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[9]);
            if (model.TopSysNo != AppConst.IntNull)
            {
                parameters[10].Value = model.TopSysNo;
            }
            else
            {
                parameters[10].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[10]);
            return(SqlHelper.ExecuteNonQuery(cmd, parameters));
        }
Exemplo n.º 18
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(SYS_DistrictMod model)
 {
     return dal.Add(model);
 }
Exemplo n.º 19
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(SYS_DistrictMod model)
 {
     dal.Update(model);
 }
Exemplo n.º 20
0
        /// <summary>
        /// 更新一条数据
        /// </summary>

        public void Update(SYS_DistrictMod model)
        {
            dal.Update(model);
        }
Exemplo n.º 21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["id"] != null)
            {
                try
                {
                    m_user = USR_CustomerBll.GetInstance().GetModel(int.Parse(Request.QueryString["id"]));
                    if (m_user.SysNo == AppConst.IntNull)
                    {
                        ShowError("");
                    }
                }
                catch
                {
                    ShowError("");
                }
            }
            else if (Page.RouteData.Values["id"] != null)
            {
                try
                {
                    m_user = USR_CustomerBll.GetInstance().GetModel(int.Parse(Page.RouteData.Values["id"].ToString()));
                    if (m_user.SysNo == AppConst.IntNull)
                    {
                        ShowError("");
                    }
                }
                catch
                {
                    ShowError("");
                }
            }
            else
            {
                Login(Request.Url.ToString());
                m_user  = USR_CustomerBll.GetInstance().GetModel(GetSession().CustomerEntity.SysNo);
                m_grade = USR_GradeBll.GetInstance().GetModel(m_user.GradeSysNo);
            }
            try
            {
                if (!IsPostBack)
                {
                    if (m_user.HomeTown != AppConst.IntNull)
                    {
                        SYS_DistrictMod m_dictrict = SYS_DistrictBll.GetInstance().GetModel(SYS_DistrictBll.GetInstance().GetModel(m_user.HomeTown).UpSysNo);
                        ltrFrom.Text = m_dictrict.Name;
                    }
                    else
                    {
                        ltrFrom.Text = "未知";
                    }
                    if (m_user.Birth != AppConst.DateTimeNull)
                    {
                        ltrBirth.Text = "生日:" + m_user.Birth.ToString("yyyy年MM月dd日");
                    }
                    else
                    {
                        ltrBirth.Text = "生日:未知";
                    }
                    BindArticles();
                    BindBestAnswer();
                    BindIcons();

                    LinkButton1_Click(LinkButton1, e);
                }
                if (GetSession().CustomerEntity != null && GetSession().CustomerEntity.SysNo != AppConst.IntNull && m_user.SysNo == GetSession().CustomerEntity.SysNo)
                {
                    ltrMe                 = "我";
                    sendmsg.Visible       = false;
                    intro.HRef            = AppConfig.HomeUrl() + "Qin/UserInfo.aspx?id=" + m_user.SysNo + "&tab=1";
                    ImageButton1.ImageUrl = AppConfig.HomeUrl() + "ControlLibrary/ShowPhoto.aspx?type=o&id=" + m_user.Photo;
                }
                else
                {
                    ltrMe                 = "Ta";
                    intro.Visible         = false;
                    sendmsg.HRef          = AppConfig.HomeUrl() + "Qin/MsgDetail.aspx?UserSysNo=" + m_user.SysNo;
                    ImageButton1.ImageUrl = AppConfig.HomeUrl() + "ControlLibrary/ShowPhoto.aspx?type=o&id=" + m_user.Photo;
                    ImageButton1.Enabled  = false;
                }
                RightPannel1.m_user  = m_user;
                RightPannel1.m_grade = m_grade;
            }
            catch
            {
                ShowError("");
            }

            if (Request.QueryString["pn"] != null)
            {
                try
                {
                    pageindex = int.Parse(Request.QueryString["pn"]);
                }
                catch
                { }
            }
            if (Request.QueryString["tab"] != null)
            {
                try
                {
                    tab = int.Parse(Request.QueryString["tab"]);
                }
                catch
                { }
            }
        }
Exemplo n.º 22
0
        /// <summary>
        /// 增加一条数据
        /// </summary>

        public int Add(SYS_DistrictMod model)
        {
            return(dal.Add(model));
        }
Exemplo n.º 23
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public SYS_DistrictMod GetModel(int SysNo)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("select SysNo, UpSysNo, Name, EnglishName, Level, UseType, DR, TS, Latitude, longitude, TopSysNo from  SYS_District");
     strSql.Append(" where SysNo=@SysNo ");
     SqlParameter[] parameters = {
     new SqlParameter("@SysNo", SqlDbType.Int,4 )
      		};
     parameters[0].Value = SysNo;
     SYS_DistrictMod model = new SYS_DistrictMod();
     DataSet ds = SqlHelper.ExecuteDataSet(strSql.ToString(), parameters);
     if (ds.Tables[0].Rows.Count > 0)
     {
         if (ds.Tables[0].Rows[0]["SysNo"].ToString() != "")
         {
             model.SysNo = int.Parse(ds.Tables[0].Rows[0]["SysNo"].ToString());
         }
         if (ds.Tables[0].Rows[0]["UpSysNo"].ToString() != "")
         {
             model.UpSysNo = int.Parse(ds.Tables[0].Rows[0]["UpSysNo"].ToString());
         }
         model.Name = ds.Tables[0].Rows[0]["Name"].ToString();
         model.EnglishName = ds.Tables[0].Rows[0]["EnglishName"].ToString();
         if (ds.Tables[0].Rows[0]["Level"].ToString() != "")
         {
             model.Level = int.Parse(ds.Tables[0].Rows[0]["Level"].ToString());
         }
         if (ds.Tables[0].Rows[0]["UseType"].ToString() != "")
         {
             model.UseType = int.Parse(ds.Tables[0].Rows[0]["UseType"].ToString());
         }
         if (ds.Tables[0].Rows[0]["DR"].ToString() != "")
         {
             model.DR = int.Parse(ds.Tables[0].Rows[0]["DR"].ToString());
         }
         if (ds.Tables[0].Rows[0]["TS"].ToString() != "")
         {
             model.TS = DateTime.Parse(ds.Tables[0].Rows[0]["TS"].ToString());
         }
         model.Latitude = ds.Tables[0].Rows[0]["Latitude"].ToString();
         model.longitude = ds.Tables[0].Rows[0]["longitude"].ToString();
         if (ds.Tables[0].Rows[0]["TopSysNo"].ToString() != "")
         {
             model.TopSysNo = int.Parse(ds.Tables[0].Rows[0]["TopSysNo"].ToString());
         }
         return model;
     }
     else
     {
         return null;
     }
 }