/// <summary>
 /// 功能描述    :  根据主键取得[tblEQI_Item_Group]表的记录
 /// 创建者      :  Auto Generator
 /// 创建日期    :  2009-04-29
 /// 修改者      :
 /// 修改日期    :
 /// 修改原因    :
 /// </summary>
 /// <param name="iPK">PK主键值</param>
 /// <returns>tblEQI_Item_Group</returns>
 public tblEQI_Item_Group ByPK(int iPK)
 {
     try
     {
         usp_tblEQI_Item_Group_ByPK uspByPK = new usp_tblEQI_Item_Group_ByPK();
         uspByPK.fldAutoID = iPK;
         DataTable tblData = uspByPK.ExecDataTable();
         if (tblData != null)
         {
             tblEQI_Item_Group objData = new tblEQI_Item_Group();
             objData.MetaDataTable = tblData;
             return(objData);
         }
         else
         {
             throw new Exception("取得单条记录失败,未找到对应的记录");
         }
     }
     catch (DBOpenException e)
     {
         throw new GetByPKException("打开数据库连接失败", "RuletblEQI_Item_Group", "ByPK", iPK.ToString());
     }
     catch (DBQueryException e)
     {
         throw new GetByPKException("执行Sql语句失败", "RuletblEQI_Item_Group", "ByPK", iPK.ToString());
     }
     catch (Exception e)
     {
         throw new GetByPKException(e.Message, "RuletblEQI_Item_Group", "ByPK", iPK.ToString());
     }
 }
 /// <summary>
 /// 功能描述    :  添加[tblEQI_Item_Group]表的记录
 /// 创建者      :  Auto Generator
 /// 创建日期    :  2009-04-28
 /// 修改者      :
 /// 修改日期    :
 /// 修改原因    :
 /// </summary>
 /// <param name="objInsert">需要添加的实体类</param>
 /// <returns>返回新增记录的PK主键的值</returns>
 public int Insert(tblEQI_Item_Group objInsert)
 {
     try
     {
         usp_tblEQI_Item_Group_Insert uspInsert = new usp_tblEQI_Item_Group_Insert();
         uspInsert.ReceiveParameter(objInsert);
         uspInsert.ExecNoQuery();
         if (uspInsert.fldAutoID > 0)
         {
             return(uspInsert.fldAutoID);
         }
         else
         {
             throw new Exception("插入新记录失败");
         }
     }
     catch (DBOpenException e)
     {
         throw new InsertException("打开数据库连接失败", "RuletblEQI_Item_Group", "Insert", objInsert.ToString());
     }
     catch (DBPKException e)
     {
         throw new InsertPKException("相同的记录已经存在,违反表的唯一键约束", "RuletblEQI_Item_Group", "Insert", objInsert.ToString());
     }
     catch (DBQueryException e)
     {
         throw new InsertException("执行Sql语句失败", "RuletblEQI_Item_Group", "Insert", objInsert.ToString());
     }
     catch (Exception e)
     {
         throw new InsertException(e.Message, "RuletblEQI_Item_Group", "Insert", objInsert.ToString());
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 功能描述    :  查询保存的分组
 /// 创建者      :  周文卿
 /// 创建日期    :  2017-07-05
 /// 修改者      :
 /// 修改日期    :
 /// 修改原因    :
 /// </summary>
 /// <param name="stcode">城市代码</param>
 /// <param name="type">业务类别</param>
 /// <returns>IList</returns>
 public List <tblEQI_Item_Group> GetdllBystcode(string stcode, string type)
 {
     try
     {
         List <tblEQI_Item_Group>  list  = new List <tblEQI_Item_Group>();
         usp_tblEQI_getdllBystcode usp_t = new usp_tblEQI_getdllBystcode();
         usp_t.stcode    = stcode;
         usp_t.fldObject = type;
         DataTable dt = usp_t.ExecDataTable();
         if (dt.Rows.Count > 0)
         {
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 tblEQI_Item_Group tig = new tblEQI_Item_Group();
                 tig.fldName        = dt.Rows[i]["fldName"].ToString();
                 tig.fldAutoID      = Int32.Parse(dt.Rows[i]["fldAutoID"].ToString());
                 tig.fldItemContent = dt.Rows[i]["fldItemContent"].ToString();
                 list.Add(tig);
             }
         }
         return(list);
     }
     catch (DBOpenException e)
     {
         throw new GetListException("打开数据库连接失败", "RuletblEQI_publi", "usp_tblEQI_Section_getCodeByRRCode", "stcode:" + stcode);
     }
     catch (DBQueryException e)
     {
         throw new GetListException("执行Sql语句失败", "RuletblEQI_publi", "usp_tblEQI_Section_getCodeByRRCode", "stcode:" + stcode);
     }
     catch (Exception e)
     {
         throw new GetListException(e.Message, "RuletblEQI_publi", "usp_tblEQI_Section_getCodeByRRCode", "stcode:" + stcode);
     }
 }
 /// <summary>
 /// 功能描述    :  根据用户ID和分组所属模块获得[tblEQI_Item_Group]表的所有记录
 /// 创建者      :  张浩
 /// 创建日期    :  2009-04-28
 /// 修改者      :
 /// 修改日期    :
 /// 修改原因    :
 /// </summary>
 /// <returns>IList</returns>
 public IList <tblEQI_Item_Group> GetByUserIDandObject(int UserID, string Object)
 {
     try
     {
         DataTable tblData = new DataTable();
         usp_tblEQI_Item_Group_ByUserIDandObject uspByUserIDandObject = new usp_tblEQI_Item_Group_ByUserIDandObject();
         uspByUserIDandObject.fldUserID = UserID;
         uspByUserIDandObject.fldObject = Object;
         tblData = uspByUserIDandObject.ExecDataTable();
         if (tblData != null)
         {
             IList <tblEQI_Item_Group> listAll = new List <tblEQI_Item_Group>();
             for (int i = 0; i < tblData.Rows.Count; i++)
             {
                 DataTable tblTmp = tblData.Clone();
                 tblTmp.Rows.Add(tblData.Rows[i].ItemArray);
                 tblEQI_Item_Group objData = new tblEQI_Item_Group();
                 objData.MetaDataTable = tblTmp;
                 listAll.Add(objData);
             }
             tblData.Dispose();
             return(listAll);
         }
         else
         {
             throw new Exception("取得记录失败,未找到对应的记录");
         }
     }
     catch (DBOpenException e)
     {
         throw new GetListException("打开数据库连接失败", "RuletblEQI_Item_Group", "GetByUserIDandObject", "UserID:" + UserID.ToString() + ",Object:" + Object);
     }
     catch (DBQueryException e)
     {
         throw new GetListException("执行Sql语句失败", "RuletblEQI_Item_Group", "GetByUserIDandObject", "UserID:" + UserID.ToString() + ",Object:" + Object);
     }
     catch (Exception e)
     {
         throw new GetListException(e.Message, "RuletblEQI_Item_Group", "GetByUserIDandObject", "UserID:" + UserID.ToString() + ",Object:" + Object);
     }
 }
 /// <summary>
 /// 功能描述    :  更新[tblEQI_Item_Group]表的记录
 /// 创建者      :  Auto Generator
 /// 创建日期    :  2009-04-28
 /// 修改者      :
 /// 修改日期    :
 /// 修改原因    :
 /// </summary>
 /// <param name="objUpdate_old">需要更新的实体类</param>
 /// <param name="objUpdate_new">更新后的实体类</param>
 /// <returns>true / false</returns>
 public bool Update(tblEQI_Item_Group objUpdate_old, tblEQI_Item_Group objUpdate_new)
 {
     try
     {
         usp_tblEQI_Item_Group_Update uspUpdate = new usp_tblEQI_Item_Group_Update();
         uspUpdate.ReceiveParameter_Old(objUpdate_old);
         uspUpdate.ReceiveParameter_New(objUpdate_new);
         int iResult = uspUpdate.ExecNoQuery();
         if (iResult > 0)
         {
             return(true);
         }
         else
         {
             throw new Exception("更新记录失败,未找到对应的记录");
         }
     }
     catch (DBOpenException e)
     {
         throw new UpdateException("打开数据库连接失败", "RuletblEQI_Item_Group", "Update",
                                   "objUpdate_old:" + objUpdate_old.ToString() + ";objUpdate_new:" + objUpdate_new.ToString());
     }
     catch (DBPKException e)
     {
         throw new UpdatePKException("相同的记录已经存在,违反表的唯一键约束", "RuletblEQI_Item_Group", "Update",
                                     "objUpdate_old:" + objUpdate_old.ToString() + ";objUpdate_new:" + objUpdate_new.ToString());
     }
     catch (DBQueryException e)
     {
         throw new UpdateException("执行Sql语句失败", "RuletblEQI_Item_Group", "Update",
                                   "objUpdate_old:" + objUpdate_old.ToString() + ";objUpdate_new:" + objUpdate_new.ToString());
     }
     catch (Exception e)
     {
         throw new UpdateException(e.Message, "RuletblEQI_Item_Group", "Update",
                                   "objUpdate_old:" + objUpdate_old.ToString() + ";objUpdate_new:" + objUpdate_new.ToString());
     }
 }
Ejemplo n.º 6
0
        //[SupportFilter]
        public HttpResponseMessage UpdateItemGroup(dynamic obj)
        {
            string result = string.Empty;

            try
            {
                if (string.IsNullOrEmpty(Convert.ToString(obj.id)) || Convert.ToString(obj.id) == "0")
                {
                    result = rule.JsonStr("error", "id参数错误", "缺少更新的项目信息");
                }
                else if (string.IsNullOrEmpty(Convert.ToString(obj.flditemcontent)))
                {
                    result = rule.JsonStr("error", "flditemcontent参数错误", "缺少要保存在分组中的项目");
                }
                else if (string.IsNullOrEmpty(Convert.ToString(obj.modeltype)))
                {
                    result = rule.JsonStr("error", "fldobject参数错误", "缺少业务类型");
                }
                else
                {
                    try
                    {
                        string type = gettype(HttpUtility.UrlDecode(Convert.ToString(obj.modeltype)));
                        RuletblEQI_Item_Group rule_group    = new RuletblEQI_Item_Group();
                        tblEQI_Item_Group     objObject_old = rule_group.ByPK(Convert.ToInt32(rule.ConductUserinfo(obj.id)));
                        tblEQI_Item_Group     objObject_new = new tblEQI_Item_Group();
                        objObject_new.fldObject      = type;
                        objObject_new.fldUserID      = objObject_old.fldUserID;
                        objObject_new.fldName        = objObject_old.fldName;
                        objObject_new.fldItemContent = HttpUtility.UrlDecode(Convert.ToString(obj.flditemcontent));
                        bool isdelete = rule_group.Update(objObject_old, objObject_new);
                        if (isdelete)
                        {
                            objObject_new.fldAutoID = Convert.ToInt32(obj.id);
                            result = rule.JsonStr("ok", "更新组成功", objObject_new);
                        }
                    }
                    catch (UpdatePKException ex)
                    {
                        result = rule.JsonStr("error", "flditemcontent参数错误", "请选择要保存在分组中的项目");
                    }
                    catch (DDYZ.Ensis.Library.Exception.DataRule.UpdateException ex)
                    {
                        PageException pagex = new PageException(Convert.ToInt32(obj.UserID), ex.Message, "input", "UpdateItemProject", "");
                        result = rule.JsonStr("error", "更新项目信息时出现了错误", "");
                    }
                    catch (Exception ex)
                    {
                        PageException pagex = new PageException(Convert.ToInt32(obj.UserID), ex.Message, "input", "UpdateItemProject", "");
                        result = rule.JsonStr("error", "更新项目信息时出现了错误", "");
                    }
                }
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
            }
            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }
Ejemplo n.º 7
0
        //[SupportFilter]
        public HttpResponseMessage AddItemGroup(dynamic obj)
        {
            string result = string.Empty;

            try
            {
                //验证字符串是否符合要求

                if (!string.IsNullOrEmpty(Convert.ToString(obj.fldname)))
                {
                    if (!string.IsNullOrEmpty(Convert.ToString(obj.flditemcontent)))
                    {
                        if (!string.IsNullOrEmpty(Convert.ToString(obj.modeltype)))
                        {
                            try
                            {
                                string            type       = gettype(HttpUtility.UrlDecode(Convert.ToString(obj.modeltype)));
                                tblEQI_Item_Group item_group = new tblEQI_Item_Group();
                                item_group.fldName        = HttpUtility.UrlDecode(Convert.ToString(obj.fldname));
                                item_group.fldObject      = type;
                                item_group.fldUserID      = Convert.ToInt32(rule.ConductUserinfo(obj.UserID));
                                item_group.fldItemContent = Convert.ToString(obj.flditemcontent);
                                RuletblEQI_Item_Group rule_group = new RuletblEQI_Item_Group();
                                int returnID = rule_group.Insert(item_group);
                                if (returnID > 0)
                                {
                                    item_group.fldAutoID = returnID;
                                    result = rule.JsonStr("ok", "", item_group);
                                }
                            }
                            catch (InsertPKException ex)
                            {
                                result = rule.JsonStr("error", "相同名称的分组已经存在,请输入其它名称", "");
                            }
                            catch (InsertException ex)
                            {
                                PageException pagex = new PageException(Convert.ToInt32(obj.UserID), ex.Message, "input", "AddItemProject", "");
                                result = rule.JsonStr("error", "项目分组信息写入数据库失败", "");
                            }
                            catch (Exception ex)
                            {
                                PageException pagex = new PageException(Convert.ToInt32(obj.UserID), ex.Message, "input", "AddItemProject", "");
                                result = rule.JsonStr("error", "新增项目分组失败", "");
                            }
                        }
                        else
                        {
                            result = rule.JsonStr("error", "fldobject参数错误", "");
                        }
                    }
                    else
                    {
                        result = rule.JsonStr("error", "flditemcontent参数错误", "请选择要保存在分组中的项目");
                    }
                }
                else
                {
                    result = rule.JsonStr("error", "fldname参数错误", "请输入要保存的名称");
                }
            }
            catch (Exception e)
            {
                result = rule.JsonStr("error", e.Message, "");
            }
            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }