コード例 #1
0
        private void ParameterAdd(ref DbCommand cmd, NM_FeeClassInfo nm_FeeClassInfo)
        {
            if (nm_FeeClassInfo.FeeId.Length < 1 || nm_FeeClassInfo.FeeId.Length > 20)
            {
                throw new Exception("费项标识长度需在1-20个字符之间!");
            }

            if (nm_FeeClassInfo.FeeName.Length < 1 || nm_FeeClassInfo.FeeName.Length > 50)
            {
                throw new Exception("费项名称长度需在1-50个字符之间!");
            }

            DbParameter param = _dataBaseAccess.CreateParameter();
            param.ParameterName = "@FeeId";
            param.DbType = DbType.Int64;
            param.Value = nm_FeeClassInfo.FeeId;
            cmd.Parameters.Add(param);

            param = _dataBaseAccess.CreateParameter();
            param.ParameterName = "@FeeName";
            param.DbType = DbType.String;
            param.Value = nm_FeeClassInfo.FeeName;
            cmd.Parameters.Add(param);

            param = _dataBaseAccess.CreateParameter();
            param.ParameterName = "@VoiceClass";
            param.DbType = DbType.String;
            param.Value = nm_FeeClassInfo.VoiceClass.ToUpper();
            cmd.Parameters.Add(param);

            param = _dataBaseAccess.CreateParameter();
            param.ParameterName = "@VoiceSub";
            param.DbType = DbType.String;
            param.Value = nm_FeeClassInfo.VoiceSub.ToUpper();
            cmd.Parameters.Add(param);

            param = _dataBaseAccess.CreateParameter();
            param.ParameterName = "@DreamClass";
            param.DbType = DbType.String;
            param.Value = nm_FeeClassInfo.DreamClass.ToUpper();
            cmd.Parameters.Add(param);

            param = _dataBaseAccess.CreateParameter();
            param.ParameterName = "@DreamSub";
            param.DbType = DbType.String;
            param.Value = nm_FeeClassInfo.DreamSub.ToUpper();
            cmd.Parameters.Add(param);

            param = _dataBaseAccess.CreateParameter();
            param.ParameterName = "@DataClass";
            param.DbType = DbType.String;
            param.Value = nm_FeeClassInfo.DataClass.ToUpper();
            cmd.Parameters.Add(param);

            param = _dataBaseAccess.CreateParameter();
            param.ParameterName = "@DataSub";
            param.DbType = DbType.String;
            param.Value = nm_FeeClassInfo.DataSub.ToUpper();
            cmd.Parameters.Add(param);

            param = _dataBaseAccess.CreateParameter();
            param.ParameterName = "@GroupClass";
            param.DbType = DbType.String;
            param.Value = nm_FeeClassInfo.GroupClass.ToUpper();
            cmd.Parameters.Add(param);

            param = _dataBaseAccess.CreateParameter();
            param.ParameterName = "@GroupSub";
            param.DbType = DbType.String;
            param.Value = nm_FeeClassInfo.GroupSub.ToUpper();
            cmd.Parameters.Add(param);

            param = _dataBaseAccess.CreateParameter();
            param.ParameterName = "@Result";
            param.DbType = DbType.String;
            param.Size = 50;
            param.Direction = ParameterDirection.Output;
            cmd.Parameters.Add(param);
        }
コード例 #2
0
        public string Update(NM_FeeClassInfo nm_FeeClassInfo)
        {
            int checkValue = 0;

            if (nm_FeeClassInfo.VoiceClass.ToUpper() == "Y")
            {
                checkValue++;
            }

            if (nm_FeeClassInfo.DataClass.ToUpper() == "Y")
            {
                checkValue++;
            }

            if (nm_FeeClassInfo.GroupClass.ToUpper() == "Y")
            {
                checkValue++;
            }

            if (checkValue != 1)
            {
                return "语音类、数据类、集团类这三个类别必须有一个且只有一个是 Y";
            }

            DbCommand cmd = _dataBaseAccess.CreateCommand();
            cmd.CommandText = "Proc_NM_FeeClassInfo_Update";

            ParameterAdd(ref cmd, nm_FeeClassInfo);

            DbParameter param = _dataBaseAccess.CreateParameter();
            param.ParameterName = "@Id";
            param.DbType = DbType.String;
            param.Value = nm_FeeClassInfo.Id;
            cmd.Parameters.Add(param);

            _dataBaseAccess.ExecuteCommand(cmd);
            return cmd.Parameters["@Result"].Value.ToString();
        }
コード例 #3
0
        private void FeeClassInfoFilterNull(ref NM_FeeClassInfo nm_FeeClassInfo)
        {
            if (nm_FeeClassInfo.FeeId == null)
                {
                    nm_FeeClassInfo.FeeId = string.Empty;
                }

                if (nm_FeeClassInfo.FeeName == null)
                {
                    nm_FeeClassInfo.FeeName = string.Empty;
                }

                if (nm_FeeClassInfo.VoiceClass == null)
                {
                    nm_FeeClassInfo.VoiceClass = string.Empty;
                }

                if (nm_FeeClassInfo.VoiceSub == null)
                {
                    nm_FeeClassInfo.VoiceSub = string.Empty;
                }

                if (nm_FeeClassInfo.DreamClass == null)
                {
                    nm_FeeClassInfo.DreamClass = string.Empty;
                }

                if (nm_FeeClassInfo.DreamSub == null)
                {
                    nm_FeeClassInfo.DreamSub = string.Empty;
                }

                if (nm_FeeClassInfo.DataClass == null)
                {
                    nm_FeeClassInfo.DataClass = string.Empty;
                }

                if (nm_FeeClassInfo.DataSub == null)
                {
                    nm_FeeClassInfo.DataSub = string.Empty;
                }

                if (nm_FeeClassInfo.GroupClass == null)
                {
                    nm_FeeClassInfo.GroupClass = string.Empty;
                }

                if (nm_FeeClassInfo.GroupSub == null)
                {
                    nm_FeeClassInfo.GroupSub = string.Empty;
                }
        }
コード例 #4
0
        public string Insert(NM_FeeClassInfo nm_FeeClassInfo)
        {
            DbCommand cmd = _dataBaseAccess.CreateCommand();
            cmd.CommandText = "Proc_NM_FeeClassInfo_Insert";

            ParameterAdd(ref cmd, nm_FeeClassInfo);

            _dataBaseAccess.ExecuteCommand(cmd);
            return cmd.Parameters["@Result"].Value.ToString();
        }
コード例 #5
0
        public ActionResult Update(NM_FeeClassInfo nm_FeeClassInfo, string id)
        {
            try
            {
                FeeClassInfoFilterNull(ref nm_FeeClassInfo);

                nm_FeeClassInfo.Id = id;

                result = bllFeeClassManagement.Update(nm_FeeClassInfo);

                if (string.IsNullOrEmpty(result))
                {
                    resultJSON = Tools.ExecResultToJSON(true, "更新成功!");
                }
                else
                {
                    resultJSON = Tools.ExecResultToJSON(false, result);
                }
                return Content(resultJSON);
            }
            catch (Exception ex)
            {
                Tools.LogWrite(ex.ToString());
                resultJSON = Tools.ExecResultToJSON(false, ex.Message);
                return Content(resultJSON);
            }
        }