public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Charset = "utf-8"; HttpPostedFile file = context.Request.Files["Filedata"]; if (file != null) { string AreaId = context.Request.Form["AreaId"]; IList <StringObjectDictionary> datas = NPOIManager.GetSheetData(file.InputStream, 0, true); List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); FamilyCamera familyCamera = new FamilyCamera() { DataSource = GlobalManager.DIKey_00012_UploadFile, OperatedBy = NormalSession.UserId.ToGuid(), OperatedOn = DateTime.Now, AreaId = AreaId }; foreach (var data in datas) { familyCamera.DeviceId = Guid.NewGuid(); StringObjectDictionary sod = familyCamera.ToStringObjectDictionary(false); IDictionary <string, object> dataItem = sod.MixInObject(data, false, e0571.web.core.Other.CaseSensitive.NORMAL); statements.Add(new IBatisNetBatchStatement { StatementName = familyCamera.GetCreateMethodName(), ParameterObject = dataItem, Type = SqlExecuteType.INSERT }); } BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements); //下面这句代码缺少的话,上传成功后上传队列的显示不会自动消失 context.Response.Write("1"); } else { context.Response.Write("0"); } }
public ModelInvokeResult <FamilyCameraPK> Nullify(string strDeviceId) { ModelInvokeResult <FamilyCameraPK> result = new ModelInvokeResult <FamilyCameraPK> { Success = true }; try { List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); Guid?_DeviceId = strDeviceId.ToGuid(); if (_DeviceId == null) { result.Success = false; result.ErrorCode = 59996; return(result); } FamilyCamera familyCamera = new FamilyCamera { DeviceId = _DeviceId, Status = 0 }; /***********************begin 自定义代码*******************/ familyCamera.OperatedBy = NormalSession.UserId.ToGuid(); familyCamera.OperatedOn = DateTime.Now; familyCamera.DataSource = GlobalManager.DIKey_00012_ManualEdit; /***********************end 自定义代码*********************/ statements.Add(new IBatisNetBatchStatement { StatementName = familyCamera.GetUpdateMethodName(), ParameterObject = familyCamera.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE }); /***********************begin 自定义代码*******************/ /***********************此处添加自定义代码*****************/ /***********************end 自定义代码*********************/ BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements); result.instance = new FamilyCameraPK { DeviceId = _DeviceId }; } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }
public InvokeResult NullifySelected(string strDeviceIds) { InvokeResult result = new InvokeResult { Success = true }; try { List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); string[] arrDeviceIds = strDeviceIds.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (arrDeviceIds.Length == 0) { result.Success = false; result.ErrorCode = 59996; return(result); } string statementName = new FamilyCamera().GetUpdateMethodName(); foreach (string strDeviceId in arrDeviceIds) { FamilyCamera familyCamera = new FamilyCamera { DeviceId = strDeviceId.ToGuid(), Status = 0 }; /***********************begin 自定义代码*******************/ familyCamera.OperatedBy = NormalSession.UserId.ToGuid(); familyCamera.OperatedOn = DateTime.Now; familyCamera.DataSource = GlobalManager.DIKey_00012_ManualEdit; /***********************end 自定义代码*********************/ statements.Add(new IBatisNetBatchStatement { StatementName = statementName, ParameterObject = familyCamera.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE }); } BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements); } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }
public InvokeResult DeleteSelected(string strDeviceIds) { InvokeResult result = new InvokeResult { Success = true }; try { List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); string[] arrDeviceIds = strDeviceIds.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (arrDeviceIds.Length == 0) { result.Success = false; result.ErrorCode = 59996; return(result); } string statementName = new FamilyCamera().GetDeleteMethodName(); foreach (string strDeviceId in arrDeviceIds) { FamilyCameraPK pk = new FamilyCameraPK { DeviceId = strDeviceId.ToGuid() }; DeleteCascade(statements, pk); statements.Add(new IBatisNetBatchStatement { StatementName = statementName, ParameterObject = pk, Type = SqlExecuteType.DELETE }); } BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements); } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }
public ModelInvokeResult <FamilyCameraPK> Create(FamilyCamera familyCamera) { ModelInvokeResult <FamilyCameraPK> result = new ModelInvokeResult <FamilyCameraPK> { Success = true }; try { List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); if (familyCamera.DeviceId == GlobalManager.GuidAsAutoGenerate) { familyCamera.DeviceId = Guid.NewGuid(); } /***********************begin 自定义代码*******************/ familyCamera.OperatedBy = NormalSession.UserId.ToGuid(); familyCamera.OperatedOn = DateTime.Now; familyCamera.DataSource = GlobalManager.DIKey_00012_ManualEdit; /***********************end 自定义代码*********************/ statements.Add(new IBatisNetBatchStatement { StatementName = familyCamera.GetCreateMethodName(), ParameterObject = familyCamera.ToStringObjectDictionary(false), Type = SqlExecuteType.INSERT }); /***********************begin 自定义代码*******************/ /***********************此处添加自定义代码*****************/ /***********************end 自定义代码*********************/ BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements); result.instance = new FamilyCameraPK { DeviceId = familyCamera.DeviceId }; } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }
static void Main(string[] args) { Console.WriteLine("Choose an option: "); Console.WriteLine("FamilyCamera -> go to family camera details"); Console.WriteLine("DoubleSimpleCamera -> go to double simple camera details"); Console.WriteLine("DoubleMountainCamera -> go to double camera with mountain view details"); Console.WriteLine("Mansard -> go to mansard details"); Console.WriteLine("Option: "); String option = Console.ReadLine(); switch (option) { case "FamilyCamera": FamilyCamera FC = new FamilyCamera("FamilyCamera - parter", 200m, 0.2m, 4); Console.WriteLine(""); Console.WriteLine(FC.Location + " will cost " + FC.Price + "RON/night"); if (FC.Nights > 3) { Console.WriteLine(FC.Location + " for " + FC.Nights + " nights will cost " + (FC.Price - (FC.Price * FC.Discount)) + "RON/night (20% discount)"); Console.WriteLine("with a total price of: " + ((FC.Price - (FC.Price * FC.Discount))) * FC.Nights + "RON"); } else { Console.WriteLine(FC.Location + " for " + FC.Nights + " nights will cost " + FC.Price * FC.Nights + "RON"); } break; case "DoubleSimpleCamera": DoubleSimpleCamera DSC = new DoubleSimpleCamera("DoubleSimpleCamera - Camera 1 (floor1)", 120m, 0.2m, 3); Console.WriteLine(""); Console.WriteLine(DSC.Location + " will cost " + DSC.Price + "RON/night"); if (DSC.Nights > 3) { Console.WriteLine(DSC.Location + " for " + DSC.Nights + " nights will cost " + (DSC.Price - (DSC.Price * DSC.Discount)) + "RON/night (20% discount)"); Console.WriteLine("with a total price of: " + ((DSC.Price - (DSC.Price * DSC.Discount)) * DSC.Nights) + "RON"); } else { Console.WriteLine(DSC.Location + " for " + DSC.Nights + " nights will cost " + DSC.Price * DSC.Nights + "RON"); } break; case "DoubleMountainCamera": DoubleMountainCamera DMC = new DoubleMountainCamera("DoubleMountainCamera - Camera 1 (floor1)", 150m, 0.2m, 3); DoubleMountainCamera DMC2 = new DoubleMountainCamera("DoubleMountainCamera - Camera 2 (floor1)", 150m, 0.2m, 4); Console.WriteLine(""); Console.WriteLine(DMC.Location + " will cost " + DMC.Price + "RON/night"); if (DMC.Nights > 3) { Console.WriteLine(DMC.Location + " for " + DMC.Nights + " nights will cost " + (DMC.Price - (DMC.Price * DMC.Discount)) + "RON/night (20% discount)"); Console.WriteLine("with a total price of: " + ((DMC.Price - (DMC.Price * DMC.Discount)) * DMC.Nights) + "RON"); } else { Console.WriteLine(DMC.Location + " for " + DMC.Nights + " nights will cost " + DMC.Price * DMC.Nights + "RON"); } Console.WriteLine(""); Console.WriteLine(DMC2.Location + " will cost " + DMC2.Price + "RON/night"); if (DMC2.Nights > 3) { Console.WriteLine(DMC2.Location + " for " + DMC2.Nights + " nights will cost " + (DMC2.Price - (DMC2.Price * DMC2.Discount)) + "RON/night (20% discount)"); Console.WriteLine("with a total price of: " + ((DMC2.Price - (DMC2.Price * DMC2.Discount))) * DMC2.Nights + "RON"); } else { Console.WriteLine(DMC2.Location + " for " + DMC2.Nights + " nights will cost " + DMC2.Price * DMC2.Nights + "RON"); } break; case "Mansard": Mansard mansard = new Mansard("Mansard - Camera 1 (floor1)", 100m, 0.2m, 21); Mansard mansard2 = new Mansard("Mansard - Camera 2 (floor1)", 100m, 0.2m, 2); Console.WriteLine(""); Console.WriteLine(mansard.Location + " will cost " + mansard.Price + "RON/night"); if (mansard.Nights > 3) { Console.WriteLine(mansard.Location + " for " + mansard.Nights + " nights will cost " + (mansard.Price - (mansard.Price * mansard.Discount)) + "RON/night (20% discount)"); Console.WriteLine("with a total price of: " + ((mansard.Price - (mansard.Price * mansard.Discount)) * mansard.Nights) + "RON"); } else { Console.WriteLine(mansard.Location + " for " + mansard.Nights + " nights will cost " + mansard.Price * mansard.Nights + "RON"); } Console.WriteLine(""); Console.WriteLine(mansard2.Location + " will cost " + mansard.Price + "RON/night"); if (mansard2.Nights > 3) { Console.WriteLine(mansard2.Location + " for " + mansard2.Nights + " nights will cost " + (mansard2.Price - (mansard2.Price * mansard2.Discount)) + "RON/night (20% discount)"); Console.WriteLine("with a total price of: " + ((mansard2.Price - (mansard2.Price * mansard2.Discount))) * mansard2.Nights + "RON"); } else { Console.WriteLine(mansard2.Location + " for " + mansard2.Nights + " nights will cost " + mansard2.Price * mansard2.Nights + "RON"); } break; default: break; } }