Esempio n. 1
0
        /// <summary>
        /// 获取实体
        /// </summary>
        public Model.manager_guid GetManagerGuidModel(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 * from dt_manager_guid ");
            strSql.Append(" where id=@id ");

            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int,4)};
            parameters[0].Value = id;

            Model.manager_guid model = new Model.manager_guid();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                #region  DATA
                if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }

                if (ds.Tables[0].Rows[0]["guid_id"] != null && ds.Tables[0].Rows[0]["guid_id"].ToString() != "")
                {
                    model.guid_id = int.Parse(ds.Tables[0].Rows[0]["guid_id"].ToString());
                }

                if (ds.Tables[0].Rows[0]["manager_id"] != null && ds.Tables[0].Rows[0]["manager_id"].ToString() != "")
                {
                    model.manager_id = int.Parse(ds.Tables[0].Rows[0]["manager_id"].ToString());
                }

                if (ds.Tables[0].Rows[0]["status"] != null && ds.Tables[0].Rows[0]["status"].ToString() != "")
                {
                    model.status = int.Parse(ds.Tables[0].Rows[0]["status"].ToString());
                }

                if (ds.Tables[0].Rows[0]["apply_time"] != null && ds.Tables[0].Rows[0]["apply_time"].ToString() != "")
                {
                    model.apply_time = DateTime.Parse(ds.Tables[0].Rows[0]["apply_time"].ToString());
                }

                if (ds.Tables[0].Rows[0]["push_state"] != null && ds.Tables[0].Rows[0]["push_state"].ToString() != "")
                {
                    model.push_state = int.Parse(ds.Tables[0].Rows[0]["push_state"].ToString());
                }

                if (ds.Tables[0].Rows[0]["is_pushed"] != null && ds.Tables[0].Rows[0]["is_pushed"].ToString() != "")
                {
                    model.is_pushed = int.Parse(ds.Tables[0].Rows[0]["is_pushed"].ToString());
                }

                if (ds.Tables[0].Rows[0]["remark1"] != null && ds.Tables[0].Rows[0]["remark1"].ToString() != "")
                {
                    model.remark1 = ds.Tables[0].Rows[0]["remark1"].ToString();
                }

                if (ds.Tables[0].Rows[0]["remark2"] != null && ds.Tables[0].Rows[0]["remark2"].ToString() != "")
                {
                    model.remark2 = int.Parse(ds.Tables[0].Rows[0]["remark2"].ToString());
                }

                #endregion

                return model;
            }
            else
            {
                return null;
            }
        }
        public void Attention(int userId, int groupTeamId, int status, string version, string equType, string equName)
        {
            string json = String.Empty;
            BLL.manager_guid bll_managerguid = new BLL.manager_guid();
            Model.manager_guid model_managerguid = null;
            try
            {
                bool is_exsit = bll_managerguid.Exists(groupTeamId, userId);
                if (is_exsit)
                {
                    bool result = false;
                    if (status == 0)
                    {
                        result = bll_managerguid.Delete(groupTeamId, userId);
                    }
                    if (result)
                    {
                        json = "{\"status\":\"true\"}";
                    }
                    else
                    {
                        json = "{\"status\":\"false\",\"data\":\"已关注此旅行社!\"}";
                    }

                }
                else
                {
                    model_managerguid = new Model.manager_guid();
                    model_managerguid.guid_id = userId;
                    model_managerguid.manager_id = groupTeamId;
                    model_managerguid.status = 1;//关注
                    model_managerguid.apply_time = DateTime.Now;
                    int count = bll_managerguid.Add(model_managerguid);
                    if (count > 0)
                    {
                        json = "{\"status\":\"true\"}";
                    }
                    else
                    {
                        json = "{\"status\":\"false\",\"data\":\"关注失败,请联系管理员!\"}";
                    }
                }

            }
            catch (Exception ex)
            {
                json = "{\"status\":\"false\",\"data\":\"" + ex.Message + "\"}";
            }
            WriteWebServiceLog(version, equType, equName, "Attention", "");
            Context.Response.Write(json);
            Context.Response.End();
        }