コード例 #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update_CT_Auth_Process(CT_Auth_Process model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update CT_Auth_Process set ");
            strSql.Append("AT_UType=@AT_UType,");
            strSql.Append("AT_AD_OM_Code=@AT_AD_OM_Code,");
            strSql.Append("AT_AType=@AT_AType,");
            strSql.Append("AT_AU_UG_Code=@AT_AU_UG_Code ");
            strSql.Append(" where AT_Code=@AT_Code");
            SqlParameter[] parameters =
            {
                new SqlParameter("@AT_UType",      SqlDbType.TinyInt, 1),
                new SqlParameter("@AT_AD_OM_Code", SqlDbType.Int,     4),
                new SqlParameter("@AT_AType",      SqlDbType.TinyInt, 1),
                new SqlParameter("@AT_AU_UG_Code", SqlDbType.BigInt,  8),
                new SqlParameter("@AT_Code",       SqlDbType.Int, 4)
            };
            parameters[0].Value = model.AT_UType;
            parameters[1].Value = model.AT_AD_OM_Code;
            parameters[2].Value = model.AT_AType;
            parameters[3].Value = model.UG_Code;
            parameters[4].Value = model.AT_Code;
            int rows = SqlHelper.ExecuteNonQuery(CommandType.Text, strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
    private void Save_Auth_Process(dynamic data, DBCRMTree db)
    {
        var s_eaps = JsonConvert.SerializeObject(data.auth_process.changes);
        List <EX_Auth_Process> eaps = JsonConvert.DeserializeObject <List <EX_Auth_Process> >(s_eaps);

        int i = 1;

        foreach (var eap in eaps)
        {
            CT_Auth_Process ap = new CT_Auth_Process();
            ap.AT_Code       = eap.AT_Code;
            ap.AT_UType      = (byte)UserSession.User.UG_UType;
            ap.AT_AD_OM_Code = UserSession.DealerEmpl.DE_AD_OM_Code;
            ap.AT_Update_dt  = DateTime.Now;

            ap.AT_SType = eap.AT_SType;
            ap.AT_IType = (byte?)eap.AT_IType;
            if (eap.AU_Code.HasValue && eap.AU_Code.Value > 0)
            {
                ap.AT_AType      = 1;
                ap.AT_AU_UG_Code = eap.AU_Code;
            }
            if (eap.UG_Code.HasValue && eap.UG_Code.Value > 0)
            {
                ap.AT_AType      = 2;
                ap.AT_AU_UG_Code = eap.UG_Code;
            }
            ap.AT_Level = (byte)i;
            i++;

            if (ap.AT_Code > 0)
            {
            }
            else
            {
                ap.AT_Created_By = UserSession.User.AU_Code;
                ap.Insert();
            }
        }

        var s_deletes = JsonConvert.SerializeObject(data.auth_process.deletes);
        List <CT_Auth_Process> deletes = JsonConvert.DeserializeObject <List <CT_Auth_Process> >(s_deletes);

        foreach (var d in deletes)
        {
            d.Delete();
        }
    }
コード例 #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool AddCT_Auth_Process(CT_Auth_Process model)
        {
            if (model.AT_Code != 0 && !string.IsNullOrEmpty(model.AT_Code.ToString()))
            {
                return(Update_CT_Auth_Process(model));
            }
            else
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into CT_Auth_Process(");
                strSql.Append("AT_UType,AT_AD_OM_Code,AT_Level,AT_AType,AT_AU_UG_Code,AT_IType,AT_CG_Cat,AT_SType)");
                strSql.Append(" values (");
                strSql.Append("@AT_UType,@AT_AD_OM_Code,@AT_Level,@AT_AType,@AT_AU_UG_Code,@AT_IType,@AT_CG_Cat,@AT_SType)");
                strSql.Append(";select @@IDENTITY");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@AT_UType",      SqlDbType.TinyInt, 1),
                    new SqlParameter("@AT_AD_OM_Code", SqlDbType.Int,     4),
                    new SqlParameter("@AT_Level",      SqlDbType.TinyInt, 1),
                    new SqlParameter("@AT_AType",      SqlDbType.TinyInt, 1),
                    new SqlParameter("@AT_AU_UG_Code", SqlDbType.BigInt,  8),
                    new SqlParameter("@AT_IType",      SqlDbType.TinyInt, 1),
                    new SqlParameter("@AT_CG_Cat",     SqlDbType.TinyInt, 1),
                    new SqlParameter("@AT_SType",      SqlDbType.VarChar, 50)
                };
                parameters[0].Value = model.AT_UType;
                parameters[1].Value = model.AT_AD_OM_Code;
                parameters[2].Value = GetMaxLevel((int)model.AT_AD_OM_Code) + 1;
                parameters[3].Value = model.AT_AType;
                parameters[4].Value = model.UG_Code;
                parameters[5].Value = model.AT_IType;
                parameters[6].Value = model.EX_Camp_Category;
                parameters[7].Value = model.AT_SType;

                int i = SqlHelper.ExecuteNonQuery(CommandType.Text, strSql.ToString(), parameters);

                if (i > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
コード例 #4
0
ファイル: BL_Campaign.cs プロジェクト: wangqi0314/crm-tree
 public bool AddCT_Auth_Process(CT_Auth_Process model)
 {
     return(Cam.AddCT_Auth_Process(model));
 }