示例#1
0
        private void CreateRecord(int formId, int?localWorkerWithLowQualification, int?localWorkerWithMediumQualification,
                                  int?localWorkerWithHighQualification, int?externalWorkerWithLowQualification, int?externalWorkerWithMediumQualification,
                                  int?externalWorkerWithHighQualification)
        {
            using (var db = new Models.SmizeeContext())
            {
                HumanResourceQualificationForm entity = new HumanResourceQualificationForm();
                entity.StateID = 1;
                entity.FormID  = formId;
                entity.ExternalWorkerWithHighQualification   = externalWorkerWithHighQualification;
                entity.ExternalWorkerWithLowQualification    = externalWorkerWithLowQualification;
                entity.ExternalWorkerWithMediumQualification = externalWorkerWithMediumQualification;
                entity.LocalWorkerWithHighQualification      = localWorkerWithHighQualification;
                entity.LocalWorkerWithLowQualification       = localWorkerWithLowQualification;
                entity.LocalWorkerWithMediumQualification    = localWorkerWithMediumQualification;
                entity.SubmitDate     = DateTime.Now;
                entity.SubmitUserName = User.Identity.Name;

                db.HumanResourceQualificationForms.Add(entity);
                db.SaveChanges();
            }
            BackPanel.Visible          = true;
            ConfirmButtonPanel.Visible = false;
            DetailPanel.Visible        = false;
            ShowInfo(MessagePanel, Resources.Resource.mCreateOK);
        }
示例#2
0
        public static void UpdateRecord(int operationalFormId, int formState, string userName, int?numeroHectaresQuadrante1, int?numeroHectaresQuadrante2,
                                        int?numeroHectaresQuadrante3, int?numeroHectaresQuadrante4, int?numeroHectaresEspacoUtilizado,
                                        int?numeroTotalUnidadesProdutivas)
        {
            //Query the database for the rows to be updated.
            using (var db = new Models.SmizeeContext())
            {
                var entity = (from c in db.OperationalForms where c.OperationalFormID == operationalFormId select c).First();
                if (entity != null)
                {
                    entity.OperationalFormID          = operationalFormId;
                    entity.ProductionUnitsTotalNumber = numeroTotalUnidadesProdutivas;
                    entity.Quadrant1HectaresNumber    = numeroHectaresQuadrante1;
                    entity.Quadrant2HectaresNumber    = numeroHectaresQuadrante2;
                    entity.Quadrant3HectaresNumber    = numeroHectaresQuadrante3;
                    entity.Quadrant4HectaresNumber    = numeroHectaresQuadrante4;

                    entity.UsedSpace = numeroHectaresEspacoUtilizado;
                    entity.StateID   = formState;
                    if (formState <= 3)
                    {
                        entity.SubmitDate     = DateTime.Now;
                        entity.SubmitUserName = userName;
                    }
                    else
                    {
                        entity.ApprovalUserName = userName;
                        entity.ApprovalDate     = DateTime.Now;
                    }
                    db.SaveChanges();
                }
            }
        }
示例#3
0
 private void UpdateRecord(int HumanResourceQualificationFormId, int formState, int?localWorkerWithLowQualification, int?localWorkerWithMediumQualification,
                           int?localWorkerWithHighQualification, int?externalWorkerWithLowQualification, int?externalWorkerWithMediumQualification,
                           int?externalWorkerWithHighQualification)
 {
     //Query the database for the rows to be updated.
     using (var db = new Models.SmizeeContext())
     {
         var entity = (from c in db.HumanResourceQualificationForms where c.HumanResourceQualificationFormID == HumanResourceQualificationFormId select c).First();
         if (entity != null)
         {
             entity.HumanResourceQualificationFormID      = HumanResourceQualificationFormId;
             entity.ExternalWorkerWithHighQualification   = externalWorkerWithHighQualification;
             entity.ExternalWorkerWithLowQualification    = externalWorkerWithLowQualification;
             entity.ExternalWorkerWithMediumQualification = externalWorkerWithMediumQualification;
             entity.LocalWorkerWithHighQualification      = localWorkerWithHighQualification;
             entity.LocalWorkerWithLowQualification       = localWorkerWithLowQualification;
             entity.LocalWorkerWithMediumQualification    = localWorkerWithMediumQualification;
             entity.StateID = formState;
             if (formState <= 3)
             {
                 entity.SubmitDate     = DateTime.Now;
                 entity.SubmitUserName = User.Identity.Name;
             }
             else
             {
                 entity.ApprovalUserName = User.Identity.Name;
                 entity.ApprovalDate     = DateTime.Now;
             }
             db.SaveChanges();
         }
     }
 }
        public static void UpdateAlertDate(int operationalLicencesFormId, bool userAlert, bool managerAlert, bool executiveAlert)
        {
            if (!userAlert && !managerAlert && !executiveAlert)
            {
                return;
            }

            // Query the database for the row to be updated.
            using (var db = new Models.SmizeeContext())
            {
                var entity = (from c in db.OperationalLicensesForms where c.OperationalLicensesFormID == operationalLicencesFormId select c).First();
                if (entity != null)
                {
                    if (userAlert)
                    {
                        entity.UserAlertDate = DateTime.Now;
                    }
                    if (managerAlert)
                    {
                        entity.ManagerAlertDate = DateTime.Now;
                    }
                    if (executiveAlert)
                    {
                        entity.ExecutiveAlertDate = DateTime.Now;
                    }

                    db.SaveChanges();
                }
            }
        }
示例#5
0
        private void CreateRecord(int formId, int productionUnitId)
        {
            int?activeEmployees    = GetIntValueFromInput(ActiveEmployeesInput.Text);
            int?employeesLeft      = GetIntValueFromInput(EmployeesLeftInput.Text);
            int?employeesHired     = GetIntValueFromInput(EmployeesHiredInput.Text);
            int?totalTrainingHours = GetIntValueFromInput(TotalTrainingHoursInput.Text);

            using (var db = new Models.SmizeeContext())
            {
                HumanResourceSDZEEForm entity = new HumanResourceSDZEEForm();
                entity.StateID            = 1;
                entity.FormID             = formId;
                entity.ActiveEmployees    = activeEmployees;
                entity.EmployeesLeft      = employeesLeft;
                entity.EmployeesHired     = employeesHired;
                entity.TotalTrainingHours = totalTrainingHours;

                entity.SubmitDate = DateTime.Now;

                entity.SubmitUserName = User.Identity.Name;
                db.HumanResourceSDZEEForms.Add(entity);
                db.SaveChanges();
            }
            BackPanel.Visible          = true;
            ConfirmButtonPanel.Visible = false;
            DetailPanel.Visible        = false;
            ShowInfo(MessagePanel, Resources.Resource.mCreateOK);
        }
示例#6
0
        private void UpdateRecord(int formState, int financialFormId)
        {
            int?activeEmployees    = GetIntValueFromInput(ActiveEmployeesInput.Text);
            int?employeesLeft      = GetIntValueFromInput(EmployeesLeftInput.Text);
            int?employeesHired     = GetIntValueFromInput(EmployeesHiredInput.Text);
            int?totalTrainingHours = GetIntValueFromInput(TotalTrainingHoursInput.Text);

            // Query the database for the rows to be deleted.
            using (var db = new Models.SmizeeContext())
            {
                var entity = (from c in db.HumanResourceSDZEEForms where c.HumanResourceSDZEEFormID == financialFormId select c).First();
                if (entity != null)
                {
                    entity.ActiveEmployees    = activeEmployees;
                    entity.EmployeesLeft      = employeesLeft;
                    entity.EmployeesHired     = employeesHired;
                    entity.TotalTrainingHours = totalTrainingHours;

                    if (formState <= 3)
                    {
                        entity.SubmitDate     = DateTime.Now;
                        entity.SubmitUserName = User.Identity.Name;
                    }
                    else
                    {
                        entity.ApprovalUserName = User.Identity.Name;
                        entity.ApprovalDate     = DateTime.Now;
                    }
                    entity.StateID = formState;
                    db.SaveChanges();
                }
            }
        }
示例#7
0
        private void CreateRecord(int formId)
        {
            int?nrTotalHorasFormacao     = GetIntValueFromInput(NrTotalHorasFormacaoInput.Text);
            int?nrDiasAusenciaTrabalho   = GetIntValueFromInput(NrDiasAusenciaTrabalhoInput.Text);
            int?nrDiasUteisPeriodo       = GetIntValueFromInput(NrDiasUteisPeriodoInput.Text);
            int?nrColaboradoresAdmitidos = GetIntValueFromInput(NrColaboradoresAdmitidosInput.Text);
            int?nrSaidas = GetIntValueFromInput(NrSaidasInput.Text);

            using (var db = new Models.SmizeeContext())
            {
                HumanResourceForm entity = new HumanResourceForm();
                entity.StateID             = 1;
                entity.FormID              = formId;
                entity.EmployeesHired      = nrColaboradoresAdmitidos;
                entity.EmployeesLeft       = nrSaidas;
                entity.TrainingTotalHours  = nrTotalHorasFormacao;
                entity.WorkingDaysInPeriod = nrDiasUteisPeriodo;
                entity.WorkMissingDays     = nrDiasAusenciaTrabalho;
                entity.SubmitDate          = DateTime.Now;
                entity.ApprovalDate        = DateTime.Parse("01/01/2000 00:00:00");
                entity.SubmitUserName      = User.Identity.Name;

                db.HumanResourceForms.Add(entity);
                db.SaveChanges();
            }
            BackPanel.Visible          = true;
            ConfirmButtonPanel.Visible = false;
            DetailPanel.Visible        = false;
            ShowInfo(MessagePanel, Resources.Resource.mCreateOK);
        }
        public static void UpdateRecord(int operationalLicensesFormID, string userName, int formState)
        {
            // remove all country export records associated to the current formId
            CxOperationalLicensesFormPhase.Delete(operationalLicensesFormID);

            // Query the database for the rows to be deleted.
            using (var db = new Models.SmizeeContext())
            {
                var entity = (from c in db.OperationalLicensesForms where c.OperationalLicensesFormID == operationalLicensesFormID select c).First();
                if (entity != null)
                {
                    entity.StateID = formState;
                    if (formState <= 3)
                    {
                        entity.SubmitDate     = DateTime.Now;
                        entity.SubmitUserName = userName;
                    }
                    else
                    {
                        entity.ApprovalUserName = userName;
                        entity.ApprovalDate     = DateTime.Now;
                    }
                    db.SaveChanges();
                }
            }
        }
示例#9
0
 private void UpdateRecord(int HumanResourceFormId, int formState, int?nrTotalHorasFormacao, int?nrDiasAusenciaTrabalho, int?nrDiasUteisPeriodo, int?nrColaboradoresAdmitidos, int?nrSaidas)
 {
     //Query the database for the rows to be updated.
     using (var db = new Models.SmizeeContext())
     {
         var entity = (from c in db.HumanResourceForms where c.HumanResourceFormID == HumanResourceFormId select c).First();
         if (entity != null)
         {
             entity.HumanResourceFormID = HumanResourceFormId;
             entity.EmployeesHired      = nrColaboradoresAdmitidos;
             entity.EmployeesLeft       = nrSaidas;
             entity.TrainingTotalHours  = nrTotalHorasFormacao;
             entity.WorkingDaysInPeriod = nrDiasUteisPeriodo;
             entity.WorkMissingDays     = nrDiasAusenciaTrabalho;
             entity.StateID             = formState;
             if (formState <= 3)
             {
                 entity.SubmitDate     = DateTime.Now;
                 entity.SubmitUserName = User.Identity.Name;
             }
             else
             {
                 entity.ApprovalUserName = User.Identity.Name;
                 entity.ApprovalDate     = DateTime.Now;
             }
             db.SaveChanges();
         }
     }
 }
示例#10
0
        private void CreateRecord(int formId, int productionUnitId)
        {
            decimal?salesNetAmount           = GetDecimalValueFromInput(SalesNetAmountInput.Text, true);
            decimal?serviceDeliveryNetAmount = GetDecimalValueFromInput(ServiceDeliveryNetAmountInput.Text, true);
            decimal?currentAssetsValue       = GetDecimalValueFromInput(CurrentAssetsValueInput.Text, true);
            decimal?currentLiabilitiesValue  = GetDecimalValueFromInput(CurrentLiabilitiesValueInput.Text, true);
            decimal?totalCostValue           = GetDecimalValueFromInput(TotalCostValueInput.Text, true);
            decimal?liabilityValue           = GetDecimalValueFromInput(LiabilityValueInput.Text, true);
            decimal?assetValue = GetDecimalValueFromInput(AssetValueInput.Text, true);

            using (var db = new Models.SmizeeContext())
            {
                FinancialSDZEEForm entity = new FinancialSDZEEForm();
                entity.StateID                  = 1;
                entity.FormID                   = formId;
                entity.SalesNetAmount           = salesNetAmount;
                entity.ServiceDeliveryNetAmount = serviceDeliveryNetAmount;
                entity.CurrentAssetsValue       = currentAssetsValue;
                entity.CurrentLiabilitiesValue  = currentLiabilitiesValue;
                entity.TotalCostValue           = totalCostValue;
                entity.LiabilityValue           = liabilityValue;
                entity.AssetValue               = assetValue;

                entity.SubmitDate = DateTime.Now;

                entity.SubmitUserName = User.Identity.Name;
                db.FinancialSDZEEForms.Add(entity);
                db.SaveChanges();
            }
            BackPanel.Visible          = true;
            ConfirmButtonPanel.Visible = false;
            DetailPanel.Visible        = false;
            ShowInfo(MessagePanel, Resources.Resource.mCreateOK);
        }
示例#11
0
        private void UpdateRecord(int formState, int financialExportFormId)
        {
            HiddenField currentCountry = null;
            Label       currentAmount  = null;
            FinancialExportFormCountry countryExport = null;

            if (FormGridView.Rows.Count == 0)
            {
                throw new Exception(Resources.Resource.mFinancialExportMandatory);
            }

            // remove all country export records associated to the current formId
            CxFinancialExportFormCountry.Delete(financialExportFormId);

            // Query the database for the row to be updated.
            using (var db = new Models.SmizeeContext())
            {
                var entity = (from c in db.FinancialExportForms where c.FinancialExportFormID == financialExportFormId select c).First();
                if (entity != null)
                {
                    if (formState <= 3)
                    {
                        entity.SubmitDate     = DateTime.Now;
                        entity.SubmitUserName = User.Identity.Name;
                    }
                    else
                    {
                        entity.ApprovalUserName = User.Identity.Name;
                        entity.ApprovalDate     = DateTime.Now;
                    }
                    entity.StateID = formState;
                    db.SaveChanges();

                    foreach (GridViewRow currentExport in FormGridView.Rows)
                    {
                        currentCountry                      = currentExport.FindControl("CountryIdHidden") as HiddenField;
                        currentAmount                       = currentExport.FindControl("ExportAmountLabel") as Label;
                        countryExport                       = new FinancialExportFormCountry();
                        countryExport.CountryID             = int.Parse(currentCountry.Value);
                        countryExport.ExportAmount          = GetDecimalValue(currentAmount.Text);
                        countryExport.FinancialExportFormID = entity.FinancialExportFormID;
                        db.FinancialExportFormCountries.Add(countryExport);
                    }
                    db.SaveChanges();
                }
            }
        }
示例#12
0
        private void UpdateRecord(int formState, int financialFormId)
        {
            decimal?salesNetAmount                = GetDecimalValueFromInput(SalesNetAmountInput.Text, true);
            decimal?serviceDeliveryNetAmount      = GetDecimalValueFromInput(ServiceDeliveryNetAmountInput.Text, true);
            decimal?costTotalAmount               = GetDecimalValueFromInput(CostTotalAmountInput.Text, true);
            decimal?operacionalCostAmount         = GetDecimalValueFromInput(OperacionalCostAmountInput.Text, true);
            decimal?productSalesNetAmountBudgeted = GetDecimalValueFromInput(ProductSalesNetAmountBudgetedInput.Text, true);
            decimal?serviceSalesNetAmountBudgeted = GetDecimalValueFromInput(ServiceSalesNetAmountBudgetedInput.Text, true);
            decimal?businessAmount                = GetDecimalValueFromInput(BusinessAmountInput.Text, true);
            decimal?trainingAmount                = GetDecimalValueFromInput(TrainingAmountInput.Text, true);
            decimal?salaryAmount                     = GetDecimalValueFromInput(SalaryAmountInput.Text, true);
            decimal?socialExpensesAmount             = GetDecimalValueFromInput(SocialExpensesAmountInput.Text, true);
            decimal?otherPersonelCostsAmount         = GetDecimalValueFromInput(OtherPersonelCostsAmountInput.Text, true);
            decimal?directLabourCostsAmount          = GetDecimalValueFromInput(DirectLabourCostsAmountInput.Text, true);
            decimal?investmentValue                  = GetDecimalValueFromInput(InvestmentValueInput.Text, true);
            decimal?technologyInvestmentValue        = GetDecimalValueFromInput(TechnologyInvestmentValueInput.Text, true);
            int     productionAutomatedControlSystem = ddlProductionAutomatedControlSystem.SelectedValue == "1"?1:0;

            // Query the database for the rows to be deleted.
            using (var db = new Models.SmizeeContext())
            {
                var entity = (from c in db.FinancialForms where c.FinancialFormID == financialFormId select c).First();
                if (entity != null)
                {
                    entity.ProductSalesNetAmountBudgeted = productSalesNetAmountBudgeted;
                    entity.ServiceSalesNetAmountBudgeted = serviceSalesNetAmountBudgeted;
                    entity.CostTotalAmount           = costTotalAmount;
                    entity.DirectLabourCostsAmount   = directLabourCostsAmount;
                    entity.BusinessAmount            = businessAmount;
                    entity.OperacionalCostAmount     = operacionalCostAmount;
                    entity.OtherPersonelCostsAmount  = otherPersonelCostsAmount;
                    entity.SalaryAmount              = salaryAmount;
                    entity.SalesNetAmount            = salesNetAmount;
                    entity.ServiceDeliveryNetAmount  = serviceDeliveryNetAmount;
                    entity.SocialExpensesAmount      = socialExpensesAmount;
                    entity.TrainingAmount            = trainingAmount;
                    entity.InvestmentValue           = investmentValue;
                    entity.TechnologyInvestmentValue = technologyInvestmentValue;

                    entity.ProductionAutomatedControlSystem = productionAutomatedControlSystem;
                    if (formState <= 3)
                    {
                        entity.SubmitDate     = DateTime.Now;
                        entity.SubmitUserName = User.Identity.Name;
                    }
                    else
                    {
                        entity.ApprovalUserName = User.Identity.Name;
                        entity.ApprovalDate     = DateTime.Now;
                    }
                    entity.StateID = formState;
                    db.SaveChanges();
                }
            }
        }
示例#13
0
        private void CreateRecord(int formId, int productionUnitId)
        {
            HiddenField currentCountry = null;
            Label       currentAmount  = null;
            FinancialExportFormCountry countryExport = null;

            if (FormGridView.Rows.Count == 0)
            {
                throw new Exception(Resources.Resource.mFinancialExportMandatory);
            }

            using (var db = new Models.SmizeeContext())
            {
                FinancialExportForm entity = new FinancialExportForm();
                entity.FormID     = formId;
                entity.StateID    = 1;
                entity.SubmitDate = DateTime.Now;
                //entity.ApprovalDate = DateTime.Parse("01/01/2000 00:00:00");
                entity.SubmitUserName = User.Identity.Name;

                db.FinancialExportForms.Add(entity);
                db.SaveChanges();

                foreach (GridViewRow currentExport in FormGridView.Rows)
                {
                    currentCountry                      = currentExport.FindControl("CountryIdHidden") as HiddenField;
                    currentAmount                       = currentExport.FindControl("ExportAmount") as Label;
                    countryExport                       = new FinancialExportFormCountry();
                    countryExport.CountryID             = int.Parse(currentCountry.Value);
                    countryExport.ExportAmount          = GetDecimalValue(currentAmount.Text);
                    countryExport.FinancialExportFormID = entity.FinancialExportFormID;
                    db.FinancialExportFormCountries.Add(countryExport);
                }
                db.SaveChanges();
            }
            BackPanel.Visible          = true;
            ConfirmButtonPanel.Visible = false;
            DetailPanel.Visible        = false;
            FormPanel.Visible          = false;
            ShowInfo(MessagePanel, Resources.Resource.mCreateOK);
        }
示例#14
0
        private void CreateRecord(int formId, int productionUnitId)
        {
            decimal?salesNetAmount                = GetDecimalValueFromInput(SalesNetAmountInput.Text, true);
            decimal?serviceDeliveryNetAmount      = GetDecimalValueFromInput(ServiceDeliveryNetAmountInput.Text, true);
            decimal?costTotalAmount               = GetDecimalValueFromInput(CostTotalAmountInput.Text, true);
            decimal?operacionalCostAmount         = GetDecimalValueFromInput(OperacionalCostAmountInput.Text, true);
            decimal?productSalesNetAmountBudgeted = GetDecimalValueFromInput(ProductSalesNetAmountBudgetedInput.Text, true);
            decimal?serviceSalesNetAmountBudgeted = GetDecimalValueFromInput(ServiceSalesNetAmountBudgetedInput.Text, true);
            decimal?businessAmount                = GetDecimalValueFromInput(BusinessAmountInput.Text, true);
            decimal?trainingAmount                = GetDecimalValueFromInput(TrainingAmountInput.Text, true);
            decimal?salaryAmount                     = GetDecimalValueFromInput(SalaryAmountInput.Text, true);
            decimal?socialExpensesAmount             = GetDecimalValueFromInput(SocialExpensesAmountInput.Text, true);
            decimal?otherPersonelCostsAmount         = GetDecimalValueFromInput(OtherPersonelCostsAmountInput.Text, true);
            decimal?directLabourCostsAmount          = GetDecimalValueFromInput(DirectLabourCostsAmountInput.Text, true);
            decimal?investmentValue                  = GetDecimalValueFromInput(InvestmentValueInput.Text, true);
            decimal?technologyInvestmentValue        = GetDecimalValueFromInput(TechnologyInvestmentValueInput.Text, true);
            int     productionAutomatedControlSystem = ddlProductionAutomatedControlSystem.SelectedValue == "1" ? 1 : 0;

            using (var db = new Models.SmizeeContext())
            {
                FinancialForm entity = new FinancialForm();
                entity.StateID                       = 1;
                entity.FormID                        = formId;
                entity.SalesNetAmount                = salesNetAmount;
                entity.ServiceDeliveryNetAmount      = serviceDeliveryNetAmount;
                entity.CostTotalAmount               = costTotalAmount;
                entity.OperacionalCostAmount         = operacionalCostAmount;
                entity.ProductSalesNetAmountBudgeted = productSalesNetAmountBudgeted;
                entity.ServiceSalesNetAmountBudgeted = serviceSalesNetAmountBudgeted;

                entity.BusinessAmount           = businessAmount;
                entity.TrainingAmount           = trainingAmount;
                entity.SalaryAmount             = salaryAmount;
                entity.SocialExpensesAmount     = socialExpensesAmount;
                entity.OtherPersonelCostsAmount = otherPersonelCostsAmount;
                entity.DirectLabourCostsAmount  = directLabourCostsAmount;

                entity.InvestmentValue                  = investmentValue;
                entity.TechnologyInvestmentValue        = technologyInvestmentValue;
                entity.ProductionAutomatedControlSystem = productionAutomatedControlSystem;


                entity.SubmitDate = DateTime.Now;
                //entity.ApprovalDate = DateTime.Parse("01/01/2000 00:00:00");
                entity.SubmitUserName = User.Identity.Name;
                db.FinancialForms.Add(entity);
                db.SaveChanges();
            }
            BackPanel.Visible          = true;
            ConfirmButtonPanel.Visible = false;
            DetailPanel.Visible        = false;
            ShowInfo(MessagePanel, Resources.Resource.mCreateOK);
        }
示例#15
0
        public static void Insert(Guid userId, int productionUnitID)
        {
            using (var db = new Models.SmizeeContext())
            {
                UserProductionUnit entity = new UserProductionUnit();
                entity.UserID           = userId;
                entity.ProductionUnitID = productionUnitID;

                db.UserProductionUnits.Add(entity);
                db.SaveChanges();
            }
        }
        public static void CreateRecord(int formId, string userName)
        {
            using (var db = new Models.SmizeeContext())
            {
                OperationalLicensesForm entity = new OperationalLicensesForm();
                entity.StateID        = 1;
                entity.FormID         = formId;
                entity.SubmitDate     = DateTime.Now;
                entity.SubmitUserName = userName;

                db.OperationalLicensesForms.Add(entity);
                db.SaveChanges();
            }
        }
示例#17
0
 public static void UpdateRecord(int code, string companyName, string description)
 {
     // Query the database for the rows to be deleted.
     using (var db = new Models.SmizeeContext())
     {
         var entity = (from c in db.Companies where c.CompanyID == code select c).First();
         if (entity != null)
         {
             entity.CompanyName = companyName;
             entity.Description = description;
             db.SaveChanges();
         }
     }
 }
示例#18
0
 public static void Delete(Guid userId)
 {
     //Query the database for the rows to be deleted.
     using (var db = new Models.SmizeeContext())
     {
         //db.Database.ExecuteSqlCommand("delete from UserProductionUnits where UserId={0}", userId);
         IQueryable <UserProductionUnit> myItem = from c in db.UserProductionUnits where c.UserID == userId select c;
         foreach (UserProductionUnit ec in myItem)
         {
             db.UserProductionUnits.Remove(ec);
         }
         db.SaveChanges();
     }
 }
示例#19
0
 public static void UpdateRecord(int periodicityId, string description, string code)
 {
     // Query the database for the rows to be deleted.
     using (var db = new Models.SmizeeContext())
     {
         var myItem = (from c in db.Periodicities where c.PeriodicityID == periodicityId select c).First();
         if (myItem != null)
         {
             myItem.Description = description;
             myItem.Code        = code;
             db.SaveChanges();
         }
     }
 }
示例#20
0
 public static void Delete(int financialExportFormID)
 {
     // Query the database for the rows to be deleted.
     using (var db = new Models.SmizeeContext())
     {
         //db.Database.ExecuteSqlCommand("delete from FinancialExportForms where FinancialExportFormId={0}", code);
         IQueryable <FinancialExportFormCountry> myItem = from c in db.FinancialExportFormCountries where c.FinancialExportFormID == financialExportFormID select c;
         foreach (FinancialExportFormCountry ec in myItem)
         {
             db.FinancialExportFormCountries.Remove(ec);
         }
         db.SaveChanges();
     }
 }
示例#21
0
        private void CreateRecord(string userName, string password, string email, string firstName, string lastName, int?companyID, int?functionalAreaID, Boolean?isManager, Boolean?isExecutive, Boolean?isLockedOut)
        {
            MembershipCreateStatus status = WebSecurity.Register(userName, password, email, true, firstName, lastName, companyID == 0 ? null : companyID, functionalAreaID == 0 ? null : functionalAreaID, isManager, isExecutive);

            if (status == MembershipCreateStatus.Success)
            {
                WebSecurity.LockUser(userName, (bool)isLockedOut);

                if (ddlMembershipRole.SelectedValue.Equals("0"))
                {
                    System.Web.Security.Roles.AddUserToRole(userName, "User");
                }
                else
                {
                    System.Web.Security.Roles.AddUserToRole(userName, ddlMembershipRole.SelectedItem.Text);
                }

                GridView           gv       = ProductionUnitGrid.GetGridView();
                CheckBox           selected = null;
                HiddenField        pid      = null;
                UserProductionUnit upu      = null;
                Guid userId = WebSecurity.GetUserId(userName);

                using (var db = new Models.SmizeeContext())
                {
                    foreach (GridViewRow currentRow in gv.Rows)
                    {
                        selected = currentRow.FindControl("SelectRowCheckBox") as CheckBox;
                        if (selected.Checked)
                        {
                            pid                  = currentRow.FindControl("ProductionUnitIDHidden") as HiddenField;
                            upu                  = new UserProductionUnit();
                            upu.UserID           = userId;
                            upu.ProductionUnitID = int.Parse(pid.Value);
                            db.UserProductionUnits.Add(upu);
                        }
                    }
                    db.SaveChanges();
                }

                BackPanel.Visible          = true;
                ConfirmButtonPanel.Visible = false;
                DetailPanel.Visible        = false;
                ShowInfo(MessagePanel, Resources.Resource.mUserCreateOK);
            }
            else
            {
                ShowError(ErrorPanel, status.ToString());
            }
        }
示例#22
0
 public static void UpdateRecord(int code, string SmallDescription, string description)
 {
     // Query the database for the rows to be deleted.
     using (var db = new Models.SmizeeContext())
     {
         var myItem = (from c in db.States where c.StateID == code select c).First();
         if (myItem != null)
         {
             myItem.SmallDescription = SmallDescription;
             myItem.Description      = description;
             db.SaveChanges();
         }
     }
 }
示例#23
0
 public static void DeleteRecord(int code)
 {
     // Query the database for the rows to be deleted.
     using (var db = new Models.SmizeeContext())
     {
         //db.Database.ExecuteSqlCommand("delete from Timelines where TimelineId={0}", code);
         var myItem = (from c in db.Timelines where c.TimelineID == code select c).First();
         if (myItem != null)
         {
             db.Timelines.Remove(myItem);
             db.SaveChanges();
         }
     }
 }
示例#24
0
 public static void DeleteRecord(int code)
 {
     //Query the database for the rows to be deleted.
     using (var db = new Models.SmizeeContext())
     {
         //db.Database.ExecuteSqlCommand("delete from OperationalForms where OperationalFormId={0}", code);
         var entity = (from c in db.OperationalForms where c.OperationalFormID == code select c).First();
         if (entity != null)
         {
             db.OperationalForms.Remove(entity);
             db.SaveChanges();
         }
     }
 }
 public static void Delete(int operationalLicensesFormID)
 {
     // Query the database for the rows to be deleted.
     using (var db = new Models.SmizeeContext())
     {
         //db.Database.ExecuteSqlCommand("delete from FinancialExportForms where FinancialExportFormId={0}", code);
         IQueryable <OperationalLicensesFormPhase> myItem = from c in db.OperationalLicensesFormPhases where c.OperationalLicensesFormID == operationalLicensesFormID select c;
         foreach (OperationalLicensesFormPhase ec in myItem)
         {
             db.OperationalLicensesFormPhases.Remove(ec);
         }
         db.SaveChanges();
     }
 }
示例#26
0
 public static void UpdateRecord(int countryId, string smallDescription, string description, string isoCode)
 {
     // Query the database for the rows to be deleted.
     using (var db = new Models.SmizeeContext())
     {
         var myItem = (from c in db.Countries where c.CountryID == countryId select c).First();
         if (myItem != null)
         {
             myItem.Description      = description;
             myItem.SmallDescription = smallDescription;
             myItem.ISOCode          = isoCode;
             db.SaveChanges();
         }
     }
 }
示例#27
0
 public static void UpdateRecord(int code, string SmallDescription, string description, int?hectares)
 {
     // Query the database for the rows to be deleted.
     using (var db = new Models.SmizeeContext())
     {
         var entity = (from c in db.Areas where c.AreaID == code select c).First();
         if (entity != null)
         {
             entity.SmallDescription = SmallDescription;
             entity.Description      = description;
             entity.Hectares         = hectares;
             db.SaveChanges();
         }
     }
 }
        public static void CreateFormPhaseRecord(int operationalLicensesFormID, string userName, int formState, int devPhase, int PUN)
        {
            OperationalLicensesFormPhase olfp;

            // Query the database for the rows to be deleted.
            using (var db = new Models.SmizeeContext())
            {
                olfp = new OperationalLicensesFormPhase();
                olfp.DevelopmentPhaseID        = devPhase;
                olfp.ProductionUnitsNumber     = PUN;
                olfp.OperationalLicensesFormID = operationalLicensesFormID;
                db.OperationalLicensesFormPhases.Add(olfp);
                db.SaveChanges();
            }
        }
示例#29
0
        private void CreateRecord(string description)
        {
            using (var db = new Models.SmizeeContext())
            {
                Company entity = new Company();
                entity.CompanyName = description;
                entity.Description = description;

                db.Companies.Add(entity);
                db.SaveChanges();
            }
            BackPanel.Visible          = true;
            ConfirmButtonPanel.Visible = false;
            DetailPanel.Visible        = false;
            ShowInfo(MessagePanel, Resources.Resource.mCreateOK);
        }
示例#30
0
        private void CreateRecord(string SmallDescription, string description)
        {
            using (var db = new Models.SmizeeContext())
            {
                FunctionalArea entity = new FunctionalArea();
                entity.SmallDescription = SmallDescription;
                entity.Description      = description;

                db.FunctionalAreas.Add(entity);
                db.SaveChanges();
            }
            BackPanel.Visible          = true;
            ConfirmButtonPanel.Visible = false;
            DetailPanel.Visible        = false;
            ShowInfo(MessagePanel, Resources.Resource.mRecordCreateOK);
        }