Exemplo n.º 1
0
 protected void btn_Process_Click(object sender, EventArgs e)
 {
     ComplaintsEntity _cls = new ComplaintsEntity();
     _cls.ComplaintId = Convert.ToInt32(hd_complaintsid.Value);
     _cls.Process = txt_Process.Text;
     _cls.AdminId = logic.sysAdmin.AdminID;
     logic.complaints.updateProcess(_cls);
     rptBind();
 }
Exemplo n.º 2
0
 /// <summary>
 /// 把实体类转换成键/值对集合
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="dict"></param>
 private static void GetParameters(ComplaintsEntity entity, Dictionary <string, object> dict)
 {
     dict.Add("CID", entity.CID);
     dict.Add("CNO", entity.CNO);
     dict.Add("CName", entity.CName);
     dict.Add("CType", entity.CType);
     dict.Add("CDType", entity.CDType);
     dict.Add("CContent", entity.CContent);
     dict.Add("CContact", entity.CContact);
     dict.Add("CTime", entity.CTime);
     dict.Add("CIP", entity.CIP);
     dict.Add("CState", entity.CState);
     dict.Add("CAdminID", entity.CAdminID);
 }
Exemplo n.º 3
0
        /// <summary>
        /// 获取实体(异步方式)
        /// </summary>
        /// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
        /// <param name="dict">参数的名/值集合</param>
        /// <returns></returns>
        public virtual async Task <ComplaintsEntity> GetEntityAsync(string strWhere, Dictionary <string, object> dict = null)
        {
            ComplaintsEntity obj    = null;
            string           strSQL = "select top 1 * from Complaints where 1=1 " + strWhere;

            using (NullableDataReader reader = await Task.Run(() => _DB.GetDataReader(strSQL, dict)))
            {
                if (reader.Read())
                {
                    obj = GetEntityFromrdr(reader);
                }
            }
            return(obj);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 通过数据读取器生成实体类
        /// </summary>
        /// <param name="rdr"></param>
        /// <returns></returns>
        private static ComplaintsEntity GetEntityFromrdr(NullableDataReader rdr)
        {
            ComplaintsEntity info = new ComplaintsEntity();

            info.CID      = rdr.GetInt32("CID");
            info.CNO      = rdr.GetString("CNO");
            info.CName    = rdr.GetString("CName");
            info.CType    = rdr.GetInt32("CType");
            info.CDType   = rdr.GetInt32("CDType");
            info.CContent = rdr.GetString("CContent");
            info.CContact = rdr.GetString("CContact");
            info.CTime    = rdr.GetNullableDateTime("CTime");
            info.CIP      = rdr.GetString("CIP");
            info.CState   = rdr.GetInt32("CState");
            info.CAdminID = rdr.GetInt32("CAdminID");
            return(info);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 增加一条记录,返回新的ID号。需要有一个单一主键,并且开启有标识符属性(异步方式)
        /// </summary>
        /// <param name="entity">实体模型</param>
        /// <returns></returns>
        public virtual async Task <int> InsertAsync(ComplaintsEntity entity)
        {
            if (entity.CID <= 0)
            {
                entity.CID = GetNewID();
            }
            Dictionary <string, object> dict = new Dictionary <string, object>();

            GetParameters(entity, dict);

            string strSQL = "insert into Complaints (" +
                            "CID," +
                            "CNO," +
                            "CName," +
                            "CType," +
                            "CDType," +
                            "CContent," +
                            "CContact," +
                            "CTime," +
                            "CIP," +
                            "CState," +
                            "CAdminID) " +
                            "values(" +
                            "@CID," +
                            "@CNO," +
                            "@CName," +
                            "@CType," +
                            "@CDType," +
                            "@CContent," +
                            "@CContact," +
                            "@CTime," +
                            "@CIP," +
                            "@CState," +
                            "@CAdminID)";

            if (await Task.Run(() => _DB.ExeSQLResult(strSQL, dict)))
            {
                return(DataConverter.CLng(entity.CID));
            }
            return(-1);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 更新一条记录(异步方式)
        /// </summary>
        /// <param name="entity">实体模型</param>
        /// <returns></returns>
        public virtual async Task <bool> UpdateAsync(ComplaintsEntity entity)
        {
            Dictionary <string, object> dict = new Dictionary <string, object>();

            GetParameters(entity, dict);
            string strSQL = "Update Complaints SET " +
                            "CNO = @CNO," +
                            "CName = @CName," +
                            "CType = @CType," +
                            "CDType = @CDType," +
                            "CContent = @CContent," +
                            "CContact = @CContact," +
                            "CTime = @CTime," +
                            "CIP = @CIP," +
                            "CState = @CState," +
                            "CAdminID = @CAdminID" +
                            " WHERE " +

                            "CID = @CID";

            return(await Task.Run(() => _DB.ExeSQLResult(strSQL, dict)));
        }
Exemplo n.º 7
0
        /// <summary>
        /// 增加一条记录
        /// </summary>
        /// <param name="entity">实体模型</param>
        /// <returns></returns>
        public virtual bool Add(ComplaintsEntity entity)
        {
            if (entity.CID <= 0)
            {
                entity.CID = GetNewID();
            }
            Dictionary <string, object> dict = new Dictionary <string, object>();

            GetParameters(entity, dict);

            string strSQL = "insert into Complaints (" +
                            "CID," +
                            "CNO," +
                            "CName," +
                            "CType," +
                            "CDType," +
                            "CContent," +
                            "CContact," +
                            "CTime," +
                            "CIP," +
                            "CState," +
                            "CAdminID) " +
                            "values(" +
                            "@CID," +
                            "@CNO," +
                            "@CName," +
                            "@CType," +
                            "@CDType," +
                            "@CContent," +
                            "@CContact," +
                            "@CTime," +
                            "@CIP," +
                            "@CState," +
                            "@CAdminID)";

            return(_DB.ExeSQLResult(strSQL, dict));
        }
Exemplo n.º 8
0
 /// <summary>
 /// 增加或更新一条记录(异步方式)
 /// </summary>
 /// <param name="entity">实体模型</param>
 /// <param name="IsSave">是否增加</param>
 /// <returns></returns>
 public virtual async Task <bool> AddOrUpdateAsync(ComplaintsEntity entity, bool IsSave)
 {
     return(IsSave ? await AddAsync(entity) : await UpdateAsync(entity));
 }
Exemplo n.º 9
0
 /// <summary>
 /// 增加或更新一条记录
 /// </summary>
 /// <param name="entity">实体模型</param>
 /// <param name="IsSave">是否增加</param>
 /// <returns></returns>
 public virtual bool AddOrUpdate(ComplaintsEntity entity, bool IsSave)
 {
     return(IsSave ? Add(entity) : Update(entity));
 }