public void DeleteProduct(Sender sender, Guid ProductID) { try { using (ObjectProxy op = new ObjectProxy(true)) { op.DeleteProductProcessFilesByProductID(ProductID); op.DeleteProduct2HardwaresByProductID(ProductID); op.DeleteProductDetailsByProductID(ProductID); op.DeleteProductMainByProductID(ProductID); op.CommitTransaction(); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public List <Order2Hardware> GetOrder2HardwaresByOrderID_CabinetID(Sender sender, Guid OrderID, Guid CabinetID) { try { using (ObjectProxy op = new ObjectProxy()) { List <Order2Hardware> list = op.LoadOrder2HardwaresByOrderID(OrderID); if (list != null) { return(list.FindAll(item => item.CabinetID == CabinetID)); } return(list); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
private void PlayVoice(string message) { try { if (VoiceFlag) { if (Voice == null) { Voice = new SpVoice(); } SpeechVoiceSpeakFlags SpFlags = SpeechVoiceSpeakFlags.SVSFlagsAsync; Voice.Speak(message, SpFlags); } } catch (Exception ex) { VoiceFlag = false; PLogger.LogError(ex); } }
public void GetQuoteMainBySolutionID() { try { if (string.IsNullOrEmpty(Request["SolutionID"])) { throw new Exception("无效的参数"); } using (ProxyBE p = new ProxyBE()) { QuoteMain quote = p.Client.GetQuoteMainBySolutionID(SenderUser, Guid.Parse(Request["SolutionID"])); Response.Write(JSONHelper.Object2Json(quote)); } } catch (Exception ex) { PLogger.LogError(ex); WriteError(ex.Message, ex); } }
public Order GetOrderByOrderNo(Sender sender, string OrderNo) { try { using (ObjectProxy op = new ObjectProxy()) { Order obj = new Order(); obj.OrderNo = OrderNo; //if (op.LoadOrderByOrderNo(obj) == 0) return(null); return(obj); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
private void Main_FormClosing(object sender, FormClosingEventArgs e) { try { if (e.CloseReason == CloseReason.WindowsShutDown || isClose) { return; } e.Cancel = true; this.tmpFormWindowState = this.WindowState; this.tmpFormSize = this.Size; this.tmpFormLocation = this.Location; this.Visible = false; } catch (Exception ex) { PLogger.LogError(ex); MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// 递归压缩文件 /// </summary> /// <param name="SourcePath"></param> /// <param name="zipStream"></param> private static void CreateZipFiles(string SourcePath, ZipOutputStream zipStream) { #region 递归压缩文件 Crc32 crc = new Crc32(); try { string[] Arrays = Directory.GetFileSystemEntries(SourcePath); foreach (string item in Arrays) { if (Directory.Exists(item)) { //文件夹,递归 CreateZipFiles(item, zipStream); } else { //文件,压缩 FileStream stream = File.OpenRead(item); byte[] buffer = new byte[stream.Length]; stream.Read(buffer, 0, buffer.Length); string tempFile = item.Substring(item.LastIndexOf("\\") + 1); ZipEntry entry = new ZipEntry(tempFile); entry.DateTime = DateTime.Now; entry.Size = stream.Length; stream.Close(); crc.Reset(); crc.Update(buffer); entry.Crc = crc.Value; zipStream.PutNextEntry(entry); zipStream.Write(buffer, 0, buffer.Length); File.Delete(item); } } } catch (Exception ex) { PLogger.LogError(ex); } #endregion }
public void SaveBattchFile(Sender sender, SaveBattchFileArgs args) { try { using (ObjectProxy op = new ObjectProxy(true)) { if (string.IsNullOrEmpty(args.BattchFile.BattchNum)) { throw new PException("批次号不能为空。"); } else if (BattchFileIsDuplicated(sender, args.BattchFile)) { throw new PException("批次号【{0}】已经上传了文件", args.BattchFile.BattchNum); } BattchFile obj = new BattchFile(); obj.FileID = args.BattchFile.FileID; if (op.LoadBattchFileByFileID(obj) == 0) { args.BattchFile.Created = DateTime.Now; args.BattchFile.CreatedBy = string.Format("{0}.{1}", sender.UserCode, sender.UserName); args.BattchFile.Modified = DateTime.Now; args.BattchFile.ModifiedBy = string.Format("{0}.{1}", sender.UserCode, sender.UserName); op.InsertBattchFile(args.BattchFile); } else { args.BattchFile.Modified = DateTime.Now; args.BattchFile.ModifiedBy = string.Format("{0}.{1}", sender.UserCode, sender.UserName); op.UpdateBattchFileByFileID(args.BattchFile); } op.CommitTransaction(); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public void SaveComponentMaterialAndExtension(Sender sender, SaveComponentMaterialArgs args) { try { using (ObjectProxy op = new ObjectProxy(true)) { if (args.ComponentMaterials != null) { foreach (ComponentMaterial Item in args.ComponentMaterials) { if (op.LoadComponentMaterial(Item) == 0) { Item.Created = DateTime.Now; Item.CreatedBy = sender.UserCode + "." + sender.UserName; Item.Modified = DateTime.Now; Item.ModifiedBy = sender.UserCode + "." + sender.UserName; int componentMaterialID = op.AddComponentMaterial(Item); Item.ExtensionModel.ComponentMaterialID = componentMaterialID; Item.ExtensionModel.Created = DateTime.Now; Item.ExtensionModel.CreatedBy = sender.UserCode + "." + sender.UserName; op.InsertComponentMaterialExtension(Item.ExtensionModel); } else { Item.Modified = DateTime.Now; Item.ModifiedBy = sender.UserCode + "." + sender.UserName; op.UpdateComponentMaterialByID(Item); } } } op.CommitTransaction(); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public OrderStep GetOrderStepByPrivilegeID(Sender sender, Guid PrivilegeID) { try { using (ObjectProxy op = new ObjectProxy()) { OrderStep obj = new OrderStep(); obj.PrivilegeID = PrivilegeID; if (op.LoadOrderStepByPrivilegeID(obj) == 0) { return(null); } return(obj); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public Solution GetSolutionBySolutionCode(Sender sender, string SolutionCode) { try { using (ObjectProxy op = new ObjectProxy()) { Solution obj = new Solution(); obj.SolutionCode = SolutionCode; if (op.LoadSolutionBySolutionCode(obj) == 0) { return(null); } return(obj); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public Location GetLocation(Sender sender, Guid LocationID) { try { using (ObjectProxy op = new ObjectProxy()) { Location obj = new Location(); obj.LocationID = LocationID; if (op.LoadLocationByLocationID(obj) == 0) { return(null); } return(obj); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public SolutionFile GetSolutionFileBySourceID(Sender sender, Guid SourceID) { try { using (ObjectProxy op = new ObjectProxy()) { SolutionFile obj = new SolutionFile(); obj.SourceID = SourceID; if (op.LoadSolutionFileBySourceID(obj) == 0) { return(null); } return(obj); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public MaterialQuotePrice GetMaterialQuotePrice(Sender sender, Guid MaterialID) { try { using (ObjectProxy op = new ObjectProxy()) { MaterialQuotePrice obj = new MaterialQuotePrice(); obj.MaterialID = MaterialID; if (op.LoadMaterialQuotePriceByMaterialID(obj) == 0) { return(null); } return(obj); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public WarehouseInMain GetWarehouseInMain(Sender sender, Guid InID) { try { using (ObjectProxy op = new ObjectProxy()) { WarehouseInMain obj = new WarehouseInMain(); obj.InID = InID; if (op.LoadWarehouseInMainByInID(obj) == 0) { return(null); } return(obj); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public Car GetCar(Sender sender, Guid CarID) { try { using (ObjectProxy op = new ObjectProxy(true)) { Car obj = new Car(); obj.CarID = CarID; if (op.LoadCarByCarID(obj) == 0) { return(null); } return(obj); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public Order2Hardware GetOrder2Hardware(Sender sender, Guid ItemID) { try { using (ObjectProxy op = new ObjectProxy()) { Order2Hardware obj = new Order2Hardware(); obj.ItemID = ItemID; if (op.LoadOrder2HardwareByItemID(obj) == 0) { return(null); } return(obj); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public ProductionOrder GetProductionOrder(Sender sender, Guid ProductionID) { try { using (ObjectProxy op = new ObjectProxy()) { ProductionOrder obj = new ProductionOrder(); obj.ProductionID = ProductionID; if (op.LoadProductionOrder(obj) == 0) { return(null); } return(obj); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public ProductComponent GetProductComponent(Sender sender, Int32 ComponentID) { try { using (ObjectProxy op = new ObjectProxy()) { ProductComponent obj = new ProductComponent(); obj.ComponentID = ComponentID; if (op.LoadProductComponent(obj) == 0) { return(null); } return(obj); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public KeyValue GetKeyValue(Sender sender, string key) { try { using (ObjectProxy op = new ObjectProxy()) { KeyValue kv = new KeyValue(); kv.Key = key; if (op.LoadKeyValueByKey(kv) == 0) { return null; } return kv; } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public CustomerTransDetail GetCustomerTransDetail(Sender sender, Guid TransID) { try { using (ObjectProxy op = new ObjectProxy()) { CustomerTransDetail obj = new CustomerTransDetail(); obj.TransID = TransID; if (op.LoadCustomerTransDetailByTransID(obj) == 0) { return(null); } return(obj); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public WorkShop GetWorkShopByWorkShopCode(Sender sender, string WorkShopCode) { try { using (ObjectProxy op = new ObjectProxy()) { WorkShop obj = new WorkShop(); obj.WorkShopCode = WorkShopCode; if (op.LoadWorkShopByWorkShopCode(obj) == 0) { return(null); } return(obj); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public PartnerTask GetPartnerTask(Sender sender, Guid TaskID) { try { using (ObjectProxy op = new ObjectProxy()) { PartnerTask obj = new PartnerTask(); obj.TaskID = TaskID; if (op.LoadPartnerTaskByTaskID(obj) == 0) { return(null); } return(obj); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public Role GetRole(Sender sender, Guid roleID) { try { using (ObjectProxy op = new ObjectProxy()) { Role role = new Role(); role.RoleID = roleID; if (op.LoadRoleByRoleID(role) == 0) { return(null); } return(role); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public Solution GetSolutionByDesignerID(Sender sender, Guid DesignerID) { try { using (ObjectProxy op = new ObjectProxy()) { Solution obj = new Solution(); obj.DesignerID = DesignerID; if (op.LoadSolutionByDesignerID(obj) == 0) { return(null); } return(obj); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public WorkingLine GetWorkingLine(Sender sender, Guid WorkingLineID) { try { using (ObjectProxy op = new ObjectProxy()) { WorkingLine obj = new WorkingLine(); obj.WorkingLineID = WorkingLineID; if (op.LoadWorkingLineByWorkingLineID(obj) == 0) { return(null); } return(obj); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public OrderStep GetOrderStepByStepCode(Sender sender, string StepCode) { try { using (ObjectProxy op = new ObjectProxy()) { OrderStep obj = new OrderStep(); obj.StepCode = StepCode; if (op.LoadOrderStepByStepCode(obj) == 0) { return(null); } return(obj); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public bool WorkingLineIsDuplicated(Sender sender, WorkingLine WorkingLine) { try { using (ObjectProxy op = new ObjectProxy()) { WorkingLine obj = new WorkingLine(); obj.WorkingLineName = WorkingLine.WorkingLineName; if (op.LoadWorkingLineByWorkingLineName(obj) == 0) { return(false); } return(obj.WorkingLineID != WorkingLine.WorkingLineID); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public Supplier GetSupplier(Sender sender, Guid SupplierID) { try { using (ObjectProxy op = new ObjectProxy()) { Supplier obj = new Supplier(); obj.SupplierID = SupplierID; if (op.LoadSupplierBySupplierID(obj) == 0) { return(null); } return(obj); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }
public ComponentMaterial GetComponentMaterial(Sender sender, Int32 ID) { try { using (ObjectProxy op = new ObjectProxy()) { ComponentMaterial obj = new ComponentMaterial(); obj.ID = ID; if (op.LoadComponentMaterial(obj) == 0) { return(null); } return(obj); } } catch (Exception ex) { PLogger.LogError(ex); throw ex; } }