private void OperatorLogSerach_Load(object sender, EventArgs e)
        {
            this.radioButtonAllDate.Checked = true;
            this.comboBoxUserName.Items.Add("所有用户");
            this.comboBoxModuleName.Items.Add("所有模块");
            this.comboBoxHoseName.Items.Add("所有主机");

            // 初始化用户名下拉列表
            ArrayList userNameValues   = OperatorLog.getInctance().getDistinecRecord("USER_NAME");
            ArrayList moduleNameValues = OperatorLog.getInctance().getDistinecRecord("MODULE_NAME");
            ArrayList hostNameValues   = OperatorLog.getInctance().getDistinecRecord("HOST_NAME");

            for (int i = 0; i < userNameValues.Count; i++)
            {
                this.comboBoxUserName.Items.Add((string)userNameValues[i]);
            }

            for (int i = 0; i < moduleNameValues.Count; i++)
            {
                this.comboBoxModuleName.Items.Add((string)moduleNameValues[i]);
            }

            for (int i = 0; i < hostNameValues.Count; i++)
            {
                this.comboBoxHoseName.Items.Add((string)hostNameValues[i]);
            }

            this.comboBoxUserName.SelectedIndex   = 0;
            this.comboBoxModuleName.SelectedIndex = 0;
            this.comboBoxHoseName.SelectedIndex   = 0;
        }
Exemple #2
0
        public bool PostGuestBook(string message, string userIp, string email)
        {
            try
            {
                string title = "异常" + DateTime.Now.ToString("yyyyMMddhhmmss");

                var log = new OperatorLog();
                log.contact = email;
                log.message = message;
                log.title   = title;
                log.type    = "Exception";
                log.userip  = userIp;

                var apiHelper = new ApiHelper();

                var result = apiHelper.AddExceptionLog(log);

                if (!string.IsNullOrEmpty(result))
                {
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                LogHelper.WriteException(ex);
                return(false);
            }
        }
Exemple #3
0
        public JsonResult ResetPwd(int id = 0)
        {
            PublicUser publicUser = ncBase.CurrentEntities.PublicUser.Where(o => o.UserID == id).FirstOrDefault();

            if (publicUser.IsNull())
            {
                return(Json(new { status = 1, msg = "没有找到用户!(用户ID:" + id + ")" }));
            }
            string passWordAdorn = ConfigUtility.GetValue("PassWordAdorn");
            string passWord      = string.Empty;

            if (string.IsNullOrEmpty(publicUser.Tel))
            {
                passWord = Convert.ToString(publicUser.UserID);
            }
            PublicUserModel loginUser = this.GetLoginUser();

            passWord            = publicUser.Tel;
            publicUser.Password = StringUtility.ToMd5String(passWordAdorn + passWord);
            ncBase.CurrentEntities.SaveChanges();
            OperatorLog operatorLog = new OperatorLog();

            operatorLog.Note    = "重置密码,被重置用户ID:" + publicUser.UserID + " 新密码:" + passWord;
            operatorLog.Type    = 1;
            operatorLog.Uid     = loginUser.UserID;
            operatorLog.AddTime = DateTime.Now;
            ncBase.CurrentEntities.AddToOperatorLog(operatorLog);
            ncBase.CurrentEntities.SaveChanges();

            return(Json(new { status = 0, msg = "密码重置成功, 新密码:" + passWord }));
        }
        private void toolStripButtonReview_Click(object sender, EventArgs e)
        {
            /*
             * 函数实现逻辑
             * 1、检查界面数据有效性
             * 1、查看付款单类型是否是应收账款,如果是,则根据供应商ID,更新应付账款表
             * 2、根据付款方科目是现金或银行存款,计算本次交易完成后对应账户的余额
             * 3、更新相应表的IS_REVIEW字段
             * 4、提示保存成功,如果保存失败,提示保存失败的原因
             * */

            if (DbPublic.getInctance().isCheckOut())
            {
                MessageBoxExtend.messageWarning("当前会计期间已经执行结转损益,无法再审核单据!");
                return;
            }

            if (!checkUiValue())
            {
                return;
            }
            ;

            if (m_billNumber.Length > 0)
            {
                if (m_isBankBill)
                {
                    double currentSystemBankBalance = BalanceManager.getBankBalance(m_bankRecord.bankName);
                    BankCashsubLedger.getInctance().update(
                        m_billNumber,
                        DbPublic.getInctance().getCurrentLoginUserID(),
                        m_bankRecord.turnover + currentSystemBankBalance);
                }
                else
                {
                    double currentSystemCachBalance = BalanceManager.getCachBalance();

                    CashCashsubLedger.getInctance().update(
                        m_billNumber,
                        DbPublic.getInctance().getCurrentLoginUserID(),
                        m_cashRecord.turnover + currentSystemCachBalance);
                }


                if (this.comboBoxReceivableType.Text.IndexOf("应收") != -1)
                {
                    updateAccountReceivable();
                }
                else if (this.comboBoxReceivableType.Text.IndexOf("销售出库") != -1)
                {
                    SaleOutOrder.getInctance().updataReceivedInfo(this.textBoxSourceOrderNumber.Text.ToString(),
                                                                  Convert.ToDouble(textBoxTransactionAmount.Text.ToString()));
                }

                MessageBoxExtend.messageOK("审核成功.");
                OperatorLog.getInctance().insert(501, "单据审核[" + m_billNumber + "]");
                this.Close();
            }
        }
Exemple #5
0
        static void Main(string[] args)
        {
            Lgr.Log.Error("asd");

            OperatorLog.WriteLog("test", "aldlasfk j 拉萨的房价");

            Console.ReadKey();
        }
        private void backup_Click(object sender, EventArgs e)
        {
            OperatorLogSerach ols = new OperatorLogSerach();

            ols.ShowDialog();

            if (ols.getWhereSql().Length > 0)
            {
                updateDataGridView(OperatorLog.getInctance().getRecordFromQuerySql(ols.getWhereSql()));
            }
        }
        private void save_Click(object sender, EventArgs e)
        {
            this.ActiveControl = this.toolStrip1;

            /**
             * 函数处理逻辑
             * 1、得到页面所有控件的值
             * 2、根据付款科目类型,看本次交易是现金交易,还是银行交易
             * 3、如果是现金交易写现金明细账,如果是银行存款交易写银行存款明细账
             * 4、提示保存成功或者保存失败的原因。
             * 5、把本次交易的单据号中的数字部分取出,写入到BILL_NUMBER
             * NOTE:单据保存时,不需要考虑是否审核,审核人,现金账或银行帐余额这几个信息。
             *
             * */
            try
            {
                if ((this.comboBoxPaymentType.Text.IndexOf("应付") != -1 ||
                     this.comboBoxPaymentType.Text.IndexOf("采购") != -1) &&
                    textBoxSourceOrderNumber.Text.Length == 0)
                {
                    MessageBoxExtend.messageWarning("原单据号或往来单位不能为空,请选择.");
                    return;
                }

                if (this.textBoxTransactionAmount.Text.Length == 0)
                {
                    MessageBoxExtend.messageWarning("交易金额不能为空.");
                    return;
                }

                if (this.comboBoxPaymentObject.Text.IndexOf("现金") != -1)
                {
                    // 把数据插入到现金明细表
                    writeDataToCashCashsubLedger();
                }
                else
                {
                    // 把数据插入到银行存款明细表
                    writeDataToBankCashsubLedger();
                }

                BillNumber.getInctance().inserBillNumber(PAYMENT_ORDER_BILL_NUMBER,
                                                         this.dateTime.Value.ToString("yyyyMMdd"),
                                                         this.textBoxPaymentOrderNumber.Text.ToString());

                OperatorLog.getInctance().insert(502, "新增单据[" + this.textBoxPaymentOrderNumber.Text + "]");

                this.Close();
            }
            catch (Exception)
            {
            }
        }
        private void FormBaseOperatorLog_Load(object sender, EventArgs e)
        {
            m_dateGridViewExtend.addDataGridViewColumn("ID", 30);
            m_dateGridViewExtend.addDataGridViewColumn("操作者", 100);
            m_dateGridViewExtend.addDataGridViewColumn("操作时间", 150);
            m_dateGridViewExtend.addDataGridViewColumn("模块名称", 200);
            m_dateGridViewExtend.addDataGridViewColumn("内容描述", 400);
            m_dateGridViewExtend.addDataGridViewColumn("主机名", 100);

            m_dateGridViewExtend.initDataGridViewColumn(this.dataGridViewBilConfigList);
            updateDataGridView(OperatorLog.getInctance().getAllRecord());
        }
Exemple #9
0
        private void panelCashInvoice_Click(object sender, EventArgs e)
        {
            /*函数实现逻辑
             * 1、检查系统中是否存在未审核的(采购入库(赊购),销售出库(赊购),付款单,收款单)
             * 2、得到当前系统记录的现金余额,更新cash_balance_last_month表
             * 3、得到当前系统记录的各银行存款余额,更新bank_balance_last_month表
             * 4、计算企业当前库存现金、银行存款、应收账款合计、应付账款合计、存货金额合计信息到企业利润表
             * 4、提示用户是否保存成功,如果保存失败,提示保存失败原因
             */
            if (DbPublic.getInctance().isCheckOut())
            {
                MessageBoxExtend.messageWarning("当前会计期间已经执行结转损益,不能重复执行!");
                return;
            }

            string msg = "建议执行结转损益操作放在每个会计期间的最后一天,结转损益执行完毕后,本会计期间无法再审核新单据。\n";

            msg += "请确认当前系统不存在未审核的以下单据:\n";
            msg += "1、采购入库(赊购)\n";
            msg += "2、销售出库(赊购)\n";
            msg += "3、付款单\n";
            msg += "4、收款单\n";
            msg += "确定执行结转吗?";
            if (MessageBoxExtend.messageQuestion(msg))
            {
                try
                {
                    // 现金余额结转
                    double cachBalance = BalanceManager.getCachBalance();
                    CashBalanceLastMonth.getInctance().insert(cachBalance, "结转余额");

                    // 银行存款余额结转
                    SortedDictionary <int, AuxiliaryMaterialDataTable> bankList
                        = AuxiliaryMaterial.getInctance().getAllAuxiliaryMaterialData("BASE_BANK_LIST");

                    foreach (KeyValuePair <int, AuxiliaryMaterialDataTable> index in bankList)
                    {
                        double bankBalance = BalanceManager.getBankBalance(index.Value.name);
                        BankBalanceLastMonth.getInctance().insert(index.Value.pkey, bankBalance, "结转余额");
                    }

                    // 企业利润信息
                    CompanyProfit.getInctance().insertCashInvoiceData();

                    OperatorLog.getInctance().insert(503, "执行结转损益.");
                }
                catch (Exception exp)
                {
                    MessageBoxExtend.messageWarning(exp.ToString());
                }
            }
        }
Exemple #10
0
        public string AddExceptionLog(OperatorLog log)
        {
            var result = string.Empty;

            if (BmobUser.CurrentUser != null)
            {
                log.user = BmobUser.CurrentUser;
            }
            var createResult = Bmob.CreateTaskAsync(log);

            if (createResult.Result != null)
            {
                return(createResult.Result.objectId);
            }

            return(null);
        }
Exemple #11
0
        public static void AddOperatoAction(string Login, string Action)
        {
            lock (OPCObjects.SQLLocker)
            {
                using (var context = new MyDBContext())
                {
                    var action = new OperatorLog
                    {
                        Login    = Login,
                        Action   = Action,
                        dateTime = DateTime.Now
                    };

                    context.operatorLogs.Add(action);
                    context.SaveChanges();
                    context.Dispose();
                }
            }
        }
Exemple #12
0
        private void toolStripButtonReview_Click(object sender, EventArgs e)
        {
            /*
             * 函数实现逻辑
             * 1、检查界面数据有效性
             * 1、查看付款单类型是否是应付账款,如果是,则根据供应商ID,更新应付账款表
             * 2、根据付款方科目是现金或银行存款,计算本次交易完成后对应账户的余额
             * 3、更新相应表的IS_REVIEW字段
             * 4、提示保存成功,如果保存失败,提示保存失败的原因
             * */

            if (DbPublic.getInctance().isCheckOut())
            {
                MessageBoxExtend.messageWarning("当前会计期间已经执行结转损益,无法再审核单据!");
                return;
            }

            if (!checkUiValue())
            {
                return;
            }
            ;

            if (m_billNumber.Length > 0)
            {
                if (m_isBankBill)
                {
                    double currentSystemBankBalance = BalanceManager.getBankBalance(m_bankRecord.bankName);

                    if (m_bankRecord.turnover > currentSystemBankBalance)
                    {
                        string msg = "付款交易失败\n";
                        msg += "[" + m_bankRecord.bankName + "]余额为:";
                        msg += Convert.ToString(currentSystemBankBalance) + ",不足以完成本次支付.";
                        MessageBoxExtend.messageWarning(msg);
                        return;
                    }
                    else
                    {
                        BankCashsubLedger.getInctance().update(
                            m_billNumber,
                            DbPublic.getInctance().getCurrentLoginUserID(),
                            currentSystemBankBalance - m_bankRecord.turnover);
                    }
                }
                else
                {
                    double currentSystemCachBalance = BalanceManager.getCachBalance();

                    if (m_cashRecord.turnover > currentSystemCachBalance)
                    {
                        string msg = "付款交易失败\n";
                        msg += "库存现金余额为:";
                        msg += Convert.ToString(currentSystemCachBalance) + ",不足以完成本次支付.";
                        MessageBoxExtend.messageWarning(msg);
                        return;
                    }
                    else
                    {
                        CashCashsubLedger.getInctance().update(
                            m_billNumber,
                            DbPublic.getInctance().getCurrentLoginUserID(),
                            currentSystemCachBalance - m_cashRecord.turnover);
                    }
                }

                if (this.comboBoxPaymentType.Text.IndexOf("应付") != -1)
                {
                    updateAccountPayment();
                }
                else if (this.comboBoxPaymentType.Text.IndexOf("采购入库") != -1)
                {
                    PurchaseInOrder.getInctance().updataPaymentInfo(this.textBoxSourceOrderNumber.Text.ToString(),
                                                                    Convert.ToDouble(textBoxTransactionAmount.Text.ToString()));
                }

                MessageBoxExtend.messageOK("审核成功.");
                OperatorLog.getInctance().insert(502, "单据审核[" + m_billNumber + "]");
                this.Close();
            }
        }
Exemple #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();
 }