Example #1
0
        private void BindProcessForm()
        {
            if (!IsBeginTask)
            {
                ProcessForm      processForm = _formService.GetByInstanceId(IncidentId);
                FaArchiveTranfer entity      = _faProcessService.GetFaArchiveTranferByFormId(processForm.Id);
                ShenQingrenName.Text     = entity.ShenQingRenName;
                ShenQingrenAccount.Value = entity.ShenQingrenAccount;
                ShenQingrenDeptName.Text = entity.ShenQingRenBumenName;
                ShenQingrenId.Value      = entity.ShenQingRenId.ToString();
                ShenQingrenDeptId.Value  = entity.ShenQingRenBumenId.ToString();
                ShenQingRiqi.Text        = FormatHelper.GetIsoDateString(entity.ShenQingRiqi);
                JieyueYuanyin.InnerText  = entity.JieyueYuanyin;
                List <FaProcess> faProcesses = _faProcessService.GetFaProcesslstByTranferId(entity.Id);
                faArchiveInfoData.Value = _faReportInfoJsonService.GetArchiveInfosJson(faProcesses);
            }
            else
            {
                ShenQingrenName.Text     = EDoc2Helper.GetCurrentUserRealName();
                ShenQingrenAccount.Value = EDoc2Helper.GetCurrentUserAccount();
                ShenQingrenId.Value      = EDoc2Helper.GetCurrentUserId().ToString();
                ShenQingRiqi.Text        = DateTime.Now.ToString("yyyy-MM-dd");
                ShenQingrenDeptName.Text = EDoc2Helper.GetCurrentUserDeptName();
                ShenQingrenDeptId.Value  = EDoc2Helper.GetCurrentUserDeptId().ToString();
            }
            List <long> archiveIds = _faProcessService.GetAllJieyueArchiveIds();

            jieyueIds.Value = _faReportInfoJsonService.GetGetAllJieyueArchiveIdsJson(archiveIds);
            FaReportDetailsControl.JieyueIds = jieyueIds.Value;
        }
Example #2
0
        public void SearchBttn2_Click(object sender, EventArgs e)
        {
            ProcessForm form3 = new ProcessForm();

            form3.DataSent += Form3_DataSent;
            form3.ShowDialog(this);
        }
Example #3
0
 // Calling this form from where these checked states will be processed...
 // Let's suppose we have to click a button to launch the process, for instance...
 private void btnLaunchProcess(object sender, EventArgs e) {
     ProcessForm f = new ProcessForm();
     f.Parent = this;
     if (DialogResult.OK == f.ShowDialog()) {
         // Process accordingly if desired, otherwise let it blank...
     }
 }       
Example #4
0
 protected void StartProcessButton_Click(object sender, EventArgs e)
 {
     try
     {
         string            incidentId       = IncidentId;
         FaArchiveTranfer  faArchiveTranfer = Master.GetFaArchiveTranfer();
         IList <FaProcess> faProcesses      = Master.GetFaProcess();
         ProcessForm       processForm      = ProcessFormService.GetNewProcessForm(ProcessId, incidentId);
         processForm.FaArchiveTranfers.Add(faArchiveTranfer);
         faArchiveTranfer.FaProcesses.AddRange(faProcesses);
         ProcessFormService.Save(processForm);
         Hashtable taskVariation = new Hashtable();
         if (EDoc2Helper.IsUserInUserGroup(EDoc2Helper.GetCurrentUserId(), WebConfig.ManagerGroup))
         {
             taskVariation.Add("fenzhizouxiang", "是");
         }
         else
         {
             taskVariation.Add("fenzhizouxiang", "否");
         }
         StartFa(ProcessId, incidentId, taskVariation);
     }
     catch (Exception ex)
     {
         Edoc2LogHelper.WriteProcessSubmitExceptionLog(ex);
         Dialog("出现异常,请联系管理员。");
     }
 }
Example #5
0
        /// <summary>
        /// 进度条2
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button14_Click(object sender, EventArgs e)
        {
            this.backgroundWorker1.RunWorkerAsync();                    // 运行 backgroundWorker 组件
            ProcessForm form = new ProcessForm(this.backgroundWorker1); // 显示进度条窗体

            form.ShowDialog(this);
            form.Close();
        }
Example #6
0
        private void Process_Initialize(ProcessForm processForm)
        {
            SaveConfigFormInfo();
            processForm.EndProcessForm();

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
 public ActionResult Save(ProcessForm formData)
 {
     if (SaveProcessForm(ref formData))
     {
         ProcessFormInitialize(ref formData);
         ModelState.Clear();
     }
     return(View(ViewForm, formData));
 }
        private ProcessForm _processForm;           //进度条窗体



        public ProcessOperator()

        {
            _backgroundWorker = new BackgroundWorker();

            _processForm = new ProcessForm();

            _backgroundWorker.DoWork += new DoWorkEventHandler(_backgroundWorker_DoWork);

            _backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_backgroundWorker_RunWorkerCompleted);
        }
        public ActionResult New(int taskId, ProcessType processType = ProcessType.Process, int conditionId = 0)
        {
            var processForm = new ProcessForm();

            processForm.TaskId      = taskId;
            processForm.ProcessType = processType;
            processForm.ConditionId = conditionId;

            ProcessFormInitialize(ref processForm);
            return(View(ViewForm, processForm));
        }
 public ActionResult SaveClose(ProcessForm formData)
 {
     if (SaveProcessForm(ref formData))
     {
         return(RedirectToAction("Index", new { taskId = formData.TaskId }).WithMessage(this, string.Format("{0} Saved Successfully.", formData.Name), MessageType.Success));
     }
     else
     {
         //ProcessFormInitialize(ref formData);
         return(View(ViewForm, formData));
     }
 }
Example #11
0
 private void LoadNewDocument()
 {
     if (this.FolderBrowserDialog.ShowDialog() != DialogResult.OK)
     {
         return;
     }
     else
     {
         m_strSelectedPath = this.FolderBrowserDialog.SelectedPath;
         ProcessForm.StartProcessForm(Process_LoadNewDocument);
     }
 }
Example #12
0
        public static T ToProcess <T>(this ProcessForm formData) where T : Process
        {
            Process dto = Mapper.Map <ProcessForm, T>(formData);


            //Belgeler şablon ve analiz olarak ikiye ayrılmıştı. Birleştirilecek.

            if (formData.AnalysisFileList != null && formData.TemplateFileList != null)
            {
                dto.DocumentList = formData.AnalysisFileList.FileList.Concat(formData.TemplateFileList.FileList).ToList();
            }
            return((T)dto);
        }
        public ProcessForm ProcessFormLoad(ProcessForm formData)
        {
            var process = _unitOfWork.Repository <Process>().Get(x => x.Id == formData.Id, x => x.DocumentList);

            if (process != null)
            {
                formData.TemplateFileList  = new FileUpload(process.DocumentList, FileType.ProcessTemplateFile, process.Id);
                formData.AnalysisFileList  = new FileUpload(process.DocumentList, FileType.AnalysisFile, process.Id);
                formData.ProcessUniqueCode = process.ProcessUniqueCode;
            }

            return(formData);
        }
Example #14
0
        private void Process_Initialize(ProcessForm processForm)
        {
            if (GlobalSetting.LoadGlobalSetting() == true)
            {
                ReloadOptionFormInfo();
            }
            else
            {
                MainForm.ShowPopupMessage("读取配置文件失败!", "可能文件不存在或格式错误。。。");
            }

            processForm.EndProcessForm();
        }
        public void ProcessFormInitialize(ref ProcessForm formData)
        {
            if (formData.Id != 0)
            {
                Process process = _workFlowService.GetProcess(formData.Id);
                Mapper.Map(process, formData);
            }
            var mainProcessList = _workFlowService.GetMainProcessList(formData.TaskId);


            formData.MainProcessList = (mainProcessList != null ? new SelectList(mainProcessList, "Id", "Name") : null);

            if (formData.ProcessType == ProcessType.DecisionPoint)
            {
                formData.DecisionMethodList = new SelectList(_workFlowService.GetDecisionMethodList(formData.TaskId), "Id", "MethodName");
                formData.RepetitionHourList = new SelectList(Enumerable.Range(1, 24));
            }
            else if (formData.ProcessType == ProcessType.Process)
            {
                formData.FormViewList = new SelectList(_workFlowService.GetFormViewList(formData.TaskId), "Id", "FormName");
            }


            if (formData.ProcessType == ProcessType.OptionList || formData.ProcessType == ProcessType.Process || formData.ProcessType == ProcessType.SubProcess)
            {
                var monitoringList = formData.MonitoringRoleList;
                formData.MonitoringRoleList = Global.GetAllRoles().Select(rol => new MonitoringRoleCheckbox
                {
                    ProjectRole = rol,
                    IsChecked   = monitoringList != null ? monitoringList.Where(x => x.IsChecked == true).Any(t => t.ProjectRole == rol) : false
                }).ToList();
            }

            if (formData.ConditionId != null && formData.ConditionId != 0)
            {
                var condition = _unitOfWork.Repository <Condition>().Get((int)formData.ConditionId);
                if (condition != null)
                {
                    formData.ConditionName = condition.Name;
                    formData.AssignedRole  = condition.AssignedRole;
                }
            }
            else
            {
                if (formData.Id == 0)
                {
                    formData.AssignedRole = (formData.ProcessType == ProcessType.DecisionPoint || formData.ProcessType == ProcessType.SubProcess ? ProjectRole.System : ProjectRole.Officer);
                }
            }
            formData = ProcessFormLoad(formData);
        }
Example #16
0
        private void MainForm_Load(object sender, EventArgs eventArgs)
        {
            this.Left = (Screen.PrimaryScreen.Bounds.Width - this.Width) / 2;
            this.Top  = (Screen.PrimaryScreen.Bounds.Height - this.Height) / 2;

            this.m_AxCommandBars.ActiveMenuBar.Visible = false;

            MSFL.MSFL1_Initialize("MSFL Main Form", "H.Q.Cai", MSFL.MSFL_DLL_INTERFACE_VERSION);

            this.InitPopupControl();
            this.InitPopupMessageControl();

            ProcessForm.StartProcessForm(Process_Initialize);
        }
Example #17
0
        public ProcessForm SaveEntity()
        {
            var               faProcessService = new FaProcessService();
            ProcessForm       processForm      = ProcessFormService.GetByInstanceId(IncidentId);
            FaArchiveTranfer  faArchiveTranferentitynewEntity = GetFaArchiveTranfer();
            IList <FaProcess> newFaprocess           = GetFaProcess();
            FaArchiveTranfer  faArchiveTranferentity = faProcessService.GetFaArchiveTranferByFormId(processForm.Id);

            faArchiveTranferentity.JieyueYuanyin = faArchiveTranferentitynewEntity.JieyueYuanyin;
            faArchiveTranferentity.FaProcesses.Clear();
            faArchiveTranferentity.FaProcesses.AddRange(newFaprocess);
            faProcessService.SaveFaArchiveTranfer(faArchiveTranferentity);
            return(processForm);
        }
Example #18
0
        private void LaunchButton_Click(object sender, EventArgs e)
        {
            string errorMessage = CollectSourceData(out var data);

            if (String.IsNullOrEmpty(errorMessage))
            {
                ProcessForm processForm = new ProcessForm(data);
                processForm.Show();
                processForm.StartCalculation();
            }
            else
            {
                MessageBox.Show(errorMessage);
            }
        }
Example #19
0
 protected void AbortProcessButton_Click(object sender, EventArgs e)
 {
     try
     {
         ProcessForm      processForm      = ProcessFormService.GetByInstanceId(IncidentId);
         FaArchiveTranfer faArchiveTranfer = FaProcessService.GetFaArchiveTranferByFormId(processForm.Id);
         _faProcessService.UpdateLiuchengzhuangtai(faArchiveTranfer, LiuchengZhuangtaiEnum.YiChexiao);
         AbortIncident();
     }
     catch (Exception ex)
     {
         Edoc2LogHelper.WriteProcessSubmitExceptionLog(ex);
         Dialog("出现异常,请联系管理员。");
     }
 }
        public ActionResult Edit(int processId)
        {
            if (processId == 0)
            {
                return(HttpNotFound());
            }


            ProcessForm formData = new ProcessForm()
            {
                Id = processId
            };

            ProcessFormInitialize(ref formData);

            return(View(ViewForm, formData));
        }
Example #21
0
 public void Save(ProcessForm entity)
 {
     try
     {
         entity.LastUpdated = DateTime.Now;
         if (entity.Id == 0)
         {
             entity.CreateTime = DateTime.Now;
             DataContext.ProcessForms.InsertOnSubmit(entity);
         }
         DataContext.SubmitChanges();
     }
     catch (Exception ex)
     {
         DataContext.Dispose();
         throw new Exception(ex.Message);
     }
 }
Example #22
0
 public bool Run()
 {
     using (ProcessForm form = new ProcessForm())
     {
         form.Data    = _data;
         form.Control = GetView();
         if (form.ShowDialog() == DialogResult.Cancel)
         {
             return(false);
         }
         ProcessSalaryDataObject processSalaryDataObject = _data as ProcessSalaryDataObject;
         if (processSalaryDataObject != null)
         {
             processSalaryDataObject.FinalSalary = form.KostylFinalMoney;
         }
         return(true);
     }
 }
Example #23
0
 protected void SubmitProcessButton_Click(object sender, EventArgs e)
 {
     try
     {
         ProcessForm      processForm      = ProcessFormService.GetByInstanceId(IncidentId);
         FaArchiveTranfer faArchiveTranfer = FaProcessService.GetFaArchiveTranferByFormId(processForm.Id);
         IList <Jieyue>   jieyues          = Master.GetJieyues(faArchiveTranfer);
         _faProcessService.UpdateLiuchengzhuangtai(faArchiveTranfer, LiuchengZhuangtaiEnum.YiShenpi);
         _faProcessService.SaveJieyueInfo(jieyues);
         string desc = descText.Value;
         Submit(desc);
     }
     catch (Exception ex)
     {
         Edoc2LogHelper.WriteProcessSubmitExceptionLog(ex);
         Dialog("出现异常,请联系管理员。");
     }
 }
        public bool SaveProcessForm(ref ProcessForm formData)
        {
            if (formData.Id != 0)
            {
                formData = ProcessFormLoad(formData);
            }

            bool result = ValidationHelper.Validate(formData, new ProcessFormValidator(_unitOfWork), ModelState);

            if (result == false)
            {
                ProcessFormInitialize(ref formData);
                return(result);
            }

            _workFlowService.AddOrUpdate(formData);
            return(result);
        }
Example #25
0
        public static ProcessForm ToProcessForm(this Process process, IEnumerable <Process> mainProcessList, IEnumerable <DecisionMethod> decisionMethodList, IEnumerable <FormView> formViewList)
        {
            var roleList = ProjectRole.Admin.GetAllValues().Where(x => x != ProjectRole.Sistem).ToList();

            ProcessForm dto = Mapper.Map <Process, ProcessForm>(process);

            foreach (var rol in roleList)
            {
                if (!dto.MonitoringRoleList.Any(x => x.ProjectRole == rol))
                {
                    dto.MonitoringRoleList.Add(new MonitoringRoleCheckbox {
                        IsChecked = false, ProjectRole = rol
                    });
                }
            }

            if (process.GetType() == typeof(ConditionOption))
            {
                dto.ProcessType = ProcessType.OptionList;
            }
            else if (process.GetType() == typeof(DecisionPoint))
            {
                dto.ProcessType        = ProcessType.DecisionPoint;
                dto.DecisionMethodList = new SelectList(decisionMethodList, "Id", "MethodName");
                dto.RepetitionHourList = new SelectList(Enumerable.Range(1, 24));
            }
            else if (process.GetType() == typeof(Condition))
            {
                dto.ProcessType = ProcessType.Condition;
            }
            else
            {
                dto.ProcessType  = ProcessType.Process;
                dto.FormViewList = new SelectList(formViewList, "Id", "FormName");
            }

            dto.MainProcessList  = (mainProcessList != null ? new SelectList(mainProcessList, "Id", "Name") : null);
            dto.TemplateFileList = new FileUpload(process.DocumentList, FileType.ProcessTemplateFile, process.Id);

            dto.AnalysisFileList = new FileUpload(process.DocumentList, FileType.AnalysisFile, process.Id);

            return(dto);
        }
Example #26
0
 protected void StartProcessButton_Click(object sender, EventArgs e)
 {
     try
     {
         string            incidentId       = IncidentId;
         FaArchiveTranfer  faArchiveTranfer = Master.GetFaArchiveTranfer();
         IList <FaProcess> faProcesses      = Master.GetFaProcess();
         ProcessForm       processForm      = ProcessFormService.GetNewProcessForm(ProcessId, incidentId);
         processForm.FaArchiveTranfers.Add(faArchiveTranfer);
         faArchiveTranfer.FaProcesses.AddRange(faProcesses);
         ProcessFormService.Save(processForm);
         StartFa(ProcessId, incidentId, null);
     }
     catch (Exception ex)
     {
         Edoc2LogHelper.WriteProcessSubmitExceptionLog(ex);
         Dialog("出现异常,请联系管理员。");
     }
 }
Example #27
0
        private void SettingControl_SetConfigFile()
        {
            if (GlobalSetting.IsLoadGlobalSetting == false)
            {
                MainForm.ShowPopupMessage("正在初始化数据", "请稍等片刻。。。");
                ProcessForm.StartProcessForm(Process_InitializeLoad);
            }

            if (m_ConfigForm.ShowDialog() == DialogResult.OK)
            {
                if (GlobalSetting.LoadGlobalSetting() == false)
                {
                    MainForm.ShowPopupMessage("读取配置文件失败!", "可能文件不存在或格式错误。。。");
                    return;
                }

                ProcessForm.StartProcessForm(Process_Initialize);
            }
        }
Example #28
0
        public void AddOrUpdate(ProcessForm formData)
        {
            int processId = 0;

            if (formData.ProcessType == ProcessType.Process)
            {
                var process = Mapper.Map <ProcessForm, Process>(formData);
                processId = AddOrUpdate(process);
            }
            else if (formData.ProcessType == ProcessType.Condition)
            {
                var process = Mapper.Map <ProcessForm, Condition>(formData);
                processId = AddOrUpdate(process);
            }
            else if (formData.ProcessType == ProcessType.OptionList)
            {
                var process = Mapper.Map <ProcessForm, ConditionOption>(formData);
                processId = AddOrUpdate(process);
            }
            else if (formData.ProcessType == ProcessType.DecisionPoint)
            {
                var process = Mapper.Map <ProcessForm, DecisionPoint>(formData);
                processId = AddOrUpdate(process);
            }
            else if (formData.ProcessType == ProcessType.SubProcess)
            {
                var process = Mapper.Map <ProcessForm, SubProcess>(formData);
                processId = AddOrUpdate(process);
            }

            if (formData.Id == 0 && processId != 0)
            {
                formData.Id = processId;
                if (formData.ProcessType == ProcessType.Process || formData.ProcessType == ProcessType.Condition)
                {
                    SetStartingProcess(formData.TaskId);
                }
            }


            SetWorkFlowDiagram(formData.TaskId);
        }
Example #29
0
        private void btnUploadData_Click(object sender, EventArgs e)
        {
            if (_worker.IsBusy)
            {
                return;
            }

            if (PersonInfoList.Count == 0)
            {
                return;
            }

            if (MessageBox.Show("真的要上传吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                ProcessFormObj = new ProcessForm();
                ProcessFormObj.Show();
                ProcessFormObj.BringToFront();

                btnUploadData.Enabled = false;
                _worker.RunWorkerAsync();
            }
        }
Example #30
0
        private void Process_Initialize(ProcessForm processForm)
        {
            GlobalSetting.LoadGlobalRegistry();

            if (GlobalSetting.IsAutoLoadConfigSetting == true)
            {
                if (GlobalSetting.LoadGlobalSetting() == false)
                {
                    MainForm.ShowPopupMessage("读取配置文件失败!", "可能文件不存在或格式错误。。。", "请点击<主选项>的<设置配置文件>");
                }
            }

            this.m_OptionForm.Initialize();
            this.m_U50Form.Initialize();
            this.m_D50Form.Initialize();

            this.m_NotifyIcon.Visible = true;
            if (GlobalSetting.IsPopStartupInfo == true)
            {
                this.m_NotifyIcon.ShowBalloonTip(1000);
            }

            processForm.EndProcessForm();
        }
        public void IntegraFaturamento()
        {
            ProcessForm processForm = new ProcessForm("", layout);
            processForm.Show();
            List<Faturamento> lFaturamento = new List<Faturamento>();

            IEnumerable<String> streamRead = File.ReadLines(System.Environment.CurrentDirectory.ToString() + "\\config.txt");
            var connection = streamRead.First();

            using (OleDbConnection con = new OleDbConnection(connection))
            {
                try
                {
                    con.Open();

                    using (OleDbCommand commandCount = new OleDbCommand("SELECT COUNT(*) FROM FATURAMENTO ", con))
                    using (OleDbDataReader readerCount = commandCount.ExecuteReader())
                    {
                        while (readerCount.Read())
                        {

                            countRegister = readerCount.GetValue(0).ToString();

                        }
                    }

                    try
                    {
                        using (OleDbCommand command = new OleDbCommand("SELECT SKU_PRODUTO,ID_CLIENTE,ID_DISTRIBUIDOR,ID_FV,ID_FORMA_PAGAMENTO,ID_END_ENTREGA,ID_END_COBRANCA,QTD_ITEM_NF_FATURA,VALOR_UNITARIO_ITEM_NF_FATURA,VALOR_TOTAL_NF_FATURA,VALOR_BRUTO_ITEM_NF_FATURA,VALOR_DESCONTO_ITEM_NF_FATURA,VALOR_TOTAL_ITEM_NF_FATURA,VALOR_LIQUIDO_ITEM_NF_FATURA,VALOR_CUSTO_ITEM_NF_FATURA,QTD_LITROS_ITEM_NF_FATURA,NUM_NF_FATURA,SERIE_NF_FATURA,ITEM_NF_FATURA,CFOP_NF_FATURA,NATUREZA_OPERACAO_NF_FATURA,OBSERVACAO_NF_FATURA,DATA_NF_FATURA,FLAG_ITEM_CANCELADO,DATA_CANCELAMENTO,QUANTIDADE_CANCELADO,VALOR_FRETE_NF,VALOR_IPI_ITEM,VALOR_PIS_ITEM,VALOR_COFINS_ITEM,VALOR_ICMS_ITEM,VALOR_ICMS_ST_ITEM,VALOR_SEGURO_ITEM,VALOR_DESPESAS_EXTRA_ITEM,FLAG_FATURAMENTO_TP_ENTREGA FROM FATURAMENTO", con))
                        using (OleDbDataReader reader = command.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                Faturamento faturamento = new Faturamento();
                                Validator valid = new Validator();
                                for(int i = reader.FieldCount-1; i>=0; i--){
                                    if (!(i == 34 || i == 33 || i == 32 || i == 25 || i == 24 || i == 21))
                                    {
                                        if (reader.IsDBNull(i))
                                        {
                                            MessageBox.Show(i.ToString(), "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                        }
                                    }

                                }

                                faturamento.produtoId = reader.GetValue(0).ToString();
                                faturamento.clienteId = reader.GetString(1);
                                faturamento.distribuidorId = reader.GetString(2);
                                faturamento.forcaDeVendaId = reader.GetString(3);
                                faturamento.formaDePagamentoId = reader.GetString(4);
                                faturamento.enderecoEntregaId = reader.GetString(5);
                                faturamento.enderecoCobrancaId = reader.GetString(6);
                                faturamento.quantidadeItem = reader.GetString(7);
                                faturamento.valorUnitarioItem = reader.GetString(8);
                                faturamento.valorTotalFatura = reader.GetString(9);
                                faturamento.valorBrutoItem = reader.GetString(10);
                                faturamento.valorDescontoItem = reader.GetString(11);
                                faturamento.valorTotalItem = reader.GetString(12);
                                faturamento.valorLiquidoItem = reader.GetString(13);
                                faturamento.valorCustoItem = reader.GetString(14);
                                faturamento.quantidadeLitrosItem = reader.GetString(15);
                                faturamento.numeroFatura = reader.GetString(16);
                                faturamento.serieFatura = reader.GetString(17);
                                faturamento.itemFatura = reader.GetString(18);
                                faturamento.CFOP = reader.GetString(19);
                                faturamento.naturezaOpercao = reader.GetString(20);

                                if(reader.IsDBNull(21))
                                {
                                    faturamento.observacaoFatura = valid.ValidaString();

                                }else{
                                    faturamento.observacaoFatura = reader.GetString(21);
                                }

                                faturamento.dataFatura = reader.GetString(22);
                                faturamento.flagItemCancelado = (reader.GetString(23));
                                if (reader.IsDBNull(24))
                                {
                                    faturamento.dataItemCancelado = valid.ValidaString();

                                }
                                else
                                {
                                    faturamento.dataItemCancelado = reader.GetString(24);
                                }

                                if (reader.IsDBNull(25))
                                {
                                    faturamento.quantidadeItemCancelado = valid.ValidaString();

                                }
                                else
                                {
                                    faturamento.quantidadeItemCancelado = reader.GetString(25);
                                }

                                faturamento.valorFrete = reader.GetString(26);
                                faturamento.valorIpi = reader.GetString(27);
                                faturamento.valorPis = reader.GetString(28);
                                faturamento.valorConfins = reader.GetString(29);
                                faturamento.valorIcms = reader.GetString(30);
                                faturamento.valorIcmsSt = reader.GetString(31);
                                if (reader.IsDBNull(32))
                                {
                                    faturamento.valorSeguro = valid.ValidaString();

                                }
                                else
                                {
                                    faturamento.valorSeguro = (reader.GetValue(32).ToString());
                                }

                                if (reader.IsDBNull(33))
                                {
                                    faturamento.valorDespesaExtra = valid.ValidaString();

                                }
                                else
                                {
                                    faturamento.valorDespesaExtra = reader.GetString(33);
                                }

                                if (reader.IsDBNull(34))
                                {
                                    faturamento.flagTipoEntrega = valid.ValidaString();

                                }
                                else
                                {
                                    faturamento.flagTipoEntrega = reader.GetString(34);
                                }

                                PostFaturamento(faturamento);

                                string msg = "Foram inseridos: " + lFaturamento.Count().ToString() + " de " + countRegister + " registros";
                                processForm.writeMessage(msg);
                                processForm.Enabled = false;
                                processForm.Enabled = true;

                                lFaturamento.Add(faturamento);

                            }
                        }
                        con.Dispose();
                    }

                    catch (Exception ex)
                    {
                        logErro.EscreverLog(layout, ex.Message.ToString());
                        //MessageBox.Show(ex.Message.ToString(), "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }

                }
                catch (Exception ex)
                {
                    logErro.EscreverLog(layout, ex.Message.ToString());
                    //MessageBox.Show(ex.Message.ToString(), "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }

                int countWrite = lFaturamento.Count();
                //MessageBox.Show("Foram inseridos "+countWrite.ToString()+" registros", "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                processForm.Close();
        }
Example #32
0
        public void IntegraProduto()
        {
            ProcessForm processForm = new ProcessForm("", layout);
            processForm.Show();
            List<Produto> lProduto = new List<Produto>();

            IEnumerable<String> streamRead = File.ReadLines(System.Environment.CurrentDirectory.ToString() + "\\config.txt");
            var connection = streamRead.First();

            using (OleDbConnection con = new OleDbConnection(connection))
            {
                try
                {
                    con.Open();

                    using (OleDbCommand commandCount = new OleDbCommand("SELECT COUNT(*) FROM PRODUTOS", con))
                    using (OleDbDataReader readerCount = commandCount.ExecuteReader())
                    {
                        while (readerCount.Read())
                        {

                            countRegister = readerCount.GetValue(0).ToString();

                        }
                    }
                    try{
                        using (OleDbCommand command = new OleDbCommand("SELECT SKU_PRODUTO,NOME_PRODUTO,ID_DISTRIBUIDOR,MARCA,PRODUTO,TIER,CLASSE_PRODUTO,SKU_CHEVRON,DESC_SKU_CHEVRON,COD_PRODUTO_EAN13,NCM_PRODUTO,EMBALAGEM,VOLUME_UNITARIO_PRODUTO,FLAG_ATIVO_PRODUTO FROM PRODUTOS", con))
                        using (OleDbDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            Produto produto = new Produto();

                            produto.id = reader.GetString(0);
                            produto.nome = reader.GetString(1);
                            produto.distribuidorId = reader.GetString(2);
                            produto.marca = reader.GetString(3);
                            produto.produto = reader.GetString(4);
                            produto.tier = reader.GetString(5);
                            produto.classe = reader.GetString(6);
                            produto.chevronId = reader.GetString(7);
                            produto.chevronDescricao = reader.GetString(8);
                            produto.ean13 = reader.GetString(9);
                            produto.ncm = reader.GetString(10);
                            produto.embalagem = reader.GetString(11);
                            produto.volumeUnitario = reader.GetString(12);
                            produto.flagAtivo = reader.GetString(13);

                            PostProduto(produto);

                            string msg = "Foram inseridos: " + lProduto.Count().ToString() + " de " + countRegister + " registros";
                            processForm.writeMessage(msg);
                            processForm.Enabled = false;
                            processForm.Enabled = true;

                            lProduto.Add(produto);
                        }
                        }
                        con.Dispose();
                    }

                    catch (Exception ex)
                    {
                        logErro.EscreverLog(layout, ex.Message.ToString());
                        //MessageBox.Show(ex.Message.ToString(), "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }

                }
                catch (Exception ex)
                {
                    logErro.EscreverLog(layout, ex.Message.ToString());
                    //MessageBox.Show(ex.Message.ToString(), "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }

                int countWrite = lProduto.Count();
                //MessageBox.Show("Foram inseridos "+countWrite.ToString()+" registros", "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                processForm.Close();
        }
        public void IntegraEnderecoCliente()
        {
            ProcessForm processForm = new ProcessForm("0", layout);
            processForm.Show();
            List<EnderecoCliente> lEnderecoCliente = new List<EnderecoCliente>();
            IEnumerable<String> streamRead = File.ReadLines(System.Environment.CurrentDirectory.ToString() + "\\config.txt");
            var connection = streamRead.First();

            using (OleDbConnection con = new OleDbConnection(connection))
            {
                try
                {
                    con.Open();
                    using (OleDbCommand commandCount = new OleDbCommand("SELECT COUNT(*) FROM ENDERECO_CLIENTES ", con))
                    using (OleDbDataReader readerCount = commandCount.ExecuteReader())
                    {
                        while (readerCount.Read())
                        {

                            countRegister = readerCount.GetValue(0).ToString();

                        }
                    }
                    try{

                    using (OleDbCommand command = new OleDbCommand("SELECT ID_END_CLIENTE,ID_DISTRIBUIDOR,ID_CLIENTE,COD_MUNICIPIO_IBGE_CLIENTE,RUA_END_CLIENTE,NUMERO_END_CLIENTE,COMPLEMENTO_END_CLIENTE,CEP_END_CLIENTE,BAIRRO_END_CLIENTE,MUNICIPIO_END_CLIENTE,UF_END_CLIENTE,TEL_END_CLIENTE,EMAIL_END_CLIENTE FROM ENDERECO_CLIENTES", con))
                    using (OleDbDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            EnderecoCliente enderecoCliente = new EnderecoCliente();

                            enderecoCliente.id = reader.GetString(0);
                            enderecoCliente.distribuidorId = reader.GetString(1);
                            enderecoCliente.clienteId = reader.GetString(2);
                            enderecoCliente.codigoMunicipioIBGE = reader.GetString(3);
                            enderecoCliente.cep = reader.GetString(4);
                            enderecoCliente.bairro = reader.GetString(5);
                            enderecoCliente.municipio = reader.GetString(6);
                            enderecoCliente.uf = reader.GetString(7);
                            enderecoCliente.telefone = reader.GetString(8);
                            enderecoCliente.email = reader.GetString(9);

                            PostEnderecoCliente(enderecoCliente);

                            string msg = "Foram inseridos: " + lEnderecoCliente.Count().ToString() + " de " + countRegister + " registros";
                            processForm.writeMessage(msg);
                            processForm.Enabled = false;
                            processForm.Enabled = true;

                            lEnderecoCliente.Add(enderecoCliente);
                        }
                    }

                        con.Dispose();
                    }

                    catch (Exception ex)
                    {
                        logErro.EscreverLog(layout, ex.Message.ToString());
                        //MessageBox.Show(ex.Message.ToString(), "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }

                }
                catch (Exception ex)
                {
                    logErro.EscreverLog(layout, ex.Message.ToString());
                    //MessageBox.Show(ex.Message.ToString(), "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                }

                int countWrite = lEnderecoCliente.Count();
                //MessageBox.Show("Foram inseridos "+countWrite.ToString()+" registros", "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                processForm.Close();
        }
Example #34
0
        public JsonResult Submit(string json)
        {
            AjaxResult ajaxResult = new AjaxResult()
            {
                Result = DoResult.Failed,
                PromptMsg = "操作失败"
            };
            ProcessForm processForm = null;
            try
            {
                string processDefID = Request.Form["processDefID"];
                string entry = Request.Form["Entry"];
                string processInstID = Request.Form["processInstID"];
                string workItemID = Request.Form["workItemID"];
                UnitOfWork.ExecuteWithTrans<ProcessDef>(() =>
                {
                    if (!string.IsNullOrEmpty(processDefID) && entry.EqualIgnoreCase("StartProcess"))
                    {
                        processInstID = workflowEngine.CreateAProcess(processDefID);// string.Empty; // TODO: Initialize to an appropriate value
                        workflowEngine.StartAProcess(processInstID, null);
                        WorkItem wi = repository.Query<WorkItem>().FirstOrDefault(w => w.ProcessInstID == processInstID);
                        workItemID = wi.ID;
                        AddActionLog(wi, DoResult.Success, string.Format("启动流程实像{0}", processInstID));
                    }

                    Dictionary<string, object> formValues = JsonConvert.DeserializeObject<Dictionary<string, object>>(json);
                    string table = Request.Form["DataSource"];
                    string cmdText = string.Empty;

                    processForm = repository.Query<ProcessForm>().FirstOrDefault(pf => pf.ProcessInstID == processInstID);
                    if (processForm != null)
                    {
                        StringBuilder sbUpdateValues = new StringBuilder();
                        foreach (var item in formValues)
                        {
                            if (sbUpdateValues.Length > 0)
                                sbUpdateValues.Append(",");
                            sbUpdateValues.AppendFormat("{0} = :{0}", item.Key);
                        }
                        cmdText = string.Format("update {0} set {1} where ID ='{2}'", table, sbUpdateValues.ToString(), processForm.BizID);
                    }
                    else
                    {
                        formValues.SafeAdd("ID", IdGenerator.NewComb().ToSafeString());
                        formValues.SafeAdd("Applicant", workContext.User.ID);
                        formValues.SafeAdd("ApplicantName", workContext.User.Name);
                        formValues.SafeAdd("ApplyTime", DateTime.Now);
                        StringBuilder sbFields = new StringBuilder();
                        StringBuilder sbValues = new StringBuilder();
                        foreach (var item in formValues)
                        {
                            sbFields.Append(item.Key).Append(",");
                            sbValues.Append(":").Append(item.Key).Append(",");
                        }

                        processForm = new ProcessForm()
                        {
                            ID = IdGenerator.NewComb().ToString(),
                            BizID = formValues.GetSafeValue<string>("ID"),
                            BizTable = table,
                            CreateTime = DateTime.Now,
                            Creator = workContext.User.ID,
                            ProcessInstID = processInstID,
                            KeyWord = sbValues.ToString()
                        };
                        cmdText = string.Format("insert into {0}({1}) values({2})", table, sbFields.ToString().TrimEnd(','), sbValues.ToString().TrimEnd(','));
                    }

                    workflowEngine.Persistence.Repository.ExecuteSql<WorkItem>(cmdText, formValues);
                    workflowEngine.Persistence.Repository.SaveOrUpdate(processForm);
                    workflowEngine.CompleteWorkItem(workItemID, formValues);
                });
                ajaxResult.Result = DoResult.Success;
                ajaxResult.RetValue = processForm.BizID;
                ajaxResult.PromptMsg = string.Format("完成工作流实例{0}工作项{1}", processForm.ProcessInstID, workItemID);
                //记录操作日志
                AddActionLog(processForm, ajaxResult.Result, ajaxResult.PromptMsg);
            }
            catch (Exception ex)
            {
                ajaxResult.Result = DoResult.Failed;
                //记录操作日志
                AddActionLog(processForm, ajaxResult.Result, string.Format("完成工作流实例{0}工作项失败", processForm.ProcessInstID));
                log.Error(ex);
            }

            return Json(ajaxResult);
        }
        public void IntegraForcaDeVenda()
        {
            ProcessForm processForm = new ProcessForm("", layout);
            processForm.Show();
            List<ForcaDeVenda> lForcaDeVenda = new List<ForcaDeVenda>();

            IEnumerable<String> streamRead = File.ReadLines(System.Environment.CurrentDirectory.ToString() + "\\config.txt");
            var connection = streamRead.First();

            using (OleDbConnection con = new OleDbConnection(connection))
            {
                try
                {
                    con.Open();

                    using (OleDbCommand commandCount = new OleDbCommand("SELECT COUNT(*) FROM FORCA_VENDAS", con))
                    using (OleDbDataReader readerCount = commandCount.ExecuteReader())
                    {
                        while (readerCount.Read())
                        {

                            countRegister = readerCount.GetValue(0).ToString();

                        }
                    }

                    try{

                        using (OleDbCommand command = new OleDbCommand("SELECT ID_FV,ID_DISTRIBUIDOR,AREA_ATUACAO_FV,TIPO_FV,NOME_FV,EMAIL_FV,TEL_FV FROM FORCA_VENDAS", con))
                        using (OleDbDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            ForcaDeVenda forcaDeVenda = new ForcaDeVenda();

                            forcaDeVenda.id = reader.GetString(0);
                            forcaDeVenda.distribuidorId = reader.GetString(1);
                            forcaDeVenda.areaAtuacao = reader.GetString(2);
                            forcaDeVenda.tipo = reader.GetString(3);
                            forcaDeVenda.nome = reader.GetString(4);
                            forcaDeVenda.email = reader.GetString(5);
                            forcaDeVenda.telefone = reader.GetString(6);

                            PostForcaDeVenda(forcaDeVenda);

                            string msg = "Foram inseridos: " + lForcaDeVenda.Count().ToString() +" de "+countRegister+ " registros";
                            processForm.writeMessage(msg);
                            processForm.Enabled = false;
                            processForm.Enabled = true;

                            lForcaDeVenda.Add(forcaDeVenda);
                       }
                        }
                        con.Dispose();
                    }

                    catch (Exception ex)
                    {
                        logErro.EscreverLog(layout, ex.Message.ToString());
                        //MessageBox.Show(ex.Message.ToString(), "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }

                }
                catch (Exception ex)
                {
                    logErro.EscreverLog(layout, ex.Message.ToString());
                    //MessageBox.Show(ex.Message.ToString(), "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }

                int countWrite = lForcaDeVenda.Count();
                //MessageBox.Show("Foram inseridos "+countWrite.ToString()+" registros", "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                processForm.Close();
        }
Example #36
0
        public void IntegraPedido()
        {
            ProcessForm processForm = new ProcessForm("", layout);
            processForm.Show();
            List<Pedido> lPedido = new List<Pedido>();

            IEnumerable<String> streamRead = File.ReadLines(System.Environment.CurrentDirectory.ToString() + "\\config.txt");
            var connection = streamRead.First();
            //int index = 0;

            using (OleDbConnection con = new OleDbConnection(connection))
            {
                try
                {
                    con.Open();

                    using (OleDbCommand commandCount = new OleDbCommand("SELECT COUNT(*) FROM PEDIDOS ", con))
                    using (OleDbDataReader readerCount = commandCount.ExecuteReader())
                    {
                        while (readerCount.Read())
                        {

                            countRegister = readerCount.GetValue(0).ToString();

                        }
                    }
                    try
                    {
                        using (OleDbCommand command = new OleDbCommand("SELECT SKU_PRODUTO,ID_CLIENTE,ID_DISTRIBUIDOR,ID_FV,ID_FORMA_PAGAMENTO,NUMERO_PEDIDO,DATA_PEDIDO,QUANTIDADE_ITEM_PEDIDO,VALOR_UNITARIO_PEDIDO,VALOR_TOTAL_ITEM_PEDIDO,CFOP_PEDIDO,NATUREZA_OPERACAO_NF,FLAG_PEDIDO_ITEM_CANCELADO,DATA_PEDIDO_ITEM_CANCELADO FROM PEDIDOS", con))
                        using (OleDbDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            Pedido pedido = new Pedido();

                            pedido.produtoId = reader.GetString(0);
                            pedido.clienteId= reader.GetString(1);
                            pedido.distribuidorId = reader.GetString(2);
                            pedido.forcaDeVendaId=reader.GetString(3);
                            pedido.formaDePagamentoId = reader.GetString(4);
                            pedido.numeroPedido = reader.GetString(5);
                            pedido.data = reader.GetString(6);
                            pedido.quantidadeItens = reader.GetString(7);
                            pedido.valorUnitario = reader.GetString(8);
                            pedido.valorTotalItens = reader.GetString(9);
                            pedido.cfop = reader.GetString(10);
                            pedido.naturezaOperacaoNF = reader.GetString(11);
                            pedido.flagItemCancelado = reader.GetString(12);
                            pedido.dataItemCancelado = reader.GetString(13);

                            PostPedido(pedido);

                            string msg = "Foram inseridos: " + lPedido.Count().ToString() +" de "+countRegister+ " registros";
                            processForm.writeMessage(msg);
                            processForm.Enabled = false;
                            processForm.Enabled = true;

                            lPedido.Add(pedido);
                            //index++;
                        }
                        }
                        con.Dispose();
                    }

                    catch (Exception ex)
                    {
                        logErro.EscreverLog(layout, ex.Message.ToString());
                        //MessageBox.Show(ex.Message.ToString(), "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }

                }
                catch (Exception ex)
                {
                    logErro.EscreverLog(layout, ex.Message.ToString());
                    //MessageBox.Show(ex.Message.ToString(), "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }

                int countWrite = lPedido.Count();
                //MessageBox.Show("Foram inseridos "+countWrite.ToString()+" registros", "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                processForm.Close();
                //return index;
        }
        public void IntegraCarteiraCliente()
        {
            ProcessForm processForm = new ProcessForm("", layout);
            processForm.Show();
            List<CarteiraCliente> lCarteiraCliente = new List<CarteiraCliente>();
            IEnumerable<String> streamRead = File.ReadLines(System.Environment.CurrentDirectory.ToString() + "\\config.txt");
            var connection = streamRead.First();

            using (OleDbConnection con = new OleDbConnection(connection))
            {
                try
                {
                    con.Open();
                    using (OleDbCommand commandCount = new OleDbCommand("SELECT COUNT(*) FROM CARTEIRA_CLIENTES ", con))
                    using (OleDbDataReader readerCount = commandCount.ExecuteReader())
                    {
                        while (readerCount.Read())
                        {

                            countRegister = readerCount.GetValue(0).ToString();

                        }
                    }

                    try
                    {

                        using (OleDbCommand command = new OleDbCommand("SELECT ID_DISTRIBUIDOR,ID_FV,ID_CLIENTE,DATA_PRIMEIRO_ATENDIMENTO,DATA_ULTIMO_ATENDIMENTO,VALOR_ULTIMA_VENDA,VALOR_PRIMEIRA_VENDA FROM CARTEIRA_CLIENTES ", con))
                        using (OleDbDataReader reader = command.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                CarteiraCliente carteiraCliente = new CarteiraCliente();

                                carteiraCliente.distribuidorId = reader.GetString(0);
                                carteiraCliente.forcaDeVendaId = reader.GetString(1);
                                carteiraCliente.clienteId = reader.GetString(2);
                                carteiraCliente.dataPrimeiroAtendimento = reader.GetString(3);
                                carteiraCliente.dataUltimoAtendimento = reader.GetString(4);
                                carteiraCliente.ValorUltimaVenda = reader.GetString(5);
                                carteiraCliente.valorPrimeiraVenda = reader.GetString(6);

                                PostCarteiraCLiente(carteiraCliente);

                                string msg = "Foram inseridos: " + lCarteiraCliente.Count().ToString() + " de " + countRegister + " registros";
                                processForm.writeMessage(msg);
                                processForm.Enabled = false;
                                processForm.Enabled = true;

                                lCarteiraCliente.Add(carteiraCliente);
                            }
                        }

                        con.Dispose();
                    }

                    catch (Exception ex)
                    {
                        logErro.EscreverLog(layout, ex.Message.ToString());
                       // MessageBox.Show(ex.Message.ToString(), "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }

                }
                catch (Exception ex)
                {
                    logErro.EscreverLog(layout, ex.Message.ToString());
                   // MessageBox.Show(ex.Message.ToString(), "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }

                int countWrite = lCarteiraCliente.Count();
                //MessageBox.Show("Foram inseridos " + countWrite.ToString() + " registros", "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                processForm.Close();

            }
        }
Example #38
0
        public void IntegraEstoque()
        {
            ProcessForm processForm = new ProcessForm("", layout);
            processForm.Show();
            List<Estoque> lEstoque = new List<Estoque>();
            IEnumerable<String> streamRead = File.ReadLines(System.Environment.CurrentDirectory.ToString() + "\\config.txt");
            var connection = streamRead.First();
            using (OleDbConnection con = new OleDbConnection(connection))
            {
                try
                {
                    con.Open();
                    using (OleDbCommand commandCount = new OleDbCommand("SELECT COUNT(*) FROM ESTOQUE ", con))
                    using (OleDbDataReader readerCount = commandCount.ExecuteReader())
                    {
                        while (readerCount.Read())
                        {

                            countRegister = readerCount.GetValue(0).ToString();

                        }
                    }
                    try
                    {

                        using (OleDbCommand command = new OleDbCommand("SELECT SKU_PRODUTO,ID_DISTRIBUIDOR,QUANTIDADE_ATUAL_ESTOQUE,QUANTIDADE_ULTIMA_COMPRA,QUANTIDADE_ULTIMA_VENDA,DATA_PRIMEIRA_COMPRA,DATA_ULTIMA_COMPRA,DATA_ULTIMA_VENDA,VALOR_CUSTO_UNITARIO_ESTOQUE,VALOR_CUSTO_TOTAL_ESTOQUE FROM ESTOQUE", con))
                        using (OleDbDataReader reader = command.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                Estoque estoque = new Estoque();
                                Validator valid = new Validator();

                                estoque.produtoId = reader.GetString(0);
                                estoque.distribuidorId = reader.GetString(1);
                                estoque.quantidadeAtualEstoque = reader.GetString(2);
                                estoque.quantidadeUltimaCompra = reader.GetString(3);
                                estoque.quantidadeUltimaVenda = reader.GetString(4);

                                if (reader.IsDBNull(5))
                                {
                                    estoque.dataPrimeiraCompra = valid.ValidaString();
                                }
                                else
                                {
                                    estoque.dataPrimeiraCompra = (reader.GetString(5));
                                }

                                if (reader.IsDBNull(6))
                                {
                                    estoque.dataUltimaCompra = valid.ValidaString();
                                }
                                else
                                {
                                    estoque.dataUltimaCompra = (reader.GetString(6));
                                }

                                if (reader.IsDBNull(7))
                                {
                                    estoque.dataUltimaVenda = valid.ValidaString();
                                }
                                else
                                {
                                    estoque.dataUltimaVenda = (reader.GetString(7));
                                }

                                estoque.valorCustoUnitarioEstoque = reader.GetString(8);
                                estoque.valorCustoTotalEstoque = reader.GetString(9);

                                PostEstoque(estoque);

                                string msg = "Foram inseridos: " + lEstoque.Count().ToString() + " de " + countRegister + " registros";
                                processForm.writeMessage(msg);
                                processForm.Enabled = false;
                                processForm.Enabled = true;

                                lEstoque.Add(estoque);
                            }
                        }

                        con.Dispose();
                    }

                    catch (Exception ex)
                    {
                        logErro.EscreverLog(layout, ex.Message.ToString());
                        //MessageBox.Show(ex.Message.ToString(), "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }

                }
                catch (Exception ex)
                {
                    logErro.EscreverLog(layout, ex.Message.ToString());
                    //MessageBox.Show(ex.Message.ToString(), "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }

                int countWrite = lEstoque.Count();
                //MessageBox.Show("Foram inseridos "+countWrite.ToString()+" registros", "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                processForm.Close();
            }
        }
        public void IntegraFormaDePagamento()
        {
            ProcessForm processForm = new ProcessForm("", layout);
            processForm.Show();
            List<FormaDePagamento> lFormaDePagamento = new List<FormaDePagamento>();

            IEnumerable<String> streamRead = File.ReadLines(System.Environment.CurrentDirectory.ToString() + "\\config.txt");
            var connection = streamRead.First();

            using (OleDbConnection con = new OleDbConnection(connection))
            {
                try
                {
                    con.Open();

                    using (OleDbCommand commandCount = new OleDbCommand("SELECT COUNT(*) FROM FORMA_PAGAMENTO ", con))
                    using (OleDbDataReader readerCount = commandCount.ExecuteReader())
                    {
                        while (readerCount.Read())
                        {

                            countRegister = readerCount.GetValue(0).ToString();

                        }
                    }
                    try{
                        using (OleDbCommand command = new OleDbCommand("SELECT ID_FORMA_PAGAMENTO,ID_DISTRIBUIDOR,DESC_FORMA_PAGAMENTO,FLAG_ATIVO_FORMA_PAGAMENTO FROM FORMA_PAGAMENTO", con))
                        using (OleDbDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            FormaDePagamento formaDePagamento = new FormaDePagamento();

                            formaDePagamento.id = reader.GetString(0);
                            formaDePagamento.distribuidorId = reader.GetString(1);
                            formaDePagamento.formaDePagamento = reader.GetString(2);
                            formaDePagamento.flagAtivo = reader.GetString(3);

                            PostFormaDePagamento(formaDePagamento);

                            string msg = "Foram inseridos: " + lFormaDePagamento.Count().ToString() + " de "+countRegister+" registros";
                            processForm.writeMessage(msg);
                            processForm.Enabled = false;
                            processForm.Enabled = true;

                            lFormaDePagamento.Add(formaDePagamento);
                       }
                        }
                        con.Dispose();
                    }

                    catch (Exception ex)
                    {
                        logErro.EscreverLog(layout, ex.Message.ToString());
                        //MessageBox.Show(ex.Message.ToString(), "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }

                }
                catch (Exception ex)
                {
                    logErro.EscreverLog(layout, ex.Message.ToString());
                    //MessageBox.Show(ex.Message.ToString(), "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }

                int countWrite = lFormaDePagamento.Count();
                //MessageBox.Show("Foram inseridos "+countWrite.ToString()+" registros", "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                processForm.Close();
        }
        public void IntegraTabelaPreço()
        {
            ProcessForm processForm = new ProcessForm("", layout);
            processForm.Show();
            List<TabelaPreco> lTabelaPreco = new List<TabelaPreco>();

            IEnumerable<String> streamRead = File.ReadLines(System.Environment.CurrentDirectory.ToString() + "\\config.txt");
            var connection = streamRead.First();

            using (OleDbConnection con = new OleDbConnection(connection))
            {
                try
                {
                    con.Open();

                    using (OleDbCommand commandCount = new OleDbCommand("SELECT COUNT(*) FROM TABELA_PRECO ", con))
                    using (OleDbDataReader readerCount = commandCount.ExecuteReader())
                    {
                        while (readerCount.Read())
                        {

                            countRegister = readerCount.GetValue(0).ToString();

                        }
                    }
                    try{
                        using (OleDbCommand command = new OleDbCommand("SELECT ID_DISTRIBUIDOR,SKU_PRODUTO,NOME_TABELA_PRECO,PREÇO_UNITARIO,QUANTIDADE_INICIAL,PREÇO_ESCALONADO FROM TABELA_PRECO", con))
                        using (OleDbDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            TabelaPreco tabelaPreco = new TabelaPreco();

                            tabelaPreco.distribuidorId = reader.GetString(0);
                            tabelaPreco.produtoId = reader.GetString(1);
                            tabelaPreco.nomeTabelaPreco = reader.GetString(2);
                            tabelaPreco.precoUnitario = reader.GetString(3);
                            tabelaPreco.quantidadeInicial = reader.GetString(4);
                            tabelaPreco.precoEscalonado = reader.GetString(5);

                            PostTabelaPreco(tabelaPreco);

                            string msg = "Foram inseridos: " + lTabelaPreco.Count().ToString() + " de " + countRegister + " registros";
                            processForm.writeMessage(msg);
                            processForm.Enabled = false;
                            processForm.Enabled = true;

                            lTabelaPreco.Add(tabelaPreco);
                       }
                        }
                        con.Dispose();
                    }

                    catch (Exception ex)
                    {
                        logErro.EscreverLog(layout, ex.Message.ToString());
                        //MessageBox.Show(ex.Message.ToString(), "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }

                }
                catch (Exception ex)
                {
                    logErro.EscreverLog(layout, ex.Message.ToString());
                   // MessageBox.Show(ex.Message.ToString(), "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }

                int countWrite = lTabelaPreco.Count();
                //MessageBox.Show("Foram inseridos "+countWrite.ToString()+" registros", "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                processForm.Close();
        }
        public string Save(string argument)
        {
            AjaxResult ajaxResult = new AjaxResult();
            string errorMsg = string.Empty;
            DoResult actionResult = DoResult.Failed;
            string actionMessage = string.Empty;
            string processInstID = Request.QueryString["processInstID"];
            ProcessForm processForm;
            try
            {
                Dictionary<string, object> formValues = JsonConvert.DeserializeObject<Dictionary<string, object>>(argument);

                string table = Request.Form["DataSource"];
                StringBuilder sbFields = new StringBuilder();
                StringBuilder sbValues = new StringBuilder();
                string cmdText = string.Empty;
                StringBuilder sbUpdateValues = new StringBuilder();

                IDictionary<string, object> parameters = new Dictionary<string, object>();
                parameters.SafeAdd("ProcessInstID", processInstID);
                processForm = engine.Persistence.Repository.FindOne<ProcessForm>(parameters);
                if (processForm != null)
                {
                    foreach (var item in formValues)
                    {
                        if (sbUpdateValues.Length > 0)
                            sbUpdateValues.Append(",");
                        sbUpdateValues.AppendFormat("{0} = :{0}", item.Key);
                    }
                    cmdText = string.Format("update {0} set {1} where ID ='{2}'", table, sbUpdateValues.ToString(), processForm.BizID);
                }
                else
                {
                    string bizID = IdGenerator.NewComb().ToString();
                    formValues.SafeAdd("ID", bizID);
                    foreach (var item in formValues)
                    {
                        sbFields.Append(item.Key).Append(",");
                        sbValues.Append(":").Append(item.Key).Append(",");
                    }

                    processForm = new ProcessForm()
                    {
                        ID = IdGenerator.NewComb().ToString(),
                        BizID = bizID,
                        BizTable = table,
                        CreateTime = DateTime.Now,
                        Creator = User.ID,
                        ProcessInstID = processInstID,
                        KeyWord = sbValues.ToString()
                    };
                    cmdText = string.Format("insert into {0}({1}) values({2})", table, sbFields.ToString().TrimEnd(','), sbValues.ToString().TrimEnd(','));
                }

                string workItemID = Request.QueryString["workItemID"];
                UnitOfWork.ExecuteWithTrans<WorkItem>(() =>
                {
                    engine.Persistence.Repository.ExecuteSql<WorkItem>(cmdText, formValues);
                    engine.Persistence.Repository.SaveOrUpdate(processForm);
                    engine.CompleteWorkItem(workItemID, formValues);
                });

                actionResult = DoResult.Success;
                //获取提示信息
                actionMessage = string.Format("启动工作流实例{0}工作项{1}", processForm.ProcessInstID, workItemID);

                //记录操作日志
                AddActionLog(processForm, actionResult, actionMessage);

                ajaxResult.Result = actionResult;
                ajaxResult.RetValue = processForm.BizID;
                ajaxResult.PromptMsg = actionMessage;
            }
            catch (Exception ex)
            {
                actionMessage = RemarkAttribute.GetEnumRemark(actionResult);
                log.Error(actionMessage, ex);
            }

            return JsonConvert.SerializeObject(ajaxResult);
        }
Example #42
0
        public int IntegraCliente()
        {
            ProcessForm processForm = new ProcessForm("", layout);
            processForm.Show();

            List<Cliente> lCliente = new List<Cliente>();

            IEnumerable<String> streamRead = File.ReadLines(System.Environment.CurrentDirectory.ToString()+"\\config.txt");
            var connection = streamRead.First();
            int index = 0;
            using (OleDbConnection con = new OleDbConnection(connection))
            {
                try
                {
                    con.Open();

                        using (OleDbCommand commandCount = new OleDbCommand("SELECT COUNT(*) FROM CLIENTES ", con))
                        using (OleDbDataReader readerCount = commandCount.ExecuteReader())
                        {
                            while (readerCount.Read())
                            {

                                countRegister = readerCount.GetValue(0).ToString();

                            }
                        }

                        try
                        {

                        using (OleDbCommand command = new OleDbCommand("SELECT ID_CLIENTE,ID_DISTRIBUIDOR,RAZAO_SOCIAL_CLIENTE,NOME_FANTASIA_CLIENTE,CNPJ_CPF_CLIENTE,COD_MUNICIPIO_IBGE_MATRIZ,RUA_END_MATRIZ_CLIENTE,NUMERO_END_MATRIZ_CLIENTE,COMPLEMENTO_END_MATRIZ_CLIENTE,CEP_END_MATRIZ_CLIENTE,BAIRRO_END_MATRIZ_CLIENTE,MUNICIPIO_END_MATRIZ_CLIENTE,UF_END_MATRIZ_CLIENTE,TEL_END_MATRIZ_CLIENTE,EMAIL_END_MATRIZ_CLIENTE,PESSOA_CONTATO,RAMO_NEGOCIO_CLIENTE,SUB_RAMO_NEGOCIO_CLIENTE,CURVA_ABC_CLIENTE,STATUS_FINANCEIRO_CLIENTE,DATA_CADASTRO_CLIENTE,DATA_DESATIVACAO_CLIENTE,FLAG_ATIVO_CLIENTE,GRUPO_ECONOMICO_CLIENTE FROM CLIENTES ", con))
                        using (OleDbDataReader reader = command.ExecuteReader())
                        {

                            while (reader.Read())
                            {
                                Cliente cliente = new Cliente();
                                Validator valid = new Validator();

                                cliente.id = reader.GetString(0);
                                cliente.distribuidorId = reader.GetString(1);
                                cliente.razaoSocial = reader.GetString(2);
                                cliente.nomeFantasia = reader.GetString(3);
                                cliente.cnpjCpf = reader.GetString(4);
                                if (reader.IsDBNull(5))
                                {
                                    cliente.codigoMunicipio = valid.ValidaString();
                                }
                                else
                                {
                                    cliente.codigoMunicipio = reader.GetString(5);
                                }
                                //cliente.codigoMunicipio = reader.GetString(5);

                                if (reader.IsDBNull(6))
                                {
                                    cliente.enderecoLogradouro = valid.ValidaString();
                                }
                                else
                                {
                                    cliente.enderecoLogradouro = reader.GetString(6);
                                }
                                //cliente.enderecoLogradouro = reader.GetString(6);
                                if (reader.IsDBNull(7))
                                {
                                    cliente.enderecoNumero = valid.ValidaString();
                                }
                                else
                                {
                                    cliente.enderecoNumero = reader.GetString(7);
                                }
                                //cliente.enderecoNumero = reader.GetString(7);

                                if (reader.IsDBNull(8))
                                {
                                    cliente.enderecoComplemento = valid.ValidaString();
                                }
                                else
                                {
                                    cliente.enderecoComplemento = reader.GetString(8);
                                }
                                //cliente.enderecoComplemento = reader.GetString(8);

                                if (reader.IsDBNull(9))
                                {
                                    cliente.enderecoCep = valid.ValidaString();
                                }
                                else
                                {
                                    cliente.enderecoCep = reader.GetString(9);
                                }
                                //cliente.enderecoCep = reader.GetString(9);
                                if (reader.IsDBNull(10))
                                {
                                    cliente.enderecoBairro = valid.ValidaString();
                                }
                                else
                                {
                                    cliente.enderecoBairro = reader.GetString(10);
                                }
                                //cliente.enderecoBairro = reader.GetString(10);
                                if (reader.IsDBNull(11))
                                {
                                    cliente.enderecoMunicipio = valid.ValidaString();
                                }
                                else
                                {
                                    cliente.enderecoMunicipio = reader.GetString(11);
                                }
                                //cliente.enderecoMunicipio = reader.GetString(11);
                                if (reader.IsDBNull(12))
                                {
                                    cliente.enderecoEstado = valid.ValidaString();
                                }
                                else
                                {
                                    cliente.enderecoEstado = reader.GetString(12);
                                }
                                //cliente.enderecoEstado = reader.GetString(12);
                                if (reader.IsDBNull(13))
                                {
                                    cliente.telefone = valid.ValidaString();
                                }
                                else
                                {
                                    cliente.telefone = reader.GetString(13);
                                }
                                //cliente.telefone = reader.GetString(13);

                                if (reader.IsDBNull(14))
                                {
                                    cliente.email = valid.ValidaString();
                                }
                                else
                                {
                                    cliente.email = reader.GetString(14);
                                }

                                //cliente.email = reader.GetString(14);

                                if (reader.IsDBNull(15))
                                {
                                    cliente.pessoaContato = valid.ValidaString();
                                }
                                else
                                {
                                    cliente.pessoaContato = reader.GetString(15);
                                }

                                //cliente.pessoaContato = reader.GetString(15);

                                if (reader.IsDBNull(16))
                                {
                                    cliente.ramoNegocio = valid.ValidaString();
                                }
                                else
                                {
                                    cliente.ramoNegocio = reader.GetString(16);
                                }
                                //cliente.ramoNegocio = reader.GetString(16);

                                if (reader.IsDBNull(17))
                                {
                                    cliente.subRamoNegocio = valid.ValidaString();
                                }
                                else
                                {
                                    cliente.subRamoNegocio = reader.GetString(17);
                                }
                                //cliente.subRamoNegocio = reader.GetString(17);

                                if (reader.IsDBNull(18))
                                {
                                   cliente.curvaABC = valid.ValidaString();
                                }
                                else
                                {
                                    cliente.curvaABC = reader.GetString(18);
                                }

                                if (reader.IsDBNull(19)||reader.GetValue(19).ToString()=="")
                                {
                                   cliente.statusFinanceiro = valid.ValidaString();
                                }
                                else
                                {
                                    cliente.statusFinanceiro = reader.GetString(19);
                                }

                                if ((reader.IsDBNull(20) || (reader.GetValue(20).ToString() == "") || (reader.GetValue(20) == null)))
                                {
                                    cliente.dataCadastro = valid.ValidaString();
                                }
                                else
                                {
                                    cliente.dataCadastro = (reader.GetValue(20).ToString());
                                }

                                if ((reader.IsDBNull(21)) || (reader.GetValue(21).ToString() == "") || (reader.GetValue(21)==null))
                                {
                                    cliente.dataDesativacao = valid.ValidaString();

                                }
                                else
                                {
                                    try
                                    {
                                        cliente.dataDesativacao = reader.GetString(20);
                                    }
                                    catch (Exception ex)
                                    {
                                        MessageBox.Show(ex.Message.ToString(), "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                    }
                                }

                                //cliente.ativo = (reader.GetString(22));
                                if ((reader.IsDBNull(22) || (reader.GetValue(22).ToString() == "") || (reader.GetValue(22) == null)))
                                {
                                    cliente.ativo = valid.ValidaString();
                                }
                                else
                                {
                                    cliente.ativo = reader.GetString(22);
                                }

                                if  ((reader.IsDBNull(23) || (reader.GetValue(23).ToString() == "") || (reader.GetValue(23) == null)))
                                {
                                    cliente.grupoEconomico = valid.ValidaString();
                                }
                                else
                                {
                                    cliente.grupoEconomico = reader.GetString(23);
                                }

                                PostCliente(cliente);

                                string msg = "Foram inseridos: " + lCliente.Count().ToString() +" de "+countRegister+" registros";
                                processForm.writeMessage(msg);
                                processForm.Enabled = false;
                                processForm.Enabled = true;

                                lCliente.Add(cliente);
                                index++;
                            }
                        }

                        con.Dispose();
                        //MessageBox.Show("Advetisament","Fim da execução de cliente",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);

                    }

                    catch (Exception ex)
                    {
                        logErro.EscreverLog(layout, ex.Message.ToString()+ex.ToString());
                        //MessageBox.Show(ex.Message.ToString(), "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }

                }
                catch (Exception ex)
                {
                    //MessageBox.Show(ex.Message.ToString(), "Falha ao abrir a conexao", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    logErro.EscreverLog(layout, ex.Message.ToString());
                }

                int countWrite = lCliente.Count();
                //MessageBox.Show("Foram inseridos " + countWrite.ToString() + " registros", "Advetisament", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                processForm.Close();
                return index;

            }
        }