/// <summary>
        /// 登陆(以调用 JIRA 等信息)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Login_Click(object sender, RoutedEventArgs e)
        {
            //var client = BuildJiraApiClientByPath(ConfigurationManager.AppSettings[AppSettingStatic.JIRA_SEARCH_PATH]);
            var userName = UserName.Text ?? string.Empty;
            var password = Password.Password ?? string.Empty;

            if (string.IsNullOrEmpty(userName))
            {
                MessageBox.Show("UserName can't be empty.");
                return;
            }

            if (string.IsNullOrEmpty(password))
            {
                MessageBox.Show("Password can't be empty.");
                return;
            }

            var userInfo      = new UserInfo(userName, password, GetEncodedCredentials(userName, password));
            var todayWorks    = GetWorkByUser(userName, password, true, userInfo.UN_PWD_Encoding);
            var overloadWorks = GetWorkByUser(userName, password, false, userInfo.UN_PWD_Encoding);
            var worksEntity   = new WorksEntity(todayWorks, overloadWorks);

            DialogResult = true;                    //指定成功
            CloseSelf(userInfo, worksEntity, null); //关闭自己
        }
Example #2
0
 public WorkLoadWindow(UserInfo userInfo, WorksEntity works, PassValuesHandler e)
 {
     UserInfo        = userInfo;
     WorksEntity     = works;
     PassValuesEvent = e;
     InitializeComponent();
 }
 private void CloseSelf(UserInfo userInfo, WorksEntity worksEntity, PassValueEventArgs e)
 {
     if (_loginValuesEvent != null)
     {
         _loginValuesEvent.Invoke(userInfo, worksEntity, e);
     }
     Close();
 }
Example #4
0
        /// <summary>
        /// 保存作品
        /// </summary>
        /// <returns></returns>
        private int SaveWorks(string userId, string worksTitle, string worksExcerpt, string worksContent, string labelDesc, string source, string sourceUrl, string author, string cover, string[] types)
        {
            WorksEntity worksEntity = new WorksEntity();

            worksEntity.User_id    = userId;
            worksEntity.WorksTitle = worksTitle;
            worksEntity.WorksType  = types[0];
            if (types.Length > 1)
            {
                worksEntity.Type2 = types[1];
            }
            else
            {
                worksEntity.Type2 = "0";
            }
            worksEntity.OriginaWorks = "";
            worksEntity.OriginaRole  = "";
            worksEntity.coser        = "";
            worksEntity.Photography  = "";
            worksEntity.Makeup       = "";
            worksEntity.Late         = "";
            worksEntity.Third        = "";
            worksEntity.Painter      = "";
            worksEntity.LabelDesc    = labelDesc;
            worksEntity.WorksContent = worksContent;
            worksEntity.Root         = "0";
            worksEntity.Keep         = "1";
            worksEntity.Watermark    = "1";
            worksEntity.ReleaseTime  = DateTime.Now;
            worksEntity.UpdateTime   = DateTime.Now;
            worksEntity.GoodNo       = 0;
            worksEntity.Status       = 1;
            worksEntity.reward       = 0;
            worksEntity.cover        = cover;
            worksEntity.worksExcerpt = worksExcerpt;
            worksEntity.source       = source;
            worksEntity.sourceUrl    = sourceUrl;
            worksEntity.Sticky       = "0";
            worksEntity.Recommend    = "0";

            if ((worksEntity.WorksId = WorksBll.Instance.Add(worksEntity)) > 0)
            {
                //保存作品图片
                //foreach (string s in imgss)
                //{
                //    WorkImgEntity workImgEntity = new WorkImgEntity();
                //    workImgEntity.workId = worksEntity.WorksId.ToString();
                //    workImgEntity.ImgId = s;
                //    workImgEntity.Status = 1;
                //    WorkImgBll.Instance.Add(workImgEntity);
                //}
                return(1);
            }
            else
            {
                return(-1);
            }
        }
Example #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(WorksEntity model)
 {
     try
     {
         return(WorksDb.Instance.Update(model));
     }
     catch (System.Exception ex)
     {
         WriteLog.WriteError(ex);
         throw ex;
     }
 }
Example #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string id = Context.Request.QueryString["id"];
         if (id != "")
         {
             this.WorksEntity = WorksBll.Instance.GetModel(Convert.ToInt32(id));
             BindData();
         }
     }
 }
Example #7
0
        public object GetWorksEntity(int wid)
        {
            WorksEntity worksEntity = WorksBll.Instance.GetModel(wid);

            if (worksEntity == null)
            {
                return(new Dictionary <string, string>()
                {
                    { "status", "204" }, { "message", "无内容" }
                });
            }
            return(new DataTableModels
            {
                Dt = worksEntity,
                Status = StatusEnum.success
            });
        }
Example #8
0
        private void BindData()
        {
            //初始化积分列表
            DataTable dt = IntegralChangeBll.Instance.GetList(10, $"UserId='{User_id}'", "AddTime DESC").Tables[0];

            repIntCha.DataSource = dt;
            repIntCha.DataBind();
            // 初始化评论
            DataTable replyTable   = ReplyBll.Instance.GetList(10, $"User_id='{User_id}'", "ReleaseTime DESC");
            DataTable commentTable = new DataTable();

            commentTable.Columns.Add("workId");
            commentTable.Columns.Add("type");
            commentTable.Columns.Add("cover");
            commentTable.Columns.Add("WorksTitle");
            foreach (DataRow dataRow in replyTable.Rows)
            {
                DataRow dr = commentTable.NewRow();
                dr["workId"] = dataRow["workId"];
                dr["type"]   = dataRow["type"];
                if (dataRow["type"].ToString() == "works")  //作品
                {
                    WorksEntity worksEntity = WorksBll.Instance.GetModel(int.Parse(dataRow["workId"].ToString()));
                    dr["cover"]      = worksEntity.cover;
                    dr["WorksTitle"] = worksEntity.WorksTitle;
                }
                if (dataRow["type"].ToString() == "reprint")  //合作
                {
                    CooperationEntity cooperationEntity = CooperationBll.Instance.GetModel(int.Parse(dataRow["workId"].ToString()));
                    dr["cover"]      = cooperationEntity.cover;
                    dr["WorksTitle"] = cooperationEntity.title;
                }
                if (dataRow["type"].ToString() == "activity")  //活动
                {
                    ActivityEntity activityEntity = ActivityBll.Instance.GetModel(int.Parse(dataRow["workId"].ToString()));
                    dr["cover"]      = activityEntity.cover;
                    dr["WorksTitle"] = activityEntity.title;
                }
            }
            repComment.DataSource = commentTable;
            repComment.DataBind();
            //初始化文章
            dt = WorksBll.Instance.GetList(10, $"User_id='{User_id}'", "ReleaseTime DESC");
            repArticle.DataSource = dt;
            repArticle.DataBind();
        }
Example #9
0
        private void BindData()
        {
            DataTable replyTable   = ReplyBll.Instance.GetList($"User_id='{userId}'");
            DataTable commentTable = new DataTable();

            commentTable.Columns.Add("workId");
            commentTable.Columns.Add("type");
            commentTable.Columns.Add("cover");
            commentTable.Columns.Add("WorksTitle");
            commentTable.Columns.Add("ReplyContent");
            foreach (DataRow dataRow in replyTable.Rows)
            {
                DataRow dr = commentTable.NewRow();
                dr["workId"]       = dataRow["workId"];
                dr["type"]         = dataRow["type"];
                dr["ReplyContent"] = dataRow["ReplyContent"];
                if (dataRow["type"].ToString() == "works")  //作品
                {
                    WorksEntity worksEntity = WorksBll.Instance.GetModel(int.Parse(dataRow["workId"].ToString()));
                    dr["cover"]      = worksEntity.cover;
                    dr["WorksTitle"] = worksEntity.WorksTitle;
                }
                if (dataRow["type"].ToString() == "reprint")  //合作
                {
                    CooperationEntity cooperationEntity = CooperationBll.Instance.GetModel(int.Parse(dataRow["workId"].ToString()));
                    dr["cover"]      = cooperationEntity.cover;
                    dr["WorksTitle"] = cooperationEntity.title;
                }
                if (dataRow["type"].ToString() == "activity")  //活动
                {
                    ActivityEntity activityEntity = ActivityBll.Instance.GetModel(int.Parse(dataRow["workId"].ToString()));
                    dr["cover"]      = activityEntity.cover;
                    dr["WorksTitle"] = activityEntity.title;
                }
            }
            repComment.DataSource = commentTable;
            repComment.DataBind();
        }
Example #10
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WorksEntity GetModel(int WorksId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 WorksId,User_id,WorksTitle,WorksType,Type2,OriginaWorks,OriginaRole,coser,Photography,Makeup,Late,Third,Painter,LabelDesc,WorksContent,Root,Keep,Watermark,ReleaseTime,UpdateTime,GoodNo,Status,reward,cover,worksExcerpt,source,sourceUrl,Sticky,Recommend from sns_works ");
            strSql.Append(" where WorksId=@WorksId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@WorksId", SqlDbType.Int, 4)
            };
            parameters[0].Value = WorksId;
            WorksEntity model = new WorksEntity();
            DataSet     ds    = SqlHelper.Instance.ExecSqlDataSet(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Example #11
0
        public object PostComment(string uid, string cv, string aid, [FromBody] string cont)
        {
            string      userId       = uid;
            string      type         = cv;
            string      workId       = aid;
            string      replyContent = cont;
            int         i            = -1;
            ReplyEntity replyEntity  = new ReplyEntity();

            replyEntity.User_id      = userId;
            replyEntity.type         = type;
            replyEntity.workId       = workId;
            replyEntity.ReplyContent = replyContent;
            replyEntity.ReleaseTime  = DateTime.Now;
            //插入回复表
            if (ReplyBll.Instance.Add(replyEntity) > 0)
            {
                //更新作品时间
                if (cv == "works")
                {
                    WorksEntity worksEntity = WorksBll.Instance.GetModel(int.Parse(aid));
                    worksEntity.UpdateTime = DateTime.Now;
                    WorksBll.Instance.Update(worksEntity);
                }

                return(new Dictionary <string, StatusEnum> {
                    { "Status", StatusEnum.success }
                });
            }
            else
            {
                return(new Dictionary <string, StatusEnum> {
                    { "Status", StatusEnum.error }
                });
            }
        }
Example #12
0
        private void button2_Click(object sender, EventArgs e)
        {
            DataAccess oldda = new DataAccess("oldConnLink");

            oldda.CreateConnection();
            string    sql = "SELECT * FROM dbo.cos_member";
            DataTable dt  = oldda.GetDataTable(sql);

            foreach (DataRow dataRow in dt.Rows)
            {
                MemberEntity newMemberEntity = new MemberEntity();
                newMemberEntity.User_name  = dataRow["User_name"].ToString();
                newMemberEntity.Password   = dataRow["Password"].ToString();
                newMemberEntity.Real_name  = dataRow["Real_name"].ToString();
                newMemberEntity.Gender     = dataRow["Gender"].ToString();
                newMemberEntity.Birthday   = dataRow["Birthday"].ToString();
                newMemberEntity.Reg_time   = Convert.ToDateTime(dataRow["Reg_time"]);
                newMemberEntity.Last_login = Convert.ToDateTime(dataRow["Last_login"].ToString());
                newMemberEntity.Portrait   = dataRow["Portrait"].ToString();
                newMemberEntity.integral   = Convert.ToInt32(dataRow["integral"].ToString());
                newMemberEntity.ardent     = Convert.ToInt32(dataRow["ardent"].ToString());
                newMemberEntity.Growth     = Convert.ToInt32(dataRow["Growth"].ToString());
                int userid = MemberDb.Instance.Add(newMemberEntity);

                sql = $@"SELECT * FROM dbo.sns_ordinaryNote
                        WHERE User_id='{dataRow["User_id"]}'";
                DataTable note = oldda.GetDataTable(sql);
                foreach (DataRow row in note.Rows)
                {
                    sql = $@"SELECT * FROM dbo.sns_noteImg
                        WHERE NoteId='{row["NoteId"]}'";
                    DataTable img = oldda.GetDataTable(sql);
                    string    iss = "";
                    foreach (DataRow dataRow1 in img.Rows)
                    {
                        ImgEntity imgEntity = new ImgEntity();
                        imgEntity.ImgUrl  = "/" + dataRow1["ImgUrl"].ToString();
                        imgEntity.addtime = DateTime.Now;
                        imgEntity.Status  = 1;
                        MemberDb.Instance.Add(imgEntity);
                        iss += "<img src='/" + dataRow1["ImgUrl"] + "' alt=''>";
                    }

                    WorksEntity worksEntity = new WorksEntity();
                    worksEntity.User_id      = userid.ToString();
                    worksEntity.WorksTitle   = row["notetitle"].ToString();
                    worksEntity.WorksType    = "20";
                    worksEntity.Type2        = "24";
                    worksEntity.LabelDesc    = row["LabelDesc"].ToString();
                    worksEntity.WorksContent = "<div>" + row["notecontent"] + "</div>" + iss;
                    worksEntity.Root         = "0";
                    worksEntity.Keep         = "1";
                    worksEntity.Watermark    = "1";
                    worksEntity.ReleaseTime  = Convert.ToDateTime(row["ReleaseTime"]);
                    worksEntity.UpdateTime   = Convert.ToDateTime(row["UpdateTime"]);
                    worksEntity.Status       = 1;
                    worksEntity.source       = "original";
                    MemberDb.Instance.Add(worksEntity);
                }
            }
            MessageBox.Show("完成");
        }
Example #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                worksId = Request.QueryString["nid"];  //文章id
                type    = Request.QueryString["type"]; //类型,作品(works)、合作(reprint)、活动(activity)

                Dictionary <string, string> iDi = new Dictionary <string, string>();
                switch (type)
                {
                case "works":
                    WorksEntity worksEntity1 = WorksBll.Instance.GetModel(Convert.ToInt32(worksId) - 1);
                    WorksEntity worksEntity  = WorksBll.Instance.GetModel(Convert.ToInt32(worksId));
                    WorksEntity worksEntity2 = WorksBll.Instance.GetModel(Convert.ToInt32(worksId) + 1);
                    MemberEntity = MemberBll.Instance.GetModel(Convert.ToInt32(worksEntity.User_id));
                    iDi.Add("title", worksEntity.WorksTitle);
                    iDi.Add("type", SysParaBll.Instance.GetModel(Convert.ToInt32(worksEntity.WorksType)).RefText);
                    iDi.Add("type2", (worksEntity.Type2 == "" ? "" : SysParaBll.Instance.GetModel(Convert.ToInt32(worksEntity.Type2))?.RefText));
                    iDi.Add("datetime", worksEntity.ReleaseTime.ToString("yyyy-MM-dd HH:mm:ss"));
                    iDi.Add("time", worksEntity.ReleaseTime.ToString("yyyy年MM月dd日"));
                    iDi.Add("releaseTime", GetTime(worksEntity.ReleaseTime.ToString()));
                    iDi.Add("goodNo", worksEntity.GoodNo.ToString());
                    iDi.Add("reward", worksEntity.reward.ToString());
                    iDi.Add("nickname", MemberEntity.nickname);
                    iDi.Add("excerpt", worksEntity.worksExcerpt);
                    iDi.Add("content", worksEntity.WorksContent);
                    iDi.Add("labelDesc", worksEntity.LabelDesc);
                    iDi.Add("id1", worksEntity1?.WorksId.ToString());
                    iDi.Add("title1", worksEntity1?.WorksTitle);
                    iDi.Add("cover1", worksEntity1?.cover);
                    iDi.Add("id2", worksEntity2?.WorksId.ToString());
                    iDi.Add("title2", worksEntity2?.WorksTitle);
                    iDi.Add("cover2", worksEntity2?.cover);
                    break;

                case "reprint":
                    CooperationEntity cooperationEntity1 = CooperationBll.Instance.GetModel(Convert.ToInt32(worksId) - 1);
                    CooperationEntity cooperationEntity  = CooperationBll.Instance.GetModel(Convert.ToInt32(worksId));
                    CooperationEntity cooperationEntity2 = CooperationBll.Instance.GetModel(Convert.ToInt32(worksId) + 1);
                    MemberEntity = MemberBll.Instance.GetModel(Convert.ToInt32(cooperationEntity.User_id));
                    iDi.Add("title", cooperationEntity.title);
                    iDi.Add("type", cooperationEntity.will);
                    iDi.Add("type2", (cooperationEntity.will));
                    iDi.Add("datetime", cooperationEntity.ReleaseTime.ToString("yyyy-MM-dd HH:mm:ss"));
                    iDi.Add("time", cooperationEntity.ReleaseTime.ToString("yyyy年MM月dd日"));
                    iDi.Add("releaseTime", GetTime(cooperationEntity.ReleaseTime.ToString()));
                    iDi.Add("goodNo", "-");
                    iDi.Add("nickname", MemberEntity.nickname);
                    iDi.Add("excerpt", cooperationEntity.excerpt);
                    iDi.Add("content", cooperationEntity.cooContent);
                    iDi.Add("labelDesc", "");
                    iDi.Add("id1", cooperationEntity1?.id.ToString());
                    iDi.Add("title1", cooperationEntity1?.title);
                    iDi.Add("cover1", cooperationEntity1?.cover);
                    iDi.Add("id2", cooperationEntity2?.id.ToString());
                    iDi.Add("title2", cooperationEntity2?.title);
                    iDi.Add("cover2", cooperationEntity2?.cover);
                    break;

                case "activity":
                    ActivityEntity activityEntity1 = ActivityBll.Instance.GetModel(Convert.ToInt32(worksId) - 1);
                    ActivityEntity activityEntity  = ActivityBll.Instance.GetModel(Convert.ToInt32(worksId));
                    ActivityEntity activityEntity2 = ActivityBll.Instance.GetModel(Convert.ToInt32(worksId) + 1);
                    MemberEntity = MemberBll.Instance.GetModel(Convert.ToInt32(activityEntity.User_id));
                    iDi.Add("title", activityEntity.title);
                    iDi.Add("type", "");
                    iDi.Add("type2", "");
                    iDi.Add("datetime", activityEntity.ReleaseTime.ToString("yyyy-MM-dd HH:mm:ss"));
                    iDi.Add("time", activityEntity.ReleaseTime.ToString("yyyy年MM月dd日"));
                    iDi.Add("releaseTime", GetTime(activityEntity.ReleaseTime.ToString()));
                    iDi.Add("goodNo", "-");
                    iDi.Add("nickname", MemberEntity.nickname);
                    iDi.Add("excerpt", activityEntity.excerpt);
                    iDi.Add("content", activityEntity.cont);
                    iDi.Add("labelDesc", "");
                    iDi.Add("id1", activityEntity1?.id.ToString());
                    iDi.Add("title1", activityEntity1?.title);
                    iDi.Add("cover1", activityEntity1?.cover);
                    iDi.Add("id2", activityEntity2?.id.ToString());
                    iDi.Add("title2", activityEntity2?.title);
                    iDi.Add("cover2", activityEntity2?.cover);
                    break;

                default:
                    break;
                }
                BindData(iDi);
            }
        }
Example #14
0
 /// <summary>
 /// 处理登陆窗口返回的值
 /// </summary>
 /// <param name="userInfo"></param>
 /// <param name="worksEntity"></param>
 /// <param name="e"></param>
 private void HandleLoginCallBack(UserInfo userInfo, WorksEntity worksEntity, PassValueEventArgs e)
 {
     //
     System.Windows.Forms.MessageBox.Show(userInfo.Password);
 }
Example #15
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(WorksEntity model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into sns_works(");
            strSql.Append("User_id,WorksTitle,WorksType,Type2,OriginaWorks,OriginaRole,coser,Photography,Makeup,Late,Third,Painter,LabelDesc,WorksContent,Root,Keep,Watermark,ReleaseTime,UpdateTime,GoodNo,Status,reward,cover,worksExcerpt,source,sourceUrl,Sticky,Recommend)");
            strSql.Append(" values (");
            strSql.Append("@User_id,@WorksTitle,@WorksType,@Type2,@OriginaWorks,@OriginaRole,@coser,@Photography,@Makeup,@Late,@Third,@Painter,@LabelDesc,@WorksContent,@Root,@Keep,@Watermark,@ReleaseTime,@UpdateTime,@GoodNo,@Status,@reward,@cover,@worksExcerpt,@source,@sourceUrl,@Sticky,@Recommend)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@User_id",      SqlDbType.VarChar,  50),
                new SqlParameter("@WorksTitle",   SqlDbType.Text,     16),
                new SqlParameter("@WorksType",    SqlDbType.VarChar,  50),
                new SqlParameter("@Type2",        SqlDbType.VarChar,  50),
                new SqlParameter("@OriginaWorks", SqlDbType.VarChar,  50),
                new SqlParameter("@OriginaRole",  SqlDbType.VarChar,  50),
                new SqlParameter("@coser",        SqlDbType.VarChar,  50),
                new SqlParameter("@Photography",  SqlDbType.VarChar,  50),
                new SqlParameter("@Makeup",       SqlDbType.VarChar,  50),
                new SqlParameter("@Late",         SqlDbType.VarChar,  50),
                new SqlParameter("@Third",        SqlDbType.VarChar,  50),
                new SqlParameter("@Painter",      SqlDbType.VarChar,  50),
                new SqlParameter("@LabelDesc",    SqlDbType.VarChar,  50),
                new SqlParameter("@WorksContent", SqlDbType.Text,     16),
                new SqlParameter("@Root",         SqlDbType.VarChar,   1),
                new SqlParameter("@Keep",         SqlDbType.VarChar,   1),
                new SqlParameter("@Watermark",    SqlDbType.VarChar,   1),
                new SqlParameter("@ReleaseTime",  SqlDbType.DateTime,  8),
                new SqlParameter("@UpdateTime",   SqlDbType.DateTime,  8),
                new SqlParameter("@GoodNo",       SqlDbType.Int,       4),
                new SqlParameter("@Status",       SqlDbType.Int,       4),
                new SqlParameter("@reward",       SqlDbType.Int,       4),
                new SqlParameter("@cover",        SqlDbType.VarChar,  50),
                new SqlParameter("@worksExcerpt", SqlDbType.Text,     16),
                new SqlParameter("@source",       SqlDbType.VarChar,  50),
                new SqlParameter("@sourceUrl",    SqlDbType.VarChar,  50),
                new SqlParameter("@Sticky",       SqlDbType.VarChar,  50),
                new SqlParameter("@Recommend",    SqlDbType.VarChar, 50)
            };
            parameters[0].Value  = model.User_id;
            parameters[1].Value  = model.WorksTitle;
            parameters[2].Value  = model.WorksType;
            parameters[3].Value  = model.Type2;
            parameters[4].Value  = model.OriginaWorks;
            parameters[5].Value  = model.OriginaRole;
            parameters[6].Value  = model.coser;
            parameters[7].Value  = model.Photography;
            parameters[8].Value  = model.Makeup;
            parameters[9].Value  = model.Late;
            parameters[10].Value = model.Third;
            parameters[11].Value = model.Painter;
            parameters[12].Value = model.LabelDesc;
            parameters[13].Value = model.WorksContent;
            parameters[14].Value = model.Root;
            parameters[15].Value = model.Keep;
            parameters[16].Value = model.Watermark;
            parameters[17].Value = model.ReleaseTime;
            parameters[18].Value = model.UpdateTime;
            parameters[19].Value = model.GoodNo;
            parameters[20].Value = model.Status;
            parameters[21].Value = model.reward;
            parameters[22].Value = model.cover;
            parameters[23].Value = model.worksExcerpt;
            parameters[24].Value = model.source;
            parameters[25].Value = model.sourceUrl;
            parameters[26].Value = model.Sticky;
            parameters[27].Value = model.Recommend;

            object obj = SqlHelper.Instance.ExecSqlScalar(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Example #16
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WorksEntity DataRowToModel(DataRow row)
        {
            WorksEntity model = new WorksEntity();

            if (row != null)
            {
                if (row["WorksId"] != null && row["WorksId"].ToString() != "")
                {
                    model.WorksId = int.Parse(row["WorksId"].ToString());
                }
                if (row["User_id"] != null)
                {
                    model.User_id = row["User_id"].ToString();
                }
                if (row["WorksTitle"] != null)
                {
                    model.WorksTitle = row["WorksTitle"].ToString();
                }
                if (row["WorksType"] != null)
                {
                    model.WorksType = row["WorksType"].ToString();
                }
                if (row["Type2"] != null)
                {
                    model.Type2 = row["Type2"].ToString();
                }
                if (row["OriginaWorks"] != null)
                {
                    model.OriginaWorks = row["OriginaWorks"].ToString();
                }
                if (row["OriginaRole"] != null)
                {
                    model.OriginaRole = row["OriginaRole"].ToString();
                }
                if (row["coser"] != null)
                {
                    model.coser = row["coser"].ToString();
                }
                if (row["Photography"] != null)
                {
                    model.Photography = row["Photography"].ToString();
                }
                if (row["Makeup"] != null)
                {
                    model.Makeup = row["Makeup"].ToString();
                }
                if (row["Late"] != null)
                {
                    model.Late = row["Late"].ToString();
                }
                if (row["Third"] != null)
                {
                    model.Third = row["Third"].ToString();
                }
                if (row["Painter"] != null)
                {
                    model.Painter = row["Painter"].ToString();
                }
                if (row["LabelDesc"] != null)
                {
                    model.LabelDesc = row["LabelDesc"].ToString();
                }
                if (row["WorksContent"] != null)
                {
                    model.WorksContent = row["WorksContent"].ToString();
                }
                if (row["Root"] != null)
                {
                    model.Root = row["Root"].ToString();
                }
                if (row["Keep"] != null)
                {
                    model.Keep = row["Keep"].ToString();
                }
                if (row["Watermark"] != null)
                {
                    model.Watermark = row["Watermark"].ToString();
                }
                if (row["ReleaseTime"] != null && row["ReleaseTime"].ToString() != "")
                {
                    model.ReleaseTime = DateTime.Parse(row["ReleaseTime"].ToString());
                }
                if (row["UpdateTime"] != null && row["UpdateTime"].ToString() != "")
                {
                    model.UpdateTime = DateTime.Parse(row["UpdateTime"].ToString());
                }
                if (row["GoodNo"] != null && row["GoodNo"].ToString() != "")
                {
                    model.GoodNo = int.Parse(row["GoodNo"].ToString());
                }
                if (row["Status"] != null && row["Status"].ToString() != "")
                {
                    model.Status = int.Parse(row["Status"].ToString());
                }
                if (row["reward"] != null && row["reward"].ToString() != "")
                {
                    model.reward = int.Parse(row["reward"].ToString());
                }
                if (row["cover"] != null)
                {
                    model.cover = row["cover"].ToString();
                }
                if (row["worksExcerpt"] != null)
                {
                    model.worksExcerpt = row["worksExcerpt"].ToString();
                }
                if (row["source"] != null)
                {
                    model.source = row["source"].ToString();
                }
                if (row["sourceUrl"] != null)
                {
                    model.sourceUrl = row["sourceUrl"].ToString();
                }
                if (row["Sticky"] != null)
                {
                    model.Sticky = row["Sticky"].ToString();
                }
                if (row["Recommend"] != null)
                {
                    model.Recommend = row["Recommend"].ToString();
                }
            }
            return(model);
        }
Example #17
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WorksEntity model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update sns_works set ");
            strSql.Append("User_id=@User_id,");
            strSql.Append("WorksTitle=@WorksTitle,");
            strSql.Append("WorksType=@WorksType,");
            strSql.Append("Type2=@Type2,");
            strSql.Append("OriginaWorks=@OriginaWorks,");
            strSql.Append("OriginaRole=@OriginaRole,");
            strSql.Append("coser=@coser,");
            strSql.Append("Photography=@Photography,");
            strSql.Append("Makeup=@Makeup,");
            strSql.Append("Late=@Late,");
            strSql.Append("Third=@Third,");
            strSql.Append("Painter=@Painter,");
            strSql.Append("LabelDesc=@LabelDesc,");
            strSql.Append("WorksContent=@WorksContent,");
            strSql.Append("Root=@Root,");
            strSql.Append("Keep=@Keep,");
            strSql.Append("Watermark=@Watermark,");
            strSql.Append("ReleaseTime=@ReleaseTime,");
            strSql.Append("UpdateTime=@UpdateTime,");
            strSql.Append("GoodNo=@GoodNo,");
            strSql.Append("Status=@Status,");
            strSql.Append("reward=@reward,");
            strSql.Append("cover=@cover,");
            strSql.Append("worksExcerpt=@worksExcerpt,");
            strSql.Append("source=@source,");
            strSql.Append("sourceUrl=@sourceUrl,");
            strSql.Append("Sticky=@Sticky,");
            strSql.Append("Recommend=@Recommend");
            strSql.Append(" where WorksId=@WorksId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@User_id",      SqlDbType.VarChar,  50),
                new SqlParameter("@WorksTitle",   SqlDbType.Text,     16),
                new SqlParameter("@WorksType",    SqlDbType.VarChar,  50),
                new SqlParameter("@Type2",        SqlDbType.VarChar,  50),
                new SqlParameter("@OriginaWorks", SqlDbType.VarChar,  50),
                new SqlParameter("@OriginaRole",  SqlDbType.VarChar,  50),
                new SqlParameter("@coser",        SqlDbType.VarChar,  50),
                new SqlParameter("@Photography",  SqlDbType.VarChar,  50),
                new SqlParameter("@Makeup",       SqlDbType.VarChar,  50),
                new SqlParameter("@Late",         SqlDbType.VarChar,  50),
                new SqlParameter("@Third",        SqlDbType.VarChar,  50),
                new SqlParameter("@Painter",      SqlDbType.VarChar,  50),
                new SqlParameter("@LabelDesc",    SqlDbType.VarChar,  50),
                new SqlParameter("@WorksContent", SqlDbType.Text,     16),
                new SqlParameter("@Root",         SqlDbType.VarChar,   1),
                new SqlParameter("@Keep",         SqlDbType.VarChar,   1),
                new SqlParameter("@Watermark",    SqlDbType.VarChar,   1),
                new SqlParameter("@ReleaseTime",  SqlDbType.DateTime,  8),
                new SqlParameter("@UpdateTime",   SqlDbType.DateTime,  8),
                new SqlParameter("@GoodNo",       SqlDbType.Int,       4),
                new SqlParameter("@Status",       SqlDbType.Int,       4),
                new SqlParameter("@reward",       SqlDbType.Int,       4),
                new SqlParameter("@cover",        SqlDbType.VarChar,  50),
                new SqlParameter("@worksExcerpt", SqlDbType.Text,     16),
                new SqlParameter("@source",       SqlDbType.VarChar,  50),
                new SqlParameter("@sourceUrl",    SqlDbType.VarChar,  50),
                new SqlParameter("@Sticky",       SqlDbType.VarChar,  50),
                new SqlParameter("@Recommend",    SqlDbType.VarChar,  50),
                new SqlParameter("@WorksId",      SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.User_id;
            parameters[1].Value  = model.WorksTitle;
            parameters[2].Value  = model.WorksType;
            parameters[3].Value  = model.Type2;
            parameters[4].Value  = model.OriginaWorks;
            parameters[5].Value  = model.OriginaRole;
            parameters[6].Value  = model.coser;
            parameters[7].Value  = model.Photography;
            parameters[8].Value  = model.Makeup;
            parameters[9].Value  = model.Late;
            parameters[10].Value = model.Third;
            parameters[11].Value = model.Painter;
            parameters[12].Value = model.LabelDesc;
            parameters[13].Value = model.WorksContent;
            parameters[14].Value = model.Root;
            parameters[15].Value = model.Keep;
            parameters[16].Value = model.Watermark;
            parameters[17].Value = model.ReleaseTime;
            parameters[18].Value = model.UpdateTime;
            parameters[19].Value = model.GoodNo;
            parameters[20].Value = model.Status;
            parameters[21].Value = model.reward;
            parameters[22].Value = model.cover;
            parameters[23].Value = model.worksExcerpt;
            parameters[24].Value = model.source;
            parameters[25].Value = model.sourceUrl;
            parameters[26].Value = model.Sticky;
            parameters[27].Value = model.Recommend;
            parameters[28].Value = model.WorksId;

            int rows = SqlHelper.Instance.ExecSqlNonQuery(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }