private (Model.Challenge challenge, string challengeUrl) CreateTestModel() { var account = new Model.Account(new Model.Jwk(StaticTestData.JwkJson), new List <string> { "*****@*****.**" }, null); var order = new Model.Order(account, new List <Model.Identifier> { new Model.Identifier("dns", "www.example.com") }); var authorization = new Model.Authorization(order, order.Identifiers.First(), DateTimeOffset.UtcNow); var challenge = new Model.Challenge(authorization, "http-01"); return(challenge, "https://challenge.example.com"); }
public bool AddChallenge(Model.Challenge chlg) { String sql = "insert into [Challenge] values(@id,@name,@ownerId,@time,@level,@area,@position,@entime,@num,@publish,@state,@type,@sec,@third,@first,@salary)"; SqlParameter[] par = { new SqlParameter("@id", SqlDbType.UniqueIdentifier, 50), new SqlParameter("@name", SqlDbType.VarChar, 50), new SqlParameter("@ownerId", SqlDbType.UniqueIdentifier, 50), new SqlParameter("@time", SqlDbType.DateTime), new SqlParameter("@level", SqlDbType.VarChar, 50), new SqlParameter("@area", SqlDbType.VarChar, 50), new SqlParameter("@position", SqlDbType.VarChar, 50), new SqlParameter("@entime", SqlDbType.VarChar, 50), new SqlParameter("@num", SqlDbType.VarChar, 50), new SqlParameter("@publish", SqlDbType.DateTime), new SqlParameter("@state", SqlDbType.VarChar, 50), new SqlParameter("@type", SqlDbType.VarChar, 50), new SqlParameter("@sec", SqlDbType.UniqueIdentifier, 50), new SqlParameter("@third", SqlDbType.UniqueIdentifier, 50), new SqlParameter("@first", SqlDbType.UniqueIdentifier, 50), new SqlParameter("@salary", SqlDbType.VarChar, 50), }; par[0].Value = chlg.Challenge_ID; par[1].Value = chlg.Challenge_Name; par[2].Value = chlg.Challenge_OwnerID; par[3].Value = chlg.Challenge_Time; par[4].Value = chlg.Challenge_Level; par[5].Value = chlg.Challenge_Area; par[6].Value = chlg.Challenge_Position0; par[7].Value = chlg.Challenge_EnTime; par[8].Value = chlg.Challenge_Num; //publish time par[9].Value = chlg.Challenge_Time; par[10].Value = chlg.Challenge_State; par[11].Value = chlg.Challenge_Type; par[12].Value = new Guid(chlg.Challenge_Quiz1); par[13].Value = new Guid(chlg.Challenge_Quiz2); par[14].Value = new Guid(chlg.Challenge_Quiz0); par[15].Value = chlg.Challenge_Salary; Common.DbHelperSQL.ExecuteSql(sql.ToString(), par); return(true); }
public Challenge(Model.Challenge model, string challengeUrl) { if (model is null) { throw new System.ArgumentNullException(nameof(model)); } if (string.IsNullOrEmpty(challengeUrl)) { throw new System.ArgumentNullException(nameof(challengeUrl)); } Type = model.Type; Token = model.Token; Status = EnumMappings.GetEnumString(model.Status); Url = challengeUrl; Validated = model.Validated?.ToString("o", CultureInfo.InvariantCulture); Error = model.Error != null ? new AcmeError(model.Error) : null; }
public bool PublishChallenge(string exercise, string entpId, string level, string type) { bool flag = false; OxcoderIDAL.EnterpriseChallengeIDAL ec = new OxcoderDAL.EnterpriseChallengeDAL(); flag = ec.MinEnterpriceChallengeNumber(entpId, 1); if (flag == false) { return false; } Model.Challenge chlg = new Model.Challenge(); string area = ""; string name = ""; string position = ""; string salary = ""; OxcoderIDAL.EnterpriseInfoIDAL ei = new OxcoderDAL.EnterpriseInfoDAL(); DataSet ds = ei.EnterpriceInfo(entpId); area = ds.Tables[0].Rows[0]["Enterprice_Location"].ToString(); position = ds.Tables[0].Rows[0]["Enterprice_Position"].ToString(); /* switch (level) { case "1": salary = "2k~5k"; break; case "2": salary = "5k~8k"; break; case "3": salary = "8k~10k"; break; case "4": salary = "10k~12k"; break; case "5": salary = "12k~15k"; break; case "6": salary = "15k以上"; break; default: salary = "1k~2k"; break; } */ salary = level; switch (type) { case "1": name = "C++工程师"; break; case "2": name = "Android工程师"; break; case "3": name = "IOS工程师"; break; case "4": name = "Python语言工程师"; break; case "10": name = "JAVA工程师"; break; case "29": name = "PHP工程师"; break; case "34": name = "C语言工程师"; break; default: name = "软件工程师"; break; } chlg.Challenge_Area = area; chlg.Challenge_EnTime = DateTime.Now.AddDays(30).ToString(); chlg.Challenge_ID = System.Guid.NewGuid(); chlg.Challenge_Level = Convert.ToInt32(level); chlg.Challenge_Name = name; chlg.Challenge_Num = 0; chlg.Challenge_OwnerID = new Guid(entpId); //通过ownerid得到position chlg.Challenge_Position0 = position; chlg.Challenge_Quiz0 = exercise.ToString().Split(',')[1]; chlg.Challenge_Quiz1 = exercise.ToString().Split(',')[2]; chlg.Challenge_Quiz2 = exercise.ToString().Split(',')[3]; chlg.Challenge_Salary = Convert.ToInt32(level); chlg.Challenge_State = 1; chlg.Challenge_Time = DateTime.Now; chlg.Challenge_Type = Convert.ToInt32(level); return ec.AddChallenge(chlg); }
public int InsertAChallenge(Model.Challenge id) { return(-1); }
public bool PublishChallenge(string exercise, string entpId, string level, string type) { bool flag = false; OxcoderIDAL.EnterpriseChallengeIDAL ec = new OxcoderDAL.EnterpriseChallengeDAL(); flag = ec.MinEnterpriceChallengeNumber(entpId, 1); if (flag == false) { return(false); } Model.Challenge chlg = new Model.Challenge(); string area = ""; string name = ""; string position = ""; string salary = ""; OxcoderIDAL.EnterpriseInfoIDAL ei = new OxcoderDAL.EnterpriseInfoDAL(); DataSet ds = ei.EnterpriceInfo(entpId); area = ds.Tables[0].Rows[0]["Enterprice_Location"].ToString(); position = ds.Tables[0].Rows[0]["Enterprice_Position"].ToString(); /* * switch (level) * { * case "1": * salary = "2k~5k"; * break; * case "2": * salary = "5k~8k"; * break; * case "3": * salary = "8k~10k"; * break; * case "4": * salary = "10k~12k"; * break; * case "5": * salary = "12k~15k"; * break; * case "6": * salary = "15k以上"; * break; * default: * salary = "1k~2k"; * break; * } */ salary = level; switch (type) { case "1": name = "C++工程师"; break; case "2": name = "Android工程师"; break; case "3": name = "IOS工程师"; break; case "4": name = "Python语言工程师"; break; case "10": name = "JAVA工程师"; break; case "29": name = "PHP工程师"; break; case "34": name = "C语言工程师"; break; default: name = "软件工程师"; break; } chlg.Challenge_Area = area; chlg.Challenge_EnTime = DateTime.Now.AddDays(30).ToString(); chlg.Challenge_ID = System.Guid.NewGuid(); chlg.Challenge_Level = Convert.ToInt32(level); chlg.Challenge_Name = name; chlg.Challenge_Num = 0; chlg.Challenge_OwnerID = new Guid(entpId); //通过ownerid得到position chlg.Challenge_Position0 = position; chlg.Challenge_Quiz0 = exercise.ToString().Split(',')[1]; chlg.Challenge_Quiz1 = exercise.ToString().Split(',')[2]; chlg.Challenge_Quiz2 = exercise.ToString().Split(',')[3]; chlg.Challenge_Salary = Convert.ToInt32(level); chlg.Challenge_State = 1; chlg.Challenge_Time = DateTime.Now; chlg.Challenge_Type = Convert.ToInt32(level); return(ec.AddChallenge(chlg)); }