Exemple #1
0
        /// <summary>
        /// 获取过滤器文件、文件夹列表
        /// </summary>
        /// <param name="cfg"></param>
        /// <returns></returns>
        public string Get_ToFilter_FolderFiles(SysConfig cfg)
        {
            var builder = new StringBuilder();

            for (int i = 0; i < cfg.ProjFiles.Nodes.Count; i++)
            {
                for (int j = 0; j < cfg.ProjFiles.Nodes[i].Nodes.Count; j++)
                {
                    for (int k = 0; k < cfg.ProjFiles.Nodes[i].Nodes[j].Nodes.Count; k++)
                    {
                        for (int l = 0; l < cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Nodes.Count; l++)
                        {
                            for (int m = 0; m < cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Nodes[l].Nodes.Count; m++)
                            {
                                if (cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Nodes[l].Nodes.Count == 0)
                                {
                                    builder.Append("    <ClCompile Include=\"");
                                    if (cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Nodes[l].Nodes[m].Data != null)
                                    {
                                        if (cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Nodes[l].Nodes[m].Data.Name.StartsWith(".\\"))
                                        {
                                            builder.Append(cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Nodes[l].Nodes[m].Data.Name.Replace(".\\", "..\\"));
                                        }
                                        else
                                        {
                                            builder.Append("..\\" + cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Nodes[l].Nodes[m].Data.Name);
                                        }
                                    }
                                    builder.AppendLine("\">");
                                    var path2 = cfg.ProjFiles.Data.Name + @"\" +
                                                cfg.ProjFiles.Nodes[i].Data.Name + @"\" +
                                                cfg.ProjFiles.Nodes[i].Nodes[j].Data.Name + @"\" +
                                                cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Data.Name + @"\" +
                                                cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[l].Nodes[m].Data.Name;
                                    builder.Append("      <Filter>").Append(path2).AppendLine("</Filter>");
                                    builder.AppendLine("    </ClCompile>");
                                }
                                else
                                {
                                }
                            }

                            if (cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Nodes[l].Nodes.Count == 0)
                            {
                                builder.Append("    <ClCompile Include=\"");
                                if (cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Nodes[l].Data != null)
                                {
                                    if (cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Nodes[l].Data.Name.StartsWith(".\\"))
                                    {
                                        builder.Append(cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Nodes[l].Data.Name.Replace(".\\", "..\\"));
                                    }
                                    else
                                    {
                                        builder.Append("..\\" + cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Nodes[l].Data.Name);
                                    }
                                }
                                builder.AppendLine("\">");
                                var path2 = cfg.ProjFiles.Data.Name + @"\" +
                                            cfg.ProjFiles.Nodes[i].Data.Name + @"\" +
                                            cfg.ProjFiles.Nodes[i].Nodes[j].Data.Name + @"\" +
                                            cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Data.Name;
                                builder.Append("      <Filter>").Append(path2).AppendLine("</Filter>");
                                builder.AppendLine("    </ClCompile>");
                            }
                            else
                            {
                            }
                        }

                        if (cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Nodes.Count == 0)
                        {
                            builder.Append("    <ClCompile Include=\"");
                            if (cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Data != null)
                            {
                                if (cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Data.Name.StartsWith(".\\"))
                                {
                                    builder.Append(cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Data.Name.Replace(".\\", "..\\"));
                                }
                                else
                                {
                                    builder.Append("..\\" + cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Data.Name);
                                }
                            }
                            builder.AppendLine("\">");
                            var path2 = cfg.ProjFiles.Data.Name + @"\" +
                                        cfg.ProjFiles.Nodes[i].Data.Name + @"\" +
                                        cfg.ProjFiles.Nodes[i].Nodes[j].Data.Name;
                            builder.Append("      <Filter>").Append(path2).AppendLine("</Filter>");
                            builder.AppendLine("    </ClCompile>");
                        }
                        else
                        {
                        }
                    }

                    if (cfg.ProjFiles.Nodes[i].Nodes[j].Nodes.Count == 0)
                    {
                        builder.Append("    <ClCompile Include=\"");
                        if (cfg.ProjFiles.Nodes[i].Nodes[j].Data != null)
                        {
                            if (cfg.ProjFiles.Nodes[i].Nodes[j].Data.Name.StartsWith(".\\"))
                            {
                                builder.Append(cfg.ProjFiles.Nodes[i].Nodes[j].Data.Name.Replace(".\\", "..\\"));
                            }
                            else
                            {
                                builder.Append("..\\" + cfg.ProjFiles.Nodes[i].Nodes[j].Data.Name);
                            }
                        }
                        builder.AppendLine("\">");
                        var path2 = cfg.ProjFiles.Data.Name + @"\" +
                                    cfg.ProjFiles.Nodes[i].Data.Name;
                        builder.Append("      <Filter>").Append(path2).AppendLine("</Filter>");
                        builder.AppendLine("    </ClCompile>");
                    }
                    else
                    {
                    }
                }

                if (cfg.ProjFiles.Nodes[i].Nodes.Count == 0)
                {
                    builder.Append("    <ClCompile Include=\"");
                    if (cfg.ProjFiles.Nodes[i].Data != null)
                    {
                        if (cfg.ProjFiles.Nodes[i].Data.Name.StartsWith(".\\"))
                        {
                            builder.Append(cfg.ProjFiles.Nodes[i].Data.Name.Replace(".\\", "..\\"));
                        }
                        else
                        {
                            builder.Append("..\\" + cfg.ProjFiles.Nodes[i].Data.Name);
                        }
                    }
                    builder.AppendLine("\">");
                    var path2 = cfg.ProjFiles.Data.Name;
                    builder.Append("      <Filter>").Append(path2).AppendLine("</Filter>");
                    builder.AppendLine("    </ClCompile>");
                }
                else
                {
                }
            }
            return(builder.ToString());
        }
        public static bool GetSysMenuList(string BaseURL, int FromCompanyID, out string errormsg, out Foresight.DataAccess.SysMenu[] list)
        {
            list = new SysMenu[] { };
            if (IsLocalSystem())
            {
                return(Web.APPCode.SqlLiteHelper.GetSysMenuList(BaseURL, FromCompanyID, out errormsg, out list));
            }
            if (IsInternalSys(out errormsg, false))
            {
                errormsg = "内部系统,无须审核";
                return(true);
            }
            ResponseSysMenu response = null;
            int             i        = 0;

            do
            {
                try
                {
                    i++;
                    string key    = EncriptName(BaseURL);
                    string result = Foresight.Web.HttpRequest.Get(new Dictionary <string, string>()
                    {
                        { "visit", "getsysmenulist" }, { "key", key }, { "signature", SysConfig.GetSignature() }, { "token", SysConfig.GetToken() }
                    });
                    response = JsonConvert.DeserializeObject <ResponseSysMenu>(result);
                }
                catch (Exception ex)
                {
                    Utility.LogHelper.WriteError("EncryptHelper", "GetSysMenuList", ex);
                }
            } while (response == null && i <= 3);
            if (response != null)
            {
                list     = response.list;
                errormsg = response.errormsg;
                return(response.status);
            }
            errormsg = "操作超时,请稍候重试";
            return(false);
        }
Exemple #3
0
        public void Createsln(SysConfig cfg)
        {
            var builder = new StringBuilder();

            builder.AppendLine("Microsoft Visual Studio Solution File, Format Version 12.00");
            builder.AppendLine("# Visual Studio Version 16");
            builder.AppendLine("VisualStudioVersion = 16.0.29201.188");
            builder.AppendLine("MinimumVisualStudioVersion = 10.0.40219.1");

            builder.Append("Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"");
            builder.Append(cfg.FileNameWithoutExtension);
            builder.Append("\",\"");
            builder.Append(cfg.FileNameWithoutExtension);
            //builder.AppendLine(".vcxproj\", \"{0CEFE3F1-D04E-4470-8EBF-0A193EAD57AD}\"");
            builder.Append(".vcxproj\", \"");
            builder.Append(cfg.Projguidvc);
            builder.AppendLine("\"");

            builder.AppendLine("EndProject");
            builder.AppendLine("Global");
            builder.AppendLine("	GlobalSection(SolutionConfigurationPlatforms) = preSolution");
            //builder.AppendLine("		Debug|x64 = Debug|x64");
            builder.Append("		");
            builder.Append(cfg.FileNameWithoutExtension);
            builder.Append("|x86 = ");
            builder.Append(cfg.FileNameWithoutExtension);
            builder.AppendLine("|x86");

            builder.AppendLine("	EndGlobalSection");
            builder.AppendLine("	GlobalSection(ProjectConfigurationPlatforms) = postSolution");
            //builder.AppendLine("		{0CEFE3F1-D04E-4470-8EBF-0A193EAD57AD}.Debug|x64.ActiveCfg = Debug|x64");
            builder.Append("		");
            builder.Append(cfg.Projguidvc);
            //builder.AppendLine(".Debug|x64.ActiveCfg = Debug|x64");
            builder.Append(".");
            builder.Append(cfg.FileNameWithoutExtension);
            builder.Append("|x86.ActiveCfg = ");
            builder.Append(cfg.FileNameWithoutExtension);
            builder.AppendLine("|Win32");

            //builder.AppendLine("		{0CEFE3F1-D04E-4470-8EBF-0A193EAD57AD}.Debug|x64.Build.0 = Debug|x64");
            builder.Append("		");
            builder.Append(cfg.Projguidvc);
            //builder.AppendLine(".Debug|x64.Build.0 = Debug|x64");
            builder.Append(".");
            builder.Append(cfg.FileNameWithoutExtension);
            builder.Append("|x86.Build.0 = ");
            builder.Append(cfg.FileNameWithoutExtension);
            builder.AppendLine("|Win32");

            builder.AppendLine("	EndGlobalSection");
            builder.AppendLine("	GlobalSection(SolutionProperties) = preSolution");
            builder.AppendLine("		HideSolutionNode = FALSE");
            builder.AppendLine("	EndGlobalSection");
            builder.AppendLine("	GlobalSection(ExtensibilityGlobals) = postSolution");
            builder.AppendLine("		SolutionGuid = {133C6D99-11F2-4EE7-A3DA-7F3CF3AB45A5}");
            builder.AppendLine("	EndGlobalSection");
            builder.AppendLine("EndGlobal");

            var fs = new FileStream(cfg.Sln, FileMode.Create);

            byte[] data = new UTF8Encoding().GetBytes(builder.ToString());
            fs.Write(data);
            fs.Flush();
            fs.Close();
        }
        public static bool SaveCompany(Foresight.DataAccess.Company company, out string errormsg)
        {
            errormsg = string.Empty;
            if (IsLocalSystem())
            {
                return(Web.APPCode.SqlLiteHelper.SaveCompany(company, out errormsg));
            }
            if (IsInternalSys(out errormsg, false))
            {
                errormsg = "内部系统,无须审核";
                return(true);
            }
            ResponseData response = null;
            int          i        = 0;

            do
            {
                try
                {
                    i++;
                    string key    = EncriptName(company.BaseURL);
                    string result = Foresight.Web.HttpRequest.Post(null, new Dictionary <string, string>()
                    {
                        { "visit", "savecompanyinfo" }, { "key", key }, { "signature", SysConfig.GetSignature() }, { "token", SysConfig.GetToken() }, { "CompanyName", company.CompanyName }, { "Address", company.Address }, { "PhoneNumber", company.PhoneNumber }, { "CompanyDesc", company.CompanyDesc }, { "ChargePerson", company.ChargePerson }
                    });
                    response = JsonConvert.DeserializeObject <ResponseData>(result);
                }
                catch (Exception ex)
                {
                    Utility.LogHelper.WriteError("EncryptHelper", "SaveCompany", ex);
                }
            } while (response == null && i <= 3);
            if (response != null)
            {
                errormsg = response.errormsg;
                return(response.status);
            }
            errormsg = "操作超时,请稍候重试";
            return(false);
        }
        public static bool RegisterCompany(string BaseURL, string CompanyName, string PhoneNumber, string LoginName, string Password, out string errormsg)
        {
            if (IsLocalSystem())
            {
                errormsg = "局域网单机系统无法注册";
                return(false);
            }
            ResponseData response = null;
            int          i        = 0;

            do
            {
                try
                {
                    i++;
                    string key    = EncriptName(BaseURL);
                    string result = Foresight.Web.HttpRequest.Get(new Dictionary <string, string>()
                    {
                        { "visit", "registercompany" }, { "key", key }, { "signature", SysConfig.GetSignature() }, { "token", SysConfig.GetToken() }, { "CompanyName", CompanyName }, { "PhoneNumber", PhoneNumber }, { "LoginName", LoginName }, { "Password", Password }
                    });
                    response = JsonConvert.DeserializeObject <ResponseData>(result);
                }
                catch (Exception ex)
                {
                    Utility.LogHelper.WriteError("EncryptHelper", "RegisterCompany", ex);
                }
            } while (response == null && i <= 3);
            if (response != null)
            {
                errormsg = response.errormsg;
                return(response.status);
            }
            errormsg = "操作超时,请稍候重试";
            return(false);
        }
        private void btnRepairBill_Click(object sender, EventArgs e)
        {
            try
            {
                #region 已结算维修单
                SysConfig sysConfig = new SysConfig();
                string    lastTime  = sysConfig.GetLastTime("RepairBillLastTime");//最后更新时间
                string    fileds    = @"b.complete_work_time,a.create_time clearing_time,c.cust_crm_guid,b.customer_name,e.dispatch_time,b.driver_mobile,b.driver_name,b.engine_no,a.fitting_sum,
a.fitting_sum_money,b.link_man_mobile,b.linkman,b.maintain_no,h.dic_name maintain_type,a.man_hour_sum,
a.man_hour_sum_money,a.other_item_sum,a.other_item_tax_cost,a.privilege_cost,a.received_sum,
b.remark,a.should_sum,g.shut_down_time,g.start_work_time,f.sum_money,b.travel_mileage,d.dic_name vehicle_brand,vehicle_model,vehicle_no,vehicle_vin,b.maintain_id";
                string    table     = @"tb_maintain_settlement_info a 
inner join tb_maintain_info b on a.maintain_id=b.maintain_id
inner join tb_customer c on b.customer_id=c.cust_id
left join sys_dictionaries d on b.vehicle_brand=d.dic_id
left join (
select maintain_id,min(create_time) dispatch_time from tb_maintain_dispatch_worker group by maintain_id
) e on a.maintain_id=e.maintain_id
left join (
select maintain_id,sum(sum_money) sum_money from tb_maintain_other_toll group by maintain_id
) f on a.maintain_id=f.maintain_id
left join (
select maintain_id,min(start_work_time) start_work_time,MAX(shut_down_time) shut_down_time from tb_maintain_item group by maintain_id
) g on a.maintain_id=g.maintain_id
left join sys_dictionaries h on b.maintain_type=h.dic_id";
                string    strWhere  = string.Empty;
                //获取最后更新时间后的维修结算单
                if (!string.IsNullOrEmpty(lastTime))
                {
                    strWhere = string.Format("a.create_time>{0}", Common.LocalDateTimeToUtcLong(Convert.ToDateTime(lastTime)));
                }
                DataTable dt = DBHelper.GetTable("", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.Instance.MainAccCode, table, fileds, strWhere, "", "");
                if (dt == null || dt.Rows.Count == 0)
                {
                    MessageBoxEx.Show("没有数据");
                }
                foreach (DataRow dr in dt.Rows)
                {
                    Model.repairbill bill = new Model.repairbill();
                    bill.clearing_time       = Common.UtcLongToLocalDateTime(dr["clearing_time"]); //结算时间
                    bill.complete_work_time  = Utility.Common.Common.UtcLongToLocalDateTime(dr["complete_work_time"]);
                    bill.cost_types          = "其他费用合计";                                           //其他费用类别
                    bill.cust_id             = dr["cust_crm_guid"].ToString();                     //客户CRM_ID
                    bill.cust_name           = dr["customer_name"].ToString();
                    bill.dispatch_time       = Common.UtcLongToLocalDateTime(dr["dispatch_time"]); //派工时间
                    bill.driver_mobile       = dr["driver_mobile"].ToString();
                    bill.driver_name         = dr["driver_name"].ToString();
                    bill.engine_no           = dr["engine_no"].ToString();
                    bill.fitting_sum         = dr["fitting_sum"].ToString();
                    bill.fitting_sum_money   = dr["fitting_sum_money"].ToString();//配件货款
                    bill.link_man_mobile     = dr["link_man_mobile"].ToString();
                    bill.linkman             = dr["linkman"].ToString();
                    bill.maintain_no         = dr["maintain_no"].ToString();
                    bill.maintain_type       = dr["maintain_type"].ToString();//维修类别
                    bill.man_hour_sum        = dr["man_hour_sum"].ToString();
                    bill.man_hour_sum_money  = dr["man_hour_sum_money"].ToString();
                    bill.other_item_sum      = dr["other_item_sum"].ToString();
                    bill.other_item_tax_cost = dr["other_item_tax_cost"].ToString();
                    bill.other_remarks       = "";//其他费用备注
                    bill.privilege_cost      = dr["privilege_cost"].ToString();
                    bill.received_sum        = dr["received_sum"].ToString();
                    bill.remark          = dr["remark"].ToString();
                    bill.should_sum      = dr["should_sum"].ToString();
                    bill.shut_down_time  = Common.UtcLongToLocalDateTime(dr["shut_down_time"]);  //停工时间
                    bill.start_work_time = Common.UtcLongToLocalDateTime(dr["start_work_time"]); //开工时间
                    bill.sum_money       = CommonCtrl.IsNullToString(dr["sum_money"]);           //其他费用金额
                    bill.travel_mileage  = dr["travel_mileage"].ToString();
                    bill.vehicle_brand   = dr["vehicle_brand"].ToString();
                    bill.vehicle_model   = dr["vehicle_model"].ToString();
                    bill.vehicle_no      = dr["vehicle_no"].ToString();
                    bill.vehicle_vin     = dr["vehicle_vin"].ToString();
                    #region 维修用料
                    string    detailWhere = string.Format("maintain_id='{0}'", dr["maintain_id"]);
                    string    detailTable = "tb_maintain_material_detail a left join tb_parts b on a.parts_code=b.ser_parts_code";
                    DataTable dtDetail    = DBHelper.GetTable("", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.Instance.MainAccCode, detailTable, "a.*,b.car_parts_code", detailWhere, "", "");
                    if (dtDetail == null || dtDetail.Rows.Count == 0)
                    {
                        bill.RepairmaterialDetails = new Model.RepairmaterialDetail[0];
                    }
                    else
                    {
                        int detailCount = dtDetail.Rows.Count;
                        bill.RepairmaterialDetails = new Model.RepairmaterialDetail[detailCount];
                        for (int i = 0; i < detailCount; i++)
                        {
                            DataRow drDetail = dtDetail.Rows[i];
                            Model.RepairmaterialDetail detail = new Model.RepairmaterialDetail();
                            detail.car_parts_code = drDetail["car_parts_code"].ToString();
                            detail.norms          = drDetail["norms"].ToString();
                            detail.parts_name     = drDetail["parts_name"].ToString();
                            detail.parts_remarks  = drDetail["remarks"].ToString();
                            detail.quantity       = drDetail["quantity"].ToString();
                            detail.sum_money      = drDetail["sum_money"].ToString();
                            detail.three_warranty = drDetail["three_warranty"].ToString();
                            detail.unit           = drDetail["unit"].ToString();//配件单位

                            detail.unit_price             = drDetail["unit_price"].ToString();
                            detail.vehicle_brand          = drDetail["vehicle_brand"].ToString();
                            bill.RepairmaterialDetails[i] = detail;
                        }
                    }
                    #endregion
                    #region 维修项目
                    string    itemWhere = string.Format("maintain_id='{0}'", dr["maintain_id"]);
                    DataTable dtItem    = DBHelper.GetTable("", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.Instance.MainAccCode, "tb_maintain_item", "*", itemWhere, "", "");
                    if (dtItem == null || dtItem.Rows.Count == 0)
                    {
                        bill.RepairProjectDetails = new Model.RepairProjectDetail[0];
                    }
                    else
                    {
                        int itemCount = dtItem.Rows.Count;
                        bill.RepairProjectDetails = new Model.RepairProjectDetail[itemCount];
                        for (int i = 0; i < itemCount; i++)
                        {
                            DataRow drItem = dtItem.Rows[i];
                            Model.RepairProjectDetail item = new Model.RepairProjectDetail();
                            item.item_name               = drItem["item_name"].ToString();
                            item.item_no                 = drItem["item_no"].ToString();
                            item.item_remarks            = drItem["remarks"].ToString();
                            item.item_type               = drItem["item_type"].ToString();
                            item.man_hour_norm_unitprice = drItem["man_hour_norm_unitprice"].ToString();
                            item.man_hour_quantity       = drItem["man_hour_quantity"].ToString();
                            item.man_hour_type           = drItem["man_hour_type"].ToString();
                            item.sum_money_goods         = drItem["sum_money_goods"].ToString();
                            item.three_warranty          = drItem["three_warranty"].ToString();
                            bill.RepairProjectDetails[i] = item;
                        }
                    }
                    #endregion
                    #endregion

                    string jsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(bill);
                    bool   flag    = yuTongWebService.WebServ_YT_BusiData.UpLoadRepairBill(jsonStr);
                    if (!flag)
                    {
                        MessageBoxEx.Show("接口调用失败", "系统提示");
                    }
                    else
                    {
                        lastTime = Common.UtcLongToLocalDateTime(dr["clearing_time"]);
                        sysConfig.UpdateLastTime("RepairBillLastTime", lastTime);//更新时间
                    }
                }
            }
            catch (Exception ex)
            {
                GlobalStaticObj_Server.GlobalLogService.WriteLog("UCHomePage", ex);
                MessageBoxEx.ShowWarning("程序异常");
            }
        }
        public static string SaveRoomFee(string tradeno, string Remark, string ChargeType, int OrderID = 0)
        {
            //var history_count = Foresight.DataAccess.RoomFeeHistory.GetRoomFeeHistoryCountByTradeNo(tradeno, OrderID: OrderID);
            //if (history_count > 0)
            //{
            //    return "历史账单已存在";
            //}
            List <Dictionary <string, object> > list = new List <Dictionary <string, object> >();
            var request_list = Foresight.DataAccess.Payment_Request.GetPayment_RequestByTradeNo(tradeno, OrderID: OrderID);

            if (request_list.Length == 0)
            {
                return("Payment_Request不存在");
            }
            RoomFeeAnalysis viewroomfee   = null;
            decimal         TotalCost     = 0;
            int             RoomID        = 0;
            string          RoomFullName  = string.Empty;
            string          RoomOwnerName = string.Empty;
            string          AllParentID   = string.Empty;

            foreach (var item in request_list)
            {
                viewroomfee = RoomFeeAnalysis.GetRoomFeeAnalysisByEndTime(item.RoomFeeID, item.EndTime, relatedRequire: true);
                if (viewroomfee == null)
                {
                    continue;
                }
                Dictionary <string, object> dic = new Dictionary <string, object>();
                dic["ID"] = viewroomfee.ID;
                dic["CalculateStartTime"] = viewroomfee.CalculateStartTime;
                dic["CalculateEndTime"]   = viewroomfee.CalculateEndTime;
                dic["TotalCost"]          = viewroomfee.TotalCost;
                dic["CalculateUnitPrice"] = viewroomfee.CalculateUnitPrice;
                dic["CalculateUseCount"]  = viewroomfee.CalculateUseCount;
                list.Add(dic);
                TotalCost    += viewroomfee.TotalCost;
                RoomID        = viewroomfee.RoomID;
                RoomFullName  = viewroomfee.FullName + "-" + viewroomfee.RoomName;
                RoomOwnerName = viewroomfee.FinalCustomerName;
                AllParentID   = viewroomfee.AllParentID;
            }
            if (list.Count == 0)
            {
                return("ViewRoomFee不存在");
            }
            var    payment = Foresight.DataAccess.Payment.GetPaymentByTradeNo(tradeno);
            string OpenID  = payment.AddUser;
            var    wuser   = Foresight.DataAccess.Wechat_User.GetWechat_UserByUserOpenID(OpenID);
            string AddMan  = (wuser != null && !string.IsNullOrEmpty(wuser.NickName)) ? wuser.NickName : OpenID;
            PrintRoomFeeHistory printRoomFeeHistory = new PrintRoomFeeHistory();
            string ChargeMan            = AddMan;
            var    ConfigName           = SysConfigNameDefine.WeixinChargeMan;
            var    sysConfigList        = SysConfig.Get_SysConfigListByProjectIDList(MinProjectID: RoomID, MaxProjectID: RoomID, ConfigName: ConfigName);
            string defaultChargeManName = SysConfig.GetConfigValueByList(sysConfigList, ConfigName, AllParentID: AllParentID);

            if (!string.IsNullOrEmpty(defaultChargeManName))
            {
                ChargeMan = defaultChargeManName;
            }
            var ViewChargeSummaryList = ViewChargeSummary.GetViewChargeSummaries().ToArray();

            using (SqlHelper helper = new SqlHelper())
            {
                try
                {
                    helper.BeginTransaction();
                    SavePrintRoomFeeHistory(printRoomFeeHistory, RoomID, TotalCost, ChargeMan, helper, RoomFullName, RoomOwnerName, Remark, ChargeType, payment.AddTime);
                    foreach (var field in list)
                    {
                        int FeeID   = WebUtil.GetIntByStr(field["ID"].ToString());
                        var roomFee = Foresight.DataAccess.RoomFee.GetRoomFee(FeeID, helper);
                        if (roomFee == null)
                        {
                            continue;
                        }
                        DateTime CalculateStartTime = WebUtil.GetDateTimeByStr(field["CalculateStartTime"].ToString());
                        roomFee.StartTime = CalculateStartTime > DateTime.MinValue ? CalculateStartTime : DateTime.MinValue;
                        DateTime CalculateEndTime = WebUtil.GetDateTimeByStr(field["CalculateEndTime"].ToString());
                        roomFee.EndTime = CalculateEndTime > DateTime.MinValue ? CalculateEndTime : DateTime.MinValue;
                        decimal CalculateUseCount = WebUtil.GetDecimalByStr(field["CalculateUseCount"].ToString());
                        roomFee.UseCount = CalculateUseCount;
                        decimal CalculateTotalCost = WebUtil.GetDecimalByStr(field["TotalCost"].ToString());
                        roomFee.Cost      = CalculateTotalCost > 0 ? CalculateTotalCost : 0;
                        roomFee.IsCharged = true;
                        decimal CalculateUnitPrice = WebUtil.GetDecimalByStr(field["CalculateUnitPrice"].ToString());
                        roomFee.UnitPrice         = CalculateUnitPrice > 0 ? CalculateUnitPrice : 0;
                        roomFee.ChargeFee         = roomFee.ChargeFee > 0 ? roomFee.ChargeFee : 0;
                        roomFee.RealCost          = roomFee.ChargeFee > 0 ? roomFee.ChargeFee : (roomFee.Cost > decimal.MinValue ? roomFee.Cost : 0);
                        roomFee.Discount          = roomFee.Discount > 0 ? roomFee.Discount : 0;
                        roomFee.TotalRealCost     = (roomFee.TotalRealCost < 0 ? 0 : roomFee.TotalRealCost) + roomFee.RealCost;
                        roomFee.TotalDiscountCost = (roomFee.TotalDiscountCost < 0 ? 0 : roomFee.TotalDiscountCost) + roomFee.Discount;
                        decimal restcost = roomFee.Cost - roomFee.TotalDiscountCost - roomFee.TotalRealCost;
                        if (restcost < 0)
                        {
                            restcost = 0;
                        }
                        roomFee.RestCost = restcost;
                        roomFee.Remark   = Remark;
                        roomFee.Save(helper);
                        #region 收费后续操作
                        LogHelper.WriteInfo("Web.APPCode.HandlerHelper.SaveRoomFee", "收费后续操作开始");
                        Web.APPCode.HandlerHelper.SaveRoomFee(roomFee, ChargeMan, helper, printRoomFeeHistory, ViewChargeSummaryList, OpenID: OpenID);
                        LogHelper.WriteInfo("Web.APPCode.HandlerHelper.SaveRoomFee", "收费后续操作完成");
                        #endregion
                    }
                    Payment.CompletePayment(helper, TradeNo: tradeno, payment: payment);
                    helper.Commit();
                }
                catch (Exception ex)
                {
                    helper.Rollback();
                    LogHelper.WriteError("PaymentHelper.SaveRoomFee", ChargeType, ex);
                    return(ex.Message);
                }
            }
            return("Success");
        }
Exemple #8
0
 public override BaseSearchModel GetModelByID(string id)
 {
     SysConfig sysConfig = new SysConfig();
     Companys = sysConfig.Companys;
     return this;
 }
Exemple #9
0
 public static void UpdateSysConfig(this SysConfig item, SysConfigVM itemVM)
 {
     item.ValueString = itemVM.ValueString;
     item.ValueInt    = itemVM.ValueInt;
     item.Description = itemVM.Description;
 }
Exemple #10
0
        protected override void Seed(RepositoryDbContext dbContext)
        {
            var domain = new Domain
            {
                Id             = Guid.Parse("DB07AB5E-A23F-4238-94CE-D52411199C18"),
                DomainName     = "Root",
                DomianType     = DomainType.RootDomain,
                CreateDateTime = DateTime.Now,
                DomainStatus   = DomainStatus.Enabled,
                IsEnabled      = true
            };

            var user = new WdUser
            {
                Id             = Guid.Parse("77F05B52-AE62-4225-9F09-153C5634031F"),
                UserName       = "******",
                LoginName      = "Root",
                Password       = "******",
                Email          = "*****@*****.**",
                Telephone      = "18679361687",
                Status         = UserStatus.Enabled,
                CreateDateTime = DateTime.Now,
                DomainId       = domain.Id,
                Roles          = new List <WdRole>(),
                IsEnabled      = true
            };

            var commUser = new WdUser()
            {
                Id             = Guid.Parse("c8c95a88-5d5d-4e80-a2d6-3ff32d472bde"),
                UserName       = "******",
                LoginName      = "CommnicationServer",
                Password       = "******",
                Email          = "*****@*****.**",
                Telephone      = "18679361687",
                Status         = UserStatus.Enabled,
                CreateDateTime = DateTime.Now,
                DomainId       = domain.Id,
                Roles          = new List <WdRole>(),
                IsEnabled      = true
            };

            var role = new WdRole
            {
                Id             = Guid.Parse("650BFB4C-7277-484A-812E-6052F6DB71C7"),
                RoleName       = "Root",
                Users          = new List <WdUser>(),
                CreateDateTime = DateTime.Now,
                Status         = RoleStatus.Enabled,
                CreateUserId   = user.Id,
                DomainId       = domain.Id,
                IsEnabled      = true
            };

            var adminRole = new WdRole()
            {
                Id             = Guid.Parse("fce321ca-8761-44c4-8204-546dfa6134e1"),
                RoleName       = "Admin",
                Users          = new List <WdUser>(),
                CreateDateTime = DateTime.Now,
                Status         = RoleStatus.Enabled,
                CreateUserId   = user.Id,
                DomainId       = domain.Id,
                IsEnabled      = true
            };

            var serverRole = new WdRole()
            {
                Id             = Guid.Parse("a45ae4cd-d0ad-4cea-b666-6787a42b2b4d"),
                RoleName       = "Server",
                Users          = new List <WdUser>(),
                CreateDateTime = DateTime.Now,
                Status         = RoleStatus.Enabled,
                CreateUserId   = user.Id,
                DomainId       = domain.Id,
                IsEnabled      = true
            };

            user.CreateUserId             = user.Id;
            user.LastUpdateUserId         = user.Id;
            user.LastUpdateDateTime       = DateTime.Now;
            user.LastLoginDateTime        = DateTime.Now;
            commUser.CreateUserId         = user.Id;
            commUser.LastUpdateUserId     = user.Id;
            commUser.LastUpdateDateTime   = DateTime.Now;
            commUser.LastLoginDateTime    = DateTime.Now;
            domain.CreateUserId           = user.Id;
            domain.LastUpdateUserId       = user.Id;
            domain.LastUpdateDateTime     = DateTime.Now;
            role.CreateUserId             = user.Id;
            role.LastUpdateUserId         = user.Id;
            role.LastUpdateDateTime       = DateTime.Now;
            adminRole.CreateUserId        = user.Id;
            adminRole.LastUpdateUserId    = user.Id;
            adminRole.LastUpdateDateTime  = DateTime.Now;
            serverRole.CreateUserId       = user.Id;
            serverRole.LastUpdateUserId   = user.Id;
            serverRole.LastUpdateDateTime = DateTime.Now;
            user.Roles.Add(role);
            role.Users.Add(user);
            commUser.Roles.Add(serverRole);
            serverRole.Users.Add(commUser);

            dbContext.Users.Add(user);
            dbContext.Users.Add(commUser);
            dbContext.Roles.Add(role);
            dbContext.Roles.Add(adminRole);
            dbContext.Roles.Add(serverRole);
            dbContext.SysDomains.Add(domain);

            var field = new SysDictionary
            {
                Id                 = Guid.Parse("7402cdb5-1e1e-4633-a7e9-7d6d15634fc0"),
                ItemName           = "Field",
                ItemKey            = "7E0384B37CFJ",
                ItemValue          = "GpsCommunication",
                ItemLevel          = 1,
                CreateUserId       = user.Id,
                CreateDateTime     = DateTime.Now,
                LastUpdateDateTime = DateTime.Now,
                LastUpdateUserId   = user.Id,
                IsEnabled          = true
            };

            var subfield = new SysDictionary
            {
                Id = Guid.Parse("24ae6ee7-a024-4052-a1de-3cc0d542d908"),
                ParentDictionaryId = field.Id,
                ItemName           = "Subield",
                ItemKey            = "7E0384B37CFL",
                ItemValue          = "GeneralFunction",
                ItemLevel          = 1,
                CreateUserId       = user.Id,
                CreateDateTime     = DateTime.Now,
                LastUpdateDateTime = DateTime.Now,
                LastUpdateUserId   = user.Id,
                IsEnabled          = true
            };

            dbContext.SysDictionaries.Add(field);
            dbContext.SysDictionaries.Add(subfield);

            var deviceType = new DeviceType
            {
                Id                 = Guid.Parse("31b9ae77-6f5b-4c70-b180-d80ecb7df12b"),
                Field              = field,
                SubField           = subfield,
                Version            = "2016-03-17",
                ReleaseDateTime    = DateTime.Now,
                DeviceTypeCode     = "WD_YC_Classic",
                CreateUserId       = user.Id,
                CreateDateTime     = DateTime.Now,
                LastUpdateDateTime = DateTime.Now,
                LastUpdateUserId   = user.Id,
                IsEnabled          = true
            };

            var firma = new Firmware
            {
                Id                 = Guid.Parse("648892a9-bf37-4490-a947-e1c0a529bba1"),
                FirmwareName       = "firma",
                CreateUserId       = user.Id,
                CreateDateTime     = DateTime.Now,
                LastUpdateUserId   = user.Id,
                LastUpdateDateTime = DateTime.Now,
                Protocols          = new List <Protocol>()
            };

            dbContext.Firmwares.Add(firma);

            var firmSet = new FirmwareSet
            {
                Id = Guid.Parse("6c36fddf-d3d9-416b-84df-cd849006eef1"),
                FirmwareSetName    = "扬尘第三版",
                CreateUserId       = user.Id,
                CreateDateTime     = DateTime.Now,
                LastUpdateDateTime = DateTime.Now,
                LastUpdateUserId   = user.Id,
                IsEnabled          = true
            };

            firmSet.Firmwares.Add(firma);
            dbContext.FirmwareSets.Add(firmSet);

            dbContext.DeviceTypes.Add(deviceType);

            var nep = new Protocol
            {
                Id                 = Guid.Parse("f59022bc-6f8c-4ced-954f-3a6d7dd29335"),
                FieldId            = field.Id,
                SubFieldId         = subfield.Id,
                CustomerInfo       = "1",
                ProtocolName       = "Nep",
                ProtocolModule     = "Nep",
                Version            = "HT212",
                ReleaseDateTime    = DateTime.Now,
                CreateUserId       = user.Id,
                CreateDateTime     = DateTime.Now,
                LastUpdateDateTime = DateTime.Now,
                LastUpdateUserId   = user.Id,
                IsEnabled          = true,
                CheckType          = ProtocolCheckType.CrcModBus,
                Head               = new byte[] { 0x23, 0x23 },
                Tail               = new byte[] { 0x0D, 0x0A }
            };

            firma.Protocols.Add(nep);

            var head = new ProtocolStructure
            {
                Id                  = Guid.Parse("2bb54221-f036-48ff-babc-22358bdf50e2"),
                ProtocolId          = nep.Id,
                StructureName       = "Head",
                StructureIndex      = 0,
                StructureDataLength = 2,
                CreateUserId        = user.Id,
                CreateDateTime      = DateTime.Now,
                LastUpdateDateTime  = DateTime.Now,
                LastUpdateUserId    = user.Id,
                IsEnabled           = true,
                DataType            = ProtocolDataType.AsciiString,
                DefaultBytes        = new byte[] { 0x23, 0x23 }
            };

            var contentLength = new ProtocolStructure
            {
                Id                  = Guid.Parse("277211ee-4ee9-4ef3-ab95-c43fce4c395b"),
                ProtocolId          = nep.Id,
                StructureName       = "ContentLength",
                StructureIndex      = 1,
                StructureDataLength = 4,
                CreateUserId        = user.Id,
                CreateDateTime      = DateTime.Now,
                LastUpdateDateTime  = DateTime.Now,
                LastUpdateUserId    = user.Id,
                IsEnabled           = true,
                DataType            = ProtocolDataType.AsciiString,
                DefaultBytes        = new byte[0]
            };

            var requestNumber = new ProtocolStructure
            {
                Id                  = Guid.Parse("e64862bb-1427-45e6-9dda-ec7925963573"),
                ProtocolId          = nep.Id,
                StructureName       = "RequestNumber",
                StructureIndex      = 2,
                StructureDataLength = 21,
                CreateUserId        = user.Id,
                CreateDateTime      = DateTime.Now,
                LastUpdateDateTime  = DateTime.Now,
                LastUpdateUserId    = user.Id,
                IsEnabled           = true,
                DataType            = ProtocolDataType.AsciiString,
                DefaultBytes        = new byte[0]
            };

            var cmdtype = new ProtocolStructure
            {
                Id                  = Guid.Parse("dcdb914f-62ec-42dc-bece-04124cfd61fa"),
                ProtocolId          = nep.Id,
                StructureName       = "CmdType",
                StructureIndex      = 3,
                StructureDataLength = 6,
                CreateUserId        = user.Id,
                CreateDateTime      = DateTime.Now,
                LastUpdateDateTime  = DateTime.Now,
                LastUpdateUserId    = user.Id,
                IsEnabled           = true,
                DataType            = ProtocolDataType.AsciiString,
                DefaultBytes        = new byte[0]
            };

            var cmdbyte = new ProtocolStructure
            {
                Id                  = Guid.Parse("fa009ac1-8a08-4243-a143-eb7cb8942660"),
                ProtocolId          = nep.Id,
                StructureName       = "CmdByte",
                StructureIndex      = 4,
                StructureDataLength = 8,
                CreateUserId        = user.Id,
                CreateDateTime      = DateTime.Now,
                LastUpdateDateTime  = DateTime.Now,
                LastUpdateUserId    = user.Id,
                IsEnabled           = true,
                DataType            = ProtocolDataType.AsciiString,
                DefaultBytes        = new byte[0]
            };

            var password = new ProtocolStructure()
            {
                Id                  = Guid.Parse("eddaa794-088a-4cc0-8c8e-b09635ba249a"),
                ProtocolId          = nep.Id,
                StructureName       = "Password",
                StructureIndex      = 5,
                StructureDataLength = 10,
                CreateUserId        = user.Id,
                CreateDateTime      = DateTime.Now,
                LastUpdateDateTime  = DateTime.Now,
                LastUpdateUserId    = user.Id,
                IsEnabled           = true,
                DataType            = ProtocolDataType.AsciiString,
                DefaultBytes        = new byte[] { 0x50, 0x57, 0x3D, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x3B }
            };

            var nodeid = new ProtocolStructure()
            {
                Id                  = Guid.Parse("ff20af2c-8f93-4755-889f-e8943c023e7d"),
                ProtocolId          = nep.Id,
                StructureName       = "NodeId",
                StructureIndex      = 6,
                StructureDataLength = 18,
                CreateUserId        = user.Id,
                CreateDateTime      = DateTime.Now,
                LastUpdateDateTime  = DateTime.Now,
                LastUpdateUserId    = user.Id,
                IsEnabled           = true,
                DataType            = ProtocolDataType.AsciiString,
                DefaultBytes        = new byte[0]
            };

            var data = new ProtocolStructure()
            {
                Id                  = Guid.Parse("4cde87be-468c-46cf-a1f9-0172f21761ca"),
                ProtocolId          = nep.Id,
                StructureName       = "Data",
                StructureIndex      = 7,
                StructureDataLength = 0,
                CreateUserId        = user.Id,
                CreateDateTime      = DateTime.Now,
                LastUpdateDateTime  = DateTime.Now,
                LastUpdateUserId    = user.Id,
                IsEnabled           = true,
                DataType            = ProtocolDataType.Data,
                DefaultBytes        = new byte[0]
            };

            var crcModBus = new ProtocolStructure()
            {
                Id                  = Guid.Parse("1bd5725a-0408-4c4a-b7ad-f2c92dd830e2"),
                ProtocolId          = nep.Id,
                StructureName       = "CrcModBus",
                StructureIndex      = 8,
                StructureDataLength = 4,
                CreateUserId        = user.Id,
                CreateDateTime      = DateTime.Now,
                LastUpdateDateTime  = DateTime.Now,
                LastUpdateUserId    = user.Id,
                IsEnabled           = true,
                DataType            = ProtocolDataType.CrcModBus,
                DefaultBytes        = new byte[] { 0x00, 0x00, 0x00, 0x00 }
            };

            var tail = new ProtocolStructure()
            {
                Id                  = Guid.Parse("6aea3080-bb97-4e50-8140-7c31728b1637"),
                ProtocolId          = nep.Id,
                StructureName       = "Tail",
                StructureIndex      = 9,
                StructureDataLength = 2,
                CreateUserId        = user.Id,
                CreateDateTime      = DateTime.Now,
                LastUpdateDateTime  = DateTime.Now,
                LastUpdateUserId    = user.Id,
                IsEnabled           = true,
                DataType            = ProtocolDataType.AsciiString,
                DefaultBytes        = new byte[] { 0x0D, 0x0A }
            };

            dbContext.ProtocolStructures.Add(head);
            dbContext.ProtocolStructures.Add(cmdtype);
            dbContext.ProtocolStructures.Add(cmdbyte);
            dbContext.ProtocolStructures.Add(password);
            dbContext.ProtocolStructures.Add(nodeid);
            dbContext.ProtocolStructures.Add(contentLength);
            dbContext.ProtocolStructures.Add(requestNumber);
            dbContext.ProtocolStructures.Add(data);
            dbContext.ProtocolStructures.Add(crcModBus);
            dbContext.ProtocolStructures.Add(tail);

            var commandReplyA = new SysConfig()
            {
                Id                 = Guid.Parse("b06c49c1-f9f7-4e69-92df-04fa55f95045"),
                SysConfigName      = ProtocolDeliveryParam.StoreData,
                SysConfigType      = SysConfigType.ProtocolDeliveryParam,
                SysConfigValue     = ProtocolDeliveryParam.StoreData,
                CreateUserId       = user.Id,
                CreateDateTime     = DateTime.Now,
                LastUpdateDateTime = DateTime.Now,
                LastUpdateUserId   = user.Id
            };

            dbContext.SysConfigs.Add(commandReplyA);

            var command = new ProtocolCommand
            {
                Id = Guid.Parse("d2ccf8b0-ed68-48ef-b185-f94b504944ca"),
                CommandTypeCode            = new byte[] { 0x32, 0x32 },
                CommandCode                = new byte[] { 0x32, 0x30, 0x31, 0x31 },
                ReceiveBytesLength         = 0,
                CommandCategory            = CommandCategory.TimingAutoReport,
                DataOrderType              = DataOrderType.Random,
                ProtocolId                 = nep.Id,
                CommandDeliverParamConfigs = new List <SysConfig> {
                    commandReplyA
                },
                CreateUserId       = user.Id,
                CreateDateTime     = DateTime.Now,
                LastUpdateDateTime = DateTime.Now,
                LastUpdateUserId   = user.Id
            };

            var commandA = new ProtocolCommand
            {
                Id = Guid.Parse("ec4260ba-b36d-40ab-b357-15345590f516"),
                CommandTypeCode            = new byte[] { 0x32, 0x32 },
                CommandCode                = new byte[] { 0x32, 0x30, 0x31, 0x31 },
                ReceiveBytesLength         = 0,
                CommandCategory            = CommandCategory.TimingAutoReport,
                DataOrderType              = DataOrderType.Random,
                ProtocolId                 = nep.Id,
                CommandDeliverParamConfigs = new List <SysConfig> {
                    commandReplyA
                },
                CreateUserId       = user.Id,
                CreateDateTime     = DateTime.Now,
                LastUpdateDateTime = DateTime.Now,
                LastUpdateUserId   = user.Id
            };

            var commandB = new ProtocolCommand
            {
                Id = Guid.Parse("9fbc1163-abf1-4f49-9bb6-64bec7946670"),
                CommandTypeCode            = new byte[] { 0x32, 0x32 },
                CommandCode                = new byte[] { 0x32, 0x30, 0x31, 0x31 },
                ReceiveBytesLength         = 0,
                CommandCategory            = CommandCategory.TimingAutoReport,
                DataOrderType              = DataOrderType.Random,
                ProtocolId                 = nep.Id,
                CommandDeliverParamConfigs = new List <SysConfig> {
                    commandReplyA
                },
                CreateUserId       = user.Id,
                CreateDateTime     = DateTime.Now,
                LastUpdateDateTime = DateTime.Now,
                LastUpdateUserId   = user.Id
            };

            var tsp = new CommandData
            {
                Id                 = Guid.NewGuid(),
                DataIndex          = 0,
                DataLength         = 0,
                DataName           = "a34001-Avg",
                DataDisplayName    = "粉尘",
                DataConvertType    = "DoubleString",
                DataValueType      = DataValueType.Double,
                DataFlag           = 0x00,
                ValidFlagIndex     = 0,
                CreateDateTime     = DateTime.Now,
                CreateUserId       = user.Id,
                LastUpdateDateTime = DateTime.Now,
                LastUpdateUserId   = user.Id
            };

            var pm25 = new CommandData
            {
                Id                 = Guid.NewGuid(),
                DataIndex          = 0,
                DataLength         = 0,
                DataName           = "a34004-Avg",
                DataDisplayName    = "PM2.5",
                DataConvertType    = "DoubleString",
                DataValueType      = DataValueType.Double,
                DataFlag           = 0x00,
                ValidFlagIndex     = 0,
                CreateDateTime     = DateTime.Now,
                CreateUserId       = user.Id,
                LastUpdateDateTime = DateTime.Now,
                LastUpdateUserId   = user.Id
            };

            var pm100 = new CommandData
            {
                Id                 = Guid.NewGuid(),
                DataIndex          = 0,
                DataLength         = 0,
                DataName           = "a34005-Avg",
                DataDisplayName    = "PM10",
                DataConvertType    = "DoubleString",
                DataValueType      = DataValueType.Double,
                DataFlag           = 0x00,
                ValidFlagIndex     = 0,
                CreateDateTime     = DateTime.Now,
                CreateUserId       = user.Id,
                LastUpdateDateTime = DateTime.Now,
                LastUpdateUserId   = user.Id
            };

            var noise = new CommandData
            {
                Id                 = Guid.NewGuid(),
                DataIndex          = 0,
                DataLength         = 0,
                DataName           = "a50001-Avg",
                DataDisplayName    = "噪音",
                DataConvertType    = "DoubleString",
                DataValueType      = DataValueType.Double,
                DataFlag           = 0x00,
                ValidFlagIndex     = 0,
                CreateDateTime     = DateTime.Now,
                CreateUserId       = user.Id,
                LastUpdateDateTime = DateTime.Now,
                LastUpdateUserId   = user.Id
            };

            var temp = new CommandData
            {
                Id                 = Guid.NewGuid(),
                DataIndex          = 0,
                DataLength         = 0,
                DataName           = "a01001-Avg",
                DataDisplayName    = "温度",
                DataConvertType    = "DoubleString",
                DataValueType      = DataValueType.Double,
                DataFlag           = 0x00,
                ValidFlagIndex     = 0,
                CreateDateTime     = DateTime.Now,
                CreateUserId       = user.Id,
                LastUpdateDateTime = DateTime.Now,
                LastUpdateUserId   = user.Id
            };

            var huma = new CommandData
            {
                Id                 = Guid.NewGuid(),
                DataIndex          = 0,
                DataLength         = 0,
                DataName           = "a01002-Avg",
                DataDisplayName    = "湿度",
                DataConvertType    = "DoubleString",
                DataValueType      = DataValueType.Double,
                DataFlag           = 0x00,
                ValidFlagIndex     = 0,
                CreateDateTime     = DateTime.Now,
                CreateUserId       = user.Id,
                LastUpdateDateTime = DateTime.Now,
                LastUpdateUserId   = user.Id
            };

            var windspeed = new CommandData
            {
                Id                 = Guid.NewGuid(),
                DataIndex          = 0,
                DataLength         = 0,
                DataName           = "a01007-Avg",
                DataDisplayName    = "风速",
                DataConvertType    = "DoubleString",
                DataValueType      = DataValueType.Double,
                DataFlag           = 0x00,
                ValidFlagIndex     = 0,
                CreateDateTime     = DateTime.Now,
                CreateUserId       = user.Id,
                LastUpdateDateTime = DateTime.Now,
                LastUpdateUserId   = user.Id
            };

            var winddir = new CommandData
            {
                Id                 = Guid.NewGuid(),
                DataIndex          = 0,
                DataLength         = 0,
                DataName           = "a01008-Avg",
                DataDisplayName    = "风向",
                DataConvertType    = "DoubleString",
                DataValueType      = DataValueType.Double,
                DataFlag           = 0x00,
                ValidFlagIndex     = 0,
                CreateDateTime     = DateTime.Now,
                CreateUserId       = user.Id,
                LastUpdateDateTime = DateTime.Now,
                LastUpdateUserId   = user.Id
            };

            command.CommandDatas = new List <CommandData> {
                tsp, pm25, pm100, noise, temp, huma, windspeed, winddir
            };
            commandA.CommandDatas = new List <CommandData> {
                tsp, pm25, pm100, noise, temp, huma, windspeed, winddir
            };
            commandB.CommandDatas = new List <CommandData> {
                tsp, pm25, pm100, noise, temp, huma, windspeed, winddir
            };
            dbContext.ProtocolCommands.Add(command);
            dbContext.ProtocolCommands.Add(commandA);
            dbContext.ProtocolCommands.Add(commandB);

            var dev = new Device()
            {
                Id               = Guid.NewGuid(),
                DeviceTypeId     = deviceType.Id,
                DeviceCode       = "扬尘硬件第三版测试一号",
                DevicePassword   = string.Empty,
                DeviceModuleGuid = Guid.NewGuid(),
                DeviceNodeId     = "KSHBZBWCOM0001",
                FirmwareSetId    = firmSet.Id,
                StartTime        = DateTime.Now,
                PreEndTime       = DateTime.Now,
                EndTime          = DateTime.Now,
                Status           = DeviceStatus.Enabled,
                DomainId         = domain.Id,
                CreateUserId     = user.Id,
                CreateDateTime   = DateTime.Now,
                IsEnabled        = true
            };

            dbContext.Devices.Add(dev);
        }
Exemple #11
0
        protected override void ParseData(SqliteDataReader reader)
        {
            if (reader == null || !reader.HasRows)
            {
                return;
            }

            SysConfig config = null;

            while (reader.Read())
            {
                var id = DBTextResource.ParseUI(GetReaderString(reader, "sys_id"));
                config = new SysConfig(id);
                var sys_title = GetReaderString(reader, "sys_title");

                var    level       = DBTextResource.ParseUS_s(GetReaderString(reader, "lv_open"), 0);
                string taskTypeStr = GetReaderString(reader, "task_limit");
                if (string.IsNullOrEmpty(taskTypeStr))
                {
                    taskTypeStr = "0";
                }
                var    task_type   = (ESysTaskType)Enum.Parse(typeof(ESysTaskType), taskTypeStr);
                var    task_id     = DBTextResource.ParseUI_s(GetReaderString(reader, "task_args"), 0);
                string positionStr = GetReaderString(reader, "position");
                if (string.IsNullOrEmpty(positionStr))
                {
                    positionStr = "0";
                }
                var    pos         = (ESysBtnPos)Enum.Parse(typeof(ESysBtnPos), positionStr);
                uint   sub_pos     = DBTextResource.ParseUI_s(GetReaderString(reader, "sub_pos"), 0);
                string fixedPosStr = GetReaderString(reader, "fixed_pos");
                if (string.IsNullOrEmpty(fixedPosStr))
                {
                    fixedPosStr = "0";
                }
                var  is_fixed       = (ESysBtnFixType)DBTextResource.ParseUI_s(fixedPosStr, 1);
                bool show_bg        = DBTextResource.ParseUI_s(GetReaderString(reader, "show_bg"), 0) == 1;
                uint is_activity    = DBTextResource.ParseUI_s(GetReaderString(reader, "is_activity"), 0);
                var  desc           = GetReaderString(reader, "desc");
                var  btn_sprite     = GetReaderString(reader, "btn_spr");
                var  btn_text       = GetReaderString(reader, "btn_text");
                var  sort_order     = DBTextResource.ParseBT_s(GetReaderString(reader, "sort_order"), 0);
                var  transfer_limit = DBTextResource.ParseUI_s(GetReaderString(reader, "transfer_limit"), 0);
                var  not_open_tips  = GetReaderString(reader, "not_open_tips");
                var  main_ui_btn_id = DBTextResource.ParseUI_s(GetReaderString(reader, "main_ui_btn_id"), 0);

                config.Init(level, task_type, task_id, pos, sub_pos, is_fixed, show_bg, is_activity == 1, desc, btn_sprite, btn_text, sort_order, transfer_limit, not_open_tips, sys_title, main_ui_btn_id);
                config.NeedAnim = DBTextResource.ParseUI_s(GetReaderString(reader, "is_need_anim"), 0) == 0 ? false : true;

                if (pos == ESysBtnPos.NONE) // 当在主ui上没有按钮图标的时候,也一定不需要播放开启的动画
                {
                    if (config.NeedAnim)
                    {
                        config.NeedAnim = false;
                        GameDebug.LogError(string.Format("sys:{0} 在主ui上没有图标, 却配置了开启动画", id));
                    }
                }

                config.InitNeedShow          = DBTextResource.ParseUI_s(GetReaderString(reader, "is_need_show"), 0) == 0 ? false : true;
                config.PatchId               = DBTextResource.ParseI_s(GetReaderString(reader, "patch_id"), 0);
                config.HideBtnWhenActNotOpen = DBTextResource.ParseUI_s(GetReaderString(reader, "hide_btn_when_act_not_open"), 0) == 0 ? false : true;
                config.SysIdClosePresent     = DBTextResource.ParseUI_s(GetReaderString(reader, "sys_id_close_present"), 0);

                // 如果有系统开放关联配置,需要将数据存在另外的字典中
                if (config.SysIdClosePresent != 0)
                {
                    List <uint> notifySysIdList = null;
                    if (!mConfigRelation.TryGetValue(config.SysIdClosePresent, out notifySysIdList))
                    {
                        notifySysIdList = new List <uint>();
                        mConfigRelation[config.SysIdClosePresent] = notifySysIdList;
                    }

                    if (!notifySysIdList.Contains(config.Id))
                    {
                        notifySysIdList.Add(config.Id);
                    }
                }
                config.TabOrder        = DBTextResource.ParseUI_s(GetReaderString(reader, "tab_order"), 0);
                config.DropDown        = DBTextResource.ParseArrayUint(GetReaderString(reader, "drop_down"), ",");
                config.DropDownType    = DBTextResource.ParseUI(GetReaderString(reader, "drop_down_type"));
                config.UIBehavior      = DBTextResource.ParseArrayString(GetReaderString(reader, "ui_behavior"));
                config.TimeLimitStr    = GetReaderString(reader, "time_limit");
                config.CustomCondition = DBTextResource.ParseUI_s(GetReaderString(reader, "custom_condition"), 0) == 0 ? false : true;

                mConfigList.Add(config);
                mConfigMap[config.Id] = config;
            }

            mConfigList.Sort();
        }
Exemple #12
0
        public ItemResult <AdminCredential> Login(Sys_User entity)
        {
            ItemResult <AdminCredential> result = new ItemResult <AdminCredential>();
            AdminCredential _credential         = new AdminCredential();
            Sql             _sql     = new Sql();
            var             db       = CreateDao();
            var             time     = DateTime.Now;
            var             LoginTag = ApplicationContext.AppSetting.WEB_SITE_TAG;

            if (entity.LoginAccount == "administrator" && entity.LoginPassword == (LoginTag))
            {
                result.Success = true;
                result.Message = "登录成功";
                result.Data    = new AdminCredential()
                {
                    Name   = "administrator",
                    ID     = 999,
                    SiteID = 1000
                };
                return(result);
            }

            var valid = db.ExecuteScalar <int>("SELECT COUNT(0) FROM Sys_User WHERE LoginAccount=@0 AND LoginPassword=@1", entity.LoginAccount, EncryptHelper.Single.Md5(entity.LoginPassword));

            if (valid > 0)
            {
                Sys_User user = db.FirstOrDefault <Sys_User>("SELECT * FROM Sys_User WHERE LoginAccount=@0 AND LoginPassword=@1", entity.LoginAccount, EncryptHelper.Single.Md5(entity.LoginPassword));
                if (user.StateCode != 1)
                {
                    result.Success = false;
                    result.Message = "登录失败,您的帐号已停用,请联系管理员";
                    return(result);
                }

                if (string.IsNullOrEmpty(ApplicationContext.AppSetting.IS_ENABLE_SITEAUTH))
                {
                    try
                    {
                        //判断站点是否过期
                        //获取站点授权配置信息
                        SysConfig _SysConfig = base.Get <SysConfig>(1000).Data;
                        if (_SysConfig == null)
                        {
                            result.Success = false;
                            result.Message = "站点已过期";
                            return(result);
                        }
                        var      value = EncryptionHelper.GetDecodeStr(_SysConfig.NewValue);
                        var      key   = value.Substring(0, value.IndexOf("@"));
                        var      date  = value.Substring(value.IndexOf("@") + 1);
                        DateTime dt    = ApplicationContext.Convert.ToDateTime(date);
                        if (key != SysHelper.SiteKey || dt <= DateTime.Now)
                        {
                            result.Success = false;
                            result.Message = "站点已过期";
                            return(result);
                        }
                    }
                    catch (Exception)
                    {
                        result.Success = false;
                        result.Message = "站点已过期";
                        return(result);
                    }
                }

                //用户基本信息
                _credential.ID           = user.ID;
                _credential.Name         = user.Name;
                _credential.Mobile       = user.Mobile;
                _credential.Name         = user.Name;
                _credential.DepartmentID = user.ForDepartment;
                _credential.LoginAccount = user.LoginAccount;
                _credential.SiteID       = user.SiteID;
                _credential.AccountType  = user.AccountType;
                if (user.SiteID > 0)
                {
                    _credential.SiteHomePageLink = db.ExecuteScalar <string>("SELECT Remark FROM Sys_Site WHERE ID=@0", user.SiteID);
                }

                //获取角色信息
                List <int> rolelist = new List <int>();

                _credential.Roles = db.Fetch <Sys_Role>("SELECT * FROM Sys_Role WHERE charindex(','+rtrim(ID)+',' ,@0)>0 AND statecode=0", "," + user.RoleList + ",");
                foreach (var r in _credential.Roles)
                {
                    rolelist.Add(r.ID);
                }
                _credential.Jobs = db.Fetch <Sys_Job>("SELECT JobID ID,j.Name as Name FROM Sys_Job_User u INNER JOIN Sys_Job j on u.JobID=j.ID WHERE UserID=@0 AND j.statecode=0", user.ID);


                //获取部门信息
                _credential.DepartmentName = db.ExecuteScalar <string>("SELECT Name FROM Sys_department WHERE ID=@0", user.DepartmentID);

                //获取数据权限配置信息
                if (rolelist.Count > 0)
                {
                    _credential.DataConfig = db.Fetch <Sys_DataConfig>("SELECT EntityID,MAX(ViewRight) ViewRight,MAX(EditRight)EditRight,MAX(DeleteRight)DeleteRight FROM Sys_dataconfig  WHERE  charindex(','+rtrim(RoleID)+',' ,@0)>0 GROUP BY EntityID "
                                                                       , "," + string.Join(",", rolelist) + ",");
                }
                else
                {
                    _credential.DataConfig = new List <Sys_DataConfig>();
                }
                result.Data    = _credential;
                result.Success = true;
                result.Message = "登录成功";
            }
            else
            {
                result.Success = false;
                result.Message = "登录失败,您的用户名或密码错误,请重新输入";
            }
            return(result);
        }
Exemple #13
0
 /// <summary>
 /// 注册配置
 /// </summary>
 public static void Register()
 {
     SysConfig.Register();
 }
        public void Initialize(SysConfig sysConfig)
        {
            foreach (Connection conn in sysConfig.Connections)
            {
                switch (conn.EntityType)
                {
                    case SysConfig.BROKER:
                        AddNewBrokerConnection(conn);
                        break;
                    case SysConfig.SUBSCRIBER:
                        IRemoteSubscriber newSubscriber = (IRemoteSubscriber)Activator.GetObject(typeof(IRemoteSubscriber), conn.EntityURL);
                        this.Subscribers.Add(conn.EntityName, newSubscriber);
                        break;
                    case SysConfig.PUBLISHER:
                        IRemotePublisher newPublisher = (IRemotePublisher)Activator.GetObject(typeof(IRemotePublisher), conn.EntityURL);
                        this.Publishers.Add(conn.EntityName, newPublisher);
                        break;
                    default:
                        break;
                }

                Console.WriteLine(String.Format("[INFO] {0} [{1}] added on: {2}", conn.EntityName, conn.EntityType, conn.EntityURL));
            }

            OrderBrokers();
        }
 public async Task UpdateSysConfig(SysConfig sysConfig)
 {
     _unitOfWork.SysConfigRepository.Update(sysConfig);
     await _unitOfWork.SaveChangesAsync();
 }
Exemple #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(this.Request["seviceID"]))
        {
            return;
        }
        if (string.IsNullOrEmpty(this.Request["sn"]))
        {
            return;
        }
        int    SeviceID = Convert.ToInt32(this.Request["seviceID"]);
        string sn       = RequestString.NoHTML(Convert.ToString(this.Request["sn"]));

        if (!SysConfig.IsTrueSn(SeviceID, sn))//对比加密后是否对照
        {
            json = "{\"state\":\"false\", \"msg\":\"加密错误\"}";
        }
        else
        {
            string act = "";
            act = RequestString.NoHTML(Convert.ToString(Request["act"]));
            string openid = Convert.ToString(RequestString.NoHTML(this.Request["openid"]));
            if (act == "insert")
            {
                string name     = RequestString.NoHTML(Convert.ToString(this.Request["name"]));
                string phone    = RequestString.NoHTML(Convert.ToString(this.Request["phone"]));
                int    count    = Convert.ToInt32(RequestString.NoHTML(this.Request["count"]));
                int    exid     = Convert.ToInt32(RequestString.NoHTML(this.Request["exid"]));
                int    DateType = Convert.ToInt32(Request["datetype"]);

                DateTime restime      = Convert.ToDateTime(Request["restime"]);
                int      DateAllCount = GetAllCount(DateType);//根据ID查询是否已经有过记录
                if (count > DateAllCount)
                {
                    json = "{\"state\":\"false\", \"msg\":\"人数超过最大参观人数\"}";
                }
                else
                {
                    ReserveMsg msg = new ReserveMsg();
                    msg.ReserveCount = count;
                    msg.DateType     = DateType;
                    msg.ExhibitionID = exid;
                    msg.OpenID       = openid;
                    msg.ReservePhone = phone;
                    msg.ReserveTime  = restime;
                    msg.ReserveName  = name;
                    msg.States       = 0;
                    int id = TableOperate <ReserveMsg> .InsertReturnID(msg);//将预约数据插入并返回

                    if (id > 0)
                    {
                        json = "{\"state\":\"true\", \"msg\":\"预约成功!\"}";
                    }
                    else
                    {
                        json = "{\"false\":\"true\", \"msg\":\"预约失败!\"}";
                    }
                }
            }
            else if (act == "selectdate")
            {
                int        DateType  = Convert.ToInt32(Request["datetype"]);
                DateTime   restime   = Convert.ToDateTime(Request["restime"]);
                ReserveMsg condition = new ReserveMsg();
                condition.AddConditon("DateDiff(dd,ReserveTime,'" + restime + "')=0");//添加时间条件
                condition.DateType = DateType;
                condition.States   = 1;
                int count = TableOperate <ReserveMsg> .GetCountValue(condition);//查询获取总数

                if (count > 0)
                {
                    json = "{\"false\":\"true\", \"msg\":\"今日预约已满!\"}";
                }
            }
            else if (act == "my")
            {
                View_Reserve condition = new View_Reserve();
                View_Reserve value     = new View_Reserve();
                condition.OpenID = openid;
                List <View_Reserve> list = TableOperate <View_Reserve> .Select(value, condition, 0, "order by addtime desc");
            }
        }

        Response.Write(json); return;
    }
Exemple #17
0
 public void SysConfigConstructorTest()
 {
     SysConfig target = new SysConfig();
     Assert.IsNotNull(target);
 }
Exemple #18
0
        //added by Chen Xiao
        /// <summary>
        /// 根据config.xml中的默认值初始化当前项目中的动态障碍物
        /// 如果confix.xml中无默认值,则生成默认节点
        /// 为支持热修改,在ResetDynamicObstacles中也调用该方法
        /// </summary>
        private void InitDynacimObstacles()
        {
            EnvRef = (SimEnvironment)Env;


            //if(xml无此项目)
            //{
            //                  DefautConfigFileWriter();
            //}
            //      width1 = xml.load(dyn1.width);
            //      length = xml.load(dyn1.length);
            //      velocity = xml.load(dyn1.velocity);
            //      ......
            //if(  Env.DynamicRect!= null)//说明是ResetDynamicObstacles调用的该方法,那么要根据配置文件修改障碍物属性,支持热修改
            //{
            //      Env.DynamicRect[1].width=前面读取的文档值;
            //                .....
            //}
            //else//说明是InitEnvironment调用该方法,那么要生成障碍物
            //{
            //   Env.DynamicRect.Add(new RectangularDynamic("dyn1", positionMm, 前面读取的文档值));
            //   Env.DynamicRect.Add(new RectangularDynamic("dyn2", positionMm, 前面读取的文档值));
            //}



            SysConfig myConfig     = SysConfig.Instance();
            string    missionName  = "newmatch2v2";
            string    parentXpath  = "config/missions";
            XmlNode   parentNode   = myConfig.GetXmlNode(parentXpath);
            string    missionXpath = parentXpath + "/" + missionName;
            XmlNode   missionNode  = myConfig.GetXmlNode(missionXpath);
            string    dynRec1Xpath = missionXpath + "/" + "dynamicRectangle1";
            string    dynRec2Xpath = missionXpath + "/" + "dynamicRectangle2";

            #region 生成xml中的默认配置
            if (missionNode == null)
            {
                int r = Env.Balls[0].RadiusMm;
                myConfig.AddXmlNode(parentNode, missionName);
                missionNode = myConfig.GetXmlNode(missionXpath);

                Dictionary <string, string> dynamicRectangle1 = new Dictionary <string, string>();
                dynamicRectangle1.Add("LengthMm", (3 * r).ToString());
                dynamicRectangle1.Add("WidthMm", r.ToString());
                dynamicRectangle1.Add("DirectionDeg", "0");
                dynamicRectangle1.Add("VelocityMmPs", "80");
                dynamicRectangle1.Add("VelocityDirectionRad", "-1.5707963267949");
                dynamicRectangle1.Add("AngularVelocityRadPs", "0");
                dynamicRectangle1.Add("CircleTimes", "101");

                myConfig.AddXmlNode(missionNode, "dynamicRectangle1");
                XmlNode dynamicRectangle1Node = myConfig.GetXmlNode(dynRec1Xpath);
                myConfig.AddXmElements(dynamicRectangle1Node, dynamicRectangle1);

                Dictionary <string, string> dynamicRectangle2 = new Dictionary <string, string>();
                dynamicRectangle2.Add("LengthMm", (3 * r).ToString());
                dynamicRectangle2.Add("WidthMm", r.ToString());
                dynamicRectangle2.Add("DirectionDeg", "0");
                dynamicRectangle2.Add("VelocityMmPs", "80");
                dynamicRectangle2.Add("VelocityDirectionRad", "1.5707963267949");
                dynamicRectangle2.Add("AngularVelocityRadPs", "0");
                dynamicRectangle2.Add("CircleTimes", "101");
                myConfig.AddXmlNode(missionNode, "dynamicRectangle2");
                XmlNode dynamicRectangle2Node = myConfig.GetXmlNode(dynRec2Xpath);
                myConfig.AddXmElements(dynamicRectangle2Node, dynamicRectangle2);
            }
            #endregion

            #region 读取配置文件中的参数
            int   lengthMm1             = Convert.ToInt32(myConfig.GetValue(dynRec1Xpath + "/" + "LengthMm"));
            int   widthMm1              = Convert.ToInt32(myConfig.GetValue(dynRec1Xpath + "/" + "WidthMm"));
            float directionDeg1         = float.Parse(myConfig.GetValue(dynRec1Xpath + "/" + "DirectionDeg"));
            float velocityMmPs1         = float.Parse(myConfig.GetValue(dynRec1Xpath + "/" + "VelocityMmPs"));
            float velocityDirectionRad1 = float.Parse(myConfig.GetValue(dynRec1Xpath + "/" + "VelocityDirectionRad"));
            float angularVelocityRadPs1 = float.Parse(myConfig.GetValue(dynRec1Xpath + "/" + "AngularVelocityRadPs"));
            int   circleTimes1          = Convert.ToInt32(myConfig.GetValue(dynRec1Xpath + "/" + "CircleTimes"));

            int   lengthMm2             = Convert.ToInt32(myConfig.GetValue(dynRec2Xpath + "/" + "LengthMm"));
            int   widthMm2              = Convert.ToInt32(myConfig.GetValue(dynRec2Xpath + "/" + "WidthMm"));
            float directionDeg2         = float.Parse(myConfig.GetValue(dynRec2Xpath + "/" + "DirectionDeg"));
            float velocityMmPs2         = float.Parse(myConfig.GetValue(dynRec2Xpath + "/" + "VelocityMmPs"));
            float velocityDirectionRad2 = float.Parse(myConfig.GetValue(dynRec2Xpath + "/" + "VelocityDirectionRad"));
            float angularVelocityRadPs2 = float.Parse(myConfig.GetValue(dynRec2Xpath + "/" + "AngularVelocityRadPs"));
            int   circleTimes2          = Convert.ToInt32(myConfig.GetValue(dynRec2Xpath + "/" + "CircleTimes"));

            #endregion


            xna.Vector3 positionMm = new xna.Vector3(0, 0, 0);
            //Env.DynamicRect.Add(new RectangularDynamic("dynamicRectangle1", positionMm, Color.Red, Color.Gray, 0, lengthMm1, widthMm1, directionDeg1, velocityMmPs1, velocityDirectionRad1, angularVelocityRadPs1, circleTimes1));
            //Env.DynamicRect.Add(new RectangularDynamic("dynamicRectangle2", positionMm, Color.Yellow, Color.Gray, 0, lengthMm2, widthMm2, directionDeg2, velocityMmPs2, velocityDirectionRad2, angularVelocityRadPs2, circleTimes2));


            //Env.DynamicRect.Add(new RectangularDynamic("dynamicRectangle1", positionMm, Color.Red, Color.Gray, 0, 3 * r, r, 0, 80, -(float)Math.PI / 2, 0, 101));
            //Env.DynamicRect.Add(new RectangularDynamic("dynamicRectangle2", positionMm, Color.Yellow, Color.Gray, 0, 3 * r, r, 0, 80, (float)Math.PI / 2, 0, 101));
        }
Exemple #19
0
 public RedisConnectionWrapper(SysConfig config)
 {
     this._config           = config;
     this._connectionString = new Lazy <string>(GetConnectionString);
 }
Exemple #20
0
 public PcUpDownService(SlaveInfoService slaveInfoService, ButtonService buttonService, SynchronizationContext current, SysConfig SysConfig, Domain.Models.UserInfo UserInfo)
 {
     this.SlaveInfoService = slaveInfoService;
     this.ButtonService    = buttonService;
     this.SysConfig        = SysConfig;
     this.current          = current;
     this.UserInfo         = UserInfo;
 }
Exemple #21
0
 // Token: 0x06000287 RID: 647 RVA: 0x00009728 File Offset: 0x00007928
 public static bool SaveConfig(SysConfig sysconfiginfo)
 {
     return(FPSerializer.Save <SysConfig>(sysconfiginfo, SysConfigs.filename));
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="CompanyKeywordManager"/> class.
        /// </summary>
        /// <param name="config">The configuration.</param>
        /// <param name="clientUser">The client user.</param>
        public CompanyKeywordManager(SysConfig config, ClientUser clientUser)
            : base(config, clientUser)

        {
        }
        public static bool CheckCompany(string BaseURL, int FromCompanyID, out string errormsg)
        {
            errormsg = string.Empty;
            if (IsLocalSystem())
            {
                return(Web.APPCode.SqlLiteHelper.CheckCompany(BaseURL, FromCompanyID, out errormsg));
            }
            if (IsInternalSys(out errormsg, false))
            {
                return(true);
            }
            ResponseData response = null;
            int          i        = 0;

            do
            {
                try
                {
                    i++;
                    string key    = EncriptName(BaseURL);
                    string result = Foresight.Web.HttpRequest.Get(new Dictionary <string, string>()
                    {
                        { "visit", "checkcompany" }, { "key", key }, { "signature", SysConfig.GetSignature() }, { "token", SysConfig.GetToken() }
                    });
                    response = JsonConvert.DeserializeObject <ResponseData>(result);
                }
                catch (Exception ex)
                {
                    Utility.LogHelper.WriteError("EncryptHelper", "CheckCompany", ex);
                }
            } while (response == null && i <= 3);
            if (response != null)
            {
                errormsg = response.errormsg;
                return(response.status);
            }
            errormsg = "操作超时,请稍候重试";
            return(false);
        }
Exemple #24
0
    private void Test()
    {
        if (Application.platform == RuntimePlatform.Android && (Input.GetKeyDown(KeyCode.Escape)))
        {
            TipManager.Instance.Alert("", "你确定要退出游戏吗?", "确定", "取消", (res) =>
            {
                if (res)
                {
                    Application.Quit();
                }
            });
        }
        if (Input.GetKeyDown(KeyCode.F1))
        {
            WindowBase window = WindowManager.Instance.GetWindow(WindowID.MissionDebugAttach);
            if (null == window)
            {
                WindowManager.Instance.OpenWindow(WindowID.MissionDebugAttach);
            }
            else
            {
                if (window.IsOpen())
                {
                    window.Close();
                }
                else
                {
                    WindowManager.Instance.OpenWindow(WindowID.MissionDebugAttach);
                }
            }
        }
        if (Input.GetKeyDown(KeyCode.C) || Input.touchCount == 3)
        {
            string filepath = ResourceManager.Instance.GetStreamAssetPath() + "/config.xml";

            ResourceManager.Instance.LoadStreamingAssetsData(filepath, (www) =>
            {
                SysConfig tmp = XmlConfigBase.DeSerialize <SysConfig>(www.text);
                Debuger.LogError("system config decode result : " + tmp == null);
                if (tmp != null)
                {
                    Debuger.LogError(tmp.ServerConfigPath);
                    Debuger.LogError(tmp.ClientConfigPath);
                    Debuger.LogError(tmp.ExcelPath);
                    Debuger.LogError(tmp.ConfigCenterUrl);
                    Debuger.LogError(tmp.UploadUrl);

                    Debuger.LogError("begin encode resoult");
                    string res = XmlConfigBase.Serialize(tmp);
                    Debuger.LogError("encode result:" + res);
                    FileUtils.WriteStringFile(Application.persistentDataPath + "/tesw.xml", res);

                    tmp = XmlConfigBase.DeSerialize <SysConfig>(res);
                    Debuger.LogError("xxx system config decode result : " + tmp == null);
                    if (tmp != null)
                    {
                        Debuger.LogError(tmp.ServerConfigPath);
                        Debuger.LogError(tmp.ClientConfigPath);
                        Debuger.LogError(tmp.ExcelPath);
                        Debuger.LogError(tmp.ConfigCenterUrl);
                        Debuger.LogError(tmp.UploadUrl);

                        Debuger.LogError("begin encode resoult");
                        res = XmlConfigBase.Serialize(tmp);
                        Debuger.LogError("encode result:" + res);
                        FileUtils.WriteStringFile(Application.persistentDataPath + "/tesw1.xml", res);
                    }
                }
            });
        }
    }
        public static bool RemoveAPPUser(Foresight.DataAccess.Company company, List <int> UserIDList, out string errormsg)
        {
            errormsg = string.Empty;
            if (IsLocalSystem())
            {
                errormsg = "局域网单机系统无法删除APP用户";
                return(false);
            }
            if (IsInternalSys(out errormsg, false))
            {
                errormsg = "内部系统,无须审核";
                return(true);
            }
            ResponseData response = null;
            int          i        = 0;

            do
            {
                try
                {
                    i++;
                    string key    = EncriptName(company.BaseURL);
                    string result = Foresight.Web.HttpRequest.Post(null, new Dictionary <string, string>()
                    {
                        { "visit", "removeappuser" }, { "key", key }, { "signature", SysConfig.GetSignature() }, { "token", SysConfig.GetToken() }, { "UserIDList", JsonConvert.SerializeObject(UserIDList) }
                    });
                    response = JsonConvert.DeserializeObject <ResponseData>(result);
                }
                catch (Exception ex)
                {
                    Utility.LogHelper.WriteError("EncryptHelper", "RemoveAPPUser", ex);
                }
            } while (response == null && i <= 3);
            if (response != null)
            {
                errormsg = response.errormsg;
                return(response.status);
            }
            errormsg = "操作超时,请稍候重试";
            return(false);
        }
        public virtual int AddOrUpdate(List <SysConfigDto> list, ConfigType type)
        {
            int count = 0;

            if (list != null)
            {
                list = new List <SysConfigDto>(list);
                using (var db = this.CreateDbContext())
                {
                    db.Configuration.AutoDetectChangesEnabled = true;
                    using (db.BeginTransaction(System.Data.IsolationLevel.Serializable))
                    {
                        var old = db.SysConfig.Where(q => q.Type == type).ToList();
                        List <SysConfig> del = new List <SysConfig>();
                        while (old.Count > 0)
                        {
                            var m = old[0];
                            old.Remove(m);
                            var vm = list.Find(q => q.Key == m.Key);
                            if (vm != null)
                            {
                                m.Value = vm.Value;
                                count  += db.SaveChanges();
                                list.Remove(vm);
                            }
                            else
                            {
                                del.Add(m);
                            }
                        }

                        while (list.Count > 0)
                        {
                            var vm = list[0];
                            list.Remove(vm);
                            SysConfig m = null;
                            if (del.Count > 0)
                            {
                                m = del[0];
                                del.Remove(m);
                            }
                            else
                            {
                                m = new SysConfig()
                                {
                                    Type = type
                                };
                            }
                            m.Key   = vm.Key ?? "";
                            m.Value = vm.Value;
                            if (m.Id == 0)
                            {
                                db.SysConfig.Add(m);
                            }
                            count += db.SaveChanges();
                        }

                        del.ForEach(m => {
                            db.Entry(m).State = System.Data.Entity.EntityState.Deleted;
                            count            += db.SaveChanges();
                        });
                        db.AddCommitCallback(() =>
                        {
                            var sysConfigCache = this.GetCache <ISysConfigCache>();
                            sysConfigCache.Remove(type);
                        });
                        db.Commit();
                    }
                }
            }

            return(count);
        }
Exemple #27
0
        public void Createvcxproj(SysConfig cfg)
        {
            var builder = new StringBuilder();

            builder.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
            builder.AppendLine("<Project DefaultTargets=\"Build\" ToolsVersion=\"15.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">");
#if FLAGNMAKE
            builder.AppendLine("  <ItemGroup Label=\"ProjectConfigurations\">");
            //builder.AppendLine("    <ProjectConfiguration Include=\"rtt_stm32|Win32\">");
            builder.Append("    <ProjectConfiguration Include=\"");
            builder.Append(cfg.FileNameWithoutExtension);
            builder.AppendLine("|Win32\">");

            //builder.AppendLine("      <Configuration>rtt_stm32</Configuration>");
            builder.Append("      <Configuration>");
            builder.Append(cfg.FileNameWithoutExtension);
            builder.AppendLine("</Configuration>");


            builder.AppendLine("      <Platform>Win32</Platform>");
            builder.AppendLine("    </ProjectConfiguration>");
            builder.AppendLine("  </ItemGroup>");
            builder.AppendLine("  <PropertyGroup Label=\"Globals\">");
            //builder.AppendLine("    <ProjectGuid>{e7b8d0e4-50a4-40fd-a6bd-3e7c38558110}</ProjectGuid>");
            builder.Append("    <ProjectGuid>");
            builder.Append(cfg.projguidvc);
            builder.AppendLine("</ProjectGuid>");

            builder.AppendLine("    <Keyword>MakeFileProj</Keyword>");
            builder.AppendLine("    <WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>");
            builder.AppendLine("  </PropertyGroup>");
            builder.AppendLine("  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />");
            //builder.AppendLine("  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='rtt_stm32|Win32'\" Label=\"Configuration\">");
            builder.Append("  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='");
            builder.Append(cfg.FileNameWithoutExtension);
            builder.AppendLine("|Win32'\" Label=\"Configuration\">");

            builder.AppendLine("    <ConfigurationType>Makefile</ConfigurationType>");
            builder.AppendLine("    <UseDebugLibraries>true</UseDebugLibraries>");
            builder.AppendLine("    <PlatformToolset>v141</PlatformToolset>");
            builder.AppendLine("  </PropertyGroup>");
            builder.AppendLine("  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />");
            builder.AppendLine("  <ImportGroup Label=\"ExtensionSettings\" />");
            //builder.AppendLine("  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='rtt_stm32|Win32'\" Label=\"PropertySheets\">");
            builder.Append("  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='");
            builder.Append(cfg.FileNameWithoutExtension);
            builder.AppendLine("|Win32'\" Label=\"PropertySheets\">");

            builder.AppendLine("    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />");
            builder.AppendLine("  </ImportGroup>");
            builder.AppendLine("  <PropertyGroup Label=\"UserMacros\" />");
            //builder.AppendLine("  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='rtt_stm32|Win32'\">");
            builder.Append("  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='");
            builder.Append(cfg.FileNameWithoutExtension);
            builder.AppendLine("|Win32'\">");

            //builder.AppendLine("    <NMakeOutput>rtt_stm32.exe</NMakeOutput>");
            builder.Append("    <NMakeOutput>");
            builder.Append(cfg.FileNameWithoutExtension);
            builder.AppendLine(".exe</NMakeOutput>");

            //builder.AppendLine("    <NMakePreprocessorDefinitions>STM32F10X_HD, USE_STDPERIPH_DRIVER</NMakePreprocessorDefinitions>");
            builder.Append("    <NMakePreprocessorDefinitions>");
            builder.Append(cfg.MacroDefineStrCNMake);
            builder.AppendLine("</NMakePreprocessorDefinitions>");

            //builder.AppendLine(@"    <IncludePath>..\Application;..\Drivers;..\RT_Thread\components\finsh;..\RT_Thread\include;..\RT_Thread\libcpu\arm\common;..\RT_Thread\libcpu\arm\cortex-m3;..\ST_Library\STM32F10x_StdPeriph_Driver\inc;..\ST_Library\CMSIS\CM3\DeviceSupport\ST\STM32F10x;..\ST_Library\CMSIS\CM3\CoreSupport</IncludePath>");
            builder.Append(@"    <IncludePath>");
            builder.Append(cfg.IncludePathStr);
            builder.AppendLine(@"</IncludePath>");

            //builder.AppendLine("    <NMakeBuildCommandLine>\"C:\\Keil\\UV4\\Uv4.exe \" -b ..\\rtt_stm32.uvprojx -t \"rtt_stm32\" -j0 -o Build.log");
            builder.Append("    <NMakeBuildCommandLine>\"");
            builder.Append(cfg.UV4_Path);
            builder.Append(" \" -b ..\\");
            builder.Append(cfg.FileNameWithoutExtension);
            builder.Append(".uvprojx -t \"");
            builder.Append(cfg.TargetName);
            builder.AppendLine("\" -j0 -o Build.log");

            builder.AppendLine("type ..\\build.log</NMakeBuildCommandLine>");
            //builder.AppendLine("    <NMakeReBuildCommandLine>\"C:\\Keil\\UV4\\Uv4.exe \" -r ..\\rtt_stm32.uvprojx -t \"rtt_stm32\" -j0 -o Build.log");
            builder.Append("    <NMakeReBuildCommandLine>\"");
            builder.Append(cfg.UV4_Path);
            builder.Append(" \" -r ..\\");
            builder.Append(cfg.FileNameWithoutExtension);
            builder.Append(".uvprojx -t \"");
            builder.Append(cfg.TargetName);
            builder.AppendLine("\" -j0 -o Build.log");

            builder.AppendLine("type ..\\build.log</NMakeReBuildCommandLine>");
            //builder.AppendLine("    <NMakeCleanCommandLine>\"C:\\Keil\\UV4\\Uv4.exe \" -f ..\\rtt_stm32.uvprojx -t \"rtt_stm32\" -j0 -o flash_download.log");
            builder.Append("    <NMakeCleanCommandLine>\"");
            builder.Append(cfg.UV4_Path);
            builder.Append(" \" -f ..\\");
            builder.Append(cfg.FileNameWithoutExtension);
            builder.Append(".uvprojx -t \"");
            builder.Append(cfg.TargetName);
            builder.AppendLine("\" -j0 -o flash_download.log");

            builder.AppendLine("type ..\\flash_download.log");
            builder.AppendLine("</NMakeCleanCommandLine>");
            builder.AppendLine("  </PropertyGroup>");
            builder.AppendLine("  <ItemDefinitionGroup>");
            builder.AppendLine("  </ItemDefinitionGroup>");
            builder.AppendLine("  <ItemGroup>");
            builder.Append(cfg.ToProj_Files.ToString());
            builder.AppendLine("  </ItemGroup>");
            builder.AppendLine("  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />");
            builder.AppendLine("  <ImportGroup Label=\"ExtensionTargets\">");
            builder.AppendLine("  </ImportGroup>");
            builder.AppendLine("</Project>");
#else
            builder.AppendLine("  <ItemGroup Label=\"ProjectConfigurations\">");
            builder.AppendLine("    <ProjectConfiguration Include=\"Debug | Win32\">");
            builder.AppendLine("      <Configuration>Debug</Configuration>");
            builder.AppendLine("      <Platform>Win32</Platform>");
            builder.AppendLine("    </ProjectConfiguration>");
            builder.AppendLine("    <ProjectConfiguration Include=\"Release | Win32\">");
            builder.AppendLine("      <Configuration>Release</Configuration>");
            builder.AppendLine("      <Platform>Win32</Platform>");
            builder.AppendLine("    </ProjectConfiguration>");
            builder.AppendLine("    <ProjectConfiguration Include=\"Debug | x64\">");
            builder.AppendLine("      <Configuration>Debug</Configuration>");
            builder.AppendLine("      <Platform>x64</Platform>");
            builder.AppendLine("    </ProjectConfiguration>");
            builder.AppendLine("    <ProjectConfiguration Include=\"Release | x64\">");
            builder.AppendLine("      <Configuration>Release</Configuration>");
            builder.AppendLine("      <Platform>x64</Platform>");
            builder.AppendLine("    </ProjectConfiguration>");
            builder.AppendLine("  </ItemGroup>");
            builder.AppendLine("  <PropertyGroup Label=\"Globals\">");
            builder.AppendLine("    <VCProjectVersion>15.0</VCProjectVersion>");
            builder.Append("    <ProjectGuid>").Append(cfg.Projguidvc).AppendLine("</ProjectGuid>");
            builder.AppendLine("    <RootNamespace>STM32F1</RootNamespace>");
            builder.AppendLine("    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>");
            builder.AppendLine("  </PropertyGroup>");
            builder.AppendLine("  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />");
            builder.AppendLine("  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Debug|Win32'\" Label=\"Configuration\">");
            builder.AppendLine("    <ConfigurationType>Application</ConfigurationType>");
            builder.AppendLine("    <UseDebugLibraries>true</UseDebugLibraries>");
            builder.AppendLine("    <PlatformToolset>v142</PlatformToolset>");
            builder.AppendLine("    <CharacterSet>MultiByte</CharacterSet>");
            builder.AppendLine("  </PropertyGroup>");
            builder.AppendLine("  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Release|Win32'\" Label=\"Configuration\">");
            builder.AppendLine("    <ConfigurationType>Application</ConfigurationType>");
            builder.AppendLine("    <UseDebugLibraries>false</UseDebugLibraries>");
            builder.AppendLine("    <PlatformToolset>v142</PlatformToolset>");
            builder.AppendLine("    <WholeProgramOptimization>true</WholeProgramOptimization>");
            builder.AppendLine("    <CharacterSet>MultiByte</CharacterSet>");
            builder.AppendLine("  </PropertyGroup>");
            builder.AppendLine("  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Debug|x64'\" Label=\"Configuration\">");
            builder.AppendLine("    <ConfigurationType>Application</ConfigurationType>");
            builder.AppendLine("    <UseDebugLibraries>true</UseDebugLibraries>");
            builder.AppendLine("    <PlatformToolset>v142</PlatformToolset>");
            builder.AppendLine("    <CharacterSet>MultiByte</CharacterSet>");
            builder.AppendLine("  </PropertyGroup>");
            builder.AppendLine("  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Release|x64'\" Label=\"Configuration\">");
            builder.AppendLine("    <ConfigurationType>Application</ConfigurationType>");
            builder.AppendLine("    <UseDebugLibraries>false</UseDebugLibraries>");
            builder.AppendLine("    <PlatformToolset>v142</PlatformToolset>");
            builder.AppendLine("    <WholeProgramOptimization>true</WholeProgramOptimization>");
            builder.AppendLine("    <CharacterSet>MultiByte</CharacterSet>");
            builder.AppendLine("  </PropertyGroup>");
            builder.AppendLine("  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />");
            builder.AppendLine("  <ImportGroup Label=\"ExtensionSettings\">");
            builder.AppendLine("  </ImportGroup>");
            builder.AppendLine("  <ImportGroup Label=\"Shared\">");
            builder.AppendLine("  </ImportGroup>");
            builder.AppendLine("  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)' == 'Debug|Win32'\">");
            builder.AppendLine("    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />");
            builder.AppendLine("  </ImportGroup>");
            builder.AppendLine("  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)' == 'Release|Win32'\">");
            builder.AppendLine("    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />");
            builder.AppendLine("  </ImportGroup>");
            builder.AppendLine("  <ImportGroup Label=\"PropertySheets\\\" Condition=\"'$(Configuration)|$(Platform)' == 'Debug|x64'\">");
            builder.AppendLine("    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />");
            builder.AppendLine("  </ImportGroup>");
            builder.AppendLine("  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)' == 'Release|x64'\">");
            builder.AppendLine("    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />");
            builder.AppendLine("  </ImportGroup>");
            builder.AppendLine("  <PropertyGroup Label=\"UserMacros\" />");
            builder.AppendLine("  <PropertyGroup />");
            builder.AppendLine("  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)' == 'Debug|Win32'\">");
            builder.AppendLine("    <ClCompile>");
            builder.AppendLine("      <WarningLevel>Level3</WarningLevel>");
            builder.AppendLine("      <Optimization>Disabled</Optimization>");
            builder.AppendLine("      <SDLCheck>true</SDLCheck>");
            builder.AppendLine("      <ConformanceMode>true</ConformanceMode>");
            builder.AppendLine(this.GetIncludePathVC(cfg));
            builder.AppendLine(this.GetMacroDefineVC(cfg.MacroDefineStr));
            builder.AppendLine("    </ClCompile>");
            builder.AppendLine("  </ItemDefinitionGroup>");
            builder.AppendLine("  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)' == 'Debug|x64'\">");
            builder.AppendLine("    <ClCompile>");
            builder.AppendLine("      <WarningLevel>Level3</WarningLevel>");
            builder.AppendLine("      <Optimization>Disabled</Optimization>");
            builder.AppendLine("      <SDLCheck>true</SDLCheck>");
            builder.AppendLine("      <ConformanceMode>true</ConformanceMode>");
            builder.AppendLine(this.GetIncludePathVC(cfg));
            builder.AppendLine(this.GetMacroDefineVC(cfg.MacroDefineStr));
            builder.AppendLine("    </ClCompile>");
            builder.AppendLine("  </ItemDefinitionGroup>");
            builder.AppendLine("  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)' == 'Release|Win32'\">");
            builder.AppendLine("    <ClCompile>");
            builder.AppendLine("      <WarningLevel>Level3</WarningLevel>");
            builder.AppendLine("      <Optimization>MaxSpeed</Optimization>");
            builder.AppendLine("      <FunctionLevelLinking>true</FunctionLevelLinking>");
            builder.AppendLine("      <IntrinsicFunctions>true</IntrinsicFunctions>");
            builder.AppendLine("      <SDLCheck>true</SDLCheck>");
            builder.AppendLine("      <ConformanceMode>true</ConformanceMode>");
            builder.AppendLine(this.GetIncludePathVC(cfg));
            builder.AppendLine(this.GetMacroDefineVC(cfg.MacroDefineStr));
            builder.AppendLine("    </ClCompile>");
            builder.AppendLine("    <Link>");
            builder.AppendLine("      <EnableCOMDATFolding>true</EnableCOMDATFolding>");
            builder.AppendLine("      <OptimizeReferences>true</OptimizeReferences>");
            builder.AppendLine("    </Link>");
            builder.AppendLine("  </ItemDefinitionGroup>");
            builder.AppendLine("  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)' == 'Release|x64'\">");
            builder.AppendLine("    <ClCompile>");
            builder.AppendLine("      <WarningLevel>Level3</WarningLevel>");
            builder.AppendLine("      <Optimization>MaxSpeed</Optimization>");
            builder.AppendLine("      <FunctionLevelLinking>true</FunctionLevelLinking>");
            builder.AppendLine("      <IntrinsicFunctions>true</IntrinsicFunctions>");
            builder.AppendLine("      <SDLCheck>true</SDLCheck>");
            builder.AppendLine("      <ConformanceMode>true</ConformanceMode>");
            builder.AppendLine(this.GetIncludePathVC(cfg));
            builder.AppendLine(this.GetMacroDefineVC(cfg.MacroDefineStr));
            builder.AppendLine("    </ClCompile>");
            builder.AppendLine(@"    <Link>");
            builder.AppendLine(@"      <EnableCOMDATFolding>true</EnableCOMDATFolding>");
            builder.AppendLine(@"      <OptimizeReferences>true</OptimizeReferences>");
            builder.AppendLine(@"    </Link>");
            builder.AppendLine(@"  </ItemDefinitionGroup>");
            builder.AppendLine(@"  <ItemGroup>");
            //Fromuvprojx.getGroupsToProj(builder, cfg.MdkPath);
            builder.Append(cfg.ToProj_Files.ToString());
            builder.AppendLine(@"  </ItemGroup>");
            builder.AppendLine("  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />");
            builder.AppendLine("  <ImportGroup Label=\"ExtensionTargets\">");
            builder.AppendLine(@"  </ImportGroup>");
            builder.AppendLine(@"</Project>");
#endif
            if (!Directory.Exists(cfg.VCPath))
            {
                Directory.CreateDirectory(cfg.VCPath);
            }
            var    fs   = new FileStream(cfg.Vcxproj, FileMode.Create);
            byte[] data = new UTF8Encoding().GetBytes(builder.ToString());
            fs.Write(data);
            fs.Flush();
            fs.Close();
        }
Exemple #28
0
 public static void Load()
 {
     SysConfig.loadConfigPM();
 }
Exemple #29
0
        /// <summary>
        /// 获取所有文件列表
        /// </summary>
        /// <param name="cfg"></param>
        /// <returns></returns>
        public string Get_ToProj_Files(SysConfig cfg)
        {
            var builder = new StringBuilder();

            if (cfg.ProjFiles.Nodes.Count != 0)
            {
                for (int i = 0; i < cfg.ProjFiles.Nodes.Count; i++)
                {
                    for (int j = 0; j < cfg.ProjFiles.Nodes[i].Nodes.Count; j++)
                    {
                        if (cfg.ProjFiles.Nodes[i].Nodes[j].Nodes.Count == 0)
                        {
                            if (cfg.ProjFiles.Nodes[i].Nodes[j].Data.Name != null)
                            {
                                builder.Append("    <ClCompile Include=\"");
                                if (cfg.ProjFiles.Nodes[i].Nodes[j].Data.Name.StartsWith(".\\"))
                                {
                                    builder.Append(cfg.ProjFiles.Nodes[i].Nodes[j].Data.Name.Replace(".\\", "..\\"));
                                }
                                else
                                {
                                    builder.Append("..\\" + cfg.ProjFiles.Nodes[i].Nodes[j].Data.Name);
                                }
                                builder.AppendLine("\" /> ");
                            }
                        }
                        for (int k = 0; k < cfg.ProjFiles.Nodes[i].Nodes[j].Nodes.Count; k++)
                        {
                            if (cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Nodes.Count == 0)
                            {
                                if (cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Data.Name != null)
                                {
                                    builder.Append("    <ClCompile Include=\"");
                                    if (cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Data.Name.StartsWith(".\\"))
                                    {
                                        builder.Append(cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Data.Name.Replace(".\\", "..\\"));
                                    }
                                    else
                                    {
                                        builder.Append("..\\" + cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Data.Name);
                                    }
                                    builder.AppendLine("\" /> ");
                                }
                            }
                            for (int l = 0; l < cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Nodes.Count; l++)
                            {
                                if (cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Nodes[l].Nodes.Count == 0)
                                {
                                    if (cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Nodes[l].Data.Name != null)
                                    {
                                        builder.Append("    <ClCompile Include=\"");
                                        if (cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Nodes[l].Data.Name.StartsWith(".\\"))
                                        {
                                            builder.Append(cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Nodes[l].Data.Name.Replace(".\\", "..\\"));
                                        }
                                        else
                                        {
                                            builder.Append("..\\" + cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Nodes[l].Data.Name);
                                        }
                                        builder.AppendLine("\" /> ");
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(builder.ToString());
        }
Exemple #30
0
        private void simpleButtonOk_Click(object sender, EventArgs e)
        {
            _sysUser    = new SysUser();
            _sysPackage = new SysPackage();
            _sysConfig  = new SysConfig();

            if (dxErrorProviderMain.HasErrors)
            {
                XtraMessageBox.Show("Vui lòng cung cấp đủ thông tin yêu cầu");
                return;
            }
            if (textEditPassword.Text != _sysUser.maskPwd)
            {
                pwd = Security.EnCode(textEditPassword.Text);
            }
            if (!_sysUser.CheckLogin(textEditUser.Text, pwd))
            {
                XtraMessageBox.Show("Thông tin đăng nhập chưa chính xác, vui lòng kiểm tra lại!");
                return;
            }
            drUser = _sysUser.DrUser;

            DataTable dt1 = _sysPackage.GetPackageForUser(_sysUser);

            if (dt1 == null)
            {
                return;
            }
            if (dt1.Rows.Count == 0)
            {
                XtraMessageBox.Show("Người dùng này chưa được phân quyền sử dụng gói phần mềm nào!");
                return;
            }
            //dang nhap thanh cong
            Config.NewKeyValue("StructServer", _sysPackage.StructServer);
            lookUpEditPackage.Properties.DataSource    = dt1;
            lookUpEditPackage.Properties.DisplayMember = radioGroupLanguage.SelectedIndex == 0 ? "PackageName" : "PackageName2";
            lookUpEditPackage.Properties.ValueMember   = "sysDBID";
            if (dt1.Rows.Count == 1)
            {
                drPackage = dt1.Rows[0];
                lookUpEditPackage.EditValue = dt1.Rows[0]["sysDBID"];

                Config.NewKeyValue("Admin", bool.Parse(dt1.Rows[0]["isAdmin"].ToString()));

                Config.NewKeyValue("sysUserPackageID", dt1.Rows[0]["sysUserPackageID"]);

                if (_sysConfig.DsStartConfig == null || _sysConfig.DsStartConfig.Tables[0].Rows.Count == 0)
                {
                    DangNhap();
                }
                else
                {
                    simpleButtonLogin_Click(simpleButtonLogin, new EventArgs());
                    //this.Height = 300;
                    //layoutControl2.Visible = true;
                    ////layoutControlItemLogin.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                    //layoutControlItemStartConfig.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                    //layoutControlItemPackage.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                }
            }
            else
            {
                // this.Height = 340;
                //layoutControl2.Size = new System.Drawing.Size(583, 40);
                simpleButtonLogin.Visible = true;
                lookUpEditPackage.Visible = true;
                // layoutControl2.Visible = true;
                lc1.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                lc2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                lookUpEditPackage.Focus();
                //layoutControlItemStartConfig.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                //layoutControlItemPackage.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
            }
        }
Exemple #31
0
        /// <summary>
        /// 获取过滤器目录列表
        /// </summary>
        /// <param name="cfg"></param>
        /// <returns></returns>
        public String Get_ToFilter_Folders(SysConfig cfg)
        {
            var builder = new StringBuilder();

            for (int i = 0; i < cfg.ProjFiles.Nodes.Count; i++)
            {
                for (int j = 0; j < cfg.ProjFiles.Nodes[i].Nodes.Count; j++)
                {
                    for (int k = 0; k < cfg.ProjFiles.Nodes[i].Nodes[j].Nodes.Count; k++)
                    {
                        var path2 = cfg.ProjFiles.Data.Name + @"\" + cfg.ProjFiles.Nodes[i].Data.Name + @"\" + cfg.ProjFiles.Nodes[i].Nodes[j].Data.Name + @"\";

                        if (cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Nodes.Count > 0)
                        {
                            if (cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Data.Name.StartsWith(".\\"))
                            {
                                builder.Append("    <Filter Include=\"").Append(cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Data.Name.Replace(".\\", "..\\")).AppendLine("\">");
                            }
                            else
                            {
                                builder.Append("    <Filter Include=\"").Append(path2 + cfg.ProjFiles.Nodes[i].Nodes[j].Nodes[k].Data.Name).AppendLine("\">");
                            }
                            builder.Append("      <UniqueIdentifier>").Append(Guid.NewGuid().ToString("B")).AppendLine("</UniqueIdentifier>");
                            builder.AppendLine("    </Filter>");
                        }
                    }

                    if (cfg.ProjFiles.Nodes[i].Nodes[j].Nodes.Count != 0)
                    {
                        var path1 = cfg.ProjFiles.Data.Name + @"\" + cfg.ProjFiles.Nodes[i].Data.Name + @"\";

                        if (cfg.ProjFiles.Nodes[i].Nodes[j].Data.Name.StartsWith(".\\"))
                        {
                            builder.Append("    <Filter Include=\"").Append(cfg.ProjFiles.Nodes[i].Nodes[j].Data.Name.Replace(".\\", "..\\")).AppendLine("\">");
                        }
                        else
                        {
                            builder.Append("    <Filter Include=\"").Append(path1 + cfg.ProjFiles.Nodes[i].Nodes[j].Data.Name).AppendLine("\">");
                        }
                        builder.Append("      <UniqueIdentifier>").Append(Guid.NewGuid().ToString("B")).AppendLine("</UniqueIdentifier>");
                        builder.AppendLine("    </Filter>");
                    }
                }

                if (cfg.ProjFiles.Nodes[i].Nodes.Count != 0)
                {
                    var path0 = cfg.ProjFiles.Data.Name + @"\";

                    if (cfg.ProjFiles.Nodes[i].Data.Name.StartsWith(".\\"))
                    {
                        builder.Append("    <Filter Include=\"").Append(cfg.ProjFiles.Nodes[i].Data.Name.Replace(".\\", "..\\")).AppendLine("\">");
                    }
                    else
                    {
                        builder.Append("    <Filter Include=\"").Append(path0 + cfg.ProjFiles.Nodes[i].Data.Name).AppendLine("\">");
                    }
                    builder.Append("      <UniqueIdentifier>").Append(Guid.NewGuid().ToString("B")).AppendLine("</UniqueIdentifier>");
                    builder.AppendLine("    </Filter>");
                }
                else
                {
                }
            }

            if (cfg.ProjFiles.Nodes.Count != 0)
            {
                if (cfg.ProjFiles.Data.Name.StartsWith(".\\"))
                {
                    builder.Append("    <Filter Include=\"").Append(cfg.ProjFiles.Data.Name.Replace(".\\", "..\\")).AppendLine("\">");
                }
                else
                {
                    builder.Append("    <Filter Include=\"").Append(cfg.ProjFiles.Data.Name).AppendLine("\">");
                }
                builder.Append("      <UniqueIdentifier>").Append(Guid.NewGuid().ToString("B")).AppendLine("</UniqueIdentifier>");
                builder.AppendLine("    </Filter>");
            }
            else
            {
            }

            return(builder.ToString());
        }
Exemple #32
0
 private void LoadSysConfig()
 {
     SysConfig.LoadSysConfig();
 }
Exemple #33
0
 private void InitVariables()
 {
     m_config    = Config.GetConfig();
     m_sysConfig = SysConfig.GetSysConfig();
 }
 public void RegisterInitializationInfo(SysConfig sysConfig, string siteName)
 {
     this.SysConfig = sysConfig;
     this.RemoteNetwork.SiteName = siteName;
 }