Ejemplo n.º 1
0
        private void sb_ok_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(s_new_bi001))
            {
                be_newposition.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight;
                be_newposition.ErrorText = "请先选择一个墓穴位置!";
                return;
            }
            if (string.IsNullOrEmpty(te_new_price.Text) || Convert.ToDecimal(te_new_price.Text) <= 0)
            {
                be_newposition.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight;
                be_newposition.ErrorText = "新墓穴位置尚未定价!";
                return;
            }

            if (BusinessAction.TombTransfer(ac01.AC001, s_new_bi001, me_reason.Text, Envior.cur_userId) > 0)
            {
                Tools.msg(MessageBoxIcon.Information, "提示", "办理成功!");
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
Ejemplo n.º 2
0
        public int Set <T>(List <T> listBus, string KeyService = null) where T : Bus
        {
            var listSet     = BusinessAction.GetBusinessObjectWithState <T>(listBus, RowState.Insert | RowState.Update | RowState.Delete);
            var listSetAuto = BusinessAction.ToAutoObject(listSet);//var listSetAuto = CreateListAuto(listSet);

            var listDelete = BusinessAction.GetBusinessObjectWithState <T>(listSet, RowState.Delete);
            var listIU     = BusinessAction.GetBusinessObjectWithState <T>(listSet, RowState.Insert | RowState.Update);
            var response   = SetInvoke(listSetAuto, KeyService);

            for (int i = 0; i < listDelete.Count; i++)
            {
                listBus.Remove(listDelete[i]);
            }

            for (int i = 0; i < listIU.Count; i++)
            {
                listIU[i].DataFromAutoObject(response.DataItems[i]);
                listIU[i].MakeUnchange();
            }

            return(response.RowsAffected);
        }
        internal static Result <string> BackFromBreak(HomeController.UserViewModel model)
        {
            Result <string> res = new Result <string>();

            using (var context = new ApplicationDbContext())
            {
                BusinessAction lastAction = context.BusinessActions.AsEnumerable().LastOrDefault(x => x.RadnikId == model.RadnikId &&
                                                                                                 x.Date.ToShortDateString() == DateTime.Now.ToShortDateString());
                if (lastAction != null && lastAction.TipRada == Enums.TipRadaEnum.Pauza)
                {
                    context.BusinessActions.Add(new BusinessAction()
                    {
                        RadnikId     = model.RadnikId,
                        Date         = DateTime.Now,
                        TipRada      = Enums.TipRadaEnum.Radi,
                        LocalMachine = model.LocalMachine
                    });
                    context.SaveChanges();
                    res.Success = true;
                }
            }
            return(res);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 打印发票清单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barButtonItem30_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            int    rowHandle = gridView1.FocusedRowHandle;
            int    papers    = 0;
            string s_fa001   = string.Empty;

            if (rowHandle >= 0)
            {
                s_fa001 = gridView1.GetRowCellValue(rowHandle, "FA001").ToString();
                papers  = BusinessAction.GetHaveInvoicePapers(s_fa001);
                if (papers == 0)
                {
                    Tools.msg(MessageBoxIcon.Exclamation, "提示", "此收费记录尚未开具发票!");
                    return;
                }
                else if (papers == 1)  //一张发票
                {
                    using (OracleDataReader reader = SqlAssist.ExecuteReader("select * from fp01 where fa001='" + s_fa001 + "' and flag = '1' and rownum < 2"))
                    {
                        reader.Read();
                        string s_fpdm = reader["INVOICECODE"].ToString();
                        string s_fphm = reader["INVOICENUM"].ToString();
                        if (XtraMessageBox.Show("发票代码:" + s_fpdm + "\r\n" + "发票号码:" + s_fphm + "\r\n是否继续?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            TaxInvoice.PrintInvoice(s_fpdm, s_fphm, "1");
                        }
                    }
                }
                else if (papers > 1)   //多张发票
                {
                    Frm_InvoiceDisplay frm_1 = new Frm_InvoiceDisplay();
                    frm_1.swapdata["fa001"] = s_fa001;
                    frm_1.ShowDialog();
                    frm_1.Dispose();
                }
            }
        }
Ejemplo n.º 5
0
        private void sb_ok_Click(object sender, EventArgs e)
        {
            string s_reason = string.Empty;

            if (string.IsNullOrEmpty(memoEdit1.Text))
            {
                memoEdit1.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight;
                memoEdit1.ErrorText = "请输入弃墓原因!";
                memoEdit1.Focus();
                return;
            }
            if (XtraMessageBox.Show("本操作将不可撤销,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            s_reason = memoEdit1.EditValue.ToString();
            if (BusinessAction.TombQuit(ac01.AC001, s_reason, Envior.cur_userId) > 0)
            {
                XtraMessageBox.Show("办理成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 取消预定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barButtonItem20_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            int rowHandle = gridView1.FocusedRowHandle;

            if (rowHandle >= 0)
            {
                if (gridView1.GetRowCellValue(rowHandle, "STATUS").ToString() != "1")
                {
                    Tools.msg(MessageBoxIcon.Warning, "提示", "已经到期或登记的记录不能取消!");
                    return;
                }
                if (XtraMessageBox.Show("确认要取消预定吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }

                string s_bk001 = gridView1.GetRowCellValue(rowHandle, "BK001").ToString();
                if (BusinessAction.BookinCanceled(s_bk001) > 0)
                {
                    Tools.msg(MessageBoxIcon.Information, "提示", "取消预定成功!");
                    this.RefreshData();
                }
            }
        }
        public void GenerateTestFromTemplate()
        {
            ITestCodeGenerator testCodeGenerator = new TemplatedTestCodeGenerator(
                @"Templates/TestRunners/CSharpMbUnitTestRunner.vm",
                "Banking.cs");

            TestSuite testSuite = new TestSuite("Banking")
            {
                Description      = "Class description.",
                TestRunnerName   = "OnlineBanking",
                Namespace        = "OnlineBankingNamespace",
                IsParallelizable = true,
            };

            TestCase testCase = new TestCase("ViewAccountTestCase")
            {
                TestCaseDescription = "Tests case description."
            };

            testCase.AddTestCaseTag("R15");
            testCase.AddTestCaseTag("R21.1");
            testCase.AddStep(new TestCaseStep("GoToPortal"));

            TestCaseStep testCaseStep = new TestCaseStep("SignIn");

            testCaseStep.AddParameter(new TestStepParameter("username", "john"));
            testCaseStep.AddParameter(new TestStepParameter("password", "doe"));
            testCase.AddStep(testCaseStep);

            testCaseStep = new TestCaseStep("AssertIsUserIdCorrect");
            testCaseStep.AddParameter(new TestStepParameter("userId", "1"));
            testCase.AddStep(testCaseStep);

            testCase.AddStep(new TestCaseStep("AssertOperationSuccessful"));
            testSuite.AddTestCase(testCase);

            BusinessActionsRepository businessActionsRepository = new BusinessActionsRepository();
            BusinessAction            businessAction            =
                new BusinessAction("GoToPortal")
            {
                Description =
                    "Open the online banking portal web site in the browser."
            };

            businessActionsRepository.AddAction(businessAction);
            businessAction =
                new BusinessAction("SignIn")
            {
                Description = "Sign in user '{0}'."
            };
            businessAction.AddParameter(new BusinessActionParameter("username", typeof(string), "string", 0));
            businessAction.AddParameter(new BusinessActionParameter("password", typeof(string), "string", 1));
            businessActionsRepository.AddAction(businessAction);
            businessAction =
                new BusinessAction("AssertIsUserIdCorrect")
            {
                Description = "Assert if user id is correct."
            };
            businessAction.AddParameter(new BusinessActionParameter("userId", typeof(int), "integer", 0));
            businessActionsRepository.AddAction(businessAction);
            businessAction =
                new BusinessAction("AssertOperationSuccessful")
            {
                Description = "Assert the operation was successful."
            };
            businessActionsRepository.AddAction(businessAction);

            testSuite.BusinessActionsRepository = businessActionsRepository;
            testCodeGenerator.Generate(testSuite);
        }
Ejemplo n.º 8
0
        private void DoSearch()
        {
            string s_begin = string.Empty;
            string s_end   = string.Empty;
            string s_uc001 = "%";

            if (bi_begin.EditValue == null)
            {
                s_begin = "1900-01-01";
            }
            else
            {
                s_begin = Convert.ToDateTime(bi_begin.EditValue).ToString("yyyy-MM-dd");
            }


            if (bi_end.EditValue == null)
            {
                s_end = "2999-12-31";
            }
            else
            {
                s_end = Convert.ToDateTime(bi_end.EditValue).ToString("yyyy-MM-dd");
            }

            if (BusinessAction.CashierStat(s_uc001, s_begin, s_end) == 1)
            {
                this.Cursor = Cursors.WaitCursor;
                gridView1.BeginUpdate();
                dt_source.Rows.Clear();
                souAdapter.Fill(dt_source);
                gridView1.EndUpdate();
                this.Cursor = Cursors.Arrow;

                gridColumn2.SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
                gridColumn2.SummaryItem.DisplayFormat = "{0:N0}";

                gridColumn3.SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
                gridColumn3.SummaryItem.DisplayFormat = "{0:N2}";

                gridColumn4.SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
                gridColumn4.SummaryItem.DisplayFormat = "{0:N0}";

                gridColumn5.SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
                gridColumn5.SummaryItem.DisplayFormat = "{0:N2}";

                gridColumn6.SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
                gridColumn6.SummaryItem.DisplayFormat = "{0:N0}";

                gridColumn7.SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
                gridColumn7.SummaryItem.DisplayFormat = "{0:N2}";

                gridColumn8.SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
                gridColumn8.SummaryItem.DisplayFormat = "{0:N0}";

                gridColumn9.SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
                gridColumn9.SummaryItem.DisplayFormat = "{0:N2}";

                gridColumn10.SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
                gridColumn10.SummaryItem.DisplayFormat = "{0:N0}";

                gridColumn11.SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
                gridColumn11.SummaryItem.DisplayFormat = "{0:N0}";

                gridColumn12.SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
                gridColumn12.SummaryItem.DisplayFormat = "{0:N2}";
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 发票作废
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barButtonItem22_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            int rowHandle = gridView1.FocusedRowHandle;

            if (rowHandle >= 0)
            {
                string s_handler = gridView1.GetRowCellValue(rowHandle, "FA100").ToString();
                //权限检查
                //if (!AppAction.CheckRight("收费作废", s_handler)) return;

                string s_reason = string.Empty;
                //string s_ac001 = string.Empty;

                //if(gridView1.GetRowCellValue(rowHandle, "AC001") != null)
                //    s_ac001 = gridView1.GetRowCellValue(rowHandle, "AC001").ToString();

                string s_fa001  = gridView1.GetRowCellValue(rowHandle, "FA001").ToString();
                string s_fa190  = gridView1.GetRowCellValue(rowHandle, "FA190").ToString();
                string s_fpinfo = string.Empty;

                if (s_fa190 == "3" /* 原财政发票 */)
                {
                    Tools.msg(MessageBoxIcon.Exclamation, "提示", "不能作废以前财政发票收费!");
                    return;
                }

                if (XtraMessageBox.Show("确认要作废吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
                {
                    return;
                }

                //检查与开票所在工作站是否一致!!!
                if (BusinessAction.CheckWorkStationCompare(s_fa001, Envior.WORKSTATIONID) == "0")
                {
                    XtraMessageBox.Show("此笔收费发票不是在当前工作站开具,不能继续!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                Frm_RemoveFinReason frm_reason = new Frm_RemoveFinReason();
                if (frm_reason.ShowDialog() == DialogResult.OK)
                {
                    s_reason = frm_reason.swapdata["reason"].ToString();
                }
                frm_reason.Dispose();

                int re = BusinessAction.FinanceRemove(s_fa001, s_reason, Envior.cur_userId);
                ///作废成功,开始作废发票
                if (re > 0)
                {
                    this.RefreshData();
                    XtraMessageBox.Show("收费作废成功!如果本次收费已开具发票,点击【确定】开始作废已开具发票!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    CriteriaOperator    criteria          = CriteriaOperator.Parse("FA001='" + s_fa001 + "'");
                    XPCollection <FP01> xpCollection_fp01 = new XPCollection <FP01>(PersistentCriteriaEvaluationBehavior.BeforeTransaction, unitOfWork1, criteria);
                    foreach (FP01 fp01 in xpCollection_fp01)
                    {
                        s_fpinfo = "发票代码:" + fp01.INVOICECODE + "~t" + "发票号:" + fp01.INVOICENUM;
                        if (TaxInvoice.Remove(s_fa001, Envior.cur_userName) > 0) //发票作废成功
                        {
                            //修改发票作废日志
                            if (TaxInvoice.TaxRemove_log(s_fa001, Envior.cur_userName, s_reason) < 0)
                            {
                                XtraMessageBox.Show("记录发票日志错误,请与管理员联系!\r\n" + s_fpinfo, "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                        }
                        else
                        {
                            XtraMessageBox.Show("未能作废税务发票,请在【税神通】中作废指定票据!\r\n" + s_fpinfo, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 执行查询
        /// </summary>
        private void DoSearch()
        {
            string s_begin = string.Empty;
            string s_end   = string.Empty;

            if (string.IsNullOrEmpty(bi_begin.EditValue.ToString()))
            {
                s_begin = "1900-01-01";
            }
            else
            {
                s_begin = Convert.ToDateTime(bi_begin.EditValue).ToString("yyyy-MM-dd");
            }

            if (string.IsNullOrEmpty(bi_end.EditValue.ToString()))
            {
                s_end = "1900-01-01";
            }
            else
            {
                s_end = Convert.ToDateTime(bi_end.EditValue).ToString("yyyy-MM-dd");
            }

            op_begin.Value = s_begin;
            op_end.Value   = s_end;

            this.Cursor = Cursors.WaitCursor;

            //1.售墓
            dt_tomb.Rows.Clear();
            tombAdapter.Fill(dt_tomb);

            gridColumn4.SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            gridColumn4.SummaryItem.DisplayFormat = "{0:N2}";
            gridColumn1.SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Count;
            gridColumn1.SummaryItem.DisplayFormat = "共计{0:N0}笔";

            gridColumn14.Group();
            gridView1.SetGroupLevelExpanded(0, true, true);



            //2.服务祭品
            dt_goodsService.Rows.Clear();
            gserviceAdapter.Fill(dt_goodsService);

            gridColumn8.SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            gridColumn8.SummaryItem.DisplayFormat = "{0:N2}";

            gridColumn16.SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            gridColumn16.SummaryItem.DisplayFormat = "{0:N2}";

            //3.管理费
            dt_managefee.Rows.Clear();
            mfeeAdapter.Fill(dt_managefee);

            gridColumn12.SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            gridColumn12.SummaryItem.DisplayFormat = "{0:N2}";

            //计算汇总数据
            decimal dec_tomb             = decimal.Zero;
            decimal dec_tomb_refund      = decimal.Zero;
            decimal dec_sgoods           = decimal.Zero;
            decimal dec_sgoods_refund    = decimal.Zero;
            decimal dec_managefee        = decimal.Zero;
            decimal dec_managefee_refund = decimal.Zero;

            int i_tomb        = 0;
            int i_tomb_refund = 0;


            for (int i = 0; i < gridView1.RowCount; i++)
            {
                if (gridView1.GetRowCellValue(i, "AC001") != null)
                {
                    if (Convert.ToDecimal(gridView1.GetRowCellValue(i, "AC022")) >= 0)
                    {
                        dec_tomb += Convert.ToDecimal(gridView1.GetRowCellValue(i, "AC022"));
                        i_tomb++;
                    }
                    else if (Convert.ToDecimal(gridView1.GetRowCellValue(i, "AC022")) < 0)
                    {
                        dec_tomb_refund += Convert.ToDecimal(gridView1.GetRowCellValue(i, "AC022"));
                        i_tomb_refund++;
                    }
                }
            }
            te_tomb_bs.EditValue       = i_tomb;
            te_tomb_je.EditValue       = dec_tomb;
            te_tombrefund_bs.EditValue = i_tomb_refund;
            te_tombrefund_je.EditValue = dec_tomb_refund;

            for (int i = 0; i < gridView2.RowCount; i++)
            {
                if (Convert.ToDecimal(gridView2.GetRowCellValue(i, "SA007")) >= 0)
                {
                    dec_sgoods += Convert.ToDecimal(gridView2.GetRowCellValue(i, "SA007"));
                }
                else if (Convert.ToDecimal(gridView2.GetRowCellValue(i, "SA007")) < 0)
                {
                    dec_sgoods_refund += Convert.ToDecimal(gridView2.GetRowCellValue(i, "SA007"));
                }
            }
            te_sgoods.EditValue        = dec_sgoods;
            te_sgoods_refund.EditValue = dec_sgoods_refund;

            for (int i = 0; i < gridView3.RowCount; i++)
            {
                if (Convert.ToDecimal(gridView3.GetRowCellValue(i, "SA007")) >= 0)
                {
                    dec_managefee += Convert.ToDecimal(gridView3.GetRowCellValue(i, "SA007"));
                }
                else if (Convert.ToDecimal(gridView3.GetRowCellValue(i, "SA007")) < 0)
                {
                    dec_managefee_refund += Convert.ToDecimal(gridView3.GetRowCellValue(i, "SA007"));
                }
            }
            te_managefee.EditValue        = dec_managefee;
            te_managefee_refund.EditValue = dec_managefee_refund;

            te_bs.EditValue = BusinessAction.FinStat_bs(s_begin, s_end);
            te_je.EditValue = BusinessAction.FinStat_je(s_begin, s_end);

            this.Cursor = Cursors.Arrow;
        }
        /// <summary>
        /// Adds XML nodes for the specified parameters.
        /// </summary>
        /// <param name="businessAction">The business action whose parameters should be added.</param>
        /// <param name="testSuiteSchemaDocument"><see cref="XmlDocument"/> which contains the test suite template XSD.</param>
        /// <param name="xmlNode">Parent node</param>
        private void AddBusinessActionParameters(
            BusinessAction businessAction,
            XmlDocument testSuiteSchemaDocument,
            XmlNode xmlNode)
        {
            // create element complextype
            XmlNode complexTypeNode = testSuiteSchemaDocument.CreateNode(
                XmlNodeType.Element,
                "xs",
                "complexType",
                XmlNsXs);

            if (businessAction.ParametersCount == 0)
            {
                // add restriction to action withput parameters to disable text node

                // add complextContent node
                XmlNode complexContentNode = testSuiteSchemaDocument.CreateNode(
                    XmlNodeType.Element,
                    "xs",
                    "complexContent",
                    XmlNsXs);

                // add restriction node
                XmlNode restrictionNode = testSuiteSchemaDocument.CreateNode(
                    XmlNodeType.Element,
                    "xs",
                    "restriction",
                    XmlNsXs);

                // add base attribute to restriction node
                // append attribute name
                XmlAttribute xmlAttribute = testSuiteSchemaDocument.CreateAttribute("base");
                xmlAttribute.Value = "xs:anyType";
                restrictionNode.Attributes.Append(xmlAttribute);

                // append restrictionNode to complexContentNode
                complexContentNode.AppendChild(restrictionNode);

                // append complexContentNode to complexTypeNode
                complexTypeNode.AppendChild(complexContentNode);
            }
            else
            {
                // go through all business action paramters and add elements to xsd schema
                foreach (BusinessActionParameter parameter in businessAction.EnumerateParameters())
                {
                    // create element attribute
                    XmlNode attributeNode = testSuiteSchemaDocument.CreateNode(
                        XmlNodeType.Element,
                        "xs",
                        "attribute",
                        XmlNsXs);

                    // append attribute name
                    XmlAttribute xmlAttribute = testSuiteSchemaDocument.CreateAttribute("name");
                    xmlAttribute.Value = parameter.ParameterName;
                    attributeNode.Attributes.Append(xmlAttribute);

                    // append attribute type
                    xmlAttribute       = testSuiteSchemaDocument.CreateAttribute("type");
                    xmlAttribute.Value = string.Format(CultureInfo.InvariantCulture, "xs:{0}", parameter.ParameterXsdType);
                    attributeNode.Attributes.Append(xmlAttribute);

                    xmlAttribute       = testSuiteSchemaDocument.CreateAttribute("use");
                    xmlAttribute.Value = "required";
                    attributeNode.Attributes.Append(xmlAttribute);

                    complexTypeNode.AppendChild(attributeNode);
                }
            }

            xmlNode.AppendChild(complexTypeNode);
        }
Ejemplo n.º 12
0
        private void sb_ok_Click(object sender, EventArgs e)
        {
            decimal dec_price = decimal.Zero;
            decimal dec_nums  = decimal.Zero;
            string  s_fa001   = string.Empty;

            if (string.IsNullOrEmpty(te_price.Text))
            {
                te_price.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight;
                te_price.ErrorText = "管理费单价必须输入!";
                return;
            }
            else if (string.IsNullOrEmpty(te_nums.Text))
            {
                te_nums.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight;
                te_nums.ErrorText = "管理费缴费年限必须输入!";
                return;
            }

            dec_price = Convert.ToDecimal(te_price.Text);
            dec_nums  = Convert.ToDecimal(te_nums.Text);
            if (dec_price < 0)
            {
                Tools.msg(MessageBoxIcon.Warning, "提示", "管理费单价必须大于0!");
                te_price.Focus();
                return;
            }
            if (dec_nums <= 0)
            {
                Tools.msg(MessageBoxIcon.Warning, "提示", "缴费年限必须大于0!");
                te_nums.Focus();
                return;
            }
            s_fa001 = MiscAction.GetEntityPK("FA01");
            try
            {
                if (BusinessAction.ManageFee(s_fa001, ac01.AC001, dec_price, dec_nums, Envior.cur_userId, Envior.WORKSTATIONID) > 0)
                {
                    if (XtraMessageBox.Show("缴费成功!\r\n" + "是否现在开具发票?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        sb_ok.Enabled = false;
                        //获取税务客户信息
                        Frm_TaxClientInfo frm_taxClient = new Frm_TaxClientInfo(ac01.AC003);
                        if (frm_taxClient.ShowDialog() != DialogResult.OK)
                        {
                            return;
                        }
                        TaxClientInfo clientInfo = frm_taxClient.swapdata["taxclientinfo"] as TaxClientInfo;

                        CriteriaOperator    criteria          = CriteriaOperator.Parse("FA001='" + s_fa001 + "'");
                        XPCollection <FP01> xpCollection_fp01 = new XPCollection <FP01>(PersistentCriteriaEvaluationBehavior.BeforeTransaction, session1, criteria);
                        foreach (FP01 fp01 in xpCollection_fp01)
                        {
                            if (TaxInvoice.GetNextInvoiceNo() > 0)
                            {
                                if (XtraMessageBox.Show("下一张税票代码:" + Envior.NEXT_BILL_CODE + "\r\n" + "票号:" + Envior.NEXT_BILL_NUM + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                                {
                                    TaxInvoice.Invoice(fp01.FP001, clientInfo);
                                }
                            }
                        }
                    }
                    //打印缴费记录
                    Tools.msg(MessageBoxIcon.Information, "提示", "现在打印缴费记录!");
                    PrintAction.PrintPayRecord(s_fa001);
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
            }
            catch (Exception ee)
            {
                Tools.msg(MessageBoxIcon.Error, "错误", "缴费错误!\r\n" + ee.ToString());
            }
        }
Ejemplo n.º 13
0
 /// <summary>
 /// 记录操作日志
 /// </summary>
 /// <param name="module">所属模块</param>
 /// <param name="action">操作类型</param>
 /// <param name="content">操作内容</param>
 /// <param name="ex">异常</param>
 /// <returns></returns>
 public static bool LogOperator(string module, BusinessAction action, string content, Exception ex)
 {
     var log = new OperatorLog() {
         Module = module,
         Action = action.ToString(),
         ActionContent = content,
         ActionTime = DateTime.Now,
         IsSuccess = false
     };
     if (HttpContext.Current != null) {
         var loginUser = SecurityContext.User;
         if (loginUser != null) {
             log.Actor = loginUser.LoginId + "|" + loginUser.Name;
         }
     }
     log.ExceptionType = ex.GetType().ToString();
     log.ExceptionMsg = ex.GetAllMessage();
     return log.Save();
 }
Ejemplo n.º 14
0
        public async Task Add(BusinessAction action)
        {
            await DBTransactionHelper.SqlTransactionWorkAsync(DBTypes.SqlServer, false, false, _businessSecurityRuleConnectionFactory.CreateAllForBusinessSecurityRule(), async (conn, transaction) =>
            {
                SqlTransaction sqlTran = null;
                if (transaction != null)
                {
                    sqlTran = (SqlTransaction)transaction;
                }

                using (SqlCommand commond = new SqlCommand()
                {
                    Connection = (SqlConnection)conn,
                    CommandType = CommandType.Text,
                    Transaction = sqlTran
                })
                {
                    if (action.ID == Guid.Empty)
                    {
                        commond.CommandText = @"insert into BusinessAction WITH (SNAPSHOT)([id],[name],[rule],[originalparametersfiltertype],[errorreplacetext],[createtime],[modifytime])
                                    values(default,@name,@rule,@originalparametersfiltertype,@errorreplacetext,getutcdate(),getutcdate());
                                    select @newid=[id] from BusinessAction where [sequence]=SCOPE_IDENTITY()";
                    }
                    else
                    {
                        commond.CommandText = @"insert into BusinessAction WITH (SNAPSHOT)([id],[name],[rule],[originalparametersfiltertype],[errorreplacetext],[createtime],[modifytime])
                                    values(@id,@name,@rule,@originalparametersfiltertype,@errorreplacetext,getutcdate(),getutcdate())";
                    }

                    SqlParameter parameter;
                    if (action.ID != Guid.Empty)
                    {
                        parameter = new SqlParameter("@id", SqlDbType.UniqueIdentifier)
                        {
                            Value = action.ID
                        };
                        commond.Parameters.Add(parameter);
                    }
                    else
                    {
                        parameter = new SqlParameter("@newid", SqlDbType.UniqueIdentifier)
                        {
                            Direction = ParameterDirection.Output
                        };
                        commond.Parameters.Add(parameter);
                    }


                    parameter = new SqlParameter("@name", SqlDbType.NVarChar, 150)
                    {
                        Value = action.Name
                    };
                    commond.Parameters.Add(parameter);

                    parameter = new SqlParameter("@rule", SqlDbType.NVarChar, action.Rule.Length)
                    {
                        Value = action.Rule
                    };
                    commond.Parameters.Add(parameter);


                    parameter = new SqlParameter("@originalparametersfiltertype", SqlDbType.NVarChar, 150)
                    {
                        Value = action.OriginalParametersFilterType
                    };
                    commond.Parameters.Add(parameter);

                    if (action.ErrorReplaceText == null)
                    {
                        parameter = new SqlParameter("@errorreplacetext", SqlDbType.NVarChar, 1500)
                        {
                            Value = DBNull.Value
                        };
                    }
                    else
                    {
                        parameter = new SqlParameter("@errorreplacetext", SqlDbType.NVarChar, 1500)
                        {
                            Value = action.ErrorReplaceText
                        };
                    }
                    commond.Parameters.Add(parameter);

                    commond.Prepare();


                    await commond.ExecuteNonQueryAsync();



                    if (action.ID == Guid.Empty)
                    {
                        action.ID = (Guid)commond.Parameters["@newid"].Value;
                    }
                }
            });
        }
Ejemplo n.º 15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void sb_ok_Click(object sender, EventArgs e)
        {
            string s_fa001 = string.Empty;
            FA01   fa01    = null;
            SA01   sa01    = null;
            BI01   bi01    = null;
            AC01   ac01_m  = null;
            REFUND refund  = null;
            int    i_invoice_num;

            if (XtraMessageBox.Show("确认要进行退墓操作,本操作将不可撤销,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }
            if (decimal.TryParse(te_refund.Text, out dec_tomb))
            {
                if (dec_tomb <= 0 || dec_tomb > ac01.AC022)
                {
                    te_refund.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight;
                    te_refund.ErrorText = "退费金额错误!";
                    return;
                }
            }
            else
            {
                te_refund.ErrorImageOptions.Alignment = ErrorIconAlignment.MiddleRight;
                te_refund.ErrorText = "请输入退购墓费!";
                return;
            }
            try
            {
                s_fa001 = MiscAction.GetEntityPK("FA01");

                //2.保存销售记录
                sa01        = new SA01(unitOfWork1);
                sa01.SA001  = MiscAction.GetEntityPK("SA01");              //销售流水号
                sa01.AC001  = ac01.AC001;                                  //购墓流水号
                sa01.SA002  = '0';                                         //服务或商品类别 0-购墓费 1-商品或服务 2-管理费
                sa01.SA003  = "购墓费";
                sa01.SA004  = ac01.AC015;                                  //墓位编号
                sa01.SA005  = '0';                                         //业务类型 0-购墓 1-临时销售
                sa01.PRICE  = dec_tomb;                                    //单价
                sa01.NUMS   = -1;                                          //数量
                sa01.SA007  = 0 - dec_tomb;                                //金额
                sa01.SA006  = sa01.SA007;                                  //原始单价
                sa01.SA008  = '1';                                         //结算状态 1-已结算 0-未结算
                sa01.SA010  = s_fa001;                                     //结算流水号
                sa01.SA020  = 'T';                                         //发票类型
                sa01.SA025  = MiscAction.GetSysParaValue1("tomb_taxrate"); //税率
                sa01.SA100  = Envior.cur_userId;                           //经办人
                sa01.SA200  = Tools.GetServerDate();                       //经办日期
                sa01.STATUS = '1';                                         //状态 1-正常 0-删除
                sa01.Save();

                for (int i = 0; i < gridView1.RowCount; i++)
                {
                    if (!gridView1.IsRowSelected(i))
                    {
                        continue;
                    }
                    sa01        = new SA01(unitOfWork1);
                    sa01.SA001  = MiscAction.GetEntityPK("SA01");                                      //销售流水号
                    sa01.AC001  = ac01.AC001;                                                          //购墓流水号
                    sa01.SA002  = '1';                                                                 //服务或商品类别 0-购墓费 1-商品或服务 2-管理费
                    sa01.SA003  = gridView1.GetRowCellValue(i, "SA003").ToString();                    //项目名称
                    sa01.SA004  = gridView1.GetRowCellValue(i, "SA004").ToString();                    //项目编号
                    sa01.SA005  = '0';                                                                 //业务类型 0-购墓 1-临时销售
                    sa01.PRICE  = Convert.ToDecimal(gridView1.GetRowCellValue(i, "PRICE"));            //单价
                    sa01.NUMS   = 0 - Convert.ToDecimal(gridView1.GetRowCellValue(i, "NUMS"));         //数量
                    sa01.SA007  = 0 - Convert.ToDecimal(gridView1.GetRowCellValue(i, "SA007"));        //金额
                    sa01.SA006  = sa01.SA007;                                                          //原始单价
                    sa01.SA008  = '1';                                                                 //结算状态 1-已结算 0-未结算
                    sa01.SA010  = s_fa001;                                                             //结算流水号
                    sa01.SA020  = 'T';                                                                 //发票类型
                    sa01.SA025  = BusinessAction.GetTaxRate(sa01.SA004);                               //税率
                    sa01.SA100  = Envior.cur_userId;                                                   //经办人
                    sa01.SA200  = Tools.GetServerDate();                                               //经办日期
                    sa01.STATUS = '1';                                                                 //状态 1-正常 0-删除
                    sa01.Save();
                }

                //3.保存退费日志
                refund       = new REFUND(unitOfWork1);
                refund.RF001 = s_fa001;
                refund.RF003 = te_reason.Text;
                refund.RF004 = 0 - (dec_tomb + dec_sales);
                refund.RF100 = Envior.cur_userId;
                refund.RF200 = Tools.GetServerDate();
                refund.RF300 = ac01.AC048;                               //原结算流水号
                refund.Save();

                ///4.保存缴费记录
                fa01        = new FA01(unitOfWork1);
                fa01.FA001  = s_fa001;                    //结算流水号
                fa01.FA002  = '0';                        //结算类型 0-购墓 1-服务祭品 2-管理费
                fa01.FA003  = ac01.AC003;                 //购墓人
                fa01.FA004  = 0 - (dec_tomb + dec_sales); //金额
                fa01.FA190  = '0';                        //开票标志 0-未开票
                fa01.FA100  = Envior.cur_userId;          //经办人
                fa01.FA200  = Tools.GetServerDate();      //经办日期
                fa01.STATUS = "1";                        //状态
                fa01.AC001  = ac01.AC001;
                fa01.WS001  = Envior.WORKSTATIONID;       //工作站
                fa01.Save();

                //5.修改ac01
                ac01_m        = unitOfWork1.GetObjectByKey <AC01>(ac01.AC001, true);
                ac01_m.STATUS = '2';                                     //状态-退墓
                ac01_m.Save();

                //6.修改号位状态
                bi01 = unitOfWork1.GetObjectByKey <BI01>(ac01.AC015, true);
                if (bi01 != null)
                {
                    bi01.AC001  = "";
                    bi01.STATUS = '1';
                    bi01.Save();
                }
                unitOfWork1.CommitTransaction();

                i_invoice_num = BusinessAction.GetInvoicePapers(s_fa001);
                if (i_invoice_num == 0)
                {
                    Tools.msg(MessageBoxIcon.Information, "提示", "退墓成功!");
                }
                else
                {
                    if (XtraMessageBox.Show("退墓办理成功!\r\n" + "本次业务共需要" + i_invoice_num.ToString() + "张发票,现在开具吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        sb_ok.Enabled = false;
                        //获取税务客户信息
                        string            s_ac003       = te_ac003.Text;
                        Frm_TaxClientInfo frm_taxClient = new Frm_TaxClientInfo(s_ac003);
                        if (frm_taxClient.ShowDialog() != DialogResult.OK)
                        {
                            return;
                        }
                        TaxClientInfo clientInfo = frm_taxClient.swapdata["taxclientinfo"] as TaxClientInfo;

                        CriteriaOperator    criteria          = CriteriaOperator.Parse("FA001='" + s_fa001 + "'");
                        XPCollection <FP01> xpCollection_fp01 = new XPCollection <FP01>(PersistentCriteriaEvaluationBehavior.BeforeTransaction, unitOfWork1, criteria);
                        foreach (FP01 fp01 in xpCollection_fp01)
                        {
                            if (TaxInvoice.GetNextInvoiceNo() > 0)
                            {
                                if (XtraMessageBox.Show("下一张税票代码:" + Envior.NEXT_BILL_CODE + "\r\n" + "票号:" + Envior.NEXT_BILL_NUM + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                                {
                                    TaxInvoice.Invoice(fp01.FP001, clientInfo);
                                }
                            }
                        }
                    }
                }
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ee)
            {
                unitOfWork1.RollbackTransaction();
                Tools.msg(MessageBoxIcon.Error, "错误", ee.ToString());
            }
        }
 public void MissingBusinessActionDataEntryTest()
 {
     BusinessActionsRepository businessActionsRepository = new BusinessActionsRepository();
     BusinessAction            entry = businessActionsRepository.GetAction("NoAction");
 }
Ejemplo n.º 17
0
        /// <summary>
        /// Creates a new instance of the NerdBlock authorization instance
        /// </summary>
        public NerdAuth()
        {
            // Create the colelctions
            myAuths     = new AutoDictionary <EmployeeRole, List <AuthEntry> >();
            myNullAuths = new List <string>();

            // Add all the employee roles as auth roles
            EmployeeRole[] roles = DataAccess.SelectAll <EmployeeRole>();
            for (int index = 0; index < roles.Length; index++)
            {
                myAuths[roles[index]] = new List <AuthEntry>();
            }

            // Get the assembly
            Assembly assembly = Assembly.GetExecutingAssembly();

            // Get any type that has the action container attribute
            Type[] types = assembly.GetTypes().Where(T => T.GetCustomAttribute <BusinessActionContainer>() != null).ToArray();

            // Iterate over each type
            for (int index = 0; index < types.Length; index++)
            {
                // Get the methods that are marked as a business action
                MethodInfo[] methods = types[index].GetMethods().Where(M => M.GetCustomAttribute <BusinessAction>() != null && M.GetParameters().Length == 0).ToArray();

                // Iterate over all methods
                for (int mIndex = 0; mIndex < methods.Length; mIndex++)
                {
                    // Get the methods
                    MethodInfo     mi       = methods[mIndex];
                    AuthAttrib     authRule = methods[mIndex].GetCustomAttribute <AuthAttrib>();
                    BusinessAction rule     = methods[mIndex].GetCustomAttribute <BusinessAction>();

                    // As long as we have both an action attrib and an auth attrib
                    if (authRule != null && rule != null)
                    {
                        // Add the action to our null auths if applicable
                        if (authRule.AllowNull)
                        {
                            myNullAuths.Add(rule.Name);
                        }

                        // Iterate over each role access in the attribute
                        for (int rIndex = 0; rIndex < authRule.RoleNames.Length; rIndex++)
                        {
                            // If the role name is an asterics, we grant to all
                            if (authRule.RoleNames[rIndex] == "*")
                            {
                                // Iterate over all roles and grant access to the action
                                for (int riIndex = 0; riIndex < roles.Length; riIndex++)
                                {
                                    myAuths[roles[riIndex]].Add(rule.Name);
                                }

                                // Break out of the loop
                                break;
                            }
                            // If the role name is anything else, handle it!
                            else
                            {
                                // Try to find a role by that name
                                EmployeeRole role = roles.FirstOrDefault((X) => X.Name.ToLower() == authRule.RoleNames[rIndex].ToLower());

                                // If we found a role, give it permission for this action
                                if (role != null)
                                {
                                    myAuths[role].Add(rule.Name);
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 18
0
        public async Task <QueryResult <BusinessAction> > QueryByNullRelationGroup(Guid groupId, int page, int pageSize)
        {
            QueryResult <BusinessAction> result = new QueryResult <BusinessAction>();

            await DBTransactionHelper.SqlTransactionWorkAsync(DBTypes.SqlServer, true, false, _businessSecurityRuleConnectionFactory.CreateReadForBusinessSecurityRule(), async (conn, transaction) =>
            {
                SqlTransaction sqlTran = null;
                if (transaction != null)
                {
                    sqlTran = (SqlTransaction)transaction;
                }

                using (SqlCommand commond = new SqlCommand()
                {
                    Connection = (SqlConnection)conn,
                    CommandType = CommandType.Text,
                    Transaction = sqlTran,
                    CommandText = string.Format(@"set @currentpage=@page
		                           select @count= count(*) from [dbo].[BusinessAction] WITH (SNAPSHOT) as act
                                   left outer join
                                   (
                                        select act.id as existid from [dbo].[BusinessAction] WITH (SNAPSHOT) as act join [dbo].[BusinessActionGroupRelation] WITH (SNAPSHOT) as relation
                                        on act.id=relation.actionid 
                                        where relation.groupid=@groupid
                                    )as t
                                    on act.id=t.existid
                                    where t.existid is null

		                           if @pagesize*@page>=@count
			                          begin
				                           set @currentpage= @count/@pagesize
				                           if @count%@pagesize<>0
					                           begin
						                            set @currentpage=@currentpage+1
					                           end
				                           if @currentpage=0
					                           set @currentpage=1
			                          end
		                            else if @page<1 
			                           begin 
				                           set @currentpage=1
			                           end
	
                                    select {0} from [dbo].[BusinessAction] as act
                                   left outer join
                                   (
                                        select act.id as existid from [dbo].[BusinessAction] WITH (SNAPSHOT) as act join [dbo].[BusinessActionGroupRelation] WITH (SNAPSHOT)  as relation
                                        on act.id=relation.actionid 
                                        where relation.groupid=@groupid
                                    )as t
                                    on act.id=t.existid
                                    where t.existid is null  
                                    order by [actsequence]
		                            offset (@pagesize * (@currentpage - 1)) rows 
		                            fetch next @pagesize rows only;"        , StoreHelper.GetBusinessActionSelectFields("act"))
                })
                {
                    var parameter = new SqlParameter("@page", SqlDbType.Int)
                    {
                        Value = page
                    };
                    commond.Parameters.Add(parameter);

                    parameter = new SqlParameter("@pagesize", SqlDbType.Int)
                    {
                        Value = pageSize
                    };
                    commond.Parameters.Add(parameter);

                    parameter = new SqlParameter("@groupid", SqlDbType.UniqueIdentifier)
                    {
                        Value = groupId
                    };
                    commond.Parameters.Add(parameter);

                    parameter = new SqlParameter("@count", SqlDbType.Int)
                    {
                        Direction = ParameterDirection.Output
                    };
                    commond.Parameters.Add(parameter);

                    parameter = new SqlParameter("@currentpage", SqlDbType.Int)
                    {
                        Direction = ParameterDirection.Output
                    };
                    commond.Parameters.Add(parameter);

                    commond.Prepare();

                    using (var reader = await commond.ExecuteReaderAsync())
                    {
                        while (await reader.ReadAsync())
                        {
                            var action = new BusinessAction();
                            StoreHelper.SetBusinessActionSelectFields(action, reader, "act");
                            result.Results.Add(action);
                        }

                        reader.Close();

                        result.TotalCount  = (int)commond.Parameters["@count"].Value;
                        result.CurrentPage = (int)commond.Parameters["@currentpage"].Value;
                    }
                }
            });

            return(result);
        }
Ejemplo n.º 19
0
        public async Task Update(BusinessAction action)
        {
            await DBTransactionHelper.SqlTransactionWorkAsync(DBTypes.SqlServer, false, false, _businessSecurityRuleConnectionFactory.CreateReadForBusinessSecurityRule(), async (conn, transaction) =>
            {
                SqlTransaction sqlTran = null;
                if (transaction != null)
                {
                    sqlTran = (SqlTransaction)transaction;
                }

                using (SqlCommand commond = new SqlCommand()
                {
                    Connection = (SqlConnection)conn,
                    CommandType = CommandType.Text,
                    Transaction = sqlTran,
                    CommandText = @"update BusinessAction WITH (SNAPSHOT) set [name]=@name,[rule]=@rule,[originalparametersfiltertype]=@originalparametersfiltertype,[errorreplacetext]=@errorreplacetext,[modifytime]=getutcdate()
                                    where [id]=@id"
                })
                {
                    var parameter = new SqlParameter("@id", SqlDbType.UniqueIdentifier)
                    {
                        Value = action.ID
                    };
                    commond.Parameters.Add(parameter);


                    parameter = new SqlParameter("@name", SqlDbType.NVarChar, 150)
                    {
                        Value = action.Name
                    };
                    commond.Parameters.Add(parameter);

                    parameter = new SqlParameter("@rule", SqlDbType.NVarChar, action.Rule.Length)
                    {
                        Value = action.Rule
                    };
                    commond.Parameters.Add(parameter);


                    parameter = new SqlParameter("@originalparametersfiltertype", SqlDbType.NVarChar, 150)
                    {
                        Value = action.OriginalParametersFilterType
                    };
                    commond.Parameters.Add(parameter);

                    if (action.ErrorReplaceText == null)
                    {
                        parameter = new SqlParameter("@errorreplacetext", SqlDbType.NVarChar, 1500)
                        {
                            Value = DBNull.Value
                        };
                    }
                    else
                    {
                        parameter = new SqlParameter("@errorreplacetext", SqlDbType.NVarChar, 1500)
                        {
                            Value = action.ErrorReplaceText
                        };
                    }
                    commond.Parameters.Add(parameter);

                    commond.Prepare();


                    await commond.ExecuteNonQueryAsync();
                }
            });
        }
Ejemplo n.º 20
0
        public async Task <QueryResult <BusinessAction> > QueryByName(string name, int page, int pageSize)
        {
            QueryResult <BusinessAction> result = new QueryResult <BusinessAction>();

            await DBTransactionHelper.SqlTransactionWorkAsync(DBTypes.SqlServer, true, false, _businessSecurityRuleConnectionFactory.CreateReadForBusinessSecurityRule(), async (conn, transaction) =>
            {
                SqlTransaction sqlTran = null;
                if (transaction != null)
                {
                    sqlTran = (SqlTransaction)transaction;
                }

                using (SqlCommand commond = new SqlCommand()
                {
                    Connection = (SqlConnection)conn,
                    CommandType = CommandType.Text,
                    Transaction = sqlTran,
                    CommandText = string.Format(@"set @currentpage=@page
		                           select @count= count(*) from BusinessAction WITH (SNAPSHOT) where [name] like @name 
		                           if @pagesize*@page>=@count
			                          begin
				                           set @currentpage= @count/@pagesize
				                           if @count%@pagesize<>0
					                           begin
						                            set @currentpage=@currentpage+1
					                           end
				                           if @currentpage=0
					                           set @currentpage=1
			                          end
		                            else if @page<1 
			                           begin 
				                           set @currentpage=1
			                           end
	
                                    select {0} from BusinessAction WITH (SNAPSHOT) where [name] like @name  
                                    order by [actsequence]
		                            offset (@pagesize * (@currentpage - 1)) rows 
		                            fetch next @pagesize rows only;"        , StoreHelper.GetBusinessActionSelectFields(string.Empty))
                })
                {
                    var parameter = new SqlParameter("@page", SqlDbType.Int)
                    {
                        Value = page
                    };
                    commond.Parameters.Add(parameter);

                    parameter = new SqlParameter("@pagesize", SqlDbType.Int)
                    {
                        Value = pageSize
                    };
                    commond.Parameters.Add(parameter);

                    parameter = new SqlParameter("@name", SqlDbType.NVarChar, 150)
                    {
                        Value = $"{name.ToSqlLike()}%"
                    };
                    commond.Parameters.Add(parameter);

                    parameter = new SqlParameter("@count", SqlDbType.Int)
                    {
                        Direction = ParameterDirection.Output
                    };
                    commond.Parameters.Add(parameter);

                    parameter = new SqlParameter("@currentpage", SqlDbType.Int)
                    {
                        Direction = ParameterDirection.Output
                    };
                    commond.Parameters.Add(parameter);

                    commond.Prepare();

                    using (var reader = await commond.ExecuteReaderAsync())
                    {
                        while (await reader.ReadAsync())
                        {
                            var action = new BusinessAction();
                            StoreHelper.SetBusinessActionSelectFields(action, reader, string.Empty);
                            result.Results.Add(action);
                        }

                        reader.Close();

                        result.TotalCount  = (int)commond.Parameters["@count"].Value;
                        result.CurrentPage = (int)commond.Parameters["@currentpage"].Value;
                    }
                }
            });

            return(result);
        }
Ejemplo n.º 21
0
        public async Task QueryByGroup(Guid groupId, Func <BusinessAction, Task> callback)
        {
            List <BusinessAction> actionList = new List <BusinessAction>();

            await DBTransactionHelper.SqlTransactionWorkAsync(DBTypes.SqlServer, true, false, _businessSecurityRuleConnectionFactory.CreateReadForBusinessSecurityRule(), async (conn, transaction) =>
            {
                Int64?sequence = null;
                int pageSize   = 500;

                while (true)
                {
                    actionList.Clear();

                    SqlTransaction sqlTran = null;
                    if (transaction != null)
                    {
                        sqlTran = (SqlTransaction)transaction;
                    }

                    using (SqlCommand commond = new SqlCommand()
                    {
                        Connection = (SqlConnection)conn,
                        CommandType = CommandType.Text,
                        Transaction = sqlTran
                    })
                    {
                        if (!sequence.HasValue)
                        {
                            commond.CommandText = string.Format(@"select top (@pagesize) {0} from BusinessAction WITH (SNAPSHOT) as act join BusinessActionGroupRelation WITH (SNAPSHOT) as relation on act.id=relation.[actionid] where relation.[groupid]=@groupid order by act.[sequence]", StoreHelper.GetBusinessActionSelectFields("act"));
                        }
                        else
                        {
                            commond.CommandText = string.Format(@"select top (@pagesize) {0} from BusinessAction WITH (SNAPSHOT) as act join BusinessActionGroupRelation WITH (SNAPSHOT) as relation on act.id=relation.[actionid] where relation.[groupid]=@groupid and act.[sequence]>@sequence order by act.[sequence]", StoreHelper.GetBusinessActionSelectFields("act"));
                        }

                        var parameter = new SqlParameter("@groupid", SqlDbType.UniqueIdentifier)
                        {
                            Value = groupId
                        };
                        commond.Parameters.Add(parameter);

                        parameter = new SqlParameter("@pagesize", SqlDbType.Int)
                        {
                            Value = pageSize
                        };
                        commond.Parameters.Add(parameter);

                        if (sequence.HasValue)
                        {
                            parameter = new SqlParameter("@sequence", SqlDbType.BigInt)
                            {
                                Value = sequence
                            };
                            commond.Parameters.Add(parameter);
                        }

                        commond.Prepare();

                        using (var reader = await commond.ExecuteReaderAsync())
                        {
                            while (await reader.ReadAsync())
                            {
                                var action = new BusinessAction();
                                StoreHelper.SetBusinessActionSelectFields(action, reader, "act");
                                sequence = (Int64)reader["actsequence"];
                                actionList.Add(action);
                            }

                            reader.Close();
                        }
                    }

                    foreach (var actionItem in actionList)
                    {
                        await callback(actionItem);
                    }

                    if (actionList.Count != pageSize)
                    {
                        break;
                    }
                }
            });
        }
Ejemplo n.º 22
0
        private void sb_ok_Click(object sender, EventArgs e)
        {
            bool b_payrecord = false;

            if (!checkBeforeSave())
            {
                return;
            }
            try
            {
                s_fa001 = MiscAction.GetEntityPK("FA01");
                //1.购墓登记
                ac01       = new AC01(unitOfWork1);
                ac01.AC001 = s_ac001;                            //购墓登记编号
                ac01.AC002 = te_ac002.Text;                      //购墓人身份证号
                ac01.AC003 = te_ac003.Text;                      //购墓人
                ac01.AC004 = te_ac004.Text;                      //联系电话
                ac01.AC005 = te_ac005.Text;                      //联系地址
                ac01.AC012 = bi01.RE001;                         //排编号
                ac01.AC010 = bi01.RG001;                         //墓区编号
                ac01.AC015 = bi01.BI001;                         //墓位编号
                ac01.AC020 = Convert.ToDecimal(bi01.PRICE);      //墓位定价
                ac01.AC022 = Convert.ToDecimal(te_price.Text);   //售价
                ac01.AC038 = Convert.ToInt32(te_free_nums.Text); //免费管理年限
                ac01.AC049 = Convert.ToDateTime(de_ac049.Text);  //购墓日期

                //管理费到期日期
                if (ac01.AC038 > 0)
                {
                    ac01.AC040  = ac01.AC049.AddYears(ac01.AC038);
                    b_payrecord = true;
                }
                else
                {
                    int rowHandle = gridView1.LocateByValue("SA003", "管理费");
                    if (rowHandle >= 0)
                    {
                        ac01.AC040  = ac01.AC049.AddYears(Convert.ToInt32(gridView1.GetRowCellValue(rowHandle, "NUMS")));
                        b_payrecord = true;
                    }
                    else
                    {
                        ac01.AC040 = ac01.AC049;
                    }
                }

                ac01.AC042  = '1';                      //缴费状态
                ac01.AC048  = s_fa001;                  //缴费流水号
                ac01.AC100  = Envior.cur_userId;        //经办人
                ac01.AC200  = Tools.GetServerDate();    //经办日期
                ac01.AC250  = te_ac250.Text;            //备注
                ac01.AC300  = '1';                      //登记类型 1-正常登记 0-原始登记
                ac01.STATUS = '1';                      //当前状态
                ac01.Save();

                //2.销售项目
                foreach (SA01 sa01 in xpCollection_sa01)
                {
                    sa01.SA008 = '1';                   //结算状态
                    sa01.SA010 = s_fa001;               //结算流水号
                    sa01.SA020 = 'T';                   //发票类型
                    sa01.SA100 = Envior.cur_userId;     //经办人
                    sa01.SA200 = Tools.GetServerDate(); //经办日期
                    sa01.Save();
                    if (sa01.SA003 == "管理费" /*如果是管理费*/ && sa01.SA002 == '1')
                    {
                        //插入缴费表
                        PR01 pr01 = new PR01(unitOfWork1);
                        pr01.PR001  = s_fa001;
                        pr01.AC001  = s_ac001;
                        pr01.PR002  = ac01.AC049;  //缴费开始日期
                        pr01.PR003  = ac01.AC049.AddYears(Convert.ToInt32(sa01.NUMS));
                        pr01.PRICE  = sa01.PRICE;
                        pr01.NUMS   = sa01.NUMS;
                        pr01.PR007  = sa01.SA007;
                        pr01.PR008  = '1';
                        pr01.PR100  = Envior.cur_userId;
                        pr01.PR200  = Tools.GetServerDate();
                        pr01.STATUS = '1';
                        pr01.Save();
                    }
                }


                //3.号位信息
                bi01.STATUS = '2';                                  //已使用
                bi01.PRICE  = Convert.ToDecimal(te_fixprice.Text);  //定价
                bi01.BI005  = le_mx.EditValue.ToString();           //墓型
                bi01.AC001  = s_ac001;                              //购墓登记编号
                bi01.Save();

                //4.财务收费信息
                dec_total = dec_sales + Convert.ToDecimal(te_price.Text);
                FA01 fa01 = new FA01(unitOfWork1);
                fa01.FA001 = s_fa001;                                 //缴费流水号
                fa01.AC001 = s_ac001;                                 //购墓流水号
                fa01.FA002 = '0';                                     //收费类型 0-购墓
                fa01.FA003 = te_ac003.Text;                           //缴费人
                fa01.FA004 = dec_total;                               //收费金额
                fa01.FA190 = '0';                                     //开票标志-未开票
                fa01.FA100 = Envior.cur_userId;                       //收费人

                fa01.FA180  = MiscAction.GetTombPosition(bi01.BI001); //备注(墓穴位置)
                fa01.FA200  = Tools.GetServerDate();                  //缴费时间
                fa01.STATUS = "1";                                    //状态
                fa01.WS001  = Envior.WORKSTATIONID;                   //工作站标识
                fa01.Save();

                //如果是预定的记录
                if (bk01 != null && s_action == "bookin")
                {
                    bk01.STATUS = '2';   //已登记
                    bk01.Save();
                }

                unitOfWork1.CommitTransaction();
                ///设置附加信息
                BusinessAction.SetExtraInfo(s_ac001);

                int i_papers = BusinessAction.GetInvoicePapers(s_fa001);
                if (XtraMessageBox.Show("登记办理成功!\r\n" + "本次结算共需要" + i_papers.ToString() + "张发票,现在开具吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    sb_ok.Enabled = false;
                    //获取税务客户信息
                    string            s_ac003       = te_ac003.Text;
                    Frm_TaxClientInfo frm_taxClient = new Frm_TaxClientInfo(s_ac003);
                    if (frm_taxClient.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }
                    TaxClientInfo clientInfo = frm_taxClient.swapdata["taxclientinfo"] as TaxClientInfo;

                    CriteriaOperator    criteria          = CriteriaOperator.Parse("FA001='" + s_fa001 + "'");
                    XPCollection <FP01> xpCollection_fp01 = new XPCollection <FP01>(PersistentCriteriaEvaluationBehavior.BeforeTransaction, unitOfWork1, criteria);
                    foreach (FP01 fp01 in xpCollection_fp01)
                    {
                        if (TaxInvoice.GetNextInvoiceNo() > 0)
                        {
                            if (XtraMessageBox.Show("下一张税票代码:" + Envior.NEXT_BILL_CODE + "\r\n" + "票号:" + Envior.NEXT_BILL_NUM + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                            {
                                TaxInvoice.Invoice(fp01.FP001, clientInfo);
                            }
                        }
                    }
                }
                ////打印证书
                if (XtraMessageBox.Show("现在打印【购墓证书】?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    PrintAction.PrintCert(s_ac001);
                }
                if (b_payrecord && XtraMessageBox.Show("现在打印【缴费记录】?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    PrintAction.PrintPayRecord(s_fa001);
                }
                ////打印购墓协议
                //if (XtraMessageBox.Show("现在打印【购墓协议】?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                //{
                //    PrintAction.PrintProtocol(s_ac001);
                //}


                this.Close();
            }
            catch (Exception ee)
            {
                unitOfWork1.RollbackTransaction();
                Tools.msg(MessageBoxIcon.Error, "错误", ee.ToString());
            }
        }
Ejemplo n.º 23
0
        private void sb_ok_Click(object sender, EventArgs e)
        {
            if (!checkBeforeSave())
            {
                return;
            }
            try
            {
                s_fa001 = MiscAction.GetEntityPK("FA01");

                //保存销售记录
                foreach (SA01 sa01 in xpCollection_sa01)
                {
                    sa01.SA008 = '1';                   //结算状态
                    sa01.SA010 = s_fa001;               //结算流水号
                    sa01.SA020 = 'T';                   //发票类型
                    sa01.SA100 = Envior.cur_userId;     //经办人
                    sa01.SA200 = Tools.GetServerDate(); //经办日期
                    dec_sum   += sa01.SA007;
                }
                //财务收费信息
                FA01 fa01 = new FA01(unitOfWork1);
                fa01.FA001  = s_fa001;                              //缴费流水号
                fa01.FA002  = '1';                                  //收费类型 0-购墓 1-服务祭品 2-管理费
                fa01.FA003  = te_cuname.Text;                       //缴费人
                fa01.FA004  = dec_sum;                              //收费金额
                fa01.FA190  = '0';                                  //开票标志 0-未开票
                fa01.FA100  = Envior.cur_userId;                    //收费人
                fa01.FA180  = "";                                   //备注
                fa01.FA200  = Tools.GetServerDate();                //缴费时间
                fa01.STATUS = "1";                                  //状态
                fa01.WS001  = Envior.WORKSTATIONID;                 //工作站标识
                fa01.Save();

                unitOfWork1.CommitTransaction();

                //////////保存完成 //////////
                int i_papers = BusinessAction.GetInvoicePapers(s_fa001);
                if (XtraMessageBox.Show("办理成功!\r\n" + "本次结算共需要" + i_papers.ToString() + "张发票,现在开具吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    sb_ok.Enabled = false;
                    //获取税务客户信息
                    string            s_ac003       = te_cuname.Text;
                    Frm_TaxClientInfo frm_taxClient = new Frm_TaxClientInfo(s_ac003);
                    if (frm_taxClient.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }
                    TaxClientInfo clientInfo = frm_taxClient.swapdata["taxclientinfo"] as TaxClientInfo;

                    CriteriaOperator    criteria          = CriteriaOperator.Parse("FA001='" + s_fa001 + "'");
                    XPCollection <FP01> xpCollection_fp01 = new XPCollection <FP01>(PersistentCriteriaEvaluationBehavior.BeforeTransaction, unitOfWork1, criteria);
                    foreach (FP01 fp01 in xpCollection_fp01)
                    {
                        if (TaxInvoice.GetNextInvoiceNo() > 0)
                        {
                            if (XtraMessageBox.Show("下一张税票代码:" + Envior.NEXT_BILL_CODE + "\r\n" + "票号:" + Envior.NEXT_BILL_NUM + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                            {
                                TaxInvoice.Invoice(fp01.FP001, clientInfo);
                            }
                        }
                    }
                }

                this.Close();
            }
            catch (Exception ee)
            {
                unitOfWork1.RollbackTransaction();
                Tools.msg(MessageBoxIcon.Error, "错误", ee.ToString());
            }
        }
Ejemplo n.º 24
0
        private void sb_ok_Click(object sender, EventArgs e)
        {
            decimal dec_total   = decimal.Zero;
            string  s_new_fa001 = string.Empty;
            SA01    sa01        = null;
            FA01    fa01_new    = null;

            if (gridView1.GetSelectedRows().Length == 0)
            {
                Tools.msg(MessageBoxIcon.Exclamation, "提示", "请先选择要退费的项目!");
                return;
            }

            try
            {
                dec_total   = Convert.ToDecimal(te_total.EditValue);
                s_new_fa001 = MiscAction.GetEntityPK("FA01");

                for (int i = 0; i < gridView1.RowCount; i++)
                {
                    if (!gridView1.IsRowSelected(i))
                    {
                        continue;
                    }
                    sa01        = new SA01(unitOfWork1);
                    sa01.SA001  = MiscAction.GetEntityPK("SA01");                                      //销售流水号
                    sa01.AC001  = fa01.AC001;                                                          //购墓流水号
                    sa01.SA002  = fa01.FA002 == '2' ? '2':'1';                                         //服务或商品类别 0-购墓费 1-商品或服务 2-管理费
                    sa01.SA003  = gridView1.GetRowCellValue(i, "SA003").ToString();                    //项目名称
                    sa01.SA004  = gridView1.GetRowCellValue(i, "SA004").ToString();                    //项目编号
                    sa01.SA005  = fa01.FA002;                                                          //业务类型 0-购墓 1-临时销售
                    sa01.PRICE  = Convert.ToDecimal(gridView1.GetRowCellValue(i, "PRICE"));            //单价
                    sa01.NUMS   = 0 - Convert.ToDecimal(gridView1.GetRowCellValue(i, "NUMS"));         //数量
                    sa01.SA007  = 0 - Convert.ToDecimal(gridView1.GetRowCellValue(i, "SA007"));        //金额
                    sa01.SA006  = sa01.SA007;                                                          //原始单价
                    sa01.SA008  = '1';                                                                 //结算状态 1-已结算 0-未结算
                    sa01.SA010  = s_new_fa001;                                                         //结算流水号
                    sa01.SA020  = 'T';                                                                 //发票类型
                    sa01.SA025  = BusinessAction.GetTaxRate(sa01.SA004);                               //税率
                    sa01.SA100  = Envior.cur_userId;                                                   //经办人
                    sa01.SA200  = Tools.GetServerDate();                                               //经办日期
                    sa01.STATUS = '1';                                                                 //状态 1-正常 0-删除
                    sa01.Save();
                }

                //2.保存退费日志
                refund       = new REFUND(unitOfWork1);
                refund.RF001 = s_new_fa001;
                refund.RF003 = te_reason.Text;
                refund.RF004 = 0 - dec_total;
                refund.RF100 = Envior.cur_userId;
                refund.RF200 = Tools.GetServerDate();
                refund.RF300 = s_fa001;                              //原结算流水号
                refund.Save();

                ///3.保存缴费记录
                fa01_new        = new FA01(unitOfWork1);
                fa01_new.FA001  = s_new_fa001;              //结算流水号
                fa01_new.FA002  = fa01.FA002;               //结算类型 0-购墓 1-服务祭品 2-管理费
                fa01_new.FA003  = fa01.FA003;               //缴款人
                fa01_new.FA004  = 0 - dec_total;            //金额
                fa01_new.FA190  = '0';                      //开票标志 0-未开票
                fa01_new.FA100  = Envior.cur_userId;        //经办人
                fa01_new.FA200  = Tools.GetServerDate();    //经办日期
                fa01_new.STATUS = "1";                      //状态
                fa01_new.AC001  = fa01.AC001;
                fa01_new.WS001  = Envior.WORKSTATIONID;     //工作站
                fa01_new.Save();

                unitOfWork1.CommitTransaction();

                int i_invoice_num = BusinessAction.GetInvoicePapers(s_new_fa001);
                if (i_invoice_num == 0)
                {
                    Tools.msg(MessageBoxIcon.Information, "提示", "退费办理成功!");
                }
                else
                {
                    if (XtraMessageBox.Show("退费办理成功!\r\n" + "本次业务共需要" + i_invoice_num.ToString() + "张发票,现在开具吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        sb_ok.Enabled = false;
                        //获取税务客户信息
                        string            s_fa003       = fa01.FA003;
                        Frm_TaxClientInfo frm_taxClient = new Frm_TaxClientInfo(s_fa003);
                        if (frm_taxClient.ShowDialog() != DialogResult.OK)
                        {
                            return;
                        }
                        TaxClientInfo clientInfo = frm_taxClient.swapdata["taxclientinfo"] as TaxClientInfo;

                        CriteriaOperator    criteria          = CriteriaOperator.Parse("FA001='" + s_fa001 + "'");
                        XPCollection <FP01> xpCollection_fp01 = new XPCollection <FP01>(PersistentCriteriaEvaluationBehavior.BeforeTransaction, unitOfWork1, criteria);
                        foreach (FP01 fp01 in xpCollection_fp01)
                        {
                            if (TaxInvoice.GetNextInvoiceNo() > 0)
                            {
                                if (XtraMessageBox.Show("下一张税票代码:" + Envior.NEXT_BILL_CODE + "\r\n" + "票号:" + Envior.NEXT_BILL_NUM + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                                {
                                    TaxInvoice.Invoice(fp01.FP001, clientInfo);
                                }
                            }
                        }
                    }
                }
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ee)
            {
                unitOfWork1.RollbackTransaction();
                Tools.msg(MessageBoxIcon.Error, "错误", ee.ToString());
            }
        }
Ejemplo n.º 25
0
        private void sb_ok_Click(object sender, EventArgs e)
        {
            if (!checkBeforeSave())
            {
                return;
            }
            try
            {
                s_fa001 = MiscAction.GetEntityPK("FA01");
                //1.购墓登记
                ac01       = new AC01(unitOfWork1);
                ac01.AC001 = s_ac001;                            //购墓登记编号
                ac01.AC002 = te_ac002.Text;                      //购墓人身份证号
                ac01.AC003 = te_ac003.Text;                      //购墓人
                ac01.AC004 = te_ac004.Text;                      //联系电话
                ac01.AC005 = te_ac005.Text;                      //联系地址
                ac01.AC012 = bi01.RE001;                         //排编号
                ac01.AC010 = bi01.RG001;                         //墓区编号
                ac01.AC015 = bi01.BI001;                         //墓位编号
                ac01.AC020 = Convert.ToDecimal(bi01.PRICE);      //墓位定价
                ac01.AC022 = Convert.ToDecimal(te_price.Text);   //售价
                ac01.AC038 = Convert.ToInt32(te_free_nums.Text); //免费管理年限
                ac01.AC049 = Convert.ToDateTime(de_ac049.Text);  //购墓日期

                //管理费到期日期
                if (ac01.AC038 > 0)
                {
                    ac01.AC040 = ac01.AC049.AddYears(ac01.AC038);
                }
                else
                {
                    ac01.AC040 = ac01.AC049;
                }

                ac01.AC042  = '1';                      //缴费状态
                ac01.AC048  = s_fa001;                  //缴费流水号
                ac01.AC100  = Envior.cur_userId;        //经办人
                ac01.AC200  = Tools.GetServerDate();    //经办日期
                ac01.AC250  = te_ac250.Text;            //备注
                ac01.AC300  = '0';                      //登记类型 1-正常登记 0-原始登记
                ac01.STATUS = '1';                      //当前状态
                ac01.Save();


                //3.号位信息
                bi01.STATUS = '2';                                  //已使用
                bi01.PRICE  = Convert.ToDecimal(te_fixprice.Text);  //定价
                bi01.BI005  = le_mx.EditValue.ToString();           //墓型
                bi01.AC001  = s_ac001;                              //购墓登记编号
                bi01.Save();

                unitOfWork1.CommitTransaction();
                BusinessAction.SetExtraInfo(s_ac001);

                Tools.msg(MessageBoxIcon.Information, "提示", "登记成功!");

                this.Close();
            }
            catch (Exception ee)
            {
                unitOfWork1.RollbackTransaction();
                Tools.msg(MessageBoxIcon.Error, "错误", ee.ToString());
            }
        }