示例#1
0
        //新增房屋出租或房屋转让
        public string RentalNew(DataRow Row)
        {
            string backstr = "";

            try
            {
                decimal Amount = 0.0m, Rent = 0.0m;
                if (Row.Table.Columns.Contains("Price") && !string.IsNullOrEmpty(Row["Price"].ToString()))
                {
                    Amount = AppGlobal.StrToDec(Row["Price"].ToString());
                }
                if (Row["BussType"].ToString() == "租售")
                {
                    Rent   = Amount;
                    Amount = 0.0m;
                }


                string        ConnStr = ConnectionDb.GetUnifiedConnectionString();
                IDbConnection Conn    = new SqlConnection(ConnStr);
                string        Query   = @"INSERT INTO Tb_Rental
                                (Id,CommunityId,BussType,LinkMan,Province,City,Area,Address,Mobile,Img,UserId,ProcessState,Amount,Rent,RegisterDate,RegisterMan) 
                                VALUES
                                (@Id,@CommunityId,@BussType,@LinkMan,@Province,@City,@Area,@Address,@Mobile,@Img,@UserId,'受理',@Amount,@Rent,getdate(),@LinkMan)";
                Conn.Execute(Query, new
                {
                    Id          = Guid.NewGuid().ToString(),
                    CommunityId = Row["CommunityId"].ToString(),
                    BussType    = Row["BussType"].ToString(),
                    LinkMan     = Row["LinkMan"].ToString(),
                    Province    = Row["Province"].ToString(),
                    City        = Row["City"].ToString(),
                    Area        = Row["Area"].ToString(),
                    Address     = Row["Address"].ToString(),
                    Mobile      = Row["Mobile"].ToString(),
                    Img         = Row["Img"].ToString(),
                    UserId      = Row["UserId"].ToString(),
                    Amount      = Amount,
                    Rent        = Rent
                });
            }
            catch (Exception ex)
            {
                backstr = ex.Message;
            }
            if (backstr == "")
            {
                return(JSONHelper.FromString(true, "success"));
            }
            else
            {
                return(JSONHelper.FromString(false, backstr));
            }
        }
示例#2
0
        /// <summary>
        /// 生成物业订单
        /// </summary>
        /// <param name="Row"></param>
        /// <param name="IsOk">是否成功生成物业代收订单</param>
        /// <param name="Amount">订单总金额</param>
        /// <returns></returns>
        public string GeneratePropertyOrder(string CommunityId, string FeesIds, string txnTime, string CustID, ref bool IsOk, ref decimal Amount, ref string PropertyOrderId)
        {
            DataTable CommunityTable = new DbHelperSQLP(PubConstant.UnifiedContionString.ToString()).Query(string.Format("SELECT * FROM Tb_Community WHERE Id='{0}' OR CommID='{0}'", CommunityId.ToString())).Tables[0];

            if (CommunityTable.Rows.Count > 0)
            {
                //连接字符串
                DataRow T = CommunityTable.Rows[0];
                //增加订单验证【检测费用是否存在于未下帐订单明细中】
                //List<string> list = CheckFees(FeesIds, CommunityId);
                //if (list.Count>0)
                //{
                //    string str = "";
                //    foreach (string item in list)
                //    {
                //        str += item + ",";
                //    }
                //    return "费项:" + str + "已支付成功,等待下帐!";
                //}
                //生成物业订单
                //2018-3-19  YFZW  增加合景箐蜜  违约金必缴
                string comstr = T["CommID"].ToString().Substring(0, 4);

                DataSet Ds = null;
                if (comstr == "1862")
                {
                    Ds = PropertyOrder_1862(CustID, FeesIds, T["CommID"].ToString(), c.seller_id.ToString(), txnTime, CommunityId);
                }
                else
                {
                    Ds = PropertyOrder(CustID, FeesIds, T["CommID"].ToString(), c.seller_id.ToString(), txnTime, CommunityId);
                }

                if (Ds.Tables.Count > 0)
                {
                    DataRow DRow = Ds.Tables[0].Rows[0];
                    Amount          = AppGlobal.StrToDec(DRow["Amount"].ToString());//总金额
                    IsOk            = true;
                    PropertyOrderId = DRow["orderId"].ToString();
                    return("生成" + T["CorpName"] + "物业账单成功");
                }
                else
                {
                    IsOk = false;
                    return("部分费用已缴纳,请重新选择费用");
                }
            }
            else
            {
                //未找到小区
                IsOk = false;
                return("没找到小区");
            }
        }
示例#3
0
        /// <summary>
        /// 添加订单评价  InsertResourcesCommodityEvaluation
        /// </summary>
        /// <param name="row"></param>
        /// RpdCode             订单明细表ID【必填】
        /// ResourcesID         商品编码【必填】
        /// EvaluateContent     评价内容
        /// UploadImg           上传图片
        /// Star                商品评星
        /// EvaluateDate        评价时间
        /// 返回:
        ///     false:错误信息
        ///     true:操作成功
        /// <returns></returns>
        private string InsertResourcesCommodityEvaluation(DataRow row)
        {
            if (!row.Table.Columns.Contains("RpdCode") || string.IsNullOrEmpty(row["RpdCode"].ToString()))
            {
                return(JSONHelper.FromString(false, "评价内容不能为空"));
            }

            string RpdCode = row["RpdCode"].ToString();

            IDbConnection con = new SqlConnection(PubConstant.GetConnectionString("BusinessContionString"));
            string        str = "";

            try
            {
                Tb_Resources_CommodityEvaluation RCE = new Tb_Resources_CommodityEvaluation();

                foreach (string item in RpdCode.Split(','))
                {
                    string[] str_Ev = item.Split(':');
                    RCE.Id              = Guid.NewGuid().ToString();
                    RCE.RpdCode         = str_Ev[0];
                    RCE.Star            = AppGlobal.StrToDec(str_Ev[2]);
                    RCE.EvaluateDate    = DateTime.Now;
                    RCE.IsDelete        = 0;
                    RCE.EvaluateContent = str_Ev[1];

                    Tb_Charge_ReceiptDetail m = con.Query <Tb_Charge_ReceiptDetail>("select * from Tb_Charge_ReceiptDetail where RpdCode=@ResourcesID", new { ResourcesID = str_Ev[0] }).SingleOrDefault <Tb_Charge_ReceiptDetail>();
                    if (m != null)
                    {
                        RCE.ResourcesID = m.ResourcesID;
                    }

                    con.Insert <Tb_Resources_CommodityEvaluation>(RCE);
                }
            }
            catch (Exception ex)
            {
                str = ex.Message;
            }

            if (str != "")
            {
                return(JSONHelper.FromString(false, str));
            }
            else
            {
                return(JSONHelper.FromString(true, "操作成功"));
            }
        }
示例#4
0
        /// <summary>
        /// 更新当前位置信息,用于实时定位
        /// </summary>
        private string UpdateCurrentLocation(DataRow row)
        {
            if (!row.Table.Columns.Contains("LastLocation") || string.IsNullOrEmpty(row["LastLocation"].ToString()))
            {
                return(new ApiResult(false, "缺少参数LastLocation").toJson());
            }
            if (!row.Table.Columns.Contains("LastFullLocation") || string.IsNullOrEmpty(row["LastFullLocation"].ToString()))
            {
                return(new ApiResult(false, "缺少参数LastFullLocation").toJson());
            }
            if (!row.Table.Columns.Contains("LocationLongitude") || string.IsNullOrEmpty(row["LocationLongitude"].ToString()))
            {
                return(new ApiResult(false, "缺少参数LocationLongitude").toJson());
            }
            if (!row.Table.Columns.Contains("LocationLatitude") || string.IsNullOrEmpty(row["LocationLatitude"].ToString()))
            {
                return(new ApiResult(false, "缺少参数LocationLatitude").toJson());
            }

            var LastLocation      = row["LastLocation"].ToString();
            var LastFullLocation  = row["LastFullLocation"].ToString();
            var LocationLongitude = AppGlobal.StrToDec(row["LocationLongitude"].ToString());
            var LocationLatitude  = AppGlobal.StrToDec(row["LocationLatitude"].ToString());

            using (IDbConnection conn = new SqlConnection(PubConstant.hmWyglConnectionString))
            {
                try
                {
                    int a = conn.Execute($@"INSERT INTO Tb_HSPR_AppRealTimeLocation(IID,UserCode,UserName,LastLocation,LastFullLocation,LocationLongitude,
                                            LocationLatitude,LocationTime,IsDelete)
                                        VALUES(NEWID(),'{Global_Var.LoginUserCode}','{Global_Var.LoginUserName}','{LastLocation}','{LastFullLocation}',{LocationLongitude},
                                        {LocationLatitude},GETDATE(),0)", null);

                    return(new ApiResult(true, "定位成功").toJson());
                }
                catch (Exception e)
                {
                    return(new ApiResult(false, "定位更新失败" + e.Message).toJson());
                }
            }
        }
        public override void Operate(ref Common.Transfer Trans)
        {
            Trans.Result = "false:";

            DataSet Ds  = base.XmlToDataSet(Trans.Attribute);
            DataRow Row = Ds.Tables[0].Rows[0];

            switch (Trans.Command)
            {
            //创建订单
            case "GenerateOrder":
                Trans.Result = GenerateOrder(Ds);
                break;

            //创建线下订单
            case "GenerateOfflineOrder":
                Trans.Result = GenerateOfflineOrder(Ds);
                break;

            //订单继续支付
            case "GoOnGenerateOrder":
                Trans.Result = GoOnGenerateOrder(Ds);
                break;

            //订单确认收款成功
            case "ReceBusinessOrder":
                Trans.Result = ReceBusinessOrder(Row["OrderId"].ToString(), AppGlobal.StrToDec(Row["RealAmount"].ToString()));
                break;

            //订单退款
            case "CancelOrder":
                Trans.Result = CancelOrder(Row["OrderId"].ToString());
                break;

            default:
                break;
            }
        }
示例#6
0
        /// <summary>
        /// 新增临时停车信息
        /// </summary>
        /// <param name="row"></param>
        /// <returns></returns>
        private string TempPayFees(string requestParam)
        {
            try
            {
                if (string.IsNullOrEmpty(requestParam))
                {
                    new Logger().WriteLog("鸿坤道闸临停信息请求参数", DateTime.Now.ToString() + "--" + requestParam);
                    string State        = "false";
                    string ErrorContent = JSONHelper.FromStringHK(false, "请求参数不能为空");
                    log.ErrorContent = ErrorContent;
                    log.State        = State;
                    LogAdd(log);
                    return(ErrorContent);
                }

                string        ContionString = PubConstant.GetConnectionString("HKSQLConnection").ToString();
                IDbConnection con           = new SqlConnection(ContionString);

                Tb_HSPR_HKCostInfo costInfo = JsonHelp.JsonDeserialize <Tb_HSPR_HKCostInfo>(requestParam);
                string             CommID   = null;//项目ID
                string             sKey     = "A2YGWFV7QP5KFOMLXIYRW";

                int    parkId       = costInfo.parkId;
                int    duration     = costInfo.duration;
                string dutyId       = costInfo.dutyId;
                string endTime      = costInfo.endTime;
                string feeAli       = costInfo.feeAli;
                string feeCash      = costInfo.feeCash;
                string feeCoupon    = costInfo.feeCoupon;
                string feeException = costInfo.feeException;
                string feeExpected  = costInfo.feeExpected;
                string feeFree      = costInfo.feeFree;
                string feeWechat    = costInfo.feeWechat;
                string roomNum      = costInfo.roomNum;
                string startTime    = costInfo.startTime;
                string tollManName  = costInfo.tollManName;
                string HtcSign      = costInfo.sign;

                //查询当前数据是否已经存在天问系统
                string    tmpStr         = "SELECT * FROM Tb_HSPR_TemporaryCarPrecostsDetail WHERE dutyId='" + dutyId + "'";
                DataTable dtTemporaryCar = new DbHelperSQLP(ContionString).Query(tmpStr).Tables[0];
                if (dtTemporaryCar.Rows.Count > 0)
                {
                    new Logger().WriteLog("鸿坤道闸临停信息同步异常", DateTime.Now.ToString() + "--" + "该条临停数据已经存在天问系统:" + tmpStr);

                    string State        = "false";
                    string ErrorContent = JSONHelper.FromStringHK(false, "该条临停数据已经存在天问系统");
                    log.ErrorContent = ErrorContent;
                    log.State        = State;
                    LogAdd(log);
                    return(ErrorContent);
                }


                if (parkId <= 0)
                {
                    string State        = "false";
                    string ErrorContent = JSONHelper.FromStringHK(false, "车场ID不能为空");
                    log.ErrorContent = ErrorContent;
                    log.State        = State;
                    LogAdd(log);
                    return(ErrorContent);
                }
                string signParm = "{\"duration\":" + duration + ",\"dutyId\":\"" + dutyId + "\",\"endTime\":\"" + endTime
                                  + "\",\"feeAli\":" + feeAli + ",\"feeCash\":" + feeCash + ",\"feeCoupon\":" + feeCoupon + ",\"feeException\":"
                                  + feeException + ",feeExpected:" + feeExpected + ",feeFree:" + feeFree + ",feeWechat:" + feeWechat
                                  + ",\"roomNum\":\"" + roomNum + "\",\"startTime\":\"" + startTime + "\",\"tollManName\":\"" + tollManName + "\"}";

                Dictionary <String, String> param = JSONHelper.StringToDictionary <string, string>(signParm);
                string signStr = BuildParamStr(param) + "&key=" + sKey + "";
                string sign    = MD5Encrypt(signStr);
                if (sign != HtcSign)
                {
                    new Logger().WriteLog("鸿坤道闸临停信息同步异常", DateTime.Now.ToString() + "--" + "签名错误:" + sign);

                    string State        = "false";
                    string ErrorContent = JSONHelper.FromStringHK(false, "签名错误");
                    log.ErrorContent = ErrorContent;
                    log.State        = State;
                    LogAdd(log);
                    return(ErrorContent);
                }



                string    ctpStr       = "SELECT * FROM Tb_HTC_CommToPark WHERE ParkId='" + parkId + "'";
                DataTable dtCommToPark = new DbHelperSQLP(ContionString).Query(ctpStr).Tables[0];
                if (dtCommToPark.Rows.Count > 0)
                {
                    DataRow retRow = dtCommToPark.Rows[0];
                    CommID = retRow["CommID"].ToString();
                }
                else
                {
                    new Logger().WriteLog("鸿坤道闸临停信息同步异常", DateTime.Now.ToString() + "--" + "车场ID无法匹配天问CommID:" + ctpStr);

                    string State        = "false";
                    string ErrorContent = JSONHelper.FromStringHK(false, "车场ID无法匹配天问CommID");
                    log.ErrorContent = ErrorContent;
                    log.State        = State;
                    LogAdd(log);
                    return(ErrorContent);
                }

                long      CustId         = 0;
                long      RoomId         = 0;
                long      CostId         = 0;
                long      CorpStanId     = 0;
                long      StanId         = 0;
                string    UserCode       = "";
                string    csStr          = "SELECT * FROM Tb_HTC_CostStandard WHERE ParkId='" + parkId + "'";
                DataTable dtCostStandard = new DbHelperSQLP(ContionString).Query(csStr).Tables[0];
                if (dtCostStandard.Rows.Count > 0)
                {
                    DataRow retRow = dtCostStandard.Rows[0];
                    CustId     = AppGlobal.StrToLong(retRow["CustId"].ToString());
                    RoomId     = AppGlobal.StrToLong(retRow["RoomId"].ToString());
                    CostId     = AppGlobal.StrToLong(retRow["CostId"].ToString());
                    CorpStanId = AppGlobal.StrToLong(retRow["CorpStanId"].ToString());
                    StanId     = AppGlobal.StrToLong(retRow["StanId"].ToString());
                    UserCode   = retRow["UserCode"].ToString();
                }
                else
                {
                    new Logger().WriteLog("鸿坤道闸临停信息同步异常", DateTime.Now.ToString() + "--" + "车场ID无法匹配天问收费标准:" + csStr);
                    string State        = "false";
                    string ErrorContent = JSONHelper.FromStringHK(false, "车场ID无法匹配天问收费标准");
                    log.ErrorContent = ErrorContent;
                    log.State        = State;
                    LogAdd(log);
                    return(ErrorContent);
                }
                try
                {
                    DynamicParameters parameters = new DynamicParameters();
                    var InfoCode = Guid.NewGuid();
                    parameters.Add("@InfoCode", InfoCode);
                    parameters.Add("@CardID", null);
                    parameters.Add("@CardType", null);
                    parameters.Add("@GoName", null);
                    parameters.Add("@CommID", CommID);
                    parameters.Add("@OverTime", startTime);
                    parameters.Add("@OutTime", endTime);
                    parameters.Add("@CarNumber", null);
                    parameters.Add("@Money", feeExpected);
                    parameters.Add("@IssueDate", null);
                    parameters.Add("@dutyId", dutyId);
                    parameters.Add("@feeCash", feeCash);
                    parameters.Add("@feeWechat", feeWechat);
                    parameters.Add("@feeAli", feeAli);

                    int b = con.Execute("Proc_HSPR_TemporaryCarPrecostsDetail_Insert", parameters, null, null, CommandType.StoredProcedure);
                    con.Dispose();
                    if (b > 0)
                    {
                        string Memo = "";
                        if (AppGlobal.StrToDec(feeAli) > 0)
                        {
                            Memo = "支付宝收款";
                            CreateCarFees(AppGlobal.StrToInt(CommID), CustId, RoomId, AppGlobal.StrToDec(feeAli), CorpStanId,
                                          StanId, Memo, CostId, UserCode);
                        }
                        if (AppGlobal.StrToDec(feeWechat) > 0)
                        {
                            Memo = "微信收款";
                            CreateCarFees(AppGlobal.StrToInt(CommID), CustId, RoomId, AppGlobal.StrToDec(feeWechat), CorpStanId,
                                          StanId, Memo, CostId, UserCode);
                        }
                        if (AppGlobal.StrToDec(feeCash) > 0)
                        {
                            Memo = "现金收款";
                            CreateCarFees(AppGlobal.StrToInt(CommID), CustId, RoomId, AppGlobal.StrToDec(feeCash), CorpStanId,
                                          StanId, Memo, CostId, UserCode);
                        }
                        new Logger().WriteLog("鸿坤道闸临停信息请求参数", DateTime.Now.ToString() + "--同步成功 " + Memo);
                        string State        = "true";
                        string ErrorContent = JSONHelper.FromStringHK(false, "同步成功");
                        log.ErrorContent = ErrorContent;
                        log.State        = State;
                        LogAdd(log);
                        return(ErrorContent);
                    }
                    else
                    {
                        new Logger().WriteLog("鸿坤道闸临停信息请求参数", DateTime.Now.ToString() + "--同步失败!");
                        string State        = "false";
                        string ErrorContent = JSONHelper.FromStringHK(false, "同步失败");
                        log.ErrorContent = ErrorContent;
                        log.State        = State;
                        LogAdd(log);
                        return(ErrorContent);
                    }
                }
                catch (Exception ex)
                {
                    new Logger().WriteLog("鸿坤道闸临停信息同步异常", DateTime.Now.ToString() + "--" + ex.ToString());
                    string State        = "false";
                    string ErrorContent = JSONHelper.FromStringHK(false, ex.Message);
                    log.ErrorContent = ErrorContent;
                    log.State        = State;
                    LogAdd(log);
                    return(ErrorContent);
                }
            }
            catch (Exception ex)
            {
                new Logger().WriteLog("鸿坤道闸临停信息同步异常", DateTime.Now.ToString() + "--" + ex.ToString());
                string State        = "false";
                string ErrorContent = JSONHelper.FromStringHK(false, ex.Message);
                log.ErrorContent = ErrorContent;
                log.State        = State;
                LogAdd(log);
                return(ErrorContent);
            }
        }
示例#7
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                Business.Alipay.Log("收到支付宝预存通知");

                HttpRequest Request = context.Request;
                Dictionary <string, string> sPara = GetRequestPost(context);

                decimal total_amount = AppGlobal.StrToDec(Request.Params["total_fee"].ToString());
                string  respcode     = Request.Params["trade_status"];
                string  respmsg      = Request.Params["trade_status"].ToString();
                string  orderId      = Request.Params["out_trade_no"].ToString();
                string  body         = Request.Params["body"].ToString();
                string  userId       = null;
                int     months       = 0;
                if (body.Contains(","))
                {
                    months = AppGlobal.StrToInt(body.Split(',')[2]);
                    userId = body.Split(',')[1];
                    body   = body.Split(',')[0];
                }

                string sign        = Request.Params["sign"];
                string notify_id   = Request.Params["notify_id"];
                string CommunityId = body;

                Config c = new Config();
                //初始化参数
                bool IsConfig = new Business.AlipayPrec_lf().GenerateConfig(CommunityId, out c);

                string Result = "";
                if (IsConfig == false)
                {
                    throw new Exception("未配置证书文件" + CommunityId);
                }

                Business.AlipayPrec_lf.Log("开始验证:" + CommunityId.ToString() + "," + orderId);

                //返回报文中不包含UPOG,表示Server端正确接收交易请求,则需要验证Server端返回报文的签名
                Notify aliNotify = new Notify(c);

                if (aliNotify.GetResponseTxt(notify_id) == "true")
                {
                    Business.AlipayPrec_lf.Log("验证:" + CommunityId.ToString() + "," + orderId + " GetResponseTxt 正确");

                    if (aliNotify.GetSignVeryfy(sPara, sign))
                    {
                        Business.AlipayPrec_lf.Log("验证:" + CommunityId.ToString() + "," + orderId + " GetSignVeryfy 正确");

                        //更新订单返回状态
                        Business.AlipayPrec_lf.UpdateProperyOrder(CommunityId, orderId, respcode, respmsg);
                        //已收到请求,无需再发送通知
                        Result = "success";
                        if (respcode == "TRADE_SUCCESS")
                        {
                            string ReceResult = Business.AlipayPrec_lf.ReceProperyOrder(CommunityId, orderId);
                            if (ReceResult == "success")
                            {
                                // 下账成功,送积分
                                PresentedPoint(userId, months);
                            }
                            Business.AlipayPrec_lf.Log("支付宝下账:" + CommunityId.ToString() + "," + orderId + "," + ReceResult);
                        }
                    }
                    else
                    {
                        Result = "支付宝验签失败:" + orderId;
                    }
                }
                else
                {
                    Result = "支付宝" + orderId + "订单信息不匹配!";
                }

                Business.AlipayPrec_lf.Log("支付宝流程:" + CommunityId.ToString() + "," + orderId + "," + Result);
                context.Response.ContentType = "text/plain";
                context.Response.Write(Result);
            }
            catch (Exception E)
            {
                Business.AlipayPrec_lf.Log(E.Message.ToString());
                context.Response.ContentType = "text/plain";
                context.Response.Write(E.Message.ToString());
            }
        }
示例#8
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                List <string> list = new List <string>();
                foreach (var item in context.Request.Params.AllKeys)
                {
                    list.Add($"{item}={context.Request.Params[item]}");
                }
                Business.Alipay.Log("购物收到支付宝通知" + context.Request.RawUrl + "?" + string.Join("&", list));

                HttpRequest Request = context.Request;
                Dictionary <string, string> sPara = GetRequestPost(context);

                decimal total_amount = AppGlobal.StrToDec(Request.Params["total_fee"].ToString());
                string  respcode     = Request.Params["trade_status"];
                string  respmsg      = Request.Params["trade_status"].ToString();
                string  orderId      = Request.Params["out_trade_no"].ToString();
                string  body         = Request.Params["body"].ToString();
                string  sign         = Request.Params["sign"];
                string  notify_id    = Request.Params["notify_id"];
                string  bussId       = body;

                string Result = "";

                Config c        = new Config();
                bool   IsConfig = new AlipayBusinessOrder_lf().GenerateConfig(bussId, out c);
                if (IsConfig == false)
                {
                    throw new Exception("未配置证书文件");
                }

                Business.AlipayBusinessOrder_lf.Log("开始验证:" + bussId.ToString() + "," + orderId);

                //返回报文中不包含UPOG,表示Server端正确接收交易请求,则需要验证Server端返回报文的签名
                Notify aliNotify = new Notify(c);

                if (aliNotify.GetResponseTxt(notify_id) == "true")
                {
                    Business.AlipayBusinessOrder_lf.Log("验证:" + bussId.ToString() + "," + orderId + " GetResponseTxt 正确");

                    if (aliNotify.GetSignVeryfy(sPara, sign))
                    {
                        Business.AlipayBusinessOrder_lf.Log("验证:" + bussId.ToString() + "," + orderId + " GetSignVeryfy 正确");

                        //更新订单返回状态
                        Business.AlipayBusinessOrder_lf.UpdateBusinessOrder(orderId, respcode, respmsg);
                        //已收到请求,无需再发送通知
                        Result = "success";
                        if (respcode == "TRADE_SUCCESS")
                        {
                            string ReceResult = Business.AlipayBusinessOrder_lf.ReceBusinessOrder(orderId, total_amount);

                            // 下账成功,操作积分
                            if (ReceResult == "success")
                            {
                                UsePoint(orderId);
                                PresentedPoint(bussId, orderId, total_amount);
                            }
                            Business.AlipayBusinessOrder_lf.Log("支付宝购物下账:" + bussId.ToString() + "," + orderId + "," + ReceResult);
                        }
                    }
                    else
                    {
                        Result = "支付宝购物验签失败:" + orderId;
                    }
                }
                else
                {
                    Result = "支付宝" + orderId + "订单信息不匹配!";
                }

                Business.Alipay.Log("支付宝购物流程:" + bussId.ToString() + "," + orderId + "," + Result);
                context.Response.ContentType = "text/plain";
                context.Response.Write(Result);
            }
            catch (Exception E)
            {
                Business.Alipay.Log(E.Message.ToString() + E.StackTrace + E.Source);
                context.Response.ContentType = "text/plain";
                context.Response.Write(E.Message.ToString());
            }
        }
        /// <summary>
        /// 搜索房屋
        /// </summary>
        private string SearchRoom(DataRow row)
        {
            var bussType    = "";
            var title       = "";
            var city        = "";
            var communityId = "";
            var houseType   = "";
            var amount      = "";
            var pageIndex   = 1;
            var pageSize    = 10;

            #region 查询条件
            if (row.Table.Columns.Contains("BussType") && !string.IsNullOrEmpty(row["BussType"].AsString()))
            {
                bussType = row["BussType"].AsString();
            }
            if (row.Table.Columns.Contains("Title") && !string.IsNullOrEmpty(row["Title"].AsString()))
            {
                title = row["Title"].AsString();
            }
            if (row.Table.Columns.Contains("City") && !string.IsNullOrEmpty(row["City"].AsString()))
            {
                city = row["City"].AsString();
            }
            if (row.Table.Columns.Contains("CommunityId") && !string.IsNullOrEmpty(row["CommunityId"].AsString()))
            {
                communityId = row["CommunityId"].AsString();
            }
            if (row.Table.Columns.Contains("HouseType") && !string.IsNullOrEmpty(row["HouseType"].AsString()))
            {
                houseType = row["HouseType"].AsString();
            }
            if (row.Table.Columns.Contains("Amount") && !string.IsNullOrEmpty(row["Amount"].AsString()))
            {
                amount = row["Amount"].AsString();
            }
            if (row.Table.Columns.Contains("PageIndex") && !string.IsNullOrEmpty(row["PageIndex"].AsString()))
            {
                pageIndex = AppGlobal.StrToInt(row["PageIndex"].AsString());
            }
            #endregion

            using (var conn = new SqlConnection(PubConstant.UnifiedContionString))
            {
                var condition = "";
                var parameter = new DynamicParameters();

                #region 查询条件
                // 业务类型
                if (!string.IsNullOrEmpty(bussType))
                {
                    if (bussType == "出租")
                    {
                        condition += " AND BussType in ('整租','合租')";
                    }
                    else
                    {
                        condition += $" AND BussType=@BussType";
                        parameter.Add("@BussType", bussType);
                    }
                }
                // 标题
                if (!string.IsNullOrEmpty(title))
                {
                    condition += $" AND Title LIKE @Title";
                    parameter.Add("@Title", $"%{ title }%");
                }

                // 城市
                if (!string.IsNullOrEmpty(city))
                {
                    condition += $" AND City=@City";
                    parameter.Add("@City", city);
                }

                // 项目
                if (!string.IsNullOrEmpty(communityId))
                {
                    condition += $" AND CommunityId=@CommunityId";
                    parameter.Add("@CommunityId", communityId);
                }

                // 户型
                if (!string.IsNullOrEmpty(houseType))
                {
                    if (houseType.Contains("+"))
                    {
                        condition += $" AND BedRooms>@BedRooms";
                        parameter.Add("@BedRooms", AppGlobal.StrToInt(houseType.Replace("+", "")));
                    }
                    else
                    {
                        condition += $" AND BedRooms=@BedRooms";
                        parameter.Add("@BedRooms", AppGlobal.StrToInt(houseType));
                    }
                }

                // 金额
                if (!string.IsNullOrEmpty(amount))
                {
                    var tmp = amount.Split('-').ToList();
                    if (tmp.Count() < 2)
                    {
                        tmp.Insert(0, "0");
                    }

                    condition += $" AND Amount>=@A1 AND Amount<=@A2";
                    parameter.Add("@A1", AppGlobal.StrToDec(tmp[0]));
                    parameter.Add("@A2", AppGlobal.StrToDec(tmp[1]));
                }
                #endregion

                String sqlNewAdd   = String.Empty;
                String sqlTbRental = String.Empty;
                String sqlStr      = "SELECT isnull(col_length('Tb_Rental','AmountMax'),0)";
                if (conn.Query <int>(sqlStr).FirstOrDefault() > 0)
                {
                    sqlNewAdd   = "[Description],LinkMan,LinkManTel,Orientation,AmountMax,BuildingAreaMax,HasElevator,CommName,SalesMan,SalesMobile,";
                    sqlTbRental = "[Description],LinkMan,LinkManTel,Orientation,AmountMax,BuildingAreaMax,HasElevator,CommunityName as CommName,SalesMan,SalesMobile,";
                }

                var sql = $@"SELECT * FROM
                            (
                                SELECT Id,Title,CommunityId,City,BussType,BuildingArea,HouseType,Renovation,Amount,PubDate,Img,Tags,{sqlNewAdd}
                                    row_number() OVER (ORDER BY PUBDATE DESC) AS RID
                                FROM
                                (
                                    SELECT Id,Title,BussType,BuildingArea,Renovation,Amount,PubDate,CommunityId,City,{sqlTbRental}
                                        CASE a.BedRooms WHEN 0 THEN '' ELSE substring('123456789',a.BedRooms,1)+'室' END+
                                        CASE a.LivingRooms WHEN 0 THEN '' ELSE substring('123456789',a.LivingRooms,1)+'厅' END+
                                        CASE ISNULL(a.KitchenRooms ,0) WHEN 0 THEN '' ELSE substring('123456789',a.KitchenRooms,1)+'厨' END+
                                        CASE a.BathRooms WHEN 0 THEN '' ELSE substring('123456789',a.BathRooms,1)+'卫' END AS HouseType,
                                        CASE CommunityId WHEN @CommunityId THEN 0 ELSE 1 END AS SN1,
                                        CASE City WHEN @City THEN 0 ELSE 1 END AS SN2,
                                        (SELECT Top 1 Value FROM SplitString(Img,',',1)) AS Img,
                                        CASE WHEN BussType IN ('整租','合租')  THEN
										STUFF((
											SELECT  ','+[Name] FROM (
											SELECT  row_number() over(partition by CATEGORYID order by IID  ) as rowIndex,* FROM Tb_Rental_TagSetting 
											 WHERE IID IN
											(
											SELECT VALUE FROM SplitString(
											(SELECT stuff((SELECT ','+Tags FROM (SELECT top 3 * FROM Tb_Rental_RoomTag x  WHERE x.RentalID =a.Id AND X.CategoryID IN (2,5)) as R  FOR XML PATH('')),1,1,'')),',',1)
											) 
											) AS T   ORDER BY Sort DESC FOR XML PATH('')
											),1,1,'')

										WHEN BussType = '出售'  THEN
										STUFF((
											SELECT  ','+[Name] FROM (
											SELECT  row_number() over(partition by CATEGORYID order by IID  ) as rowIndex,* FROM Tb_Rental_TagSetting 
											 WHERE IID IN
											(
											SELECT VALUE FROM SplitString(
											(SELECT stuff((SELECT ','+Tags FROM (SELECT top 3 * FROM Tb_Rental_RoomTag x  WHERE x.RentalID =a.Id AND X.CategoryID IN (2,5)) as R  FOR XML PATH('')),1,1,'')),',',1)
											) 
											) AS T   ORDER BY Sort DESC FOR XML PATH('')
											),1,1,'')
										else 
                                        stuff((SELECT ','+Name FROM Tb_Rental_TagSetting 
                                            WHERE IID IN
                                            (
                                                SELECT VALUE FROM SplitString(
                                                (SELECT stuff((SELECT ','+Tags FROM (SELECT top 3 * FROM Tb_Rental_RoomTag x  WHERE x.RentalID =a.Id AND X.CategoryID IN (2,5)) as R FOR XML PATH('')),1,1,'')),',',1)
                                                ) ORDER BY Sort DESC FOR XML PATH('')
                                        ),1,1,'')
										end as Tags 
                                    FROM Tb_Rental a
                                    WHERE ProcessState='发布' AND IsDelete=0 { condition }
                                ) AS t
                            ) AS t
                            WHERE t.RID>(@PageIndex-1)*@PageSize AND t.RID<=(@PageIndex*@PageSize);

                            SELECT count(1) FROM Tb_Rental 
                            WHERE ProcessState='发布' AND IsDelete=0 { condition };";

                parameter.Add("@CommunityId", communityId);
                parameter.Add("@City", city);
                parameter.Add("@PageIndex", pageIndex);
                parameter.Add("@PageSize", pageSize);

                var reader = conn.QueryMultiple(sql, parameter);
                var data   = reader.Read();
                var total  = reader.Read <int>().FirstOrDefault();

                var pageCount = (int)Math.Ceiling((double)total / pageSize);

                var json = new ApiResult(true, data).toJson();
                json = json.Insert(json.Length - 1, $",\"PageCount\":{pageCount}");
                return(json);
            }
        }
示例#10
0
        /// <summary>
        /// 添加求租/求售信息
        /// </summary>
        private string AddBuyAndRentalInfo(DataRow row)
        {
            #region 参数校验
            if (!row.Table.Columns.Contains("Type") || string.IsNullOrEmpty(row["Type"].AsString()) || !int.TryParse(row["Type"].AsString(), out int type))
            {
                return(new ApiResult(false, "缺少参数Type").toJson());
            }
            if (!row.Table.Columns.Contains("UserId") || string.IsNullOrEmpty(row["UserId"].AsString()))
            {
                return(new ApiResult(false, "缺少参数UserId").toJson());
            }
            String communityId = String.Empty;
            if (row.Table.Columns.Contains("CommunityId") && !string.IsNullOrEmpty(row["CommunityId"].AsString()))
            {
                communityId = row["CommunityId"].ToString();
            }
            if (!row.Table.Columns.Contains("LivingRooms") || string.IsNullOrEmpty(row["LivingRooms"].AsString()))
            {
                return(new ApiResult(false, "缺少参数LivingRooms").toJson());
            }
            if (!row.Table.Columns.Contains("BedRooms") || string.IsNullOrEmpty(row["BedRooms"].AsString()))
            {
                return(new ApiResult(false, "缺少参数BedRooms").toJson());
            }
            if (!row.Table.Columns.Contains("BathRooms") || string.IsNullOrEmpty(row["BathRooms"].AsString()))
            {
                return(new ApiResult(false, "缺少参数BathRooms").toJson());
            }
            if (!row.Table.Columns.Contains("KitchenRooms") || string.IsNullOrEmpty(row["KitchenRooms"].AsString()))
            {
                return(new ApiResult(false, "缺少参数KitchenRooms").toJson());
            }
            String orientation = String.Empty;
            if (row.Table.Columns.Contains("Orientation") && !string.IsNullOrEmpty(row["Orientation"].AsString()))
            {
                orientation = row["Orientation"].ToString();
            }
            if (!row.Table.Columns.Contains("BuildingArea") || string.IsNullOrEmpty(row["BuildingArea"].AsString()))
            {
                return(new ApiResult(false, "缺少参数BuildingArea").toJson());
            }
            if (!row.Table.Columns.Contains("Amount") || string.IsNullOrEmpty(row["Amount"].AsString()))
            {
                return(new ApiResult(false, "缺少参数Amount").toJson());
            }
            if (!row.Table.Columns.Contains("Linkman") || string.IsNullOrEmpty(row["Linkman"].AsString()))
            {
                return(new ApiResult(false, "缺少参数Linkman").toJson());
            }
            if (!row.Table.Columns.Contains("LinkmanTel") || string.IsNullOrEmpty(row["LinkmanTel"].AsString()))
            {
                return(new ApiResult(false, "缺少参数LinkmanTel").toJson());
            }
            int hasElevator = 0;
            if (row.Table.Columns.Contains("HasElevator") && !string.IsNullOrEmpty(row["HasElevator"].AsString()))
            {
                hasElevator = AppGlobal.StrToInt(row["HasElevator"].ToString());
            }
            if (!row.Table.Columns.Contains("AmountMax") || string.IsNullOrEmpty(row["AmountMax"].AsString()))
            {
                return(new ApiResult(false, "缺少参数最大金额").toJson());
            }
            if (!row.Table.Columns.Contains("BuildingAreaMax") || string.IsNullOrEmpty(row["BuildingAreaMax"].AsString()))
            {
                return(new ApiResult(false, "缺少参数最大建筑面积").toJson());
            }
            if (!row.Table.Columns.Contains("Title") || string.IsNullOrEmpty(row["Title"].AsString()))
            {
                return(new ApiResult(false, "缺少参数标题").toJson());
            }
            String renovation = String.Empty;
            if (row.Table.Columns.Contains("Renovation") && !string.IsNullOrEmpty(row["Renovation"].AsString()))
            {
                renovation = row["Renovation"].ToString();
            }
            String description = String.Empty;
            if (row.Table.Columns.Contains("Description") && !string.IsNullOrEmpty(row["Description"].AsString()))
            {
                description = row["Description"].ToString();
            }

            #endregion
            var    userId          = row["UserId"].ToString();
            var    livingRooms     = AppGlobal.StrToInt(row["LivingRooms"].ToString());
            var    bedRooms        = AppGlobal.StrToInt(row["BedRooms"].ToString());
            var    bathRooms       = AppGlobal.StrToInt(row["BathRooms"].ToString());
            var    kitchenRooms    = AppGlobal.StrToInt(row["KitchenRooms"].ToString());
            var    title           = row["Title"].ToString();
            var    buildingArea    = AppGlobal.StrToDec(row["BuildingArea"].ToString());
            var    bussType        = type == 1 ? "求购" : "求租";
            var    amount          = AppGlobal.StrToDec(row["Amount"].ToString());
            var    linkman         = row["Linkman"].ToString();
            var    linkmanTel      = row["LinkmanTel"].ToString();
            var    amountMax       = AppGlobal.StrToDec(row["AmountMax"].ToString());
            var    buildingAreaMax = AppGlobal.StrToDec(row["BuildingAreaMax"].ToString());
            String address         = String.Empty;
            var    community       = GetCommunity(communityId);
            if (community != null)
            {
                address = String.Format("{0}{1}{2}", community.Province, community.City, community.Area);
            }
            using (var conn = new SqlConnection(PubConstant.UnifiedContionString))
            {
                try
                {
                    var iid = Guid.NewGuid().ToString();
                    var sql = @"INSERT INTO Tb_Rental(Id,CommunityId,Address,UserId,Title,BussType,Province,City,Area,
                                    BuildingAge,BuildingArea,BuildingType,Floor,FloorCount,LivingRooms,BedRooms,
                                    BathRooms,KitchenRooms,Orientation,TranRoomTime,
                                    Renovation,Amount,Description,Img,LinkMan,LinkManTel,LinkManSex,PubDate,HasElevator,RegisterDate,InformationSource,AmountMax,BuildingAreaMax)
                                VALUES(@Id,@CommunityId,@Address,@UserId,@Title,@BussType,@Province,@City,@Area,
                                    @BuildingAge,@BuildingArea,@BuildingType,@Floor,@FloorCount,@LivingRooms,@BedRooms,
                                    @BathRooms,@KitchenRooms,@Orientation,@TranRoomTime,
                                    @Renovation,@Amount,@Description,@Img,@LinkMan,@LinkManTel,@LinkManSex,GETDATE(),@HasElevator,GETDATE(),'客户线上提交',@AmountMax,@BuildingAreaMax);";
                    var i   = conn.Execute(sql, new
                    {
                        Id              = iid,
                        CommunityId     = communityId,
                        Address         = address,
                        UserId          = userId,
                        BussType        = bussType,
                        Province        = community != null ? community.Province : String.Empty,
                        City            = community != null ? community.City : String.Empty,
                        Area            = community != null ? community.Area : String.Empty,
                        LivingRooms     = livingRooms,
                        BedRooms        = bedRooms,
                        BathRooms       = bathRooms,
                        KitchenRooms    = kitchenRooms,
                        BuildingAge     = String.Empty,
                        BuildingArea    = buildingArea,
                        BuildingType    = String.Empty,
                        Floor           = 0,
                        FloorCount      = 0,
                        Orientation     = orientation,
                        TranRoomTime    = String.Empty,
                        Renovation      = renovation,
                        Amount          = amount,
                        Description     = description,
                        Img             = String.Empty,
                        LinkMan         = linkman,
                        LinkManTel      = linkmanTel,
                        LinkManSex      = 0,
                        HasElevator     = hasElevator,
                        AmountMax       = amountMax,
                        BuildingAreaMax = buildingAreaMax,
                        Title           = title
                    });
                    return(JSONHelper.FromString(true, "添加成功"));
                }
                catch (Exception ex)
                {
                    return(JSONHelper.FromString(false, ex.Message));
                }
            }
        }
示例#11
0
        public void ProcessRequest(HttpContext context)
        {
            HttpRequest Request = context.Request;
            Dictionary <string, string> sPara = GetRequestPost(context);

            Business.AlipayBusinessOrder.Log("收到支付宝通知");
            Business.AlipayBusinessOrder.Log(Request.Url.AbsoluteUri);

            foreach (var key in sPara.Keys)
            {
                Business.AlipayBusinessOrder.Log(string.Format("key={0}, value={1}", key, sPara[key]));
            }

            try
            {
                string  respcode    = Request.Form["trade_status"];
                string  respmsg     = Request.Form["trade_status"].ToString();
                string  orderId     = Request.Form["out_trade_no"].ToString();
                string  CommunityId = Request.Form["body"].ToString();
                decimal realAmount  = AppGlobal.StrToDec(Request.Form["total_fee"].ToString());

                string notify_id = Request.Form["notify_id"]; //获取notify_id

                string sign = Request.Form["sign"];           //获取sign

                Config c = new Config();
                //初始化参数
                bool IsConfig = new AlipayBusinessOrder().GenerateConfig(CommunityId, out c);

                string Result = "";
                if (IsConfig == false)
                {
                    throw new Exception("未配置证书文件");
                }

                Business.AlipayBusinessOrder.Log("开始验证:" + CommunityId.ToString() + "," + orderId);

                //返回报文中不包含UPOG,表示Server端正确接收交易请求,则需要验证Server端返回报文的签名
                Notify aliNotify = new Notify(c);

                if (aliNotify.GetResponseTxt(notify_id) == "true")
                {
                    Business.AlipayBusinessOrder.Log("验证:" + CommunityId.ToString() + "," + orderId + " GetResponseTxt 正确");

                    if (aliNotify.GetSignVeryfy(sPara, sign))
                    {
                        Business.AlipayBusinessOrder.Log("验证:" + CommunityId.ToString() + "," + orderId + " GetSignVeryfy 正确");

                        //更新订单返回状态
                        Business.AlipayBusinessOrder.UpdateBusinessOrder(orderId, respcode, respmsg);
                        //已收到请求,无需再发送通知
                        Result = "success";
                        if (respcode == "TRADE_SUCCESS")
                        {
                            string ReceResult = Business.AlipayBusinessOrder.ReceBusinessOrder(orderId, realAmount);
                            Business.AlipayBusinessOrder.Log("支付宝商家下账:" + CommunityId.ToString() + "," + orderId + "," + ReceResult);
                        }
                    }
                    else
                    {
                        Result = "支付宝商家验签失败:" + orderId;
                    }
                }
                else
                {
                    Result = "支付宝" + orderId + "订单信息不匹配!";
                }

                Business.Alipay.Log("支付宝流程:" + CommunityId.ToString() + "," + orderId + "," + Result);
                context.Response.ContentType = "text/plain";
                context.Response.Write(Result);
            }
            catch (Exception E)
            {
                Business.Alipay.Log(E.Message.ToString() + E.StackTrace + E.Source);
                context.Response.ContentType = "text/plain";
                context.Response.Write(E.Message.ToString());
            }
        }
示例#12
0
        /// <summary>
        /// 修改求租/求售信息
        /// </summary>
        private string UpdateBuyAndRentalInfo(DataRow row)
        {
            #region 参数校验
            if (!row.Table.Columns.Contains("Id") || string.IsNullOrEmpty(row["Id"].AsString()))
            {
                return(new ApiResult(false, "缺少参数Id").toJson());
            }
            if (!row.Table.Columns.Contains("CommunityId") || string.IsNullOrEmpty(row["CommunityId"].AsString()))
            {
                return(new ApiResult(false, "缺少参数CommunityId").toJson());
            }
            if (!row.Table.Columns.Contains("LivingRooms") || string.IsNullOrEmpty(row["LivingRooms"].AsString()))
            {
                return(new ApiResult(false, "缺少参数LivingRooms").toJson());
            }
            if (!row.Table.Columns.Contains("BedRooms") || string.IsNullOrEmpty(row["BedRooms"].AsString()))
            {
                return(new ApiResult(false, "缺少参数BedRooms").toJson());
            }
            if (!row.Table.Columns.Contains("BathRooms") || string.IsNullOrEmpty(row["BathRooms"].AsString()))
            {
                return(new ApiResult(false, "缺少参数BathRooms").toJson());
            }
            if (!row.Table.Columns.Contains("KitchenRooms") || string.IsNullOrEmpty(row["KitchenRooms"].AsString()))
            {
                return(new ApiResult(false, "缺少参数KitchenRooms").toJson());
            }
            if (!row.Table.Columns.Contains("Orientation") || string.IsNullOrEmpty(row["Orientation"].AsString()))
            {
                return(new ApiResult(false, "缺少参数Orientation").toJson());
            }
            if (!row.Table.Columns.Contains("BuildingArea") || string.IsNullOrEmpty(row["BuildingArea"].AsString()))
            {
                return(new ApiResult(false, "缺少参数BuildingArea").toJson());
            }
            if (!row.Table.Columns.Contains("Amount") || string.IsNullOrEmpty(row["Amount"].AsString()))
            {
                return(new ApiResult(false, "缺少参数Amount").toJson());
            }
            if (!row.Table.Columns.Contains("Linkman") || string.IsNullOrEmpty(row["Linkman"].AsString()))
            {
                return(new ApiResult(false, "缺少参数Linkman").toJson());
            }
            if (!row.Table.Columns.Contains("LinkmanTel") || string.IsNullOrEmpty(row["LinkmanTel"].AsString()))
            {
                return(new ApiResult(false, "缺少参数LinkmanTel").toJson());
            }
            if (!row.Table.Columns.Contains("HasElevator") || string.IsNullOrEmpty(row["HasElevator"].AsString()))
            {
                return(new ApiResult(false, "缺少参数HasElevator").toJson());
            }
            if (!row.Table.Columns.Contains("AmountMax") || string.IsNullOrEmpty(row["AmountMax"].AsString()))
            {
                return(new ApiResult(false, "缺少参数最大金额").toJson());
            }
            if (!row.Table.Columns.Contains("BuildingAreaMax") || string.IsNullOrEmpty(row["BuildingAreaMax"].AsString()))
            {
                return(new ApiResult(false, "缺少参数最大建筑面积").toJson());
            }
            if (!row.Table.Columns.Contains("Title") || string.IsNullOrEmpty(row["Title"].AsString()))
            {
                return(new ApiResult(false, "缺少参数标题").toJson());
            }

            #endregion
            var title           = row["Title"].ToString();
            var iid             = row["Id"].ToString();
            var communityId     = row["CommunityId"].ToString();
            var livingRooms     = AppGlobal.StrToInt(row["LivingRooms"].ToString());
            var bedRooms        = AppGlobal.StrToInt(row["BedRooms"].ToString());
            var bathRooms       = AppGlobal.StrToInt(row["BathRooms"].ToString());
            var kitchenRooms    = AppGlobal.StrToInt(row["KitchenRooms"].ToString());
            var buildingArea    = AppGlobal.StrToDec(row["BuildingArea"].ToString());
            var orientation     = row["Orientation"].ToString();
            var amount          = AppGlobal.StrToDec(row["Amount"].ToString());
            var linkman         = row["Linkman"].ToString();
            var linkmanTel      = row["LinkmanTel"].ToString();
            var hasElevator     = AppGlobal.StrToInt(row["HasElevator"].ToString());
            var amountMax       = row["AmountMax"].ToString();
            var buildingAreaMax = row["BuildingAreaMax"].ToString();
            var community       = GetCommunity(communityId);
            if (community == null)
            {
                return(JSONHelper.FromString(false, "未查询到小区信息"));
            }
            using (var conn = new SqlConnection(PubConstant.UnifiedContionString))
            {
                try
                {
                    var sql = @"  UPDATE Tb_Rental SET  Address=@Address, Province=@Province,City=@City, Area=@Area,LivingRooms=@LivingRooms,BedRooms=@BedRooms,BathRooms=@BathRooms ,KitchenRooms =@KitchenRooms,
                     BuildingArea=@BuildingArea,Floor=@Floor,FloorCount=@FloorCount,Orientation=@Orientation,Amount=@Amount,LinkMan=@LinkMan,LinkManSex=@LinkManSex,HasElevator=@HasElevator,AmountMax=@AmountMax,
                    BuildingAreaMax=@BuildingAreaMax ,Title=@Title
                    WHERE Id=@Id  ";
                    var i   = conn.Execute(sql, new
                    {
                        Id              = iid,
                        Address         = String.Format("{0}{1}{2}", community.Province, community.City, community.Area),
                        Province        = community.Province,
                        City            = community.City,
                        Area            = community.Area,
                        LivingRooms     = livingRooms,
                        BedRooms        = bedRooms,
                        BathRooms       = bathRooms,
                        KitchenRooms    = kitchenRooms,
                        BuildingArea    = buildingArea,
                        Floor           = 0,
                        FloorCount      = 0,
                        Orientation     = orientation,
                        Amount          = amount,
                        LinkMan         = linkman,
                        LinkManTel      = linkmanTel,
                        LinkManSex      = 0,
                        HasElevator     = hasElevator,
                        AmountMax       = amountMax,
                        BuildingAreaMax = buildingAreaMax,
                        Title           = title
                    });
                    if (i > 0)
                    {
                        return(JSONHelper.FromString(true, "修改成功"));
                    }
                    return(JSONHelper.FromString(false, "修改失败"));
                }
                catch (Exception ex)
                {
                    return(JSONHelper.FromString(false, ex.Message));
                }
            }
        }
示例#13
0
        /// <summary>
        /// 人员放行登记
        /// </summary>
        private string AddInOutRecord(DataRow row)
        {
            if (!row.Table.Columns.Contains("IID") || string.IsNullOrEmpty(row["IID"].AsString()))
            {
                return(new ApiResult(false, "无效的出入证二维码").toJson());
            }
            if (!row.Table.Columns.Contains("Action") || string.IsNullOrEmpty(row["Action"].AsString()))
            {
                return(new ApiResult(false, "缺少参数Action").toJson());
            }
            if (!row.Table.Columns.Contains("BodyTemperature") || string.IsNullOrEmpty(row["BodyTemperature"].AsString()))
            {
                return(new ApiResult(false, "缺少参数BodyTemperature").toJson());
            }

            var iid             = row["IID"].AsString();
            var action          = AppGlobal.StrToInt(row["Action"].AsString());
            var bodyTemperature = AppGlobal.StrToDec(row["BodyTemperature"].AsString());

            var recordTime = DateTime.Now;

            if (row.Table.Columns.Contains("RecordTime") && !string.IsNullOrEmpty(row["RecordTime"].AsString()))
            {
                recordTime = Convert.ToDateTime(row["RecordTime"].AsString());
                var interval = (recordTime - DateTime.Now).TotalMinutes;
                if (interval > 10 || interval < -30)
                {
                    return(JSONHelper.FromString(false, "记录时间有误,请重新记录"));
                }
            }

            var purpose = default(string);

            if (row.Table.Columns.Contains("Purpose") && !string.IsNullOrEmpty(row["Purpose"].AsString()))
            {
                purpose = row["Purpose"].AsString();
            }

            var additionalInfo = default(string);

            if (row.Table.Columns.Contains("AdditionalInfo") && !string.IsNullOrEmpty(row["AdditionalInfo"].AsString()))
            {
                additionalInfo = row["AdditionalInfo"].AsString();
            }

            var roomId = 0;

            if (row.Table.Columns.Contains("RoomID") && !string.IsNullOrEmpty(row["RoomID"].AsString()))
            {
                roomId = AppGlobal.StrToInt(row["RoomID"].AsString());
            }

            using (var conn = new SqlConnection(PubConstant.hmWyglConnectionString))
            {
                conn.Open();
                var trans = conn.BeginTransaction();

                try
                {
                    var recordId = Guid.NewGuid().ToString();

                    var sql = @"INSERT INTO Tb_IOM_InOutRecord(IID,CommID,RoomID,PersonName,Gender,IDNumber,PassCardID,ActionType,BodyTemperature,ReleaseUser,Purpose)
                                SELECT @RecordID,b.CommID,b.RoomID,b.PersonName,b.Gender,b.IDNumber,a.IID,@ActionType,@BodyTemperature,@ReleaseUser,@Purpose
                                FROM Tb_IOM_PassCard a 
                                LEFT JOIN Tb_IOM_PersonRegistration b ON a.PersonRegistrationID=b.IID
                                WHERE a.IID=@PassCardID;";

                    var i = conn.Execute(sql, new
                    {
                        RecordID        = recordId,
                        ActionType      = action,
                        BodyTemperature = bodyTemperature,
                        ReleaseUser     = Global_Var.LoginUserCode,
                        PassCardID      = iid,
                        Purpose         = purpose
                    }, trans);

                    if (i == 1 && !string.IsNullOrEmpty(additionalInfo))
                    {
                        // 存在额外登记信息
                        sql = @"INSERT INTO Tb_IOM_InOutRecordAdditionalInfo(IID,InOutRecordID,AdditionalInfoID,Result) 
                                VALUES(newid(),@InOutRecordID,@AdditionalInfoID,@Result);";

                        var jArray = (JArray)JsonConvert.DeserializeObject(additionalInfo);
                        foreach (var item in jArray)
                        {
                            conn.Execute(sql, new
                            {
                                InOutRecordID    = recordId,
                                AdditionalInfoID = item["IID"].ToString(),
                                Result           = item["Value"].ToString()
                            }, trans);
                        }
                    }

                    if (roomId != 0)
                    {
                        sql = @"DECLARE @PersonRegistrationID varchar(36);
                                SELECT @PersonRegistrationID=PersonRegistrationID FROM Tb_IOM_PassCard WHERE IID=@PassCardID;

                                UPDATE Tb_IOM_PassCard SET RoomID=@RoomID WHERE IID=@PassCardID;
                                UPDATE Tb_IOM_PersonRegistration SET RoomID=@RoomID WHERE IID=@PersonRegistrationID;";

                        conn.Execute(sql, new { RoomID = roomId, PassCardID = iid });
                    }

                    trans.Commit();
                    return(JSONHelper.FromString(true, "信息记录成功,请放行"));
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    return(new ApiResult(false, ex.Message + ex.StackTrace).toJson());
                }
            }
        }
示例#14
0
        /// <summary>
        /// 生成订单        SetOrder
        /// </summary>
        /// <param name="row"></param>
        /// ShoppingDetailed            购物车明细编号【必填】
        /// UserAddressId               收货地址编号【必填】
        /// UserId                      用户编号【必填】
        /// 返回:
        ///     true:""
        ///     false:errmessage
        /// <returns></returns>
        private string SetOrder(DataRow row)
        {
            if (!row.Table.Columns.Contains("ShoppingDetailed") || string.IsNullOrEmpty(row["ShoppingDetailed"].ToString()))
            {
                return(JSONHelper.FromString(false, "购物车明细编号不能为空"));
            }
            if (!row.Table.Columns.Contains("UserAddressId") || string.IsNullOrEmpty(row["UserAddressId"].ToString()))
            {
                return(JSONHelper.FromString(false, "收货地址编号不能为空"));
            }
            if (!row.Table.Columns.Contains("UserId") || string.IsNullOrEmpty(row["UserId"].ToString()))
            {
                return(JSONHelper.FromString(false, "用户编号不能为空"));
            }

            IDbConnection con = new SqlConnection(PubConstant.GetConnectionString("BusinessContionString"));
            string        str = "";

            try
            {
                //获取收货地址
                Tb_User_Address UserAddress = BussinessCommon.GetAddressModel(row["UserAddressId"].ToString());

                //获取购物明细
                DataTable Dt_ShoppingDetailed = BussinessCommon.GetShoppingDetailedView(" Id in (" + BussinessCommon.GetShoppingDetailedIdS(row["ShoppingDetailed"].ToString()) + ")");

                if (Dt_ShoppingDetailed == null || Dt_ShoppingDetailed.Rows.Count <= 0)
                {
                    return(JSONHelper.FromString(false, "生成订单失败:未找到购物明细"));
                }


                Tb_Charge_Receipt Order = new Tb_Charge_Receipt();

                //根据商家ID分组
                var query = from t in Dt_ShoppingDetailed.AsEnumerable()
                            group t by new { t1 = t.Field <string>("BussId") } into m
                    select new
                {
                    BussId = m.Key.t1
                };
                if (query.ToList().Count > 0)
                {
                    query.ToList().ForEach(q =>
                    {
                        //生成订单
                        Order             = new Tb_Charge_Receipt();
                        Order.Id          = Guid.NewGuid().ToString();
                        Order.BussId      = q.BussId;
                        Order.OrderId     = Guid.NewGuid().ToString();
                        Order.ReceiptSign = DateTime.Now.ToString("yyyyMMddHHmmss") + new Random().Next(1000, 9999).ToString();
                        Order.UserId      = row["UserId"].ToString();
                        if (UserAddress != null)
                        {
                            if (UserAddress.Address != "" && UserAddress.Address.Split(',').Length > 0)
                            {
                                Order.Name           = UserAddress.Address.Split(',')[0];
                                Order.DeliverAddress = UserAddress.Address.Split(',')[1];
                            }
                            Order.Mobile = UserAddress.Mobile;
                        }
                        else
                        {
                            throw new Exception("该收货地址不存在");
                        }
                        Order.ReceiptDate = DateTime.Now;
                        Order.IsReceive   = "未收货";
                        Order.IsDeliver   = "未发货";
                        Order.IsPay       = "未付款";
                        Order.IsDelete    = 0;
                        //查询此商家的所有购物车明细
                        DataRow[] dr = Dt_ShoppingDetailed.Select("BussId=" + q.BussId);
                        //生成订单明细
                        foreach (DataRow item in dr)
                        {
                            Tb_Charge_ReceiptDetail OrderDetail = new Tb_Charge_ReceiptDetail();
                            OrderDetail.RpdCode       = Guid.NewGuid().ToString();
                            OrderDetail.ReceiptCode   = Order.Id;
                            OrderDetail.ResourcesID   = item["ResourcesID"].ToString();
                            OrderDetail.Quantity      = AppGlobal.StrToInt(item["Number"].ToString());
                            OrderDetail.SalesPrice    = AppGlobal.StrToDec(item["ResourcesSalePrice"].ToString());
                            OrderDetail.DiscountPrice = AppGlobal.StrToDec(item["ResourcesDisCountPrice"].ToString());
                            OrderDetail.GroupPrice    = AppGlobal.StrToDec(item["GroupBuyPrice"].ToString());
                            OrderDetail.DetailAmount  = AppGlobal.StrToDec(item["SubtotalMoney"].ToString());;
                            OrderDetail.RpdMemo       = "";
                            OrderDetail.RpdIsDelete   = 0;
                            //累计订单金额【取销售价格】
                            Order.Amount += AppGlobal.StrToDec(OrderDetail.SalesPrice.ToString()) * AppGlobal.StrToDec(OrderDetail.Quantity.ToString());
                            //生成订单明细
                            con.Insert <Tb_Charge_ReceiptDetail>(OrderDetail);
                        }
                        //生成订单
                        con.Insert <Tb_Charge_Receipt>(Order);
                        //判断此商家中是否存在该客户
                        string sqlStr      = "select BussId from Tb_Customer_List where BussId='" + q.BussId + "' and UserId='" + row["UserId"] + "' and Mobile='" + UserAddress.Mobile + "'";
                        List <string> list = con.Query <string>(sqlStr, null, null, true, null, CommandType.Text).ToList <string>();
                        //如果不存在,将此客户添加至此商家的客户资料中
                        if (list.Count <= 0)
                        {
                            Tb_Customer_List cust = new Tb_Customer_List();
                            cust.Id       = Guid.NewGuid().ToString();
                            cust.BussId   = q.BussId;
                            cust.UserId   = row["UserId"].ToString();
                            cust.Mobile   = UserAddress.Mobile;
                            cust.CustName = "";
                            con.Insert <Tb_Customer_List>(cust);
                        }
                    });
                }
            }
            catch (Exception ex)
            {
                str = ex.Message;
            }
            if (str != "")
            {
                return(JSONHelper.FromString(false, str));
            }
            else
            {
                return(JSONHelper.FromString(true, ""));
            }
        }
示例#15
0
        /// <summary>
        /// 更新当前打卡状态
        /// </summary>
        private string UpdateLocation(DataRow row)
        {
            if (!row.Table.Columns.Contains("Location") || string.IsNullOrEmpty(row["Location"].ToString()))
            {
                return(new ApiResult(false, "缺少参数Location").toJson());
            }
            if (!row.Table.Columns.Contains("FullLocation") || string.IsNullOrEmpty(row["FullLocation"].ToString()))
            {
                return(new ApiResult(false, "缺少参数FullLocation").toJson());
            }
            if (!row.Table.Columns.Contains("Longitude") || string.IsNullOrEmpty(row["Longitude"].ToString()))
            {
                return(new ApiResult(false, "缺少参数Longitude").toJson());
            }
            if (!row.Table.Columns.Contains("Latitude") || string.IsNullOrEmpty(row["Latitude"].ToString()))
            {
                return(new ApiResult(false, "缺少参数Latitude").toJson());
            }
            if (!row.Table.Columns.Contains("State") || string.IsNullOrEmpty(row["State"].ToString()))
            {
                return(new ApiResult(false, "缺少参数State").toJson());
            }
            var Location     = row["Location"].ToString();
            var FullLocation = row["FullLocation"].ToString();
            var Longitude    = AppGlobal.StrToDec(row["Longitude"].ToString());
            var Latitude     = AppGlobal.StrToDec(row["Latitude"].ToString());
            // App传入1,则将状态设置为在线;如传入0,则设置为离线
            var State = AppGlobal.StrToInt(row["State"].ToString());

            var Date = DateTime.Now.ToString("yyyy-MM-dd");//获取当前年月日

            using (IDbConnection conn = new SqlConnection(PubConstant.hmWyglConnectionString))
            {
                conn.Open();
                var trans = conn.BeginTransaction();
                try
                {
                    int count = conn.Query <int>($@"SELECT COUNT(*) FROM Tb_HSPR_AppOnlineClock WHERE CONVERT(varchar(10),ClockTime,120) = '{Date}' 
                                                    AND UserCode = {Global_Var.LoginUserCode} AND IsDelete = 0", null, trans).FirstOrDefault();
                    //判断今天是否有打卡记录
                    if (count > 0)//有打卡记录 更新数据
                    {
                        if (State == -1)
                        {
                            return(UpdateLocation(conn, trans, Location, FullLocation, Longitude, Latitude, State, Date));
                        }
                        else
                        {
                            int OnlineState = conn.Query <int>($@"SELECT ISNULL(ClockOnlineState,0) FROM Tb_HSPR_AppOnlineClock WHERE CONVERT(varchar(10),ClockTime,120) = '{Date}' 
                                                                AND UserCode = {Global_Var.LoginUserCode} AND IsDelete = 0 ORDER BY ClockTime DESC", null, trans).FirstOrDefault();
                            if (OnlineState == State)//状态一致 更新
                            {
                                return(UpdateLocation(conn, trans, Location, FullLocation, Longitude, Latitude, State, Date));
                            }
                            else
                            {
                                //状态不一致 插入新的数据
                                return(InsertLocation(conn, trans, Location, FullLocation, Longitude, Latitude, State, Date));
                            }
                        }
                    }
                    else
                    {
                        return(InsertLocation(conn, trans, Location, FullLocation, Longitude, Latitude, State, Date));
                    }
                }
                catch (Exception e)
                {
                    trans.Rollback();
                    return(new ApiResult(false, "定位更新失败" + e.Message).toJson());
                }
            }
        }
示例#16
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                RecordClientInfo record = new RecordClientInfo();

                List <string> list = new List <string>();
                foreach (var item in context.Request.Params.AllKeys)
                {
                    list.Add($"{item}={context.Request.Params[item]}");
                }
                Business.Alipay.Log("收到支付宝通知" + context.Request.RawUrl + "?" + string.Join("&", list));

                DataTable dAttributeTable = new DataTable();
                dAttributeTable.Columns.Add("CustID", Type.GetType("System.String"));
                DataRow newRow;
                newRow           = dAttributeTable.NewRow();
                newRow["CustID"] = "";
                dAttributeTable.Rows.Add(newRow);
                //record.RecordOperationLog(dAttributeTable.Rows[0], context.Request.RawUrl + "?" + string.Join("&", list), "Alipay", "支付宝回调");

                HttpRequest Request = context.Request;
                Dictionary <string, string> sPara = GetRequestPost(context);

                decimal total_amount = AppGlobal.StrToDec(Request.Params["total_fee"].ToString());
                string  respcode     = Request.Params["trade_status"];
                string  respmsg      = Request.Params["trade_status"].ToString();
                string  orderId      = Request.Params["out_trade_no"].ToString();
                string  body         = Request.Params["body"].ToString();
                string  userId       = null;
                if (body.Contains(","))
                {
                    userId = body.Split(',')[1];
                    body   = body.Split(',')[0];
                }

                string sign        = Request.Params["sign"];
                string notify_id   = Request.Params["notify_id"];
                string communityId = body;

                Config c = new Config();
                //初始化参数,并返回配置信息
                bool IsConfig = new Business.Alipay().GenerateConfig(communityId, out c);
                if (IsConfig == false)
                {
                    throw new Exception("未配置证书文件");
                }

                Business.Alipay.Log("开始验证:" + communityId.ToString() + "," + orderId);

                string Result = "";
                //返回报文中不包含UPOG,表示Server端正确接收交易请求,则需要验证Server端返回报文的签名
                Notify aliNotify = new Notify(c);

                if (aliNotify.GetResponseTxt(notify_id) == "true")
                {
                    Business.Alipay.Log("验证:" + communityId.ToString() + "," + orderId + " GetResponseTxt 正确");

                    if (aliNotify.GetSignVeryfy(sPara, sign))
                    {
                        Business.Alipay.Log("验证:" + communityId.ToString() + "," + orderId + " GetSignVeryfy 正确");

                        //已收到请求,无需再发送通知
                        Result = "success";
                        if (respcode == "TRADE_SUCCESS")
                        {
                            //更新订单返回状态
                            Business.Alipay.UpdateProperyOrder(communityId, orderId, respcode, respmsg);

                            string useHistoryId = null;

                            if (!string.IsNullOrEmpty(userId))
                            {
                                // 查询是否使用了积分
                                //UsePoint(orderId, userId, out useHistoryId);
                            }

                            string ReceResult = Business.Alipay.ReceProperyOrder(total_amount, communityId, orderId, useHistoryId);

                            // 下账成功,赠送积分
                            if (ReceResult == "success")
                            {
                                if (!string.IsNullOrEmpty(userId))
                                {
                                    // PresentedPoint(communityId, orderId, userId, useHistoryId, total_amount);
                                }
                            }

                            Business.Alipay.Log("支付宝下账:" + communityId.ToString() + "," + orderId + "," + ReceResult);
                            log.Info("支付宝下账:" + communityId.ToString() + "," + orderId + "," + ReceResult);
                        }
                    }
                    else
                    {
                        Result = "支付宝验签失败:" + orderId;
                    }
                }
                else
                {
                    Result = "支付宝" + orderId + "订单信息不匹配!";
                    //record.RecordOperationLog(dAttributeTable.Rows[0], context.Request.RawUrl + "?" + string.Join("&", list), "Alipay", "支付宝回调订单信息不匹配");
                }

                Business.Alipay.Log("支付宝流程:" + communityId.ToString() + "," + orderId + "," + Result);
                log.Info("支付宝流程:" + communityId.ToString() + "," + orderId + "," + Result);
                context.Response.ContentType = "text/plain";
                context.Response.Write(Result);
            }
            catch (Exception E)
            {
                Business.Alipay.Log(E.Message.ToString() + Environment.NewLine + E.StackTrace);
                log.Info("支付宝流程:" + E.Message.ToString() + Environment.NewLine + E.StackTrace);
                context.Response.ContentType = "text/plain";
                context.Response.Write(E.Message.ToString());
            }
        }
示例#17
0
        public bool CalcCostStanSettingAmountWithMonths(string CommID, string CustID, string RoomID, string CostID, string StanID, string HandID, int months, out decimal totalAmount)
        {
            totalAmount = 0;
            using (IDbConnection conn = new SqlConnection(PubConstant.hmWyglConnectionString))
            {
                // 计算费用开始时间
                string beginDateStr = conn.Query <string>("Proc_HSPR_Fees_CalcBeginDateFilter", new
                {
                    CommID = CommID,
                    CustID = CustID,
                    RoomID = RoomID,
                    CostID = CostID,
                    HandID = HandID
                }, null, false, null, CommandType.StoredProcedure).FirstOrDefault();

                if (string.IsNullOrEmpty(beginDateStr))
                {
                    beginDateStr = DateTime.Now.ToString();
                }

                DateTime FeesStateDate = Convert.ToDateTime(beginDateStr);
                DateTime FeesEndDate   = FeesStateDate.AddMonths(months);

                //// 计算应缴费用
                //dynamic info = conn.Query("Proc_HSPR_Fees_CalcAmount", new
                //{
                //    CommID = CommID,
                //    CustID = CustID,
                //    RoomID = RoomID,
                //    HandID = HandID,
                //    CostID = CostID,
                //    StanID = StanID,
                //    FeesStateDate = FeesStateDate,
                //    FeesEndDate = FeesEndDate,
                //    Amount = 0,
                //    Amount2 = 0
                //}, null, false, null, CommandType.StoredProcedure).FirstOrDefault();

                //if (null == info)
                //{
                //    return false;
                //}
                //totalAmount = info.DueAmount;
                //return true;

                StringBuilder sb = new StringBuilder();
                sb.AppendFormat(" and CommID={0}", CommID);
                sb.AppendFormat(" and CustID={0}", CustID);
                sb.AppendFormat(" and RoomID={0}", RoomID);
                sb.AppendFormat(" and CostID={0}", CostID);

                SqlParameter[] parameters =
                {
                    new SqlParameter("@SQLEx", SqlDbType.VarChar, 255)
                };
                parameters[0].Value = sb.ToString();

                DataSet Ds = new DbHelperSQLP(PubConstant.hmWyglConnectionString).RunProcedure("Proc_HSPR_CostStanSetting_Filter", parameters, "RetDataSet");

                if (Ds == null || Ds.Tables.Count <= 0)
                {
                    return(false);
                }

                try
                {
                    DateTime date1 = FeesStateDate;
                    DateTime date2 = FeesEndDate;
                    date2 = date2.AddMonths(1).AddDays(-1);

                    while (date1 < date2)
                    {
                        SqlParameter[] paramete =
                        {
                            new SqlParameter("@CommID",        SqlDbType.Int),
                            new SqlParameter("@CustID",        SqlDbType.BigInt),
                            new SqlParameter("@RoomID",        SqlDbType.BigInt),

                            new SqlParameter("@HandID",        SqlDbType.BigInt),
                            new SqlParameter("@CostID",        SqlDbType.BigInt),
                            new SqlParameter("@StanID",        SqlDbType.BigInt),

                            new SqlParameter("@FeesStateDate", SqlDbType.DateTime),
                            new SqlParameter("@FeesEndDate",   SqlDbType.DateTime),
                            new SqlParameter("@Amount",        SqlDbType.Decimal),

                            new SqlParameter("@Amount2",       SqlDbType.Decimal)
                        };
                        paramete[0].Value = CommID;
                        paramete[1].Value = CustID;
                        paramete[2].Value = RoomID;
                        paramete[3].Value = 0;
                        paramete[4].Value = CostID;

                        paramete[5].Value = StanID;
                        paramete[6].Value = date1;
                        paramete[7].Value = date1.AddMonths(months).AddDays(-1);
                        paramete[8].Value = 0;
                        paramete[9].Value = 1;

                        DataTable dTableCalc = new DbHelperSQLP(PubConstant.hmWyglConnectionString).RunProcedure("Proc_HSPR_Fees_CalcAmount", paramete, "RetDataSet").Tables[0];

                        if (dTableCalc.Rows.Count > 0)
                        {
                            DataRow DRowCalc = dTableCalc.Rows[0];
                            totalAmount = AppGlobal.StrToDec(DRowCalc["DueAmount"].ToString());
                            dTableCalc.Dispose();

                            return(true);
                        }
                        dTableCalc.Dispose();
                        date1 = date1.AddMonths(1);
                    }
                }
                catch (Exception ex)
                {
                    return(false);
                }

                return(true);
            }
        }
示例#18
0
        public static int ReceivePrecFees_POS(string Memo, int iCommID, long iCustID, long iRoomID, string[] CostIDs
                                              , string strChargeMode, string[] iPrecAmounts, string strUserCode, ref string HitResult, ref string strBillsDate, ref string ErrMsg, ref long iReceID)
        {
            int  iReturn = 0;
            bool IsPrint = true;

            int Percent = 0;//完成百分比

            iReceID = 0;

            HitResult = "";

            string   strBillsSign = "";
            int      iPrintTimes  = 0;
            DateTime dBillsDate   = DateTime.Now;

            strBillsDate = dBillsDate.ToString();

            int    iAccountWay = TypeRule.TWAccountWay.PreCosts;
            string strReceMemo = "";
            int    iIsDelete   = 0;

            //string strInvoiceBills = "";
            //long iInvoiceTypeID = 0;

            string strInvoiceBill  = "";
            string strInvoiceUnit  = "";
            string strRemitterUnit = "";

            string strBankName    = "";
            string strBankAccount = "";

            string strChequeBill = "";
            long   iBillTypeID   = 0;

            try
            {
                #region 保存明细
                string strSQL = "  and CommID = " + iCommID.ToString() + "  ";
                strSQL = strSQL + " and CustID = -1 and RoomID = -1 ";

                DataTable dTableDetail = HSPR_PreCostsDetail_Filter(strSQL);

                if (dTableDetail != null)
                {
                    for (int i = 0; i < CostIDs.Length; i++)
                    {
                        DataRow DRow = dTableDetail.NewRow();
                        DRow["RecdID"] = 0;
                        DRow["PrecID"] = 0;
                        DRow["CommID"] = iCommID;
                        DRow["CostID"] = AppGlobal.StrToLong(CostIDs[i]);
                        DRow["CustID"] = iCustID;
                        DRow["RoomID"] = iRoomID;
                        decimal amount = AppGlobal.StrToDec(iPrecAmounts[i]);
                        //DRow["PrecAmount"]=AppGlobal.StrToDec(PrecAmount.Value.ToString());
                        if (amount <= 0)
                        {
                            DRow["PrecAmount"] = 0;
                        }
                        else
                        {
                            DRow["PrecAmount"] = amount;
                        }
                        string strPrecMemo = Memo;
                        if (strPrecMemo == "请点击费用备注生成费用期间")
                        {
                            strPrecMemo = "";
                        }
                        DRow["PrecMemo"]  = strPrecMemo;
                        DRow["BillsSign"] = strBillsSign;
                        DRow["PrecDate"]  = DateTime.Now.ToString();
                        DRow["UserCode"]  = strUserCode;


                        DRow["CostIDs"]    = AppGlobal.StrToLong(CostIDs[i]);
                        DRow["RoomSign"]   = "";
                        DRow["CostNames"]  = "";
                        DRow["UserName"]   = "";
                        DRow["ChargeMode"] = strChargeMode;
                        DRow["AccountWay"] = TypeRule.TWAccountWay.PreCosts;

                        DRow["HandID"] = 0;

                        DRow["HandIDs"] = "";

                        DRow["ParkNames"] = "";

                        DRow["IsDelete"] = 0;

                        dTableDetail.Rows.Add(DRow);
                    }

                    dTableDetail.AcceptChanges();
                }
                #endregion

                HitResult = "";
                IsPrint   = false;

                decimal iTotalAmount    = 0;
                int     iFeesLimitCount = 0;

                string strProcName = "Proc_HSPR_PreCosts_InsertAuto";

                string ChildSQLEx = "";

                string[] arrSQLEx = new string[10];

                int iSelCount = 0;
                int iCut      = 0;

                //每段笔数
                int iExcCount = 10;

                //*行计数器
                int     k   = 0;
                Decimal Len = 1;

                if (dTableDetail != null)
                {
                    if (dTableDetail.Rows.Count != 0)
                    {
                        Len = Convert.ToDecimal(dTableDetail.Rows.Count + 1);

                        foreach (DataRow DRow in dTableDetail.Rows)
                        {
                            k++;
                            Percent = Convert.ToInt32(k / Len * 100);

                            #region 取值
                            int     iiCommID     = AppGlobal.StrToInt(DRow["CommID"].ToString());
                            long    iiCustID     = AppGlobal.StrToLong(DRow["CustID"].ToString());
                            long    iiRoomID     = AppGlobal.StrToLong(DRow["RoomID"].ToString());
                            long    iiCostID     = AppGlobal.StrToLong(DRow["CostID"].ToString());
                            decimal iiPrecAmount = AppGlobal.StrToDec(DRow["PrecAmount"].ToString());
                            string  strPrecMemo  = DRow["PrecMemo"].ToString();
                            long    iiHandID     = AppGlobal.StrToLong(DRow["HandID"].ToString());

                            string strTmpCostIDs = DRow["CostIDs"].ToString();
                            string strTmpHandIDs = DRow["HandIDs"].ToString();

                            #endregion

                            #region 合计
                            iTotalAmount = iTotalAmount + iiPrecAmount;

                            if (iiPrecAmount > 0)
                            {
                                iFeesLimitCount++;
                            }
                            #endregion

                            //有需要预交的费用
                            if (iiPrecAmount > 0)
                            {
                                #region 明细生成

                                ChildSQLEx = " exec " + strProcName + " " + iiCommID.ToString() + ","
                                             + iiCustID.ToString() + ","
                                             + iiRoomID.ToString() + ","
                                             + iiCostID.ToString() + ","
                                             + iiPrecAmount.ToString() + ","
                                             + "$ReceID$" + ","
                                             + "N'" + strPrecMemo + "',"
                                             + iiHandID.ToString() + ","
                                             + "N'" + strTmpCostIDs + "',"
                                             + "N'" + strTmpHandIDs + "'"
                                             + "\r\n";

                                #region 分成多段
                                if ((iSelCount < (iExcCount * (iCut + 1))) && (iSelCount >= iExcCount * iCut))
                                {
                                    arrSQLEx[iCut] = arrSQLEx[iCut] + ChildSQLEx;
                                }

                                iSelCount++;

                                if (iSelCount >= (iExcCount * (iCut + 1)))
                                {
                                    iCut++;
                                }

                                #endregion

                                #endregion
                            }
                        }

                        //有需要预交的费用
                        if (iFeesLimitCount > 0)
                        {
                            #region 票据
                            DataTable dTable = HSPR_BillUse_GetBillsSignUseRange(iCommID, "", "POS机端");

                            if (dTable.Rows.Count > 0)
                            {
                                DataRow DRow = dTable.Rows[0];

                                iBillTypeID  = AppGlobal.StrToLong(DRow["BillTypeID"].ToString());
                                strBillsSign = DRow["BillsSign"].ToString();
                                HitResult    = strBillsSign;
                            }
                            dTable.Dispose();
                            #endregion

                            //预交收据
                            iReceID = HSPR_PreCostsReceipts_InsertAuto(iCommID, iCustID, iRoomID, strBillsSign
                                                                       , iPrintTimes, strBillsDate, strUserCode, strChargeMode, iAccountWay, strReceMemo, iTotalAmount, iIsDelete
                                                                       , strInvoiceBill, strInvoiceUnit, strRemitterUnit, strBankName, strBankAccount, strChequeBill, iBillTypeID
                                                                       , arrSQLEx[0], arrSQLEx[1], arrSQLEx[2], arrSQLEx[3], arrSQLEx[4], arrSQLEx[5], arrSQLEx[6], arrSQLEx[7], arrSQLEx[8], arrSQLEx[9]);

                            #region 收据记录
                            if (strBillsSign != "")
                            {
                                if (iReceID != 0)
                                {
                                    int iSourceType = 2;//预交收据
                                    HSPR_BillUseInstead_InsUpdate(iCommID, iBillTypeID, strBillsSign, strUserCode, iReceID, iSourceType, TypeRule.TWBillUseCase.PreCosts);
                                }

                                //更新号段数量和金额
                                if ((iBillTypeID != 0) && (strBillsSign != ""))
                                {
                                    HSPR_BillUse_UpdateData(iCommID, iBillTypeID, strBillsSign);
                                }
                            }
                            #endregion

                            #region  回發票據號
                            string    ContionStringr = ConnectionString;
                            string    strSqlr        = " select BillsSign,BillsDate   from Tb_HSPR_PreCostsReceipts where receid='" + iReceID + "' ";
                            DataTable dtr            = new DbHelperSQLP(PubConstant.GetConnectionString("SQLConnection").ToString()).Query(strSqlr).Tables[0];
                            if (dtr.Rows.Count > 0)
                            {
                                DataRow DRow = dtr.Rows[0];
                                strBillsSign = DRow["BillsSign"].ToString();
                                HitResult    = strBillsSign;
                                strBillsDate = DRow["BillsDate"].ToString();
                            }

                            #endregion

                            if (iReceID != 0)
                            {
                                IsPrint = true;
                            }
                            else
                            {
                                HitResult = "预存费用失败!";
                                IsPrint   = false;
                            }
                        }
                    }
                    else
                    {
                        HitResult = "请添加需要预交的费用!";

                        IsPrint = false;
                    }
                }
            }
            catch (Exception ex)
            {
                ErrMsg = ex.Message;
            }
            finally
            {
            }

            if (IsPrint == true)
            {
                iReturn = 1;
            }
            else
            {
                iReturn = 0;
            }


            return(iReturn);
        }
示例#19
0
        /// <summary>
        /// 客服动态
        /// </summary>
        /// <returns></returns>
        public string GetIncidentDynamic(DataRow row)
        {
            #region
            int iCommID = 0;
            if (row.Table.Columns.Contains("CommID"))
            {
                iCommID = AppGlobal.StrToInt(row["CommID"].ToString());
            }
            string userCode = Global_Var.LoginUserCode;
            if (row.Table.Columns.Contains("UserCode"))
            {
                userCode = row["UserCode"].ToString();
            }
            string organCode    = null;
            string strCommName  = AppGlobal.GetCommName(iCommID);
            string strOrganName = "";

            //未分派的报事
            int NoDispIncidentNum = 0;
            //未完结的协调单
            int NoCoordinateIncidentNum = 0;
            //逾期的协调单
            int BeOverdueIncidentNum = 0;

            string strDate   = "";
            string strReText = "";

            int iIncidentNum1 = 0;
            int iIncidentNum2 = 0;
            int iIncidentNum3 = 0;
            int iIncidentNum4 = 0;
            int iIncidentNum5 = 0;

            decimal iIncidentRate1 = 0;
            decimal iIncidentRate2 = 0;
            decimal iIncidentRate3 = 0;
            decimal iIncidentRate4 = 0;
            #endregion

            string strSQL = "";
            int    temp   = 3;

            // 项目客服动态
            if (iCommID != 0)
            {
                strSQL = " and CommID = " + iCommID.ToString() + " and datediff(day,StatDate,getdate()) = 1 and StatType = 1 ";
            }
            else
            {
                if (row.Table.Columns.Contains("OrganCode"))
                {
                    organCode = row["OrganCode"].ToString();
                }

                if (string.IsNullOrEmpty(organCode))
                {
                    organCode = "01";
                }

                strOrganName = AppGlobal.GetOrganName4(organCode);

                // 分公司
                if (organCode.Length == 4)
                {
                    temp   = 2;
                    strSQL = " and OrganCode like '" + organCode + "%' and datediff(day,StatDate,getdate()) = 1 and StatType = 2 ";
                }

                // 总公司
                if (organCode.Length == 2)
                {
                    temp   = 1;
                    strSQL = " and datediff(day,StatDate,getdate()) = 1 and StatType = 3 ";
                }
            }

            MobileSoft.BLL.Sys.Bll_Tb_Sys_TakePic Bll = new MobileSoft.BLL.Sys.Bll_Tb_Sys_TakePic();

            DataTable dTable = Bll.GetListFromProc(strSQL).Tables[0];

            if (dTable.Rows.Count > 0)
            {
                DataRow DRow = dTable.Rows[0];

                NoDispIncidentNum       = AppGlobal.StrToInt(DRow["NoDispIncidentNum"].ToString());
                NoCoordinateIncidentNum = AppGlobal.StrToInt(DRow["NoCoordinateIncidentNum"].ToString());
                BeOverdueIncidentNum    = AppGlobal.StrToInt(DRow["BeOverdueIncidentNum"].ToString());

                iIncidentNum1 = AppGlobal.StrToInt(DRow["IncidentNum1"].ToString());
                iIncidentNum2 = AppGlobal.StrToInt(DRow["IncidentNum2"].ToString());
                iIncidentNum3 = AppGlobal.StrToInt(DRow["IncidentNum3"].ToString());
                iIncidentNum4 = AppGlobal.StrToInt(DRow["IncidentNum4"].ToString());
                iIncidentNum5 = AppGlobal.StrToInt(DRow["IncidentNum5"].ToString());

                iIncidentRate1 = AppGlobal.StrToDec(DRow["IncidentRate1"].ToString());
                iIncidentRate2 = AppGlobal.StrToDec(DRow["IncidentRate2"].ToString());
                iIncidentRate3 = AppGlobal.StrToDec(DRow["IncidentRate3"].ToString());
                iIncidentRate4 = AppGlobal.StrToDec(DRow["IncidentRate4"].ToString());

                strDate = AppGlobal.StrToDate(DRow["StatDate"].ToString()).ToString("yyyy年MM月dd日");
            }
            dTable.Dispose();

            if (string.IsNullOrEmpty(strDate))
            {
                strDate = DateTime.Now.ToString("yyyy年MM月dd日");
            }

            // 读取报时预警信息
            MobileSoft.BLL.HSPR.Bll_Tb_HSPR_TempIncidentWarning Bll3 = new MobileSoft.BLL.HSPR.Bll_Tb_HSPR_TempIncidentWarning();
            DataTable dTable3 = Bll3.GetList(userCode, iCommID).Tables[0];

            string value1 = "";
            string value2 = "";
            string value3 = "";

            if (dTable3.Rows.Count > 0)
            {
                DataRow DRow = dTable3.Rows[0];
                value1 = DRow[0].ToString();
                value2 = DRow[1].ToString();
                value3 = DRow[2].ToString();
            }

            switch (temp)
            {
            case 3:
                strReText = string.Format(@"【{0}】<br/>1、截止到{1},未分派报事{2}件,未完结的派工单{3}件(其中逾期{4}件),未完结的协调单{5}件(其中逾期{6}件);本月派工单完结率{7}%,本年累计{8}%;本月协调单完结率{9}%,本年累计{10}%。<br/>2、{11},共有{12}件报事,其中{13}件未完结。<br/>3、超时预警:已受理未分派超时工单{14}件,已分派未处理超时工单{15}件,已处理未回访超时工单{16}件;",
                                          strCommName, strDate, NoDispIncidentNum.ToString(), iIncidentNum1.ToString(), iIncidentNum2.ToString(), NoCoordinateIncidentNum.ToString(), BeOverdueIncidentNum.ToString(), iIncidentRate1.ToString("N2"), iIncidentRate2.ToString("N2"), iIncidentRate3.ToString("N2"), iIncidentRate4.ToString("N2"), strDate, iIncidentNum4.ToString(), iIncidentNum5.ToString(), value1, value2, value3);
                break;

            case 2:
            case 1:
                strReText = string.Format(@"【{0}】<br/>1、截止到{1},未分派报事{2}件,未完结的派工单{3}件(其中逾期{4}件),未完结的协调单{5}件(其中逾期{6}件);本月派工单完结率{7}%,本年累计{8}%;本月协调单完结率{9}%,本年累计{10}%。<br/>2、{11},共有{12}件报事,其中{13}件未完结。<br/>3、超时预警:已受理未分派超时工单{14}件,已分派未处理超时工单{15}件,已处理未回访超时工单{16}件;",
                                          strOrganName, strDate, NoDispIncidentNum.ToString(), iIncidentNum1.ToString(), iIncidentNum2.ToString(), NoCoordinateIncidentNum.ToString(), BeOverdueIncidentNum.ToString(), iIncidentRate1.ToString("N2"), iIncidentRate2.ToString("N2"), iIncidentRate3.ToString("N2"), iIncidentRate4.ToString("N2"), strDate, iIncidentNum4.ToString(), iIncidentNum5.ToString(), value1, value2, value3);
                break;
            }

            // 客服动态图表统计
            MobileSoft.BLL.Sys.Bll_Tb_Sys_TakePicIncidentTypeDeskTop Bll2 = new MobileSoft.BLL.Sys.Bll_Tb_Sys_TakePicIncidentTypeDeskTop();
            DataTable dTable2 = Bll2.GetList(organCode, iCommID).Tables[0];

            string chart = JSONHelper.FromDataTable(dTable2);

            return(JSONHelper.FromJsonString(true, "{\"Info\":\"" + strReText + "\", \"Chart\":" + chart + "}"));
        }
示例#20
0
        /// <summary>
        /// 更新出售信息
        /// </summary>
        private string UpdateSaleInfo(DataRow row)
        {
            #region 参数校验

            if (!row.Table.Columns.Contains("Id") || string.IsNullOrEmpty(row["Id"].AsString()))
            {
                return(new ApiResult(false, "缺少参数Id").toJson());
            }
            if (!row.Table.Columns.Contains("UserId") || string.IsNullOrEmpty(row["UserId"].AsString()))
            {
                return(new ApiResult(false, "缺少参数UserId").toJson());
            }
            if (!row.Table.Columns.Contains("CommunityId") || string.IsNullOrEmpty(row["CommunityId"].AsString()))
            {
                return(new ApiResult(false, "缺少参数CommunityId").toJson());
            }
            if (!row.Table.Columns.Contains("Address") || string.IsNullOrEmpty(row["Address"].AsString()))
            {
                return(new ApiResult(false, "缺少参数Address").toJson());
            }
            if (!row.Table.Columns.Contains("Title") || string.IsNullOrEmpty(row["Title"].AsString()))
            {
                return(new ApiResult(false, "缺少参数Title").toJson());
            }
            if (!row.Table.Columns.Contains("LivingRooms") || string.IsNullOrEmpty(row["LivingRooms"].AsString()))
            {
                return(new ApiResult(false, "缺少参数LivingRooms").toJson());
            }
            if (!row.Table.Columns.Contains("BedRooms") || string.IsNullOrEmpty(row["BedRooms"].AsString()))
            {
                return(new ApiResult(false, "缺少参数BedRooms").toJson());
            }
            if (!row.Table.Columns.Contains("BathRooms") || string.IsNullOrEmpty(row["BathRooms"].AsString()))
            {
                return(new ApiResult(false, "缺少参数BathRooms").toJson());
            }
            if (!row.Table.Columns.Contains("KitchenRooms") || string.IsNullOrEmpty(row["KitchenRooms"].AsString()))
            {
                return(new ApiResult(false, "缺少参数KitchenRooms").toJson());
            }
            if (!row.Table.Columns.Contains("Orientation") || string.IsNullOrEmpty(row["Orientation"].AsString()))
            {
                return(new ApiResult(false, "缺少参数Orientation").toJson());
            }
            if (!row.Table.Columns.Contains("BuildingAge") || string.IsNullOrEmpty(row["BuildingAge"].AsString()))
            {
                return(new ApiResult(false, "缺少参数BuildingAge").toJson());
            }
            if (!row.Table.Columns.Contains("BuildingArea") || string.IsNullOrEmpty(row["BuildingArea"].AsString()))
            {
                return(new ApiResult(false, "缺少参数BuildingArea").toJson());
            }
            if (!row.Table.Columns.Contains("BuildingType") || string.IsNullOrEmpty(row["BuildingType"].AsString()))
            {
                return(new ApiResult(false, "缺少参数BuildingType").toJson());
            }
            if (!row.Table.Columns.Contains("TranRoomTime") || string.IsNullOrEmpty(row["TranRoomTime"].AsString()))
            {
                return(new ApiResult(false, "缺少参数TranRoomTime").toJson());
            }
            if (!row.Table.Columns.Contains("Floor") || string.IsNullOrEmpty(row["Floor"].AsString()))
            {
                return(new ApiResult(false, "缺少参数Floor").toJson());
            }
            if (!row.Table.Columns.Contains("FloorCount") || string.IsNullOrEmpty(row["FloorCount"].AsString()))
            {
                return(new ApiResult(false, "缺少参数FloorCount").toJson());
            }
            if (!row.Table.Columns.Contains("Renovation") || string.IsNullOrEmpty(row["Renovation"].AsString()))
            {
                return(new ApiResult(false, "缺少参数Renovation").toJson());
            }
            if (!row.Table.Columns.Contains("Amount") || string.IsNullOrEmpty(row["Amount"].AsString()))
            {
                return(new ApiResult(false, "缺少参数Amount").toJson());
            }
            if (!row.Table.Columns.Contains("Linkman") || string.IsNullOrEmpty(row["Linkman"].AsString()))
            {
                return(new ApiResult(false, "缺少参数Linkman").toJson());
            }
            if (!row.Table.Columns.Contains("LinkmanTel") || string.IsNullOrEmpty(row["LinkmanTel"].AsString()))
            {
                return(new ApiResult(false, "缺少参数LinkmanTel").toJson());
            }
            if (!row.Table.Columns.Contains("LinkmanSex") || string.IsNullOrEmpty(row["LinkmanSex"].AsString()))
            {
                return(new ApiResult(false, "缺少参数LinkmanSex").toJson());
            }
            if (!row.Table.Columns.Contains("HasElevator") || string.IsNullOrEmpty(row["HasElevator"].AsString()))
            {
                return(new ApiResult(false, "缺少参数HasElevator").toJson());
            }
            if (!row.Table.Columns.Contains("Imgs") || string.IsNullOrEmpty(row["Imgs"].AsString()))
            {
                return(new ApiResult(false, "缺少参数Imgs").toJson());
            }

            #endregion

            var id          = row["Id"].ToString();
            var title       = row["Title"].ToString();
            var userId      = row["UserId"].ToString();
            var communityId = row["CommunityId"].ToString();
            var address     = row["Address"].ToString();

            var livingRooms  = AppGlobal.StrToInt(row["LivingRooms"].ToString());
            var bedRooms     = AppGlobal.StrToInt(row["BedRooms"].ToString());
            var bathRooms    = AppGlobal.StrToInt(row["BathRooms"].ToString());
            var kitchenRooms = AppGlobal.StrToInt(row["KitchenRooms"].ToString());

            var buildingAge  = AppGlobal.StrToInt(row["BuildingAge"].ToString());
            var buildingType = row["BuildingType"].ToString();
            var buildingArea = AppGlobal.StrToDec(row["BuildingArea"].ToString());
            var tranRoomTime = AppGlobal.StrToDate(row["TranRoomTime"].ToString());
            var orientation  = row["Orientation"].ToString();
            var floor        = AppGlobal.StrToInt(row["Floor"].ToString());
            var floorCount   = AppGlobal.StrToInt(row["FloorCount"].ToString());
            var bussType     = "出售";
            var renovation   = row["Renovation"].ToString();
            var amount       = AppGlobal.StrToDec(row["Amount"].ToString());
            var linkman      = row["Linkman"].ToString();
            var linkmanTel   = row["LinkmanTel"].ToString();
            var linkmanSex   = AppGlobal.StrToInt(row["LinkmanSex"].ToString());
            var hasElevator  = AppGlobal.StrToInt(row["HasElevator"].ToString());
            var imgs         = row["Imgs"].ToString();

            var description = default(string);
            if (row.Table.Columns.Contains("Description") && !string.IsNullOrEmpty(row["Description"].AsString()))
            {
                description = row["Description"].AsString();
            }

            var community = GetCommunity(communityId);
            if (community == null)
            {
                return(JSONHelper.FromString(false, "未查询到小区信息"));
            }

            using (var conn = new SqlConnection(PubConstant.UnifiedContionString))
            {
                conn.Open();

                var trans = conn.BeginTransaction();

                try
                {
                    var sql = @"UPDATE  Tb_Rental
                                    SET CommunityId=@CommunityId,Address=@Address,UserId=@UserId,Title=@Title,
                                    BussType=@BussType,City=@City,Area=@Area, BuildingAge=@BuildingAge, 
                                    BuildingArea=@BuildingArea,BuildingType=@BuildingType,Floor=@Floor,FloorCount=@FloorCount,
                                    LivingRooms=@LivingRooms,BedRooms=@BedRooms, BathRooms=@BathRooms,KitchenRooms=@KitchenRooms,
                                    Orientation=@Orientation, TranRoomTime=@TranRoomTime,Renovation=@Renovation,
                                    Amount=@Amount,Description=@Description,Img=@Img,LinkMan=@LinkMan, LinkManTel=@LinkManTel,
                                    LinkManSex=@LinkManSex,PubDate=getdate(), HasElevator=@HasElevator
                                WHERE Id=@Id";

                    var i = conn.Execute(sql, new
                    {
                        Id           = id,
                        CommunityId  = community.Id,
                        Address      = address,
                        UserId       = userId,
                        Title        = title,
                        BussType     = bussType,
                        City         = community.City,
                        Area         = community.Area,
                        LivingRooms  = livingRooms,
                        BedRooms     = bedRooms,
                        BathRooms    = bathRooms,
                        KitchenRooms = kitchenRooms,
                        BuildingAge  = buildingAge,
                        BuildingArea = buildingArea,
                        BuildingType = buildingType,
                        Floor        = floor,
                        FloorCount   = floorCount,
                        Orientation  = orientation,
                        TranRoomTime = tranRoomTime,
                        Renovation   = renovation,
                        Amount       = amount,
                        Description  = description,
                        Img          = imgs,
                        LinkMan      = linkman,
                        LinkManTel   = linkmanTel,
                        LinkManSex   = linkmanSex,
                        HasElevator  = hasElevator
                    }, trans);

                    if (i == 1)
                    {
                        //删除标签信息
                        sql = @"DELETE Tb_Rental_RoomTag  WHERE RentalID=@RentalID";
                        conn.Execute(sql, new
                        {
                            RentalID = id
                        }, trans);


                        // 读取标签信息
                        var tags = (JArray)JsonConvert.DeserializeObject(row["Tags"].ToString());
                        if (tags != null)
                        {
                            foreach (var item in tags)
                            {
                                sql = @"INSERT INTO Tb_Rental_RoomTag(RentalID,CategoryID,Tags)
                                    VALUES(@RentalID,@CategoryID,@Tags);";
                                conn.Execute(sql, new
                                {
                                    RentalID   = id,
                                    CategoryID = item["ID"].ToString(),
                                    Tags       = string.Join(",", ((JArray)item["Tags"]).ToArray().Select(obj => obj.ToString()))
                                }, trans);
                            }
                        }
                    }

                    trans.Commit();
                    return(JSONHelper.FromString(true, "修改成功"));
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    return(JSONHelper.FromString(false, ex.Message));
                }
            }
        }
示例#21
0
        /// <summary>
        /// 收费动态
        /// </summary>
        /// <returns></returns>
        public string GetChargeDynamic(DataRow row)
        {
            #region
            int iCommID = 0;
            if (row.Table.Columns.Contains("CommID"))
            {
                iCommID = AppGlobal.StrToInt(row["CommID"].ToString());
            }
            string strCommName  = AppGlobal.GetCommName(iCommID);
            string strOrganName = "";

            string strDate   = "";
            string strReText = "";

            decimal iChargeRate1   = 0;
            decimal iChargeRate2   = 0;
            decimal iChargeRate3   = 0;
            int     iFeesCreateNum = 0;
            int     iFeesCancelNum = 0;

            #endregion

            string strSQL = "";
            int    temp   = 3;

            // 项目收费动态
            if (iCommID != 0)
            {
                strSQL = " and CommID = " + iCommID.ToString() + " and datediff(day,StatDate,getdate()) = 1 and StatType = 1 ";
            }
            else
            {
                string organCode = null;

                if (row.Table.Columns.Contains("OrganCode"))
                {
                    organCode = row["OrganCode"].ToString();
                }

                if (string.IsNullOrEmpty(organCode))
                {
                    organCode = "01";
                }

                strOrganName = AppGlobal.GetOrganName4(organCode);

                // 分公司
                if (organCode.Length == 4)
                {
                    temp   = 2;
                    strSQL = " and OrganCode like '" + organCode + "%' and datediff(day,StatDate,getdate()) = 1 and StatType = 2 ";
                }

                // 总公司
                if (organCode.Length == 2)
                {
                    temp   = 1;
                    strSQL = " and datediff(day,StatDate,getdate()) = 1 and StatType = 3 ";
                }
            }

            MobileSoft.BLL.Sys.Bll_Tb_Sys_TakePic Bll = new MobileSoft.BLL.Sys.Bll_Tb_Sys_TakePic();

            DataTable dTable = Bll.GetListFromProc(strSQL).Tables[0];

            if (dTable.Rows.Count > 0)
            {
                DataRow DRow = dTable.Rows[0];

                iChargeRate1 = AppGlobal.StrToDec(DRow["ChargeRate1"].ToString());
                iChargeRate2 = AppGlobal.StrToDec(DRow["ChargeRate2"].ToString());
                iChargeRate3 = AppGlobal.StrToDec(DRow["ChargeRate3"].ToString());

                iFeesCreateNum = AppGlobal.StrToInt(DRow["FeesCreateNum"].ToString());
                iFeesCancelNum = AppGlobal.StrToInt(DRow["FeesCancelNum"].ToString());

                strDate = AppGlobal.StrToDate(DRow["StatDate"].ToString()).ToString("yyyy年MM月dd日");
            }
            DataTable dt = new DataTable();
            dt.Columns.AddRange(new DataColumn[] {
                new DataColumn()
                {
                    ColumnName = dTable.Columns["ChargeRate1"].ColumnName, DataType = dTable.Columns["ChargeRate1"].DataType
                },
                new DataColumn()
                {
                    ColumnName = dTable.Columns["ChargeRate2"].ColumnName, DataType = dTable.Columns["ChargeRate2"].DataType
                },
                new DataColumn()
                {
                    ColumnName = "Info", DataType = typeof(string)
                }
            });
            DataRow resultRow = dt.NewRow();

            if (dTable.Rows.Count > 0)
            {
                DataRow DRow = dTable.Rows[0];
                resultRow["ChargeRate1"] = DRow["ChargeRate1"];
                resultRow["ChargeRate2"] = DRow["ChargeRate2"];
            }
            else
            {
                resultRow["ChargeRate1"] = 0;
                resultRow["ChargeRate2"] = 0;
            }

            dTable.Dispose();

            switch (temp)
            {
            case 3:
                strReText = string.Format(@"【{0}】<br/>1、截止到{1},物管费本月收费率{2}%,本年累计收费率{3}%,以前年度欠费回收率{4}%。<br/>2、截止到{5},本月共有{6}笔审核费用入账,{7}笔费用撤销。",
                                          strCommName, strDate, iChargeRate1.ToString("N2"), iChargeRate2.ToString("N2"), iChargeRate3.ToString("N2"), strDate, iFeesCreateNum.ToString(), iFeesCancelNum.ToString());
                break;

            case 2:
            case 1:
                strReText = string.Format(@"【{0}】<br/>1、截止到{1},物管费本月收费率{2}%,本年累计收费率{3}%,以前年度欠费回收率{4}%。<br/>2、截止到{5},本月共有{6}笔审核费用入账,{7}笔费用撤销。",
                                          strOrganName, strDate, iChargeRate1.ToString("N2"), iChargeRate2.ToString("N2"), iChargeRate3.ToString("N2"), strDate, iFeesCreateNum.ToString(), iFeesCancelNum.ToString());
                break;
            }

            resultRow["Info"] = strReText;
            dt.Rows.Add(resultRow);

            return(JSONHelper.FromString(dt));
        }
示例#22
0
        public string GetDynamic(DataRow row, string Type)
        {
            String        result    = "";
            StringBuilder strReText = new StringBuilder("");

            #region 变量定义
            //int iCommID = AppGlobal.StrToInt(Global_Var.LoginCommID);
            int iCommID = 0;
            if (row.Table.Columns.Contains("CommID"))
            {
                iCommID = AppGlobal.StrToInt(row["CommID"].ToString());
            }
            string  strCommName       = AppGlobal.GetCommName(iCommID);
            string  strOrganName      = AppGlobal.GetOrganName4(Global_Var.LoginOrganCorp);
            string  strDate           = "";
            string  strPark           = "";
            string  strRoomState      = "";
            string  strOrganParkList  = "";
            string  strStateList      = "";
            string  strParkList       = "";
            string  strOrganDate      = "";
            string  strOrganRoomState = "";
            string  strOrganPark      = "";
            string  strOrganStateList = "";
            decimal iAllArea          = 0;
            decimal iOrganAllArea     = 0;
            decimal iChargeRate1      = 0;
            decimal iChargeRate2      = 0;
            decimal iChargeRate3      = 0;

            int iRoomNum4      = 0;
            int iRoomNum5      = 0;
            int iRoomNum6      = 0;
            int iFeesCreateNum = 0;
            int iFeesCancelNum = 0;

            int iIncidentNum1 = 0;
            int iIncidentNum2 = 0;
            int iIncidentNum3 = 0;
            int iIncidentNum4 = 0;
            int iIncidentNum5 = 0;

            decimal iIncidentRate1 = 0;
            decimal iIncidentRate2 = 0;
            decimal iIncidentRate3 = 0;
            decimal iIncidentRate4 = 0;
            #endregion

            // 项目
            if (iCommID != 0)
            {
                string strSQL = " CommID = " + iCommID.ToString() + " and datediff(day,StatDate,getdate()) = 1 and StatType = 1 ";

                MobileSoft.BLL.Sys.Bll_Tb_Sys_TakePic Bll = new MobileSoft.BLL.Sys.Bll_Tb_Sys_TakePic();

                //DataTable dTable = Bll.GetList(strSQL, "RoomNum4,RoomNum5,RoomNum6,ChargeRate1,ChargeRate2,ChargeRate3,FeesCreateNum,FeesCancelNum,AllArea,StatDate,IncidentNum1,IncidentNum2,IncidentNum3,IncidentNum4,IncidentNum5,IncidentRate1,IncidentRate2,IncidentRate3,IncidentRate4").Tables[0];
                DataTable dTable = Bll.GetList(1000, strSQL, "CommID").Tables[0];
                if (dTable.Rows.Count > 0)
                {
                    DataRow DRow = dTable.Rows[0];
                    iRoomNum4      = AppGlobal.StrToInt(DRow["RoomNum4"].ToString());
                    iRoomNum5      = AppGlobal.StrToInt(DRow["RoomNum5"].ToString());
                    iRoomNum6      = AppGlobal.StrToInt(DRow["RoomNum6"].ToString());
                    iChargeRate1   = AppGlobal.StrToDec(DRow["ChargeRate1"].ToString());
                    iChargeRate2   = AppGlobal.StrToDec(DRow["ChargeRate2"].ToString());
                    iChargeRate3   = AppGlobal.StrToDec(DRow["ChargeRate3"].ToString());
                    iFeesCreateNum = AppGlobal.StrToInt(DRow["FeesCreateNum"].ToString());
                    iFeesCancelNum = AppGlobal.StrToInt(DRow["FeesCancelNum"].ToString());
                    iAllArea       = AppGlobal.StrToDec(DRow["AllArea"].ToString());
                    strDate        = AppGlobal.StrToDate(DRow["StatDate"].ToString()).ToString("yyyy年MM月dd日");

                    iIncidentNum1 = AppGlobal.StrToInt(DRow["IncidentNum1"].ToString());
                    iIncidentNum2 = AppGlobal.StrToInt(DRow["IncidentNum2"].ToString());
                    iIncidentNum3 = AppGlobal.StrToInt(DRow["IncidentNum3"].ToString());
                    iIncidentNum4 = AppGlobal.StrToInt(DRow["IncidentNum4"].ToString());
                    iIncidentNum5 = AppGlobal.StrToInt(DRow["IncidentNum5"].ToString());

                    iIncidentRate1 = AppGlobal.StrToDec(DRow["IncidentRate1"].ToString());
                    iIncidentRate2 = AppGlobal.StrToDec(DRow["IncidentRate2"].ToString());
                    iIncidentRate3 = AppGlobal.StrToDec(DRow["IncidentRate3"].ToString());
                    iIncidentRate4 = AppGlobal.StrToDec(DRow["IncidentRate4"].ToString());
                }

                #region 房屋状态
                string strSQL2 = " CommID = " + iCommID.ToString() + " and datediff(day,StatDate,getdate()) = 1 and StatType = 1 ";
                MobileSoft.BLL.Sys.Bll_Tb_Sys_TakePicRoomState BllState = new MobileSoft.BLL.Sys.Bll_Tb_Sys_TakePicRoomState();
                DataTable dTable2 = BllState.GetList(strSQL2).Tables[0];
                if (dTable2.Rows.Count > 0)
                {
                    strRoomState = ",其中";
                }
                else
                {
                    strRoomState = "。";
                }

                foreach (DataRow DRow in dTable2.Rows)
                {
                    string strStateName = DRow["StateName"].ToString();
                    if (strStateName == "")
                    {
                        strStateName = "[无]";
                    }

                    if (strStateList != "")
                    {
                        strStateList = strStateList + "," + strStateName + "" + DRow["Counts"].ToString() + "" + "套";
                    }
                    else
                    {
                        strStateList = strStateName + "" + DRow["Counts"].ToString() + "" + "套";
                    }
                }

                if (strStateList != "")
                {
                    strRoomState = strRoomState + strStateList + "。";
                }

                dTable2.Dispose();
                #endregion

                #region 车位数
                string strSQL3 = " CommID = " + iCommID.ToString() + " and datediff(day,StatDate,getdate()) = 1 and StatType = 1 ";

                MobileSoft.BLL.Sys.Bll_Tb_Sys_TakePicPark BllPark = new MobileSoft.BLL.Sys.Bll_Tb_Sys_TakePicPark();

                DataTable dTable3 = BllPark.GetList(strSQL3).Tables[0];

                if (dTable3.Rows.Count > 0)
                {
                    strPark = "车位:";
                }
                else
                {
                    strPark = "无车位信息";
                }


                foreach (DataRow DRow in dTable3.Rows)
                {
                    string strParkTypeName = DRow["ParkTypeName"].ToString();

                    if (strParkTypeName == "")
                    {
                        strParkTypeName = "[无]";
                    }

                    if (strParkList != "")
                    {
                        strParkList = strParkList + "," + strParkTypeName + "" + DRow["Counts"].ToString() + "" + "个";
                    }
                    else
                    {
                        strParkList = strParkTypeName + "" + DRow["Counts"].ToString() + "" + "个";
                    }
                }

                if (strParkList != "")
                {
                    strPark = strPark + strParkList + "。";
                }
                dTable3.Dispose();
                #endregion

                #region 设置社区


                switch (Type)
                {
                case "1":
                    //获取资源动态
                    strReText.Append("【" + strCommName + "】<br/>");
                    strReText.Append("1、截止到" + strDate + ",可收物管费面积共" + iAllArea.ToString() + "平方米" + strRoomState + "<br/>2、截止到" + strDate + "," + strPark + "<br/>");
                    strReText.Append("3、" + strDate + "共有" + iRoomNum4.ToString() + "套办理转让," + iRoomNum5.ToString() + "套办理租赁," + iRoomNum6.ToString() + "套车位办理转让。");
                    break;

                case "2":
                    //收费动态
                    strReText.Append("【" + strCommName + "】<br/>");
                    strReText.Append("1、截止到" + strDate + ",物管费本月收费率" + iChargeRate1.ToString("N2") + "%,本年累计收费率" + iChargeRate2.ToString("N2") + "%,以前年度欠费回收率" + iChargeRate3.ToString("N2") + "%。" + "<br/>");
                    strReText.Append("2、" + strDate + ",共有" + iFeesCreateNum.ToString() + "笔审核费用入账," + iFeesCancelNum.ToString() + "笔费用撤销。");

                    break;

                case "3":
                    //客服动态
                    strReText.Append("【" + strCommName + "】<br/>");
                    strReText.Append("1、截止到" + strDate + ",未完结的派工单" + iIncidentNum1.ToString() + "件(其中逾期" + iIncidentNum2.ToString() + "件),超过60天未完结的协调单" + iIncidentNum3.ToString() + "件;本月派工单完结率" + iIncidentRate1.ToString("N2") + "%,本年累计" + iIncidentRate2.ToString("N2") + "%;本月协调单完结率" + iIncidentRate3.ToString("N2") + "%,本年累计" + iIncidentRate4.ToString("N2") + "%。<br/>");
                    strReText.Append("2、" + strDate + ",共有" + iIncidentNum4.ToString() + "件报事,其中" + iIncidentNum5.ToString() + "件未完结;<br/>");
                    break;
                }
                #endregion
            }

            else
            {
                #region
                if (Global_Var.LoginOrganCode == "" || Global_Var.LoginOrganCode == "01")
                {
                    #region 集团

                    #region 集团
                    string strSQLOrgan = " datediff(day,StatDate,getdate()) = 1 and StatType = 3 ";

                    MobileSoft.BLL.Sys.Bll_Tb_Sys_TakePic Bll = new MobileSoft.BLL.Sys.Bll_Tb_Sys_TakePic();
                    DataTable dTableOrgan = Bll.GetList(strSQLOrgan, "AllArea,StatDate,ChargeRate1,ChargeRate2,ChargeRate3,IncidentNum1,IncidentNum2,IncidentNum3,IncidentNum4,IncidentNum5,IncidentRate1,IncidentRate2,IncidentRate3,IncidentRate4").Tables[0];
                    // DataTable dTableOrgan = Bll.GetList(strSQLOrgan).Tables[0];
                    decimal iOrganChargeRate1   = 0;
                    decimal iOrganChargeRate2   = 0;
                    decimal iOrganChargeRate3   = 0;
                    int     iOrganIncidentNum1  = 0;
                    int     iOrganIncidentNum2  = 0;
                    int     iOrganIncidentNum3  = 0;
                    int     iOrganIncidentNum4  = 0;
                    int     iOrganIncidentNum5  = 0;
                    decimal iOrganIncidentRate1 = 0;
                    decimal iOrganIncidentRate2 = 0;
                    decimal iOrganIncidentRate3 = 0;
                    decimal iOrganIncidentRate4 = 0;
                    if (dTableOrgan.Rows.Count > 0)
                    {
                        DataRow DRow = dTableOrgan.Rows[0];
                        iOrganAllArea = AppGlobal.StrToDec(DRow["AllArea"].ToString());
                        strOrganDate  = AppGlobal.StrToDate(DRow["StatDate"].ToString()).ToString("yyyy年MM月dd日");

                        iOrganChargeRate1 = AppGlobal.StrToDec(DRow["ChargeRate1"].ToString());
                        iOrganChargeRate2 = AppGlobal.StrToDec(DRow["ChargeRate2"].ToString());
                        iOrganChargeRate3 = AppGlobal.StrToDec(DRow["ChargeRate3"].ToString());

                        iOrganIncidentNum1 = AppGlobal.StrToInt(DRow["IncidentNum1"].ToString());
                        iOrganIncidentNum2 = AppGlobal.StrToInt(DRow["IncidentNum2"].ToString());
                        iOrganIncidentNum3 = AppGlobal.StrToInt(DRow["IncidentNum3"].ToString());
                        iOrganIncidentNum4 = AppGlobal.StrToInt(DRow["IncidentNum4"].ToString());
                        iOrganIncidentNum5 = AppGlobal.StrToInt(DRow["IncidentNum5"].ToString());

                        iOrganIncidentRate1 = AppGlobal.StrToDec(DRow["IncidentRate1"].ToString());
                        iOrganIncidentRate2 = AppGlobal.StrToDec(DRow["IncidentRate2"].ToString());
                        iOrganIncidentRate3 = AppGlobal.StrToDec(DRow["IncidentRate3"].ToString());
                        iOrganIncidentRate4 = AppGlobal.StrToDec(DRow["IncidentRate4"].ToString());
                    }
                    dTableOrgan.Dispose();
                    #endregion

                    #region 房屋状态(集团)
                    string strSQLOrgan2 = " OrganCode like '" + Global_Var.LoginOrganCorp + "%' and datediff(day,StatDate,getdate()) = 1 and StatType = 3 ";

                    MobileSoft.BLL.Sys.Bll_Tb_Sys_TakePicRoomState BllState = new MobileSoft.BLL.Sys.Bll_Tb_Sys_TakePicRoomState();

                    DataTable dTableOrgan2 = BllState.GetList(strSQLOrgan2).Tables[0];
                    if (dTableOrgan2.Rows.Count > 0)
                    {
                        strOrganRoomState = ",其中";
                    }
                    else
                    {
                        strOrganRoomState = "。";
                    }
                    foreach (DataRow DRow in dTableOrgan2.Rows)
                    {
                        string strStateName = DRow["StateName"].ToString();
                        if (strStateName == "")
                        {
                            strStateName = "[无]";
                        }

                        if (strOrganStateList != "")
                        {
                            strOrganStateList = strOrganStateList + "," + strStateName + "" + DRow["Counts"].ToString() + "" + "套";
                        }
                        else
                        {
                            strOrganStateList = strStateName + "" + DRow["Counts"].ToString() + "" + "套";
                        }
                    }
                    if (strOrganStateList != "")
                    {
                        strOrganRoomState = strOrganRoomState + strOrganStateList + "。";
                    }
                    dTableOrgan2.Dispose();
                    #endregion

                    #region 车位数(集团)
                    string strSQLOrgan3 = " OrganCode like '" + Global_Var.LoginOrganCorp + "%' and datediff(day,StatDate,getdate()) = 1 and StatType = 3 ";
                    MobileSoft.BLL.Sys.Bll_Tb_Sys_TakePicPark BllPark = new MobileSoft.BLL.Sys.Bll_Tb_Sys_TakePicPark();
                    DataTable dTableOrgan3 = BllPark.GetList(strSQLOrgan3).Tables[0];
                    if (dTableOrgan3.Rows.Count > 0)
                    {
                        strOrganPark = "车位:";
                    }
                    else
                    {
                        strOrganPark = "无车位信息";
                    }
                    foreach (DataRow DRow in dTableOrgan3.Rows)
                    {
                        string strParkTypeName = DRow["ParkTypeName"].ToString();
                        if (strParkTypeName == "")
                        {
                            strParkTypeName = "[无]";
                        }

                        if (strOrganParkList != "")
                        {
                            strOrganParkList = strOrganParkList + "," + strParkTypeName + "" + DRow["Counts"].ToString() + "" + "个";
                        }
                        else
                        {
                            strOrganParkList = strParkTypeName + "" + DRow["Counts"].ToString() + "" + "个";
                        }
                    }
                    if (strOrganParkList != "")
                    {
                        strOrganPark = strOrganPark + strOrganParkList + "。";
                    }
                    dTableOrgan3.Dispose();
                    #endregion

                    #region 设置集团

                    switch (Type)
                    {
                    case "1":
                        strReText.Append("1、截止到" + strOrganDate + ",可收物管费面积共" + iOrganAllArea.ToString() + "平方米" + strOrganRoomState + "<br/>2、截止到" + strOrganDate + "," + strOrganPark);
                        break;

                    case "2":
                        strReText.Append("截止到" + strOrganDate + ":<br/>1、物管费本月收费率" + iOrganChargeRate1.ToString("N2") + "%;<br/>2、本年累计收费率" + iOrganChargeRate2.ToString("N2") + "%;<br/>3、以前年度欠费回收率" + iOrganChargeRate3.ToString("N2") + "%。");

                        break;

                    case "3":
                        strReText.Append("1、截止到" + strOrganDate + ",未完结的派工单" + iOrganIncidentNum1.ToString() + "件(其中逾期" + iOrganIncidentNum2.ToString() + "件),超过60天未完结的协调单" + iOrganIncidentNum3.ToString() + "件;<br/>2、本月派工单完结率" + iOrganIncidentRate1.ToString("N2") + "%,本年累计" + iOrganIncidentRate2.ToString("N2") + "%;本月协调单完结率" + iOrganIncidentRate3.ToString("N2") + "%,本年累计" + iOrganIncidentRate4.ToString("N2") + "%;<br/>");
                        break;
                    }

                    #endregion
                    #endregion
                }
                else
                {
                    #region 公司

                    #region 地区公司
                    string strSQLOrgan = " OrganCode like '" + Global_Var.LoginOrganCorp + "%' and datediff(day,StatDate,getdate()) = 1 and StatType = 2 ";

                    MobileSoft.BLL.Sys.Bll_Tb_Sys_TakePic Bll = new MobileSoft.BLL.Sys.Bll_Tb_Sys_TakePic();
                    decimal iOrganChargeRate1 = 0;
                    decimal iOrganChargeRate2 = 0;
                    decimal iOrganChargeRate3 = 0;

                    int iOrganIncidentNum1 = 0;
                    int iOrganIncidentNum2 = 0;
                    int iOrganIncidentNum3 = 0;
                    int iOrganIncidentNum4 = 0;

                    decimal   iOrganIncidentRate1 = 0;
                    decimal   iOrganIncidentRate2 = 0;
                    decimal   iOrganIncidentRate3 = 0;
                    decimal   iOrganIncidentRate4 = 0;
                    DataTable dTableOrgan         = Bll.GetList(strSQLOrgan, "AllArea,StatDate,ChargeRate1,ChargeRate2,ChargeRate3,IncidentNum1,IncidentNum2,IncidentNum3,IncidentNum4,IncidentRate1,IncidentRate2,IncidentRate3,IncidentRate4").Tables[0];
                    if (dTableOrgan.Rows.Count > 0)
                    {
                        #region 取值
                        DataRow DRow = dTableOrgan.Rows[0];
                        iOrganAllArea     = AppGlobal.StrToDec(DRow["AllArea"].ToString());
                        strOrganDate      = AppGlobal.StrToDate(DRow["StatDate"].ToString()).ToString("yyyy年MM月dd日");
                        iOrganChargeRate1 = AppGlobal.StrToDec(DRow["ChargeRate1"].ToString());
                        iOrganChargeRate2 = AppGlobal.StrToDec(DRow["ChargeRate2"].ToString());
                        iOrganChargeRate3 = AppGlobal.StrToDec(DRow["ChargeRate3"].ToString());

                        iOrganIncidentNum1 = AppGlobal.StrToInt(DRow["IncidentNum1"].ToString());
                        iOrganIncidentNum2 = AppGlobal.StrToInt(DRow["IncidentNum2"].ToString());
                        iOrganIncidentNum3 = AppGlobal.StrToInt(DRow["IncidentNum3"].ToString());
                        iOrganIncidentNum4 = AppGlobal.StrToInt(DRow["IncidentNum4"].ToString());

                        iOrganIncidentRate1 = AppGlobal.StrToDec(DRow["IncidentRate1"].ToString());
                        iOrganIncidentRate2 = AppGlobal.StrToDec(DRow["IncidentRate2"].ToString());
                        iOrganIncidentRate3 = AppGlobal.StrToDec(DRow["IncidentRate3"].ToString());
                        iOrganIncidentRate4 = AppGlobal.StrToDec(DRow["IncidentRate4"].ToString());

                        #endregion
                    }

                    dTableOrgan.Dispose();
                    #endregion

                    #region 房屋状态(地区公司)
                    string strSQLOrgan2 = " OrganCode like '" + Global_Var.LoginOrganCorp + "%' and datediff(day,StatDate,getdate()) = 1 and StatType = 2 ";
                    MobileSoft.BLL.Sys.Bll_Tb_Sys_TakePicRoomState BllState = new MobileSoft.BLL.Sys.Bll_Tb_Sys_TakePicRoomState();
                    DataTable dTableOrgan2 = BllState.GetList(strSQLOrgan2).Tables[0];
                    if (dTableOrgan2.Rows.Count > 0)
                    {
                        strOrganRoomState = ",其中";
                    }
                    else
                    {
                        strOrganRoomState = "。";
                    }


                    foreach (DataRow DRow in dTableOrgan2.Rows)
                    {
                        string strStateName = DRow["StateName"].ToString();
                        if (strStateName == "")
                        {
                            strStateName = "[无]";
                        }

                        if (strOrganStateList != "")
                        {
                            strOrganStateList = strOrganStateList + "," + strStateName + "" + DRow["Counts"].ToString() + "" + "套";
                        }
                        else
                        {
                            strOrganStateList = strStateName + "" + DRow["Counts"].ToString() + "" + "套";
                        }
                    }

                    if (strOrganStateList != "")
                    {
                        strOrganRoomState = strOrganRoomState + strOrganStateList + "。";
                    }

                    dTableOrgan2.Dispose();
                    #endregion

                    #region 车位数(地区公司)
                    string strSQLOrgan3 = " OrganCode like '" + Global_Var.LoginOrganCorp + "%' and datediff(day,StatDate,getdate()) = 1 and StatType = 2  ";
                    MobileSoft.BLL.Sys.Bll_Tb_Sys_TakePicPark BllPark = new MobileSoft.BLL.Sys.Bll_Tb_Sys_TakePicPark();
                    DataTable dTableOrgan3 = BllPark.GetList(strSQLOrgan3).Tables[0];
                    if (dTableOrgan3.Rows.Count > 0)
                    {
                        strOrganPark = "车位:";
                    }
                    else
                    {
                        strOrganPark = "无车位信息";
                    }
                    foreach (DataRow DRow in dTableOrgan3.Rows)
                    {
                        string strParkTypeName = DRow["ParkTypeName"].ToString();
                        if (strParkTypeName == "")
                        {
                            strParkTypeName = "[无]";
                        }
                        if (strOrganParkList != "")
                        {
                            strOrganParkList = strOrganParkList + "," + strParkTypeName + "" + DRow["Counts"].ToString() + "" + "个";
                        }
                        else
                        {
                            strOrganParkList = strParkTypeName + "" + DRow["Counts"].ToString() + "" + "个";
                        }
                    }
                    if (strOrganParkList != "")
                    {
                        strOrganPark = strOrganPark + strOrganParkList + "。";
                    }
                    dTableOrgan3.Dispose();
                    #endregion

                    #region 设置地区公司
                    switch (Type)
                    {
                    case "1":
                        strReText.Append("1、截止到" + strOrganDate + ",可收物管费面积共" + iOrganAllArea.ToString() + "平方米" + strOrganRoomState + "<br/>2、截止到" + strOrganDate + "," + strOrganPark);
                        break;

                    case "2":
                        strReText.Append("截止到" + strOrganDate + ",物管费本月收费率" + iOrganChargeRate1.ToString("N2") + "%,本年累计收费率" + iOrganChargeRate2.ToString("N2") + "%,以前年度欠费回收率" + iOrganChargeRate3.ToString("N2") + "%。");
                        break;

                    case "3":
                        strReText.Append("1、截止到" + strOrganDate + ",未完结的派工单" + iOrganIncidentNum1.ToString() + "件(其中逾期" + iOrganIncidentNum2.ToString() + "件),超过60天未完结的协调单" + iOrganIncidentNum3.ToString() + "件;<br/>2、本月派工单完结率" + iOrganIncidentRate1.ToString("N2") + "%,本年累计" + iOrganIncidentRate2.ToString("N2") + "%;本月协调单完结率" + iOrganIncidentRate3.ToString("N2") + "%,本年累计" + iOrganIncidentRate4.ToString("N2") + "%;<br/>");
                        break;
                    }
                    #endregion

                    #endregion
                }
                #endregion
            }

            if (strReText.ToString().Trim() == "")
            {
                result = "暂无内容";
            }
            else
            {
                result = JSONHelper.FromString(true, strReText.ToString());
            }
            return(result);
        }
示例#23
0
        /// <summary>
        /// 融信,优惠券使用回调函数
        /// </summary>
        private string CouponUsedCallback_RongXin(DataRow row)
        {
            // http://tool.chacuo.net/cryptdes
            string key = "WwW.tw369.Com";

            if (!row.Table.Columns.Contains("CommID") || string.IsNullOrEmpty(row["CommID"].ToString()))
            {
                return(JSONHelper.FromString(false, "小区ID不能为空"));
            }
            if (!row.Table.Columns.Contains("FeesIDs") || string.IsNullOrEmpty(row["FeesIDs"].ToString()))
            {
                return(JSONHelper.FromString(false, "费用ID不能为空"));
            }
            if (!row.Table.Columns.Contains("TotalAmount") || string.IsNullOrEmpty(row["TotalAmount"].ToString()))
            {
                return(JSONHelper.FromString(false, "缴费金额不能为空"));
            }

            try
            {
                string connStr = "Pooling=false;Data Source=125.64.16.14,8433;Initial Catalog=HM_wygl_new_1528;User ID=LFUser;Password=LF123SPoss";
                string feesIds = row["FeesIDs"].ToString().Trim(',');

                decimal totalAmount  = 0.0m;
                decimal couponAmount = 0.0M;

                try
                {
                    totalAmount = AppGlobal.StrToDec(DES.Decrypt(row["TotalAmount"].ToString(), key));

                    if (row.Table.Columns.Contains("CouponAmount") && !string.IsNullOrEmpty(row["CouponAmount"].ToString()))
                    {
                        couponAmount = AppGlobal.StrToDec(DES.Decrypt(row["CouponAmount"].ToString(), key));
                    }
                }
                catch (Exception)
                {
                    return(JSONHelper.FromString(false, "解密字符串错误"));
                }

                using (IDbConnection conn = new SqlConnection(connStr))
                {
                    // 1、获取费用信息
                    string sql = string.Format(@"SELECT FeesID,DebtsAmount FROM Tb_HSPR_Fees WHERE isnull(IsCharge,0)=0 AND FeesID IN({0})", feesIds);

                    IEnumerable <dynamic> feesResultSet = conn.Query(sql);

                    if (feesResultSet.Count() > 0)
                    {
                        DynamicParameters parameters = new DynamicParameters();
                        parameters.Add("@FeesIDs", feesIds);
                        parameters.Add("@ChargeAmount", totalAmount);
                        parameters.Add("@WaivAmount", couponAmount);
                        parameters.Add("@IsSucceed", 0, DbType.Int32, ParameterDirection.Output);

                        conn.Execute("Proc_HSPR_FeesReceipts_Insert_Phone", parameters, null, null, CommandType.StoredProcedure);

                        int IsSucceed = parameters.Get <int>("@IsSucceed");

                        if (IsSucceed == 1)
                        {
                            return(JSONHelper.FromString(true, "操作成功"));
                        }
                        else
                        {
                            return(JSONHelper.FromString(false, "操作失败"));
                        }

                        /*
                         * foreach (dynamic item in feesResultSet)
                         * {
                         *  decimal itemWaivAmount = 0.0m;      // 当前费用减免金额
                         *  decimal itemDebtsAmount = 0.0m;     // 当前未缴费用欠费金额
                         *  decimal itemAmount = 0.0m;          // 销账的实际金额
                         *
                         *  // 当前费用欠费
                         *  itemDebtsAmount = AppGlobal.StrToDec(item.DebtsAmount.ToString());
                         *
                         *  // 优惠减免金额
                         *  if (couponAmount > 0)
                         *  {
                         *      itemWaivAmount = (couponAmount > itemDebtsAmount ? itemDebtsAmount : couponAmount);
                         *  }
                         *
                         *  itemAmount = (totalAmount > (itemDebtsAmount - itemWaivAmount) ? (itemDebtsAmount - itemWaivAmount) : totalAmount);
                         *
                         *  // 下账,在存储过程中插入费用明细
                         *  conn.Execute("Proc_HSPR_FeesReceipts_Insert_Phone",
                         *      new
                         *      {
                         *          FeesID = item.FeesID,
                         *          ChargeAmount = itemAmount,
                         *          WaivAmount = itemWaivAmount
                         *      }, null, null, CommandType.StoredProcedure);
                         *
                         *  // 插入减免明细
                         *  if (itemWaivAmount > 0)
                         *  {
                         *      conn.Execute("Proc_HSPR_WaiversFee_Insert_HongBao", new { FeesID = item.FeesID, WaivAmount = itemWaivAmount }, null, null, CommandType.StoredProcedure);
                         *  }
                         *
                         *  couponAmount -= itemWaivAmount;
                         *  totalAmount -= itemAmount;
                         * }
                         */
                    }
                    else
                    {
                        return(JSONHelper.FromString(false, "未查询到未缴费用信息"));
                    }
                }
            }
            catch (Exception ex)
            {
                return(JSONHelper.FromString(false, ex.Message));
            }
        }
示例#24
0
        /// <summary>
        /// 添加车位
        /// </summary>
        private string AddParkingInfo(DataRow row)
        {
            #region 参数校验
            if (!row.Table.Columns.Contains("UserId") || string.IsNullOrEmpty(row["UserId"].AsString()))
            {
                return(new ApiResult(false, "缺少参数UserId").toJson());
            }
            if (!row.Table.Columns.Contains("CommunityId") || string.IsNullOrEmpty(row["CommunityId"].AsString()))
            {
                return(new ApiResult(false, "缺少参数CommunityId").toJson());
            }
            if (!row.Table.Columns.Contains("Title") || string.IsNullOrEmpty(row["Title"].AsString()))
            {
                return(new ApiResult(false, "缺少参数Title").toJson());
            }
            if (!row.Table.Columns.Contains("BussType") || string.IsNullOrEmpty(row["BussType"].AsString()))
            {
                return(new ApiResult(false, "缺少参数BussType").toJson());
            }
            if (!row.Table.Columns.Contains("BuildingArea") || string.IsNullOrEmpty(row["BuildingArea"].AsString()))
            {
                return(new ApiResult(false, "缺少参数BuildingArea").toJson());
            }
            if (!row.Table.Columns.Contains("Floor") || string.IsNullOrEmpty(row["Floor"].AsString()))
            {
                return(new ApiResult(false, "缺少参数Floor").toJson());
            }
            if (!row.Table.Columns.Contains("Amount") || string.IsNullOrEmpty(row["Amount"].AsString()))
            {
                return(new ApiResult(false, "缺少参数Amount").toJson());
            }
            if (!row.Table.Columns.Contains("Linkman") || string.IsNullOrEmpty(row["Linkman"].AsString()))
            {
                return(new ApiResult(false, "缺少参数Linkman").toJson());
            }
            if (!row.Table.Columns.Contains("LinkmanTel") || string.IsNullOrEmpty(row["LinkmanTel"].AsString()))
            {
                return(new ApiResult(false, "缺少参数LinkmanTel").toJson());
            }
            if (!row.Table.Columns.Contains("LinkmanSex") || string.IsNullOrEmpty(row["LinkmanSex"].AsString()))
            {
                return(new ApiResult(false, "缺少参数LinkmanSex").toJson());
            }
            if (!row.Table.Columns.Contains("Imgs") || string.IsNullOrEmpty(row["Imgs"].AsString()))
            {
                return(new ApiResult(false, "缺少参数Imgs").toJson());
            }

            #endregion

            var title        = row["Title"].ToString();
            var userId       = row["UserId"].ToString();
            var communityId  = row["CommunityId"].ToString();
            var BuildingArea = AppGlobal.StrToDec(row["BuildingArea"].ToString());
            var floor        = AppGlobal.StrToDec(row["Floor"].ToString());
            var bussType     = row["BussType"].ToString();
            var amount       = AppGlobal.StrToDec(row["Amount"].ToString());
            var linkman      = row["Linkman"].ToString();
            var linkmanTel   = row["LinkmanTel"].ToString();
            var linkmanSex   = AppGlobal.StrToInt(row["LinkmanSex"].ToString());
            var imgs         = row["Imgs"].ToString();

            var description = default(string);
            if (row.Table.Columns.Contains("Description") && !string.IsNullOrEmpty(row["Description"].AsString()))
            {
                description = row["Description"].AsString();
            }

            var community = GetCommunity(communityId);
            if (community == null)
            {
                return(JSONHelper.FromString(false, "未查询到小区信息"));
            }

            using (var conn = new SqlConnection(PubConstant.UnifiedContionString))
            {
                conn.Open();

                var trans = conn.BeginTransaction();

                try
                {
                    var iid = Guid.NewGuid().ToString();
                    var sql = @"INSERT INTO Tb_Rental(Id,CommunityId,UserId,Title,BussType,BuildingArea,Floor,
                                    Amount,Description,Img,LinkMan,LinkManTel,LinkManSex)
                                VALUES(@Id,@CommunityId,@UserId,@Title,@BussType,@BuildingArea, @Floor,@LivingRooms,@BedRooms,@BathRooms,@KitchenRooms,@BuildingType,@Orientation,@Renovation,
                                    @Amount,@Description,@Img,@LinkMan,@LinkManTel,@LinkManSex,@HasElevator);";

                    var i = conn.Execute(sql, new
                    {
                        Id           = iid,
                        CommunityId  = community.Id,
                        UserId       = userId,
                        Title        = title,
                        BussType     = bussType,
                        Province     = community.Province,
                        City         = community.City,
                        Area         = community.Area,
                        BuildingArea = BuildingArea,
                        Floor        = floor,
                        Amount       = amount,
                        Description  = description,
                        Img          = imgs,
                        LinkMan      = linkman,
                        LinkManTel   = linkmanTel,
                        LinkManSex   = linkmanSex,
                    }, trans);

                    if (i == 1)
                    {
                        // 读取标签信息
                        var tags = (JArray)JsonConvert.DeserializeObject(row["Tags"].ToString());

                        foreach (var item in tags)
                        {
                            sql = @"INSERT INTO Tb_Rental_RoomTag(RentalID,CategoryID,Tags)
                                    VALUES(@RentalID,@CategoryID,@Tags);";

                            conn.Execute(sql, new
                            {
                                RentalID   = iid,
                                CategoryID = item["ID"].ToString(),
                                Tags       = string.Join(",", ((JArray)item["Tags"]).ToArray().Select(obj => obj.ToString()))
                            }, trans);
                        }
                    }

                    trans.Commit();
                    return(JSONHelper.FromString(true, "添加成功"));
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    return(JSONHelper.FromString(false, ex.Message));
                }
            }
        }
示例#25
0
        /// <summary>
        /// 获取欠费或预存信息
        /// </summary>
        private string GetFeesStatistics_ZhongJi(DataRow row)
        {
            if (!row.Table.Columns.Contains("CommunityId") || string.IsNullOrEmpty(row["CommunityId"].ToString()))
            {
                return(JSONHelper.FromString(false, "小区编码不能为空"));
            }
            if (!row.Table.Columns.Contains("RoomID") || string.IsNullOrEmpty(row["RoomID"].ToString()))
            {
                return(JSONHelper.FromString(false, "房间编码不能为空"));
            }

            string communityId = row["CommunityId"].ToString();
            string RoomID      = row["RoomID"].ToString();

            //查询小区
            Tb_Community Community = new MobileSoft.BLL.Unified.Bll_Tb_Community().GetModel(communityId);

            //构造链接字符串
            if (Community == null)
            {
                return(JSONHelper.FromString(false, "该小区不存在"));
            }
            string strcon = new CostInfo().GetConnectionStringStr(Community);

            string  sql = string.Format(@"SELECT PrecAmount FROM
	                                    (
		                                    SELECT SUM(a.PrecAmount) AS PrecAmount FROM view_HSPR_PreCosts_Filter a
			                                    WHERE a.CommID={0} AND a.RoomID={1}
				                                    AND convert(varchar(8000),a.CostNames)='住宅物业服务费'
						                                    AND a.PrecAmount>0 AND a.IsPrec=1
	                                    ) AS t"    , Community.CommID, RoomID);
            DataSet ds  = new DbHelperSQLP(strcon).Query(sql);

            if (ds != null & ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                decimal PrecAmount = AppGlobal.StrToDec(ds.Tables[0].Rows[0]["PrecAmount"].ToString());

                DateTime dateTime = DateTime.Now.AddMonths(1);
                dateTime = new DateTime(dateTime.Year, dateTime.Month, 1).AddDays(-1);

                // 读取未缴
                sql  = string.Format(@"SELECT SUM(ISNULL(x.DebtsAmount,0) + ISNULL(x.LateFeeAmount,0)) AS DebtsAmount FROM 
						view_HSPR_Fees_SearchFilter x WHERE x.DebtsAmount > 0 AND ISNULL(x.IsCharge, 0) = 0 AND ISNULL(x.IsBank, 0) = 0 AND ISNULL(x.IsPrec, 0) = 0 AND ISNULL(IsFreeze, 0) = 0
						 AND x.RoomID = {0}"                        , RoomID);
                sql += " AND x.CustID IN(SELECT CustID FROM Tb_HSPR_CustomerLive xx where xx.RoomID=x.RoomID AND ISNULL(IsDelLive,0)=0 AND LiveType = 1) ";

                DataTable dt = new DbHelperSQLP(strcon).Query(sql).Tables[0];

                decimal DebtsAmount = AppGlobal.StrToDec(dt.Rows[0]["DebtsAmount"].ToString());

                // 俊发判断是不是成都地区,如果是成都,按月缴费,其他地区按年
                int BillingCycle = 1;
                if (Community.CorpID == 1985)
                {
                    using (var conn = new SqlConnection(strcon))
                    {
                        if (conn.Query(@"SELECT * FROM Tb_HSPR_Community WHERE CommID=@CommID AND OrganCode='0104'",
                                       new { CommID = Community.CommID }).Count() > 0)
                        {
                            BillingCycle = 1;
                        }
                        else
                        {
                            BillingCycle = 12;
                        }
                    }
                }

                return(new ApiResult(true, new { PrecAmount = PrecAmount, DebtsAmount = DebtsAmount, BillingCycle = BillingCycle }).toJson());
            }
            else
            {
                return(new ApiResult(true, new { PrecAmount = 0, DebtsAmount = 0, BillingCycle = 1 }).toJson());
            }
        }
示例#26
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                List <string> list = new List <string>();
                foreach (var item in context.Request.Params.AllKeys)
                {
                    list.Add($"{item}={context.Request.Params[item]}");
                }
                Business.Alipay.Log("收到微信通知" + context.Request.RawUrl + "?" + string.Join("&", list));

                HttpRequest Request = context.Request;
                context.Response.ContentType = "text/plain";

                string respcode    = "";
                string respmsg     = "";
                string orderId     = "";
                string CommunityId = "";

                //返回报文中不包含UPOG,表示Server端正确接收交易请求,则需要验证Server端返回报文的签名
                bool      IsValidate = false;
                WxPayData WxPostData = new WxPayData();
                string    Result     = Notify.NotifyDataFromContext(context, ref IsValidate, ref WxPostData);

                respcode    = WxPostData.GetValue("result_code").ToString();
                respmsg     = WxPostData.GetValue("result_code").ToString();
                orderId     = WxPostData.GetValue("out_trade_no").ToString();
                CommunityId = WxPostData.GetValue("attach").ToString();
                string userId = null;
                if (CommunityId.Contains(","))
                {
                    userId      = CommunityId.Split(',')[1];
                    CommunityId = CommunityId.Split(',')[0];
                }

                if (IsValidate == false)
                {
                    Business.WeiXinPay.Log("验签失败:" + CommunityId + "," + orderId.ToString());
                    Result = SetNotifyResult("FAIL", Result);
                    context.Response.Write(Result);
                    return;
                }

                Business.WeiXinPay.Log("微信支付验签成功:" + CommunityId + "," + orderId.ToString());

                if (IsValidate == true)
                {
                    //初始化参数
                    new Business.WeiXinPay().GenerateConfig(CommunityId);
                    //更新订单返回状态
                    Business.WeiXinPay.UpdateProperyOrder(CommunityId, orderId, respcode, respmsg);
                    //已收到应答,无需再通知
                    context.Response.Write(SetNotifyResult("SUCCESS", "OK"));
                    if (respcode == "SUCCESS")
                    {
                        string useHistoryId = null;

                        if (!string.IsNullOrEmpty(userId))
                        {
                            // 查询是否使用了积分
                            UsePoint(orderId, userId, out useHistoryId);
                        }

                        decimal total_fee = AppGlobal.StrToDec(WxPostData.GetValue("total_fee").ToString()) / 100.0m;

                        //下账
                        string ReceResult = Business.WeiXinPay.ReceProperyOrder(total_fee, CommunityId, orderId, useHistoryId);

                        if (!string.IsNullOrEmpty(userId))
                        {
                            // 下账成功,赠送积分
                            PresentedPoint(CommunityId, orderId, userId, useHistoryId, total_fee);
                        }

                        Business.WeiXinPay.Log("微信支付下账:" + CommunityId.ToString() + "," + orderId + "," + ReceResult);
                    }

                    Business.WeiXinPay.Log("微信支付流程:" + CommunityId.ToString() + "," + orderId + ",SUCCESS");
                }
            }
            catch (Exception E)
            {
                Business.WeiXinPay.Log(E.Message.ToString());
                context.Response.ContentType = "text/plain";
                context.Response.Write(SetNotifyResult("FAIL", E.Message.ToString()));
            }
        }