Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            FrameWorkPermission.CheckPagePermission(CMD);

            currentGP = BusinessFacade.sys_GroupDisp(UserData.GetUserDate.U_GroupID);
            if (!Page.IsPostBack)
            {
                if ("Edit".Equals(CMD))
                {
                    Department_DeviceEntity ut = BusinessFacadeShanliTech_HLD_Business.Department_DeviceDisp(IDX);
                    if (ut.State == 1)
                    {
                        EventMessage.MessageBox(2, "操作提示", "该设备已检定完成,禁止再次修改!", Icon_Type.Error, Common.GetHomeBaseUrl("Manager.aspx?CMD=List&IDX=" + IDX));
                        
                    }
                }
                ToolMethods.InitDropDownDevice(DeviceID_DropDown);
                //ToolMethods.InitDropDownAllGroup(Group_DropDown);
                ToolMethods.InitDropDownDeviceType(DeviceType_DropDown);
                ToolMethods.InitDropDownVerifyType(VerifyType_DropDown);
                OnStart();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 将记录集转为sys_GroupTable实体类
        /// </summary>
        /// <param name="dr">记录集</param>
        /// <returns>sys_GroupTable</returns>
        protected object Populatesys_Group(IDataReader dr)
        {
            sys_GroupTable nc = new sys_GroupTable();

            if (!Convert.IsDBNull(dr["GroupID"])) nc.GroupID = Convert.ToInt32(dr["GroupID"]); // 分类ID号
            if (!Convert.IsDBNull(dr["G_CName"])) nc.G_CName = Convert.ToString(dr["G_CName"]).Trim(); // 分类中文说明
            if (!Convert.IsDBNull(dr["G_ParentID"])) nc.G_ParentID = Convert.ToInt32(dr["G_ParentID"]); // 上级分类ID0:为最高级
            if (!Convert.IsDBNull(dr["G_ShowOrder"])) nc.G_ShowOrder = Convert.ToInt32(dr["G_ShowOrder"]); // 显示顺序
            if (!Convert.IsDBNull(dr["G_Level"])) nc.G_Level = Convert.ToInt32(dr["G_Level"]); // 当前分类所在层数
            if (!Convert.IsDBNull(dr["G_ChildCount"])) nc.G_ChildCount = Convert.ToInt32(dr["G_ChildCount"]); // 当前分类子分类数
            if (!Convert.IsDBNull(dr["G_Delete"])) nc.G_Delete = Convert.ToInt32(dr["G_Delete"]); // 是否删除1:是0:否

            if (!Convert.IsDBNull(dr["Address"])) nc.Address = Convert.ToString(dr["Address"]).Trim(); // 地址
            if (!Convert.IsDBNull(dr["CertificateNumber"])) nc.CertificateNumber = Convert.ToString(dr["CertificateNumber"]).Trim(); // 资质证书编号
            if (!Convert.IsDBNull(dr["Fax"])) nc.Fax = Convert.ToString(dr["Fax"]).Trim(); // 传真
            if (!Convert.IsDBNull(dr["EmailAddress"])) nc.EmailAddress = Convert.ToString(dr["EmailAddress"]).Trim(); // email地址
            if (!Convert.IsDBNull(dr["Tel"])) nc.Tel = Convert.ToString(dr["Tel"]).Trim(); // 联系电话
            if (!Convert.IsDBNull(dr["ZipCode"])) nc.ZipCode = Convert.ToString(dr["ZipCode"]).Trim(); // 邮政编码
            if (!Convert.IsDBNull(dr["Type"])) nc.Type = Convert.ToInt32(dr["Type"]); // 部门类型
            return nc;
        }
Esempio n. 3
0
 /// <summary>
 /// 新增/删除/修改 sys_Group
 /// </summary>
 /// <param name="fam">sys_GroupTable实体类</param>
 /// <returns>返回0操正常</returns>
 public abstract int sys_GroupInsertUpdate(sys_GroupTable fam);
Esempio n. 4
0
        /// <summary>
        /// ����/ɾ��/�޸� sys_Group
        /// </summary>
        /// <param name="fam">sys_GroupTableʵ����</param>
        /// <returns>����0������</returns>
        public override int sys_GroupInsertUpdate(sys_GroupTable fam)
        {
            int rInt = 0;

            using (OracleConnection Conn = GetSqlConnection())
            {
                string CommTxt;
                OracleCommand cmd = new OracleCommand();
                cmd.Connection = Conn;
                if (fam.DB_Option_Action_ == "Insert")
                {
                    CommTxt = "Insert into 	sys_Group(GroupID,G_CName,G_ParentID,G_ShowOrder,G_Level,G_ChildCount,G_Delete)VALUES(SEQ_sys_Group_ID.NEXTVAL,:G_CName,:G_ParentID,:G_ShowOrder,:G_Level,:G_ChildCount,:G_Delete)";
                    cmd.CommandText = CommTxt;

                    cmd.Parameters.Add("G_CName", OracleType.NVarChar).Value = fam.G_CName + ""; //��������˵��
                    cmd.Parameters.Add("G_ParentID", OracleType.Int32).Value = fam.G_ParentID; //�ϼ�����ID0:Ϊ��߼�
                    cmd.Parameters.Add("G_ShowOrder", OracleType.Int32).Value = fam.G_ShowOrder; //��ʾ˳��
                    cmd.Parameters.Add("G_Level", OracleType.Int32).Value = fam.G_Level; //��ǰ�������ڲ���
                    cmd.Parameters.Add("G_ChildCount", OracleType.Int32).Value = fam.G_ChildCount; //��ǰ�����ӷ�����
                    cmd.Parameters.Add("G_Delete", OracleType.SByte).Value = fam.G_Delete; //�Ƿ�ɾ��1:��0:��
                }
                else if (fam.DB_Option_Action_ == "Update")
                {

                    CommTxt = "UPDATE sys_Group SET	G_CName = :G_CName,G_ParentID = :G_ParentID,G_ShowOrder = :G_ShowOrder,G_Level = :G_Level,G_ChildCount = :G_ChildCount,G_Delete = :G_Delete WHERE (GroupID = :GroupID)";
                    cmd.CommandText = CommTxt;

                    cmd.Parameters.Add("G_CName", OracleType.NVarChar).Value = fam.G_CName + ""; //��������˵��
                    cmd.Parameters.Add("G_ParentID", OracleType.Int32).Value = fam.G_ParentID; //�ϼ�����ID0:Ϊ��߼�
                    cmd.Parameters.Add("G_ShowOrder", OracleType.Int32).Value = fam.G_ShowOrder; //��ʾ˳��
                    cmd.Parameters.Add("G_Level", OracleType.Int32).Value = fam.G_Level; //��ǰ�������ڲ���
                    cmd.Parameters.Add("G_ChildCount", OracleType.Int32).Value = fam.G_ChildCount; //��ǰ�����ӷ�����
                    cmd.Parameters.Add("G_Delete", OracleType.SByte).Value = fam.G_Delete; //�Ƿ�ɾ��1:��0:��
                    cmd.Parameters.Add("GroupID", OracleType.Int32).Value = fam.GroupID;
                }
                else if (fam.DB_Option_Action_ == "Delete")
                {
                    CommTxt = "Delete from  sys_Group  WHERE (GroupID = :GroupID)";
                    cmd.CommandText = CommTxt;
                    cmd.Parameters.Add("GroupID", OracleType.Int32).Value = fam.GroupID;
                }
                else
                    throw new ApplicationException("�޷�ʶ��IJ�������!");
                Conn.Open();
                OracleTransaction Tran = Conn.BeginTransaction();
                cmd.Transaction = Tran;
                try
                {
                    rInt = cmd.ExecuteNonQuery();
                    cmd.Parameters.Clear();
                    if (fam.DB_Option_Action_ == "Insert")
                    {
                        cmd.CommandText = "select SEQ_sys_Group_ID.CURRVAL from  dual";
                        rInt = Convert.ToInt32(cmd.ExecuteScalar());
                    }
                    Tran.Commit();
                }
                catch (Exception ex)
                {
                    Tran.Rollback();
                    throw new ApplicationException(ex.ToString());
                }
                finally
                {
                    Tran.Dispose();
                    cmd.Dispose();
                    Conn.Dispose();
                    Conn.Close();
                }
            }
            return rInt;
        }
        /// <summary>
        /// 新增/删除/修改 sys_Group
        /// </summary>
        /// <param name="fam">sys_GroupTable实体类</param>
        /// <returns>返回0操正常</returns>
        public override int sys_GroupInsertUpdate(sys_GroupTable fam)
        {
            int rInt = 0;

            #region OLD
            //using (OleDbConnection Conn = GetSqlConnection())
            //{
            //    string CommTxt;
            //    OleDbCommand cmd = new OleDbCommand();
            //    cmd.Connection = Conn;
            //    if (fam.DB_Option_Action_ == "Insert")
            //    {
            //        CommTxt = "Insert into 	sys_Group(G_CName,G_ParentID,G_ShowOrder,G_Level,G_ChildCount,G_Delete)VALUES(@G_CName,@G_ParentID,@G_ShowOrder,@G_Level,@G_ChildCount,@G_Delete)";
            //        cmd.CommandText = CommTxt;

            //        cmd.Parameters.Add("@G_CName", OleDbType.VarWChar).Value = fam.G_CName + ""; //分类中文说明	
            //        cmd.Parameters.Add("@G_ParentID", OleDbType.Integer).Value = fam.G_ParentID; //上级分类ID0:为最高级	
            //        cmd.Parameters.Add("@G_ShowOrder", OleDbType.Integer).Value = fam.G_ShowOrder; //显示顺序	
            //        cmd.Parameters.Add("@G_Level", OleDbType.Integer).Value = fam.G_Level; //当前分类所在层数	
            //        cmd.Parameters.Add("@G_ChildCount", OleDbType.Integer).Value = fam.G_ChildCount; //当前分类子分类数
            //        cmd.Parameters.Add("@G_Delete", OleDbType.LongVarWChar).Value = fam.G_Delete + "";  //是否删除1:是0:否
            //    }
            //    else if (fam.DB_Option_Action_ == "Update")
            //    {

            //        CommTxt = "UPDATE sys_Group SET	G_CName = @G_CName,G_ParentID = @G_ParentID,G_ShowOrder = @G_ShowOrder,G_Level = @G_Level,G_ChildCount = @G_ChildCount,G_Delete = @G_Delete WHERE (GroupID = @GroupID)";
            //        cmd.CommandText = CommTxt;

            //        cmd.Parameters.Add("@G_CName", OleDbType.VarWChar).Value = fam.G_CName + ""; //分类中文说明	
            //        cmd.Parameters.Add("@G_ParentID", OleDbType.Integer).Value = fam.G_ParentID; //上级分类ID0:为最高级	
            //        cmd.Parameters.Add("@G_ShowOrder", OleDbType.Integer).Value = fam.G_ShowOrder; //显示顺序	
            //        cmd.Parameters.Add("@G_Level", OleDbType.Integer).Value = fam.G_Level; //当前分类所在层数	
            //        cmd.Parameters.Add("@G_ChildCount", OleDbType.Integer).Value = fam.G_ChildCount; //当前分类子分类数
            //        cmd.Parameters.Add("@G_Delete", OleDbType.LongVarWChar).Value = fam.G_Delete + "";  //是否删除1:是0:否
            //        cmd.Parameters.Add("@GroupID", OleDbType.Integer).Value = fam.GroupID;
            //    }
            //    else if (fam.DB_Option_Action_ == "Delete")
            //    {
            //        CommTxt = "Delete from  sys_Group  WHERE (GroupID = @GroupID)";
            //        cmd.CommandText = CommTxt;
            //        cmd.Parameters.Add("@GroupID", OleDbType.Integer).Value = fam.GroupID;
            //    }
            //    else
            //        throw new ApplicationException("无法识别的操作命令!");
            //    Conn.Open();
            //    rInt = cmd.ExecuteNonQuery();
            //    if (fam.DB_Option_Action_ == "Insert")
            //    {
            //        cmd.CommandText = "SELECT @@identity";
            //        rInt = Convert.ToInt32(cmd.ExecuteScalar());
            //    }
            //    cmd.Dispose();
            //    Conn.Dispose();
            //    Conn.Close();
            //}
            #endregion

            using (OleDbConnection Conn = GetSqlConnection())
            {
                string CommTxt;
                OleDbCommand cmd = new OleDbCommand();
                cmd.Connection = Conn;
                Conn.Open();
                if (fam.DB_Option_Action_.ToString() == "Insert")
                {

                    CommTxt = "Insert into 	sys_Group(G_CName,G_ParentID,G_ShowOrder,G_Level,G_ChildCount,G_Delete,Address,CertificateNumber,Fax,EmailAddress,Tel,ZipCode,Type)VALUES(@G_CName,@G_ParentID,@G_ShowOrder,@G_Level,@G_ChildCount,@G_Delete,@Address,@CertificateNumber,@Fax,@EmailAddress,@Tel,@ZipCode,@Type)";
                    cmd.CommandText = CommTxt;

                    cmd.Parameters.Add("@G_CName", OleDbType.VarWChar).Value = fam.G_CName; //部门名称
                    cmd.Parameters.Add("@G_ParentID", OleDbType.Integer).Value = fam.G_ParentID; //父ID
                    cmd.Parameters.Add("@G_ShowOrder", OleDbType.Integer).Value = fam.G_ShowOrder; //序号
                    cmd.Parameters.Add("@G_Level", OleDbType.Integer).Value = fam.G_Level; //级别
                    cmd.Parameters.Add("@G_ChildCount", OleDbType.Integer).Value = fam.G_ChildCount; //子类数量
                    cmd.Parameters.Add("@G_Delete", OleDbType.BigInt).Value = fam.G_Delete; //是否删除:1是,0否
                    cmd.Parameters.Add("@Address", OleDbType.VarChar).Value = fam.Address; //地址
                    cmd.Parameters.Add("@CertificateNumber", OleDbType.VarChar).Value = fam.CertificateNumber; //资质证书编号
                    cmd.Parameters.Add("@Fax", OleDbType.VarChar).Value = fam.Fax; //传真
                    cmd.Parameters.Add("@EmailAddress", OleDbType.VarChar).Value = fam.EmailAddress; //email地址
                    cmd.Parameters.Add("@Tel", OleDbType.VarChar).Value = fam.Tel; //联系电话
                    cmd.Parameters.Add("@ZipCode", OleDbType.VarChar).Value = fam.ZipCode; //邮政编码
                    cmd.Parameters.Add("@Type", OleDbType.Integer).Value = fam.Type; //部门类型
                }
                else if (fam.DB_Option_Action_.ToString() == "Update")
                {

                    CommTxt = "UPDATE sys_Group SET G_CName = @G_CName,G_ParentID = @G_ParentID,G_ShowOrder = @G_ShowOrder,G_Level = @G_Level,G_ChildCount = @G_ChildCount,G_Delete = @G_Delete,Address = @Address,CertificateNumber = @CertificateNumber,Fax = @Fax,EmailAddress = @EmailAddress,Tel = @Tel,ZipCode = @ZipCode WHERE (GroupID = @GroupID)";
                    cmd.CommandText = CommTxt;

                    cmd.Parameters.Add("@G_CName", OleDbType.VarWChar).Value = fam.G_CName; //部门名称
                    cmd.Parameters.Add("@G_ParentID", OleDbType.Integer).Value = fam.G_ParentID; //父ID
                    cmd.Parameters.Add("@G_ShowOrder", OleDbType.Integer).Value = fam.G_ShowOrder; //序号
                    cmd.Parameters.Add("@G_Level", OleDbType.Integer).Value = fam.G_Level; //级别
                    cmd.Parameters.Add("@G_ChildCount", OleDbType.Integer).Value = fam.G_ChildCount; //子类数量
                    cmd.Parameters.Add("@G_Delete", OleDbType.BigInt).Value = fam.G_Delete; //是否删除:1是,0否
                    cmd.Parameters.Add("@Address", OleDbType.VarChar).Value = fam.Address; //地址
                    cmd.Parameters.Add("@CertificateNumber", OleDbType.VarChar).Value = fam.CertificateNumber; //资质证书编号
                    cmd.Parameters.Add("@Fax", OleDbType.VarChar).Value = fam.Fax; //传真
                    cmd.Parameters.Add("@EmailAddress", OleDbType.VarChar).Value = fam.EmailAddress; //email地址
                    cmd.Parameters.Add("@Tel", OleDbType.VarChar).Value = fam.Tel; //联系电话
                    cmd.Parameters.Add("@ZipCode", OleDbType.VarChar).Value = fam.ZipCode; //邮政编码
                    cmd.Parameters.Add("@编号", OleDbType.Integer).Value = fam.GroupID; //编号
                    cmd.Parameters.Add("@Type", OleDbType.Integer).Value = fam.Type; //部门类型
                }
                else if (fam.DB_Option_Action_.ToString() == "Delete")
                {
                    CommTxt = "Delete from  sys_Group  WHERE (GroupID = @GroupID)";
                    cmd.CommandText = CommTxt;
                    cmd.Parameters.Add("@GroupID", OleDbType.Integer).Value = fam.GroupID; //编号
                }
                else
                    throw new ApplicationException("无法识别的操作命令!");

                rInt = cmd.ExecuteNonQuery();
                if (fam.DB_Option_Action_.ToString() == "Insert")
                {
                    cmd.CommandText = "SELECT @@identity";
                    rInt = Convert.ToInt32(cmd.ExecuteScalar());
                }
                cmd.Dispose();
                Conn.Dispose();
                Conn.Close();
            }
            return rInt;
        }
        /// <summary>
        /// 新增/删除/修改 sys_Group
        /// </summary>
        /// <param name="fam">sys_GroupTable实体类</param>
        /// <returns>返回0操正常</returns>
        public override int sys_GroupInsertUpdate(sys_GroupTable fam)
        {
            int rInt = 0;

            using (OracleConnection Conn = GetSqlConnection())
            {
                string CommTxt;
                OracleCommand cmd = new OracleCommand();
                cmd.Connection = Conn;
                if (fam.DB_Option_Action_.ToString() == "Insert")
                {
                    CommTxt = "Insert into 	sys_Group(GroupID,G_CName,G_ParentID,G_ShowOrder,G_Level,G_ChildCount,G_Delete,Address,CertificateNumber,Fax,EmailAddress,Tel,ZipCode)VALUES(SEQ_sys_Group_ID.NEXTVAL,:G_CName,:G_ParentID,:G_ShowOrder,:G_Level,:G_ChildCount,:G_Delete,:Address,:CertificateNumber,:Fax,:EmailAddress,:Tel,:ZipCode)";
                    cmd.CommandText = CommTxt;

                    cmd.Parameters.Add("G_CName", OracleType.NVarChar).Value = fam.G_CName + ""; //分类中文说明	
                    cmd.Parameters.Add("G_ParentID", OracleType.Int32).Value = fam.G_ParentID; //上级分类ID0:为最高级	
                    cmd.Parameters.Add("G_ShowOrder", OracleType.Int32).Value = fam.G_ShowOrder; //显示顺序	
                    cmd.Parameters.Add("G_Level", OracleType.Int32).Value = fam.G_Level; //当前分类所在层数	
                    cmd.Parameters.Add("G_ChildCount", OracleType.Int32).Value = fam.G_ChildCount; //当前分类子分类数
                    cmd.Parameters.Add("G_Delete", OracleType.SByte).Value = fam.G_Delete; //是否删除1:是0:否

                    cmd.Parameters.Add("Address", OracleType.NVarChar).Value = fam.Address;
                    cmd.Parameters.Add("CertificateNumber", OracleType.NVarChar).Value = fam.CertificateNumber;
                    cmd.Parameters.Add("Fax", OracleType.NVarChar).Value = fam.Fax;
                    cmd.Parameters.Add("EmailAddress", OracleType.NVarChar).Value = fam.EmailAddress;
                    cmd.Parameters.Add("Tel", OracleType.NVarChar).Value = fam.Tel;
                    cmd.Parameters.Add("ZipCode", OracleType.NVarChar).Value = fam.ZipCode;
                }
                else if (fam.DB_Option_Action_.ToString() == "Update")
                {

                    CommTxt = "UPDATE sys_Group SET	G_CName = :G_CName,G_ParentID = :G_ParentID,G_ShowOrder = :G_ShowOrder,G_Level = :G_Level,G_ChildCount = :G_ChildCount,G_Delete = :G_Delete,Address = :Address,CertificateNumber = :CertificateNumber,Fax = :Fax,EmailAddress = :EmailAddress,Tel = :Tel,ZipCode = :ZipCode WHERE (GroupID = :GroupID)";
                    cmd.CommandText = CommTxt;

                    cmd.Parameters.Add("G_CName", OracleType.NVarChar).Value = fam.G_CName + ""; //分类中文说明	
                    cmd.Parameters.Add("G_ParentID", OracleType.Int32).Value = fam.G_ParentID; //上级分类ID0:为最高级	
                    cmd.Parameters.Add("G_ShowOrder", OracleType.Int32).Value = fam.G_ShowOrder; //显示顺序	
                    cmd.Parameters.Add("G_Level", OracleType.Int32).Value = fam.G_Level; //当前分类所在层数	
                    cmd.Parameters.Add("G_ChildCount", OracleType.Int32).Value = fam.G_ChildCount; //当前分类子分类数
                    cmd.Parameters.Add("G_Delete", OracleType.SByte).Value = fam.G_Delete; //是否删除1:是0:否

                    cmd.Parameters.Add("Address", OracleType.NVarChar).Value = fam.Address;
                    cmd.Parameters.Add("CertificateNumber", OracleType.NVarChar).Value = fam.CertificateNumber;
                    cmd.Parameters.Add("Fax", OracleType.NVarChar).Value = fam.Fax;
                    cmd.Parameters.Add("EmailAddress", OracleType.NVarChar).Value = fam.EmailAddress;
                    cmd.Parameters.Add("Tel", OracleType.NVarChar).Value = fam.Tel;
                    cmd.Parameters.Add("ZipCode", OracleType.NVarChar).Value = fam.ZipCode;

                    cmd.Parameters.Add("GroupID", OracleType.Int32).Value = fam.GroupID;
                }
                else if (fam.DB_Option_Action_.ToString() == "Delete")
                {
                    CommTxt = "Delete from  sys_Group  WHERE (GroupID = :GroupID)";
                    cmd.CommandText = CommTxt;
                    cmd.Parameters.Add("GroupID", OracleType.Int32).Value = fam.GroupID;
                }
                else
                    throw new ApplicationException("无法识别的操作命令!");
                Conn.Open();
                OracleTransaction Tran = Conn.BeginTransaction();
                cmd.Transaction = Tran;
                try
                {
                    rInt = cmd.ExecuteNonQuery();
                    cmd.Parameters.Clear();
                    if (fam.DB_Option_Action_.ToString() == "Insert")
                    {
                        cmd.CommandText = "select SEQ_sys_Group_ID.CURRVAL from  dual";
                        rInt = Convert.ToInt32(cmd.ExecuteScalar());
                    }
                    Tran.Commit();
                }
                catch (Exception ex)
                {
                    Tran.Rollback();
                    throw new ApplicationException(ex.ToString());
                }
                finally
                {
                    Tran.Dispose();
                    cmd.Dispose();
                    Conn.Dispose();
                    Conn.Close();
                }
            }
            return rInt;
        }
Esempio n. 7
0
 /// <summary>
 /// 新增/删除/修改 sys_Group
 /// </summary>
 /// <param name="fam">sys_GroupTable实体类</param>
 /// <returns>返回0操正常</returns>
 public static int sys_GroupInsertUpdate(sys_GroupTable fam)
 {
     return DataProvider.Instance().sys_GroupInsertUpdate(fam);
 }
Esempio n. 8
0
 /// <summary>
 /// 根据ID返回 sys_GroupTable实体类 单笔资料
 /// </summary>
 /// <param name="GroupID">分类ID号</param>
 /// <returns>返回sys_GroupTable实体类 GroupID为0则无记录</returns>
 public static sys_GroupTable sys_GroupDisp(int GroupID)
 {
     sys_GroupTable fam = new sys_GroupTable();
     QueryParam qp = new QueryParam();
     qp.PageIndex = 1;
     qp.PageSize = 1;
     qp.Where = " Where sys_Group.GroupID = " + GroupID;
     int RecordCount = 0;
     ArrayList lst = sys_GroupList(qp, out RecordCount);
     if (RecordCount > 0)
     {
         fam = (sys_GroupTable)lst[0];
     }
     return fam;
 }
        /// <summary>
        /// 新增/删除/修改 sys_Group
        /// </summary>
        /// <param name="fam">sys_GroupTable实体类</param>
        /// <returns>返回0操正常</returns>
        public override int sys_GroupInsertUpdate(sys_GroupTable fam)
        {
            int rInt = 0;
            using (SqlConnection Conn = GetSqlConnection())
            {
                SqlCommand cmd = new SqlCommand("sys_Group_InsertUpdateDelete", Conn);
                cmd.CommandType = CommandType.StoredProcedure;
                //设置参数
                cmd.Parameters.Add("@DataTable_Action_", SqlDbType.NVarChar).Value = fam.DB_Option_Action_.ToString();//fam.DB_Option_Action_; //操作方法 Insert:增加 Update:修改 Delete:删除 Disp:显示单笔记录
                cmd.Parameters.Add("@GroupID", SqlDbType.Int).Value = fam.GroupID;  //分类ID号
                cmd.Parameters.Add("@G_CName", SqlDbType.NVarChar).Value = fam.G_CName;  //分类中文说明
                cmd.Parameters.Add("@G_ParentID", SqlDbType.Int).Value = fam.G_ParentID;  //上级分类ID0:为最高级
                cmd.Parameters.Add("@G_ShowOrder", SqlDbType.Int).Value = fam.G_ShowOrder;  //显示顺序
                cmd.Parameters.Add("@G_Level", SqlDbType.Int).Value = fam.G_Level;  //当前分类所在层数
                cmd.Parameters.Add("@G_ChildCount", SqlDbType.Int).Value = fam.G_ChildCount;  //当前分类子分类数
                cmd.Parameters.Add("@G_Delete", SqlDbType.Int).Value = fam.G_Delete;  //是否删除1:是0:否

                cmd.Parameters.Add("@Address", SqlDbType.VarChar).Value = fam.Address;  //地址
                cmd.Parameters.Add("@CertificateNumber", SqlDbType.VarChar).Value = fam.CertificateNumber;  //资质证书编号
                cmd.Parameters.Add("@Fax", SqlDbType.VarChar).Value = fam.Fax;  //传真
                cmd.Parameters.Add("@EmailAddress", SqlDbType.VarChar).Value = fam.EmailAddress;  //email地址
                cmd.Parameters.Add("@Tel", SqlDbType.VarChar).Value = fam.Tel;  //联系电话
                cmd.Parameters.Add("@ZipCode", SqlDbType.VarChar).Value = fam.ZipCode;  //邮政编码
                cmd.Parameters.Add("@Type", SqlDbType.Int).Value = fam.Type;  //部门类型

                Conn.Open();
                rInt = Convert.ToInt32(cmd.ExecuteScalar());
                cmd.Dispose();
                Conn.Dispose();
                Conn.Close();
            }
            return rInt;
        }
Esempio n. 10
0
        /// <summary>
        /// 新增/删除/修改 sys_Group
        /// </summary>
        /// <param name="fam">sys_GroupTable实体类</param>
        /// <returns>返回0操正常</returns>
        public override int sys_GroupInsertUpdate(sys_GroupTable fam)
        {
            int rInt = 0;

            using (OleDbConnection Conn = GetSqlConnection())
            {
                string CommTxt;
                OleDbCommand cmd = new OleDbCommand();
                cmd.Connection = Conn;
                if (fam.DB_Option_Action_ == "Insert")
                {
                    CommTxt = "Insert into 	sys_Group(G_CName,G_ParentID,G_ShowOrder,G_Level,G_ChildCount,G_Delete)VALUES(@G_CName,@G_ParentID,@G_ShowOrder,@G_Level,@G_ChildCount,@G_Delete)";
                    cmd.CommandText = CommTxt;

                    cmd.Parameters.Add("@G_CName", OleDbType.VarWChar).Value = fam.G_CName + ""; //分类中文说明
                    cmd.Parameters.Add("@G_ParentID", OleDbType.Integer).Value = fam.G_ParentID; //上级分类ID0:为最高级
                    cmd.Parameters.Add("@G_ShowOrder", OleDbType.Integer).Value = fam.G_ShowOrder; //显示顺序
                    cmd.Parameters.Add("@G_Level", OleDbType.Integer).Value = fam.G_Level; //当前分类所在层数
                    cmd.Parameters.Add("@G_ChildCount", OleDbType.Integer).Value = fam.G_ChildCount; //当前分类子分类数
                    cmd.Parameters.Add("@G_Delete", OleDbType.LongVarWChar).Value = fam.G_Delete + "";  //是否删除1:是0:否
                }
                else if (fam.DB_Option_Action_ == "Update")
                {

                    CommTxt = "UPDATE sys_Group SET	G_CName = @G_CName,G_ParentID = @G_ParentID,G_ShowOrder = @G_ShowOrder,G_Level = @G_Level,G_ChildCount = @G_ChildCount,G_Delete = @G_Delete WHERE (GroupID = @GroupID)";
                    cmd.CommandText = CommTxt;

                    cmd.Parameters.Add("@G_CName", OleDbType.VarWChar).Value = fam.G_CName + ""; //分类中文说明
                    cmd.Parameters.Add("@G_ParentID", OleDbType.Integer).Value = fam.G_ParentID; //上级分类ID0:为最高级
                    cmd.Parameters.Add("@G_ShowOrder", OleDbType.Integer).Value = fam.G_ShowOrder; //显示顺序
                    cmd.Parameters.Add("@G_Level", OleDbType.Integer).Value = fam.G_Level; //当前分类所在层数
                    cmd.Parameters.Add("@G_ChildCount", OleDbType.Integer).Value = fam.G_ChildCount; //当前分类子分类数
                    cmd.Parameters.Add("@G_Delete", OleDbType.LongVarWChar).Value = fam.G_Delete + "";  //是否删除1:是0:否
                    cmd.Parameters.Add("@GroupID", OleDbType.Integer).Value = fam.GroupID;
                }
                else if (fam.DB_Option_Action_ == "Delete")
                {
                    CommTxt = "Delete from  sys_Group  WHERE (GroupID = @GroupID)";
                    cmd.CommandText = CommTxt;
                    cmd.Parameters.Add("@GroupID", OleDbType.Integer).Value = fam.GroupID;
                }
                else
                    throw new ApplicationException("无法识别的操作命令!");
                Conn.Open();
                rInt = cmd.ExecuteNonQuery();
                if (fam.DB_Option_Action_ == "Insert")
                {
                    cmd.CommandText = "SELECT @@identity";
                    rInt = Convert.ToInt32(cmd.ExecuteScalar());
                }
                cmd.Dispose();
                Conn.Dispose();
                Conn.Close();
            }
            return rInt;
        }
Esempio n. 11
0
 /// <summary>
 /// 新增/删除/修改 sys_Group
 /// </summary>
 /// <param name="fam">sys_GroupTable实体类</param>
 /// <returns>返回0操正常</returns>
 public override int sys_GroupInsertUpdate(sys_GroupTable fam)
 {
     int rInt = 0;
     using (SqlConnection Conn = GetSqlConnection())
     {
         SqlCommand cmd = new SqlCommand("sys_GroupInsertUpdateDelete", Conn);
         cmd.CommandType = CommandType.StoredProcedure;
         //设置参数
         cmd.Parameters.Add("@DB_Option_Action_", SqlDbType.NVarChar).Value = fam.DB_Option_Action_; //操作方法 Insert:增加 Update:修改 Delete:删除 Disp:显示单笔记录
         cmd.Parameters.Add("@GroupID", SqlDbType.Int).Value = fam.GroupID;  //分类ID号
         cmd.Parameters.Add("@G_CName", SqlDbType.NVarChar).Value = fam.G_CName;  //分类中文说明
         cmd.Parameters.Add("@G_ParentID", SqlDbType.Int).Value = fam.G_ParentID;  //上级分类ID0:为最高级
         cmd.Parameters.Add("@G_ShowOrder", SqlDbType.Int).Value = fam.G_ShowOrder;  //显示顺序
         cmd.Parameters.Add("@G_Level", SqlDbType.Int).Value = fam.G_Level;  //当前分类所在层数
         cmd.Parameters.Add("@G_ChildCount", SqlDbType.Int).Value = fam.G_ChildCount;  //当前分类子分类数
         cmd.Parameters.Add("@G_Delete", SqlDbType.Int).Value = fam.G_Delete;  //是否删除1:是0:否
         Conn.Open();
         rInt = Convert.ToInt32(cmd.ExecuteScalar());
         cmd.Dispose();
         Conn.Dispose();
         Conn.Close();
     }
     return rInt;
 }
Esempio n. 12
0
        /// <summary>
        /// 将记录集转为sys_GroupTable实体类
        /// </summary>
        /// <param name="dr">记录集</param>
        /// <returns>sys_GroupTable</returns>
        protected object Populatesys_Group(IDataReader dr)
        {
            sys_GroupTable nc = new sys_GroupTable();

            if (!Convert.IsDBNull(dr["GroupID"])) nc.GroupID = Convert.ToInt32(dr["GroupID"]); // 分类ID号
            if (!Convert.IsDBNull(dr["G_CName"])) nc.G_CName = Convert.ToString(dr["G_CName"]).Trim(); // 分类中文说明
            if (!Convert.IsDBNull(dr["G_ParentID"])) nc.G_ParentID = Convert.ToInt32(dr["G_ParentID"]); // 上级分类ID0:为最高级
            if (!Convert.IsDBNull(dr["G_ShowOrder"])) nc.G_ShowOrder = Convert.ToInt32(dr["G_ShowOrder"]); // 显示顺序
            if (!Convert.IsDBNull(dr["G_Level"])) nc.G_Level = Convert.ToInt32(dr["G_Level"]); // 当前分类所在层数
            if (!Convert.IsDBNull(dr["G_ChildCount"])) nc.G_ChildCount = Convert.ToInt32(dr["G_ChildCount"]); // 当前分类子分类数
            if (!Convert.IsDBNull(dr["G_Delete"])) nc.G_Delete = Convert.ToInt32(dr["G_Delete"]); // 是否删除1:是0:否
            return nc;
        }