public void SPandParameter_inputInstenceObjet2_ReturnNoNullValueParameter_Test() { // Arrange var para = new UserGroupMemberStudent() { Operate = "Get", UserID = "tester", IDs = "0", SchoolCode = "0354", AppID = "SIC", GroupID = "Junior Students Work Group", MemberID = "08", GroupType = "Grade", StartDate = "2020/09/01", EndDate = "2021/06/30", Comments = "Unit Test Add Grade 05 to School user Group Testing " }; string sp = "dbo.SIC_asm_SP"; // Concreate class can not return parameters match the para sequence string expect = "dbo.SIC_asm_SP @StartDate,@EndDate,@GroupID,@GroupType,@SchoolCode,@MemberID,@Operate,@UserID,@IDs,@AppID,@Comments"; // "dbo.SIC_asm_SP @Operate,@UserID,@IDs,@SchoolCode,@AppID,@GroupID,@MemberID,@GroupType,@StartDate,@EndDate,@Comments"; //Act var result = Factory.SPandParameter(sp, para); //Assert Assert.AreEqual(expect, result); }
public void SPandParameter_inputStruLayoutObject_ReturnNoNullValueParameter_Test() { // Arrange var paraObj = new UserGroupMemberStudent() { Operate = "Get", UserID = "tester", IDs = "0", SchoolCode = "0354", AppID = "SIC", GroupID = "Junior Students Work Group" }; string sp = "dbo.SIC_asm_SP"; // string expect = "dbo.SIC_asm_SP @Operate,@UserID,@IDs,@SchoolCode,@AppID,@GroupID"; string expect = "dbo.SIC_asm_SP @GroupID,@SchoolCode,@Operate,@UserID,@IDs,@AppID"; // string expect = "dbo.SIC_asm_SP @Path"; //Act var result = Factory.SPandParameter(sp, paraObj); // anonyPara); //Assert Assert.AreEqual(expect, result); }
public void SPandParameter_inputInstenceObject_ReturnNoNullValueParameter_Test() { // Arrange var paraObj = new UserGroupMemberStudent() { Operate = "Get", UserID = "tester", IDs = "0", SchoolCode = "0354", AppID = "SIC", GroupID = "Junior Students Work Group" }; var anony = new { }; // Concrete class dose not work // var anonyPara = AnonymousExtension.Anonymize(paraObj, anony); var anonyPara = AnonymousExtension.Anonymize2(paraObj, anony); string sp = "dbo.SIC_asm_SP"; // string expect = "dbo.SIC_asm_SP @Operate,@UserID,@IDs,@SchoolCode,@AppID,@GroupID"; string expect = "dbo.SIC_asm_SP @GroupID,@SchoolCode,@Operate,@UserID,@IDs,@AppID"; // string expect = "dbo.SIC_asm_SP @Path"; //Act var result = Factory.SPandParameter(sp, paraObj); // anonyPara); //Assert Assert.AreEqual(expect, result); }
public IHttpActionResult Put([FromBody] UserGroupMemberStudent userGroup) { if (userGroup.GroupID == "") { return(BadRequest("Invalid User Group data.")); // return Request.CreateResponse(HttpStatusCode.BadRequest, "Group ID Can not be blank"); } var result = _action.EditObj(userGroup); if (result == "Failed") { return(new ReturnMessage(result, Request)); } else { return(Ok(result)); // return Request.CreateResponse(HttpStatusCode.Accepted, result); } // return Request.CreateResponse(HttpStatusCode.NotAcceptable, result); }
public IHttpActionResult Post([FromBody] UserGroupMemberStudent userGroup) { if (userGroup.GroupID == "") { return(BadRequest("Invalid User Group data.")); } // return Request.CreateResponse(HttpStatusCode.BadRequest,"Group ID Can not be blank"); var result = _action.AddObj(userGroup); if (result.Substring(0, 12) == "Successfully") { return(Ok(result)); // Request.CreateResponse(HttpStatusCode.Created, result); } else { return(new ReturnMessage("Add User Group Failed", Request)); } //return Request.CreateResponse(HttpStatusCode.NotAcceptable, result); }
public string SaveSecurityGroupMemberStudent(string memberType, string operation, UserGroupMemberStudent para) { try { string result = ""; if (WebConfig.DataSource() == "API") { string uri = "UserGroupStudent"; result = ManageFormSave <UserGroupMemberStudent> .SaveFormContent("API", uri, para); } else { result = ManageFormSave <UserGroupMemberStudent> .SaveFormContent(operation, "UserGroupTeacher", para); } return(result); } catch (Exception ex) { var em = ex.Message; return("Failed"); } }