/// <summary> /// 修改所在子公司的公司信息 /// </summary> /// <param name="data"></param> /// <param name="com_id"></param> /// <returns></returns> public HttpResponseMessage Update_company(dynamic data, int com_id) { Entity.user_detail d = user.Value.SetData(data); string sql = "update company set com_name=@com_name,com_size=@com_size,work_address=@work_address " + "where com_id=" + com_id + ""; SqlParameter[] sp = { new SqlParameter("@com_name", d.com_name), new SqlParameter("@com_size", d.com_size), new SqlParameter("@work_address", d.work_address) }; int i = help.Count(sql, sp); if (i > 0) { obj = new { code = "A0000", msg = "修改成功" }; } else { obj = new { code = "A0001", msg = "修改失败" }; } return(help.ToJson(obj)); }
/// <summary> /// 添加子公司的方法 /// </summary> /// <param name="data"></param> /// <returns></returns> public HttpResponseMessage AddCompany(dynamic data) { Entity.user_detail com = user.Value.SetData(data); string sql = "insert into company(com_name,com_size,work_address,head_id) values(" + "'" + com.com_name + "','" + com.com_size + "','" + com.work_address + "'," + com.head_id + ")"; int i = help.Count(sql); if (i > 0) { obj = new { code = "A0000", msg = "添加成功" }; } else { obj = new { code = "A0001", msg = "添加失败" }; } return(help.ToJson(obj)); }
/// <summary> /// 修改登录信息 /// </summary> /// <param name="data"></param> /// <param name="us_id"></param> /// <returns></returns> public HttpResponseMessage ChangeUsers(dynamic data, int us_id) { Entity.user_detail ud = detail.Value.SetData(data); string sql = "update users set login_name=@login_name,login_pwd=@login_pwd,real_name=@real_name where us_id=" + us_id + ";"; SqlParameter[] sp = { new SqlParameter("@login_name", ud.login_name), new SqlParameter("@login_pwd", ud.login_pwd), new SqlParameter("@real_name", ud.real_name) }; int i = help.Count(sql, sp); object obj = null; if (i > 0) { obj = new { code = "0", msg = "修改成功" }; } else { obj = new { code = "1", msg = "修改失败" }; } return(help.ToJson(obj)); }