public string GetFlowType(int typeID)
        {
            //typeID=0查询现金的资金类型,为1时查询银行相关的
            string result = "{}";
            string obj    = "";

            try
            {
                if (typeID == 0)
                {
                    obj = JsonConvert.SerializeObject(WebComm.GetFundFlowTypeList_Cash().Where(c => c.InOutType == "in" || c.InOutType == "out"));
                }
                else if (typeID == 1)
                {
                    obj = JsonConvert.SerializeObject(WebComm.GetFundFlowTypeList_Bank().Where(c => c.InOutType == "in" || c.InOutType == "out"));
                }
                else
                {
                    obj = JsonConvert.SerializeObject(WebComm.GetFundFlowTypeList_Bank().Where(c => c.InOutType != "in" && c.InOutType != "out"));
                }
                result = WebComm.ReturnJsonForExterior(true, "获取资金类型成功!", obj);
            }
            catch (Exception ex)
            {
                result = WebComm.ReturnJsonForExterior(false, "获取资金类型失败!" + ex.Message, null);
            }

            return(result);
        }
        public string DoCashAccounting(int userID, string ApplyDate, int FlowTypeID, string feeItemID, string feeItemName, string money, string cAdd)
        {
            string result = "{}";

            try
            {
                //获取记账日期
                string applyDate = ApplyDate;
                //获取流动资金类型
                FundFlowType ffType = WebComm.GetFundFlowTypeList().Where(f => f.ID == FlowTypeID).Single();

                string flowTypeID = ffType.ID.ToString();

                //获取流动资金类型名称
                string flowTypeName = ffType.Name;

                //获取类型
                string InOutType = ffType.InOutType;
                //获取资金
                string iMoney = money;

                string isJieKuan = flowTypeName.Contains("借") == true ? "Y" : "N";

                //获取备注信息

                string sql = "exec proc_AddCashAccouting '" + applyDate + "'," + flowTypeID + ",'" + flowTypeName + "','" + InOutType + "'," + feeItemID + ",'" + feeItemName + "'," + iMoney + "," + userID.ToString() + ",'" + isJieKuan + "','N','" + cAdd + "'";
                LycSQLHelper.ExecuteCommand(CommandType.Text, sql);
                result = WebComm.ReturnJsonForExterior(true, "现金记账成功!", "{}");
            }
            catch (Exception ex)
            {
                result = WebComm.ReturnJsonForExterior(false, "现金记账失败!" + ex.Message, "{}");
            }
            return(result);
        }
        public string GetUserBankList(int userID)
        {
            string result = "{}";

            try
            {
                var list = from lu in db.UserBanks
                           where lu.UserID == userID
                           select new
                {
                    userBankID = lu.ID,
                    bankID     = lu.BankID,
                    bankName   = lu.BankName,
                    bankType   = lu.BankCardType,
                    money      = lu.NowMoney,
                    cardNo     = lu.BankNo
                };
                result = WebComm.ReturnJsonForExterior(true, "获取银行账户成功!", JsonConvert.SerializeObject(list));
            }
            catch (Exception ex)
            {
                result = WebComm.ReturnJsonForExterior(false, "获取银行账户失败!" + ex.Message, "{}");
            }
            return(result);
        }
Esempio n. 4
0
        public string GetUserBankList(int userID, string bankName, string bankNo, string bankCardType, int pageSize, int currentPage)
        {
            string jsonResult = "";

            try
            {
                //根据查询条件筛选数据
                var userBankList = db.UserBanks.Where(c => c.UserID == userID).AsQueryable();
                if (!string.IsNullOrEmpty(bankName))
                {
                    userBankList = userBankList.Where(c => c.BankName.Contains(bankName));
                }
                if (!string.IsNullOrEmpty(bankNo))
                {
                    userBankList = userBankList.Where(c => c.BankNo.Contains(bankNo));
                }
                if (!string.IsNullOrEmpty(bankCardType))
                {
                    userBankList = userBankList.Where(c => c.BankCardType.Contains(bankCardType));
                }
                int records = userBankList.Count();
                //将分页查询后的数据组织为可json序列化的对象
                var jsonObj = new
                {
                    pagesize     = pageSize,
                    totalRecords = records,
                    currentpage  = currentPage,
                    rows         = (from list in userBankList.OrderBy(c => c.BankID).Skip((currentPage - 1) * pageSize).Take(pageSize).ToList()
                                    select new
                    {
                        bankid = list.BankID,
                        bankname = list.BankName,
                        bankno = list.BankNo,
                        bankcardtype = list.BankCardType,
                        nowMoney = list.NowMoney
                    }
                                    ).ToArray()
                };
                if (records > 0)
                {
                    jsonResult = WebComm.ReturnJsonForExterior(true, "获取数据成功!", JsonConvert.SerializeObject(jsonObj));
                }
                else
                {
                    jsonResult = WebComm.ReturnJsonForExterior(false, "获取数据失败!", null);
                }
            }
            catch (Exception ex)
            {
                jsonResult = WebComm.ReturnJsonForExterior(false, "获取数据错误!" + ex.Message, null);
            }


            return(jsonResult);
        }
        public string GetFeeItem()
        {
            string result = "{}";

            try
            {
                result = WebComm.ReturnJsonForExterior(true, "获取费用科目成功!", JsonConvert.SerializeObject(WebComm.GetFeeItemListByXml().Where(c => c.IsLast == true)));
            }
            catch (Exception ex)
            {
                result = WebComm.ReturnJsonForExterior(false, "获取费用科目失败!" + ex.Message, null);
            }
            return(result);
        }
        public string DoZhuanZhang(int userID, string ApplyDate, int FlowTypeID,
                                   string feeItemID, string feeItemName, string money,
                                   string inUBID, string outUBID, string cAdd)
        {
            string result = "{}";

            try
            {
                //获取记账日期
                string applyDate = ApplyDate;
                //获取流动资金类型
                FundFlowType ffType = WebComm.GetFundFlowTypeList().Where(f => f.ID == FlowTypeID).Single();

                string flowTypeID = ffType.ID.ToString();

                //获取流动资金类型名称
                string flowTypeName = ffType.Name;

                //获取类型
                string InOutType = ffType.InOutType;
                //获取资金
                string iMoney = money;

                //获取入账银行信息
                string inUserBankID = inUBID;
                //获取出账银行信息
                string outUserBankID = outUBID;

                //获取备注信息

                string sql = "exec proc_CashChange '" + applyDate + "'," + flowTypeID + ",'" + flowTypeName + "','" + InOutType + "'," + iMoney + "," + userID.ToString() + "," + inUserBankID + "," + outUserBankID + ",'" + cAdd + "'";
                LycSQLHelper.ExecuteCommand(CommandType.Text, sql);
                result = WebComm.ReturnJsonForExterior(true, "转账记账成功!", "{}");
            }
            catch (Exception ex)
            {
                result = WebComm.ReturnJsonForExterior(false, "转账记账失败!" + ex.Message, "{}");
            }
            return(result);
        }
        public string UserLogin(int userCode, string userPwd)
        {
            string jsonResult = "";

            FamilyManagerWeb.Models.User user = db.Users.Where(c => c.cUserCode == userCode && c.cUserPwd == userPwd).SingleOrDefault();
            string jsonObj = "";

            if (user != null && user.cUserFlag == true)
            {
                jsonObj    = "{\"userID\":" + user.ID + ",\"userCode\":\"" + user.cUserCode + "\",\"userName\":\"" + user.cUserName + "\",\"userPwd\":\"" + userPwd + "\"}";
                jsonResult = WebComm.ReturnJsonForExterior(true, "登陆成功!", jsonObj);
            }
            else if (user == null)
            {
                jsonResult = WebComm.ReturnJsonForExterior(false, "用户名或密码错误!", null);
            }
            else
            {
                jsonResult = WebComm.ReturnJsonForExterior(false, "用户已无效!", null);
            }
            return(jsonResult);
        }