/// <summary>
 /// Update size (direct to DB)
 /// </summary>
 /// <param name="originalSize">originalsize</param>
 /// <param name="originalCompanyId">originalCompanyId</param>
 /// <param name="originalDeleted">originalDeleted</param>        
 /// 
 /// <param name="newSize">newSize</param>
 /// <param name="newCompanyId">newCompanyId</param>
 /// <param name="newDeleted">newDeleted</param>        
 public void UpdateDirect(string originalSize, int originalCompanyId, bool originalDeleted, string newSize, int newCompanyId, bool newDeleted)
 {
     WorkPointRepairsRepairPointSizeGateway workPointRepairsRepairPointSizeGateway = new WorkPointRepairsRepairPointSizeGateway(null);
     workPointRepairsRepairPointSizeGateway.Update(originalSize, originalCompanyId, originalDeleted, newSize, newCompanyId, newDeleted);
 }
 /// <summary>
 /// Undelete size
 /// </summary>
 /// <param name="size_">size_</param>
 /// <param name="companyId">companyId</param>
 public void UnDeleteDirect(string size_, int companyId)
 {
     WorkPointRepairsRepairPointSizeGateway workPointRepairsRepairPointSizeGateway = new WorkPointRepairsRepairPointSizeGateway(null);
     workPointRepairsRepairPointSizeGateway.UnDelete(size_, companyId);
 }
Exemplo n.º 3
0
        protected void cvSize_ServerValidate(object source, ServerValidateEventArgs args)
        {
            args.IsValid = true;

            WorkPointRepairsRepairPointSizeGateway workPointRepairsRepairPointSizeGateway = new WorkPointRepairsRepairPointSizeGateway();

            if (workPointRepairsRepairPointSizeGateway.IsUsedInPointRepair(args.Value.Trim(), Int32.Parse(hdfCompanyId.Value)))
            {
                args.IsValid = false;
            }
        }
 // ////////////////////////////////////////////////////////////////////////
 // PUBLIC METHODS
 //
 /// <summary>
 /// Insert material
 /// </summary>
 /// <param name="size_">size_</param>
 /// <param name="companyId">companyId</param>
 /// <param name="deleted">deleted</param>        
 public void InsertDirect(string size_, int companyId, bool deleted)
 {
     WorkPointRepairsRepairPointSizeGateway workPointRepairsRepairPointSizeGateway = new WorkPointRepairsRepairPointSizeGateway(null);
     workPointRepairsRepairPointSizeGateway.Insert(size_, companyId, deleted);
 }
Exemplo n.º 5
0
        /// <summary>
        /// Save all size to database (direct)
        /// </summary>
        /// <param name="companyId">companyId</param>        
        public void Save(int companyId)
        {
            SizeInformationTDS sizeInformationChanges = (SizeInformationTDS)Data.GetChanges();

            if (sizeInformationChanges != null)
            {
                if (sizeInformationChanges.SizeInformation.Rows.Count > 0)
                {
                    SizeInformationGateway sizeInformationGateway = new SizeInformationGateway(sizeInformationChanges);

                    foreach (SizeInformationTDS.SizeInformationRow row in (SizeInformationTDS.SizeInformationDataTable)sizeInformationChanges.SizeInformation)
                    {
                        // Insert new size
                        if ((!row.Deleted) && (!row.InDatabase))
                        {
                            WorkPointRepairsRepairPointSizeGateway workPointRepairsRepairPointSizeGateway = new WorkPointRepairsRepairPointSizeGateway();
                            WorkPointRepairsRepairPointSize workPointRepairsRepairPointSize = new WorkPointRepairsRepairPointSize(null);

                            workPointRepairsRepairPointSizeGateway.LoadAllBySize_(row.Size_, row.COMPANY_ID);

                            if (workPointRepairsRepairPointSizeGateway.Table.Rows.Count == 0)
                            {
                                workPointRepairsRepairPointSize.InsertDirect(row.Size_, row.COMPANY_ID, row.Deleted);
                            }
                            else
                            {
                                workPointRepairsRepairPointSize.UnDeleteDirect(row.Size_, row.COMPANY_ID);
                            }
                        }

                        // Update size
                        if ((!row.Deleted) && (row.InDatabase))
                        {
                            string originalSize_ = row.NewSize_;
                            string newSize_ = row.Size_;
                            int originalCompanyId = companyId;

                            WorkPointRepairsRepairPointSizeGateway workPointRepairsRepairPointSizeGateway = new WorkPointRepairsRepairPointSizeGateway();
                            WorkPointRepairsRepairPointSize workPointRepairsRepairPointSize = new WorkPointRepairsRepairPointSize(null);

                            workPointRepairsRepairPointSizeGateway.LoadAllBySize_(newSize_, companyId);

                            if (workPointRepairsRepairPointSizeGateway.Table.Rows.Count == 0)
                            {
                                workPointRepairsRepairPointSize.InsertDirect(newSize_, originalCompanyId, false);
                            }
                            else
                            {
                                workPointRepairsRepairPointSize.UnDeleteDirect(newSize_, originalCompanyId);
                            }

                            if (workPointRepairsRepairPointSizeGateway.IsUsedInPointRepair(originalSize_, companyId))
                            {
                                WorkPointRepairsRepairGateway workPointRepairsRepairGateway = new WorkPointRepairsRepairGateway(null);
                                workPointRepairsRepairGateway.UpdateSize(originalSize_, companyId, newSize_, companyId);
                            }

                            workPointRepairsRepairPointSize.DeleteDirect(originalSize_, companyId);
                        }

                        // Delete size
                        if ((row.Deleted) && (row.InDatabase))
                        {
                            WorkPointRepairsRepairPointSize workPointRepairsRepairPointSize = new WorkPointRepairsRepairPointSize(null);
                            workPointRepairsRepairPointSize.DeleteDirect(row.Size_, row.COMPANY_ID);
                        }
                    }
                }
            }
        }