public SYS_LeavewordEntity getLeavewordByLid(string LeaveID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 LeaveID,LeaveTitle,LeaveDate,LeaveContent,Operator,ReceiveID,IsRead from Sys_LeaveWord ");
            strSql.Append(" where LeaveID=@LeaveID ");
            SqlParameter[] parameters = {
                    new SqlParameter("@LeaveID", SqlDbType.VarChar,50)};
            parameters[0].Value = LeaveID;

            IndustryPlatform.Model.SYS_LeavewordEntity model = new IndustryPlatform.Model.SYS_LeavewordEntity();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                model.LeaveID = ds.Tables[0].Rows[0]["LeaveID"].ToString();
                model.LeaveTitle = ds.Tables[0].Rows[0]["LeaveTitle"].ToString();
                if (ds.Tables[0].Rows[0]["LeaveDate"].ToString() != "")
                {
                    model.LeaveDate = DateTime.Parse(ds.Tables[0].Rows[0]["LeaveDate"].ToString());
                }
                model.LeaveContent = ds.Tables[0].Rows[0]["LeaveContent"].ToString();
                model.Operator = ds.Tables[0].Rows[0]["Operator"].ToString();
                model.ReceiveID = ds.Tables[0].Rows[0]["ReceiveID"].ToString();
                model.IsRead = ds.Tables[0].Rows[0]["IsRead"].ToString();
                return model;
            }
            else
            {
                return null;
            }
        }
Exemplo n.º 2
0
        public SYS_LeavewordEntity getLeavewordByLid(string LeaveID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 LeaveID,LeaveTitle,LeaveDate,LeaveContent,Operator,ReceiveID,IsRead from Sys_LeaveWord ");
            strSql.Append(" where LeaveID=@LeaveID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@LeaveID", SqlDbType.VarChar, 50)
            };
            parameters[0].Value = LeaveID;

            IndustryPlatform.Model.SYS_LeavewordEntity model = new IndustryPlatform.Model.SYS_LeavewordEntity();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                model.LeaveID    = ds.Tables[0].Rows[0]["LeaveID"].ToString();
                model.LeaveTitle = ds.Tables[0].Rows[0]["LeaveTitle"].ToString();
                if (ds.Tables[0].Rows[0]["LeaveDate"].ToString() != "")
                {
                    model.LeaveDate = DateTime.Parse(ds.Tables[0].Rows[0]["LeaveDate"].ToString());
                }
                model.LeaveContent = ds.Tables[0].Rows[0]["LeaveContent"].ToString();
                model.Operator     = ds.Tables[0].Rows[0]["Operator"].ToString();
                model.ReceiveID    = ds.Tables[0].Rows[0]["ReceiveID"].ToString();
                model.IsRead       = ds.Tables[0].Rows[0]["IsRead"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
 protected void ib_save_Click(object sender, ImageClickEventArgs e)
 {
     List<SYS_LeavewordEntity> entitys = new List<SYS_LeavewordEntity>();
     if (hf_ReceiveID.Value == "")
     {
         MessageBox.Show(this.Page, "请选择接收人!");
         return;
     }
     string[] receiveIDs = hf_ReceiveID.Value.Split(',');
     for (int i = 0; i < receiveIDs.Length; i++)
     {
         SYS_LeavewordEntity entity = new SYS_LeavewordEntity();
         entity.LeaveTitle = this.txt_LEAVEtitle.Text.Trim();
         entity.LeaveDate = System.DateTime.Now;
         entity.LeaveContent = this.txt_LEAVEcontent.Text.Trim();
         entity.Operator = "1";
         entity.IsRead = "0";
         entity.ReceiveID = receiveIDs[i];
         entitys.Add(entity);
     }
     leaveword = new SYS_Leaveword();
     int result = leaveword.AddLeaveword(entitys);
     if (result == 1)
         MessageBox.Show(this.Page,"保存成功!");
     else
         MessageBox.Show(this.Page, "保存失败!");
 }