???????????????????????????js????ajax???????????????????html??
$(".jq-draggable-outcontainer").draggable({
helper: "clone"??
scroll: true??
drag: function (event?? ui) {
//   debugger;
}
});
$("#content").droppable({
drop: function (event?? ui) {
//  debugger;
if (ui.draggable[0].className.indexOf("jq-draggable-outcontainer") > 0) {
var text = ui.draggable[0].innerText.trim();
$(this).append('<div class="window jq-draggable-incontainer" onclick="GetPropertiesByType('1'??this)" style="position:absolute;left:' +(event.clientX-20) + 'px;top:' + (event.clientY-20) + 'px" id="window' + iIndex + '"><strong>' + text + '</strong></div>');
$("#content2").html("");
cur_selector = $("#window"+iIndex);
$.Ewin.AjaxPost("/Home/GetModelByType"?? { strType: "Factory" }?? function (data?? status) {
var element = $.parseJSON(data.Json);
var arrProp = element.element.property;
//0.????html
var strHtml = "<div style='float:right;padding-top:0px;width:300px;height:auto;'><table cellpadding='5' border='1'>";
//1.?html????????
strHtml += "</table></div>";
$("#content2").append(strHtml);
}?? function () {
}?? null);
iIndex++;
}
}
});
?????????C#??????
public JsonResult GetModelByType(string strType)
{
//strType??????????Factory????FactoryDetail
var assembly = Assembly.Load("Ewin.Client.Web");
//???????????????
var oType = assembly.GetType("Ewin.Client.Web.Controllers." + strType);
//??????????????
var lstProperties = oType.GetProperties();
foreach (var oProperty in lstProperties)
{
//????????????????????
IList<CustomAttributeData> lstAttr = oProperty.GetCustomAttributesData();
foreach (var oAttr in lstAttr)
{
//?????????????????
Console.WriteLine("???????????" + oAttr.AttributeType.FullName);
Console.WriteLine("???????????£?");
//?????????????в???
var lstAttrArgu = oAttr.NamedArguments;
foreach (var oAttrAru in lstAttrArgu)
{
//???????????????????
Console.WriteLine(oAttrAru.MemberName + "=" + oAttrAru.TypedValue.Value);
}
//Console.WriteLine(oAttr.AttributeType+"——"+oAttr.NamedArguments);
}
}
return Json(new { }?? JsonRequestBehavior.AllowGet);
}
????GetModelByType???????????????????????????????js?????????????js???????????檔????????????????????????????С?????????
??????2??????????????????÷???
????????÷?.Net framework?????????MVC????Filter?????????÷???
public class SuperLogStat : ActionFilterAttribute
{
//???????
private EnumModuleName moduleEnum = EnumModuleName.ModuleOther;
//????????
private string functionName = string.Empty;
//???Id
private string userId = string.Empty;
public string Version
{
get { return ConfigurationManager.AppSettings["UploatStatVersion"]; }
}
public EnumModuleName ModuleEnum
{
get { return this.moduleEnum; }
set { this.moduleEnum = value; }
}
public string FunctionName
{
get { return this.functionName; }
set { this.functionName = value; }
}
//??????????????????virtual???????????return View()????У????????????
//
// ??:
//     ????в??????????? MVC ?????á?
//
// ????:
//   filterContext:
//     ???????????
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
try
{
string userName = filterContext.HttpContext.User.Identity.Name;
this.userId = userName.Replace("china\"?? "");
}
catch (Exception)
{
this.userId = string.Empty;
}
}
//
// ??:
//     ????в?????????? MVC ?????á?
//
// ????:
//   filterContext:
//     ???????????
public override void OnResultExecuting(ResultExecutingContext filterContext)
{
UserLogUtils.LogUserStatic(this.userId?? this.Version??
EnumUtils.getEnumDescByValue((int)this.moduleEnum?? typeof(EnumModuleName))??
this.functionName);
}
}
??Controller???淽??????????????
1
2
3
4
5
6
//????
[SuperLogStat(ModuleEnum = EnumModuleName.ModuleHome?? FunctionName = "?????")]
public ActionResult MyApplyToAuditing()
{
return View();
}
???????ActionFilterAttribute????????÷???????????????????????????????????????????????
??????3??????????????÷???
????????????????÷????.Net??????????????????new????????????MEF?????????????????????
????????????????????????
????[Export("Impc_TB_Test"?? typeof(Ifc_TB_Test))]
????public class Impc_TB_Test : Ifc_TB_Test
????{
????......
????}
??????????????κ?????
????public interface Ifc_TB_Test
????{
????......
????}
??????????????????????[Import]???????????????????????new???Impc_TB_Test??????
????[Import("Impc_TB_Test")]
????Ifc_TB_Test service { get; set; }
?????????service????????????????????????Impc_TB_Test????????á??????????
????????????÷?????????ù????????????????????????÷???????????????????????????~~