Exemple #1
0
        private void loadOperationStandBook_Completed(object sender, EventArgs e)
        {
            StandBookEntityDirectory.Clear();

            LoadOperation loadOperation = sender as LoadOperation;

            foreach (Web.Model.standbook standbook in loadOperation.Entities)
            {
                StandBookEntity lStandBookEntity = new StandBookEntity();
                lStandBookEntity.StandBook = standbook;
                lStandBookEntity.Update();
                StandBookEntityDirectory.Add(lStandBookEntity.StandBookID, lStandBookEntity);
            }

            IsBusy = false;
        }
Exemple #2
0
        private bool CheckVaild()
        {
            bool isSuccess = true;

            // check the number
            string          lStandBookID = StandBookEntity.StandBookID;
            StandBookEntity lStandBookEntity;

            if (StandBookEntityDirectory.TryGetValue(lStandBookID, out lStandBookEntity))
            {
                StandBookEntity.ErrorText += "此受理流水号已经导入,请检查是否受理流水号重复!";
                isSuccess = false;
            }

            // check the project
            TaxPayerEntity lCurrentTaxPayerEntity = null;
            string         lProjectName           = StandBookEntity.ProjectName;

            {
                bool lHasProject = false;

                foreach (TaxPayerEntity lTaxPayerEntity in  TaxPayerEntityDirectory.Values)
                {
                    if (lTaxPayerEntity.TaxPayerProject == lProjectName)
                    {
                        lHasProject            = true;
                        lCurrentTaxPayerEntity = lTaxPayerEntity;
                        currentTaxPayerEntity  = lCurrentTaxPayerEntity;
                    }

                    /*
                     * string lTempProjectName = lTaxPayerEntity.TaxPayerProject;
                     *
                     * byte[] byteArray1 = System.Text.Encoding.UTF8.GetBytes(lTempProjectName);
                     * byte[] temp1 = System.Text.Encoding.Convert(System.Text.Encoding.UTF8, System.Text.Encoding.BigEndianUnicode, byteArray1);
                     * byte[] byteArray2 = System.Text.Encoding.UTF8.GetBytes(lProjectName);
                     * byte[] temp2 = System.Text.Encoding.Convert(System.Text.Encoding.UTF8, System.Text.Encoding.BigEndianUnicode, byteArray2);
                     *
                     * if (temp1.Length != temp2.Length)
                     * {
                     *  continue;
                     * }
                     *
                     * bool isEqu = true;
                     * for (int i = 2; i < temp1.Length; i++)
                     * {
                     *  if (temp1[i] != temp2[i])
                     *  {
                     *      isEqu = false;
                     *      break;
                     *  }
                     * }
                     *
                     * if (isEqu)
                     * {
                     *  lHasProject = true;
                     *  lCurrentTaxPayerEntity = lTaxPayerEntity;
                     *  currentTaxPayerEntity = lCurrentTaxPayerEntity;
                     *  break;
                     * }
                     */
                }

                if (!lHasProject)
                {
                    StandBookEntity.ErrorText += "该项目在系统纳税人信息中不存在,请先添加纳税人信息!";
                    isSuccess = false;
                }
                else
                {
                    if (lCurrentTaxPayerEntity != null && lCurrentTaxPayerEntity.TaxPayerName != StandBookEntity.TaxPayerName)
                    {
                        StandBookEntity.ErrorText += "该项目在系统纳税人信息, 项目与纳税人信息不匹配,请检查!";
                        isSuccess = false;
                    }
                }
            }

            // Check Old StandBook Info
            {
                foreach (StandBookEntity lStandBookEntityEm in StandBookEntityDirectory.Values)
                {
                    if (lStandBookEntityEm.ProjectName == StandBookEntity.ProjectName)
                    {
                        decimal lOldTotalMoney = lStandBookEntityEm.TotalMoney.GetValueOrDefault(0);
                        decimal lNewTotalMoney = StandBookEntity.TotalMoney.GetValueOrDefault(0);

                        if (lOldTotalMoney != lNewTotalMoney)
                        {
                            StandBookEntity.ErrorText += "该项目与以前导入金额不一致,请检查!";
                            isSuccess = false;
                        }
                    }
                }
            }

            if (isSuccess)
            {
                StandBookEntity.SuccessText = "可以导入!";
                StandBookEntity.ShowError   = Visibility.Collapsed;
                StandBookEntity.ShowSuccess = Visibility.Visible;
            }
            else
            {
                StandBookEntity.ShowError   = Visibility.Visible;
                StandBookEntity.ShowSuccess = Visibility.Collapsed;
            }

            return(isSuccess);
        }