//private static void UpdateEmployee() //{ // try // { // string EmployeeJson = GetEmployee("016630184325983798"); // EmployeeEntity model = Newtonsoft.Json.JsonConvert.DeserializeObject<EmployeeEntity>(EmployeeJson); // model.remark = "测试"; // model.email = "*****@*****.**"; // string param = model.ToJson(); // Result Result = EmployeeBll.Update(param); // if (Result != null) // { // if (Result.errcode == "0") // { // Console.Write("更新成功," + Result.errmsg); // } // else // { // Console.Write(Result.errmsg); // } // } // else // { // Console.Write("无返回数据"); // } // } // catch (Exception ex) // { // Console.Write(ex.Message); // } //} private static void DeleteEmployee() { try { Result Result = EmployeeBll.Delete("landon1"); if (Result != null) { if (Result.errcode == "0") { Console.Write("更新成功," + Result.errmsg); } else { Console.Write(Result.errmsg); } } else { Console.Write("无返回数据"); } } catch (Exception ex) { Console.Write(ex.Message); } }
//private static void DepartmentImputDingTalk() //{ // LogHelper log = LogFactory.GetLogger("ImputEsbDepartment"); // SqlSugarClient Ddb = new SqlSugarClient(new ConnectionConfig() // { // ConnectionString = Config.DingTalkConnectionString, // DbType = DbType.SqlServer, // IsAutoCloseConnection = true, // InitKeyType = InitKeyType.Attribute // }); // Ddb.CodeFirst.InitTables(typeof(DepartmentTrees)); // int treeCount = Ddb.Queryable<DepartmentTrees>().Count(); // int maxlevel = Ddb.Queryable<DepartmentTrees>().Max(it => it.level); // int countRow = 0; // log.Info("\r\n------------------------------------------------钉钉组织框架根据ESB部门树数据调整------------------------------------------------\r\n"); // for (int i = 1; i <= maxlevel; i++) // { // List<DepartmentTrees> list = new List<DepartmentTrees>(); // list = Ddb.Queryable<DepartmentTrees>().Where(it => it.level == i).ToList(); // foreach (var item in list) // { // countRow++; // try // { // string DepartmentJson = GetDepartment(item.DD_Id); // DepartmentEntity model = new DepartmentEntity(); // model = Newtonsoft.Json.JsonConvert.DeserializeObject<DepartmentEntity>(DepartmentJson); // model.parentid = item.DD_ParentId; // model.order = list.IndexOf(item).ToString(); // string param = model.ToJson(); // Result result = DepartmentBll.Update(param); // if (result != null) // { // if (result.errcode == "0") // { // Console.Write("第" + i + "级数据更新成功," + result.errmsg + ",已更新:" + countRow + "条,当前进度:" + (Math.Round(Convert.ToDecimal(Convert.ToDouble(countRow) / Convert.ToDouble(treeCount)), 2, MidpointRounding.AwayFromZero) * 100) + "%\n\n"); // } // else // { // Console.Write(result.errmsg); // } // } // else // { // Console.Write("\r\n无返回数据\r\n"); // } // } // catch (Exception ex) // { // log.Error("\r\n" + ex.Message + "\r\n"); // Console.Write(ex.Message); // } // } // } // Console.Write("更新成功,共更新 " + countRow + " 条数据"); //} private static void DeleteEmployee(string UserId) { try { Result Result = EmployeeBll.Delete(UserId); if (Result != null) { if (Result.errcode == "0") { Console.Write("\r\n更新成功," + Result.errmsg + "\r\n"); } else { Console.Write("\r\n" + Result.errmsg + "\r\n"); } } else { Console.Write("\r\n无返回数据\r\n"); } } catch (Exception ex) { Console.Write("\r\n" + ex.Message + "\r\n"); } }
// GET: Items/Delete/5 public JsonResult Delete(int id) { status = employeeBll.Delete(id); if (status == true) { return(Json(1)); } return(Json(0)); }