Esempio n. 1
0
 public void SaveComponentType(Sender sender, ComponentType obj)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             ComponentType model = new ComponentType();
             model.ComponentTypeID = obj.ComponentTypeID;
             if (op.LoadComponentType(model) == 0)
             {
                 obj.Created   = DateTime.Now;
                 obj.CreatedBy = sender.UserCode + "." + sender.UserName;
                 op.InsertComponentType(obj);
             }
             else
             {
                 obj.Created   = DateTime.Now;
                 obj.CreatedBy = sender.UserCode + "." + sender.UserName;
                 op.UpdateComponentTypeByComponentTypeID(obj);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 2
0
 public void SaveLocation(Sender sender, SaveLocationArgs args)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             Location obj = new Location();
             obj.LocationID = args.Location.LocationID;
             if (op.LoadLocationByLocationID(obj) == 0)
             {
                 args.Location.Created    = DateTime.Now;
                 args.Location.CreatedBy  = string.Format("{0}.{1}", sender.UserCode, sender.UserName);
                 args.Location.Modified   = DateTime.Now;
                 args.Location.ModifiedBy = string.Format("{0}.{1}", sender.UserCode, sender.UserName);
                 op.InsertLocation(args.Location);
             }
             else
             {
                 args.Location.Modified   = DateTime.Now;
                 args.Location.ModifiedBy = string.Format("{0}.{1}", sender.UserCode, sender.UserName);
                 op.UpdateLocationByLocationID(args.Location);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 3
0
 public void SaveOrderStep(Sender sender, OrderStep obj)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             if (op.LoadOrderStep(obj) == 0)
             {
                 obj.Created   = DateTime.Now;
                 obj.CreatedBy = sender.UserCode + "." + sender.UserName;
                 op.InsertOrderStep(obj);
             }
             else
             {
                 obj.Created   = DateTime.Now;
                 obj.CreatedBy = sender.UserCode + "." + sender.UserName;
                 op.UpdateOrderStepByStepID(obj);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 4
0
        public void SaveProductComponents(Sender sender, SaveProductComponentArgs args)
        {
            try
            {
                using (ObjectProxy op = new ObjectProxy(true))
                {
                    if (args.ProductComponents != null)
                    {
                        foreach (ProductComponent Item in args.ProductComponents)
                        {
                            Item.Created    = DateTime.Now;
                            Item.CreatedBy  = sender.UserCode + "." + sender.UserName;
                            Item.Modified   = DateTime.Now;
                            Item.ModifiedBy = sender.UserCode + "." + sender.UserName;
                            if (op.LoadProductComponent(Item) == 0)
                            {
                                op.InsertProductComponent(Item);
                            }
                            else
                            {
                                op.UpdateProductComponentByComponentID(Item);
                            }
                        }
                    }

                    op.CommitTransaction();
                }
            }
            catch (Exception ex)
            {
                PLogger.LogError(ex);
                throw ex;
            }
        }
Esempio n. 5
0
 public void SaveOrderLog(Sender sender, SaveOrderLogArgs args)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             OrderLog obj = new OrderLog();
             obj.LogID = args.OrderLog.LogID;
             if (op.LoadOrderLogByLogID(obj) == 0)
             {
                 args.OrderLog.Created   = DateTime.Now;
                 args.OrderLog.CreatedBy = sender.UserCode + "." + sender.UserName;
                 op.InsertOrderLog(args.OrderLog);
             }
             else
             {
                 op.UpdateOrderLogByLogID(args.OrderLog);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 6
0
 public void SaveWorkingLine(Sender sender, SaveWorkingLineArgs args)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             WorkingLine obj = new WorkingLine();
             obj.WorkingLineID = args.WorkingLine.WorkingLineID;
             if (op.LoadWorkingLineByWorkingLineID(obj) == 0)
             {
                 args.WorkingLine.Created    = DateTime.Now;
                 args.WorkingLine.CreatedBy  = sender.UserCode + "." + sender.UserName;
                 args.WorkingLine.Modified   = DateTime.Now;
                 args.WorkingLine.ModifiedBy = sender.UserCode + "." + sender.UserName;
                 op.InsertWorkingLine(args.WorkingLine);
             }
             else
             {
                 args.WorkingLine.Modified   = DateTime.Now;
                 args.WorkingLine.ModifiedBy = sender.UserCode + "." + sender.UserName;
                 op.UpdateWorkingLineByWorkingLineID(args.WorkingLine);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 7
0
 public void SaveOrder2Hardware(Sender sender, SaveOrder2HardwareArgs args)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             Order2Hardware obj = new Order2Hardware();
             obj.ItemID = args.Order2Hardware.ItemID;
             if (op.LoadOrder2HardwareByItemID(obj) == 0)
             {
                 op.InsertOrder2Hardware(args.Order2Hardware);
             }
             else
             {
                 op.UpdateOrder2HardwareByItemID(args.Order2Hardware);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 8
0
 public void SaveWorkShift(Sender sender, SaveWorkShiftArgs args)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             WorkShift obj = new WorkShift();
             obj.WorkShiftID = args.WorkShift.WorkShiftID;
             if (op.LoadWorkShiftByWorkShiftID(obj) == 0)
             {
                 args.WorkShift.Created    = DateTime.Now;
                 args.WorkShift.CreatedBy  = string.Format("{0}.{1}", sender.UserCode, sender.UserName);
                 args.WorkShift.Modified   = DateTime.Now;
                 args.WorkShift.ModifiedBy = string.Format("{0}.{1}", sender.UserCode, sender.UserName);
                 op.InsertWorkShift(args.WorkShift);
             }
             else
             {
                 args.WorkShift.Modified   = DateTime.Now;
                 args.WorkShift.ModifiedBy = string.Format("{0}.{1}", sender.UserCode, sender.UserName);
                 op.UpdateWorkShiftByWorkShiftID(args.WorkShift);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 9
0
 public void SaveReviewDetail(Sender sender, ReviewDetail obj)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             if (op.LoadReviewDetail(obj) == 0)
             {
                 obj.Created   = DateTime.Now;
                 obj.CreatedBy = sender.UserCode + "." + sender.UserName;
                 op.InsertReviewDetail(obj);
             }
             else
             {
                 obj.Created   = DateTime.Now;
                 obj.CreatedBy = sender.UserCode + "." + sender.UserName;
                 op.UpdateReviewDetailByTransID(obj);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 10
0
 public void SaveLogisticsEnterprise(Sender sender, SaveLogisticsEnterpriseArgs args)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             LogisticsEnterprise obj = new LogisticsEnterprise();
             obj.EnterpriseID = args.LogisticsEnterprise.EnterpriseID;
             if (op.LoadLogisticsEnterpriseByEnterpriseID(obj) == 0)
             {
                 args.LogisticsEnterprise.Created    = DateTime.Now;
                 args.LogisticsEnterprise.CreatedBy  = sender.UserCode + "." + sender.UserName;
                 args.LogisticsEnterprise.Modified   = DateTime.Now;
                 args.LogisticsEnterprise.ModifiedBy = sender.UserCode + "." + sender.UserName;
                 op.InsertLogisticsEnterprise(args.LogisticsEnterprise);
             }
             else
             {
                 args.LogisticsEnterprise.Modified   = DateTime.Now;
                 args.LogisticsEnterprise.ModifiedBy = sender.UserCode + "." + sender.UserName;
                 op.UpdateLogisticsEnterpriseByEnterpriseID(args.LogisticsEnterprise);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 11
0
 public void SaveRoomDesignerKJLRelation(Sender sender, SaveRoomDesignerKJLRelationArgs args)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             //string designID = args.RoomDesignerKJLRelation.KJLDesignID;
             if (op.LoadRoomDesignerKJLRelatioByDesignID(args.RoomDesignerKJLRelation) == 0)
             {
                 args.RoomDesignerKJLRelation.ID        = Guid.NewGuid();
                 args.RoomDesignerKJLRelation.Status    = false;
                 args.RoomDesignerKJLRelation.Created   = DateTime.Now;
                 args.RoomDesignerKJLRelation.CreatedBy = sender.UserCode + "." + sender.UserName;
                 op.InsertRoomDesignerKJLRelation(args.RoomDesignerKJLRelation);
             }
             //else
             //{
             //    args.RoomDesignerKJLRelation.KJLDesignID = designID;
             //    op.UpdateRoomDesignerKJLRelationByDesignID(args.RoomDesignerKJLRelation);
             //}
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 12
0
 public void SaveProductBOM(Sender sender, ProductBOM obj)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             ProductBOM model = new ProductBOM();
             model.ID = obj.ID;
             if (op.LoadProductBOM(model) == 0)
             {
                 string key   = "BOM" + DateTime.Now.ToString("yy");
                 int    index = this.GetIncrease(sender, key);
                 obj.BOMID     = key + DateTime.Now.Month.ToString("00") + index.ToString("00000");
                 obj.Created   = DateTime.Now;
                 obj.CreatedBy = sender.UserCode + "." + sender.UserName;
                 op.InsertProductBOM(obj);
             }
             else
             {
                 obj.Created   = DateTime.Now;
                 obj.CreatedBy = sender.UserCode + "." + sender.UserName;
                 op.UpdateProductBOMByID(obj);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 13
0
 public void SaveOrderWorkFlow(Sender sender, SaveOrderWorkFlowArgs args)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             OrderWorkFlow obj = new OrderWorkFlow();
             obj.WorkingID = args.OrderWorkFlow.WorkingID;
             if (op.LoadOrderWorkFlowByWorkingID(obj) == 0)
             {
                 op.InsertOrderWorkFlow(args.OrderWorkFlow);
             }
             else
             {
                 op.UpdateOrderWorkFlowByWorkingID(args.OrderWorkFlow);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 14
0
 public void SaveMaterial2Supplier(Sender sender, SaveMaterial2SupplierArgs args)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             Material2Supplier obj = new Material2Supplier();
             obj.MaterialID = args.Material2Supplier.MaterialID;
             obj.SupplierID = args.Material2Supplier.SupplierID;
             if (op.LoadMaterial2SupplierByMaterialID_SupplierID(obj) == 0)
             {
                 op.InsertMaterial2Supplier(args.Material2Supplier);
             }
             else
             {
                 op.UpdateMaterial2SupplierByMaterialID_SupplierID(args.Material2Supplier);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 15
0
 public void SaveWorkFlow(Sender sender, WorkFlow obj)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             WorkFlow model = new WorkFlow();
             model.WorkFlowID = obj.WorkFlowID;
             if (op.LoadWorkFlow(model) == 0)
             {
                 obj.Created   = DateTime.Now;
                 obj.CreatedBy = sender.UserCode + "." + sender.UserName;
                 op.InsertWorkFlow(obj);
             }
             else
             {
                 obj.Created   = DateTime.Now;
                 obj.CreatedBy = sender.UserCode + "." + sender.UserName;
                 op.UpdateWorkFlowByWorkFlowID(obj);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 16
0
 public void SaveOrderScheduling(Sender sender, SaveOrderSchedulingArgs args)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             OrderScheduling obj = new OrderScheduling();
             obj.MadeID = args.OrderScheduling.MadeID;
             if (op.LoadOrderSchedulingByMadeID(obj) == 0)
             {
                 args.OrderScheduling.Created    = DateTime.Now;
                 args.OrderScheduling.CreatedBy  = string.Format("{0}.{1}", sender.UserCode, sender.UserName);
                 args.OrderScheduling.Modified   = DateTime.Now;
                 args.OrderScheduling.ModifiedBy = string.Format("{0}.{1}", sender.UserCode, sender.UserName);
                 op.InsertOrderScheduling(args.OrderScheduling);
             }
             else
             {
                 args.OrderScheduling.Modified   = DateTime.Now;
                 args.OrderScheduling.ModifiedBy = string.Format("{0}.{1}", sender.UserCode, sender.UserName);
                 op.UpdateOrderSchedulingByMadeID(args.OrderScheduling);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 17
0
 public void SaveComponentMaterialExtension(Sender sender, ComponentMaterialExtension obj)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             if (op.LoadComponentMaterialExtension(obj) == 0)
             {
                 obj.Created   = DateTime.Now;
                 obj.CreatedBy = sender.UserCode + "." + sender.UserName;
                 op.InsertComponentMaterialExtension(obj);
             }
             else
             {
                 obj.Created   = DateTime.Now;
                 obj.CreatedBy = sender.UserCode + "." + sender.UserName;
                 op.UpdateComponentMaterialExtensionByID(obj);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 18
0
 public void DeleteUserGroup(Sender sender, Guid groupID)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             //删除用户组下面的角色用户;
             List <Role> roles = op.LoadRolesByGroupID(groupID);
             foreach (Role role in roles)
             {
                 op.DeleteUser2RolesByRoleID(role.RoleID);
             }
             //删除用户组下的角色
             op.DeleteRolesByGroupID(groupID);
             //删除用户组
             op.DeleteUserGroupByGroupID(groupID);
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 19
0
 public void SaveSolutionOthers(Sender sender, SaveSolutionOthersArgs args)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             SolutionOthers obj = new SolutionOthers();
             obj.DetailID = args.SolutionOthers.DetailID;
             if (op.LoadSolutionOthersByDetailID(obj) == 0)
             {
                 op.InsertSolutionOthers(args.SolutionOthers);
             }
             else
             {
                 op.UpdateSolutionOthersByDetailID(args.SolutionOthers);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 20
0
 public void SaveCategory(Sender sender, SaveCategoryArgs args)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             Category obj = new Category();
             obj.CategoryID = args.Category.CategoryID;
             if (op.LoadCategoryByCategoryID(obj) == 0)
             {
                 args.Category.Created    = DateTime.Now;
                 args.Category.CreatedBy  = string.Format("{0}.{1}", sender.UserCode, sender.UserName);
                 args.Category.Modified   = DateTime.Now;
                 args.Category.ModifiedBy = string.Format("{0}.{1}", sender.UserCode, sender.UserName);
                 op.InsertCategory(args.Category);
             }
             else
             {
                 args.Category.Modified   = DateTime.Now;
                 args.Category.ModifiedBy = string.Format("{0}.{1}", sender.UserCode, sender.UserName);
                 op.UpdateCategoryByCategoryID(args.Category);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 21
0
 public void SaveProductComponent(Sender sender, ProductComponent obj)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             if (op.LoadProductComponent(obj) == 0)
             {
                 obj.Created    = DateTime.Now;
                 obj.CreatedBy  = sender.UserCode + "." + sender.UserName;
                 obj.Modified   = DateTime.Now;
                 obj.ModifiedBy = sender.UserCode + "." + sender.UserName;
                 op.InsertProductComponent(obj);
             }
             else
             {
                 obj.Modified   = DateTime.Now;
                 obj.ModifiedBy = sender.UserCode + "." + sender.UserName;
                 op.UpdateProductComponentByComponentID(obj);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 22
0
 public void SaveCar(Sender sender, SaveCarArgs args)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             Car obj = new Car();
             obj.CarID = args.Car.CarID;
             if (op.LoadCarByCarID(obj) == 0)
             {
                 args.Car.Created    = DateTime.Now;
                 args.Car.CreatedBy  = sender.UserCode + "." + sender.UserName;
                 args.Car.Modified   = DateTime.Now;
                 args.Car.ModifiedBy = sender.UserCode + "." + sender.UserName;
                 op.InsertCar(args.Car);
             }
             else
             {
                 args.Car.Modified   = DateTime.Now;
                 args.Car.ModifiedBy = sender.UserCode + "." + sender.UserName;
                 op.UpdateCarByCarID(args.Car);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 23
0
 public void SaveSolutionFile(Sender sender, SaveSolutionFileArgs args)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             SolutionFile obj = new SolutionFile();
             obj.FileID = args.SolutionFile.FileID;
             if (op.LoadSolutionFileByFileID(obj) == 0)
             {
                 args.SolutionFile.Created    = DateTime.Now;
                 args.SolutionFile.CreatedBy  = sender.UserCode + "." + sender.UserName;
                 args.SolutionFile.Modified   = DateTime.Now;
                 args.SolutionFile.ModifiedBy = sender.UserCode + "." + sender.UserName;
                 op.InsertSolutionFile(args.SolutionFile);
             }
             else
             {
                 args.SolutionFile.Created    = DateTime.Now;
                 args.SolutionFile.CreatedBy  = sender.UserCode + "." + sender.UserName;
                 args.SolutionFile.Modified   = DateTime.Now;
                 args.SolutionFile.ModifiedBy = sender.UserCode + "." + sender.UserName;
                 op.UpdateSolutionFileByFileID(args.SolutionFile);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 24
0
 public void SaveMaterialQuotePrice(Sender sender, SaveMaterialQuotePriceArgs args)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             MaterialQuotePrice obj = new MaterialQuotePrice();
             obj.MaterialID = args.MaterialQuotePrice.MaterialID;
             if (op.LoadMaterialQuotePriceByMaterialID(obj) == 0)
             {
                 op.InsertMaterialQuotePrice(args.MaterialQuotePrice);
             }
             else
             {
                 op.UpdateMaterialQuotePriceByMaterialID(args.MaterialQuotePrice);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 25
0
 public void SaveCustomerTransDetail(Sender sender, SaveCustomerTransDetailArgs args)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             CustomerTransDetail obj = new CustomerTransDetail();
             obj.TransID = args.CustomerTransDetail.TransID;
             if (op.LoadCustomerTransDetailByTransID(obj) == 0)
             {
                 args.CustomerTransDetail.Created   = DateTime.Now;
                 args.CustomerTransDetail.CreatedBy = sender.UserCode + "." + sender.UserName;
                 op.InsertCustomerTransDetail(args.CustomerTransDetail);
             }
             else
             {
                 op.UpdateCustomerTransDetailByTransID(args.CustomerTransDetail);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 26
0
 public void SaveNotice(Sender sender, SaveNoticeArgs args)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             Notice obj = new Notice();
             obj.NoticeID = args.Notice.NoticeID;
             if (op.LoadNoticeByNoticeID(obj) == 0)
             {
                 args.Notice.Created   = DateTime.Now;
                 args.Notice.CreatedBy = string.Format("{0}.{1}", sender.UserCode, sender.UserName);
                 op.InsertNotice(args.Notice);
             }
             else
             {
                 op.UpdateNoticeByNoticeID(args.Notice);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 27
0
 public void SaveSolution2Hardware(Sender sender, Solution2Hardware item)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             Solution2Hardware obj = new Solution2Hardware();
             obj.CabinetID = item.CabinetID;
             if (op.LoadSolution2HardwareByItemID(obj) == 0)
             {
                 item.Created    = DateTime.Now;
                 item.CreatedBy  = sender.UserCode + "." + sender.UserName;
                 item.Modified   = DateTime.Now;
                 item.ModifiedBy = sender.UserCode + "." + sender.UserName;
                 op.InsertSolution2Hardware(item);
             }
             else
             {
                 item.Modified   = DateTime.Now;
                 item.ModifiedBy = sender.UserCode + "." + sender.UserName;
                 op.UpdateSolution2HardwareByItemID(item);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 28
0
 public void SaveKeyValue(Sender sender, KeyValue kv)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             KeyValue tmp = new KeyValue();
             tmp.Key = kv.Key;
             if (op.LoadKeyValueByKey(tmp) == 0)
             {
                 tmp = null;
             }
             if (tmp == null)
             {
                 op.InsertKeyValue(kv);
             }
             else
             {
                 op.UpdateKeyValueByKey(kv);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 29
0
 public void SaveSupplier(Sender sender, SaveSupplierArgs args)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             Supplier obj = new Supplier();
             obj.SupplierID = args.Supplier.SupplierID;
             if (op.LoadSupplierBySupplierID(obj) == 0)
             {
                 args.Supplier.Created    = DateTime.Now;
                 args.Supplier.CreatedBy  = string.Format("{0}.{1}", sender.UserCode, sender.UserName);
                 args.Supplier.Modified   = DateTime.Now;
                 args.Supplier.ModifiedBy = string.Format("{0}.{1}", sender.UserCode, sender.UserName);
                 op.InsertSupplier(args.Supplier);
             }
             else
             {
                 args.Supplier.Modified   = DateTime.Now;
                 args.Supplier.ModifiedBy = string.Format("{0}.{1}", sender.UserCode, sender.UserName);
                 op.UpdateSupplierBySupplierID(args.Supplier);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 30
0
        public void SaveWorkOrders(Sender sender, SaveWorkOrderArgs args)
        {
            try
            {
                using (ObjectProxy op = new ObjectProxy(true))
                {
                    if (args.WorkOrders != null)
                    {
                        foreach (WorkOrder Item in args.WorkOrders)
                        {
                            string key   = "W" + DateTime.Now.ToString("yy");
                            int    index = this.GetIncrease(sender, key);
                            Item.WorkOrderNo = key + DateTime.Now.Month.ToString("00") + index.ToString("00000");
                            Item.Created     = DateTime.Now;
                            Item.CreatedBy   = sender.UserCode + "." + sender.UserName;
                            op.InsertWorkOrder(Item);
                        }
                    }

                    if (args.ProductionOrder != null)
                    {
                        op.UpdateProductionOrderByProductionID(args.ProductionOrder);
                    }

                    op.CommitTransaction();
                }
            }
            catch (Exception ex)
            {
                PLogger.LogError(ex);
                throw ex;
            }
        }