Ejemplo n.º 1
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     GlobalConfiguration.Configure(WebApiConfig.Register);
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     SqliteData.Up();
 }
        public TenantInvoices(Tenant tenant)
        {
            this.tenant = tenant;

            InitializeComponent();

            lblTenant.Text   = tenant.TenantName;
            lblProperty.Text = tenant.PropertyNo;

            DataGridViewCellStyle dgvButton = new DataGridViewCellStyle();

            dgvButton.Alignment = DataGridViewContentAlignment.MiddleCenter;

            dgvInvoices.Columns.Add(new DataGridViewButtonColumn
            {
                HeaderText       = "Invoice No.",
                DataPropertyName = "InvoiceNo",
                Width            = 100,
                DefaultCellStyle = dgvButton
            });

            DataGridViewCellStyle dataGridViewCellStyle = new DataGridViewCellStyle();

            dataGridViewCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;

            dgvInvoices.AutoGenerateColumns = false;
            dgvInvoices.RowHeadersVisible   = false;

            dgvInvoices.Columns.Add(new DataGridViewTextBoxColumn
            {
                HeaderText       = "Start Date",
                Width            = 90,
                DefaultCellStyle = dataGridViewCellStyle,
                DataPropertyName = "StartContract"
            });

            dgvInvoices.Columns.Add(new DataGridViewTextBoxColumn
            {
                HeaderText       = "End Date",
                Width            = 90,
                DefaultCellStyle = dataGridViewCellStyle,
                DataPropertyName = "EndContract"
            });

            dgvInvoices.Columns.Add(new DataGridViewTextBoxColumn
            {
                HeaderText       = "Invoice Amount",
                Width            = 110,
                DefaultCellStyle = dataGridViewCellStyle,
                DataPropertyName = "InvoiceAmount"
            });

            dgvInvoices.DataSource = SqliteData.GetInvoices(tenant);
        }
        private void dgvTenants_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 6)
            {
                var tenantID = dgvTenants.Rows[e.RowIndex].Cells[0].Value;
                var tenant   = SqliteData.GetTenantByID(tenantID);

                TenantInvoices tenantInvoices = new TenantInvoices(tenant);
                tenantInvoices.StartPosition = FormStartPosition.CenterParent;
                tenantInvoices.ShowDialog(this);
            }
        }
Ejemplo n.º 4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtCode.Text) || string.IsNullOrEmpty(txtName.Text))
            {
                MessageBox.Show("Landlord name and customer code required.", "EMPTY FIELDS");
            }
            else
            {
                Landlord landlord = new Landlord
                {
                    Name = txtName.Text,
                    Code = txtCode.Text
                };

                SqliteData.Save(landlord);
                MessageBox.Show("Landlord Saved", "SAVED");
                txtCode.Text = "";
                txtName.Text = "";
            }
        }
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            dgvTenants.DataSource = SqliteData.GetTenants(cmbLandlord.Text);
            lblLandlord.Text      = cmbLandlord.Text;
            #region
            //int i = 0;

            //foreach (var row in dgvTenants.Rows)
            //{
            //    DataGridViewCellEventArgs eventArgs = new DataGridViewCellEventArgs(0, i);

            //    var tenantDate = dgvTenants.Rows[eventArgs.RowIndex].Cells[5].Value;
            //    DateTime endDate = Convert.ToDateTime(tenantDate);

            //    if(endDate < DateTime.Today)
            //    {
            //        dgvTenants.Rows[eventArgs.RowIndex].Cells[5].Style.BackColor = Color.Red;
            //    }
            //    i++;
            //}
            //try putting this block of code in the CellFormatting function of dgvTenants
            #endregion
        }
 public MessageDictionary()
 {
     list = new List <Message>();
     sql  = new SqliteData();
 }
        public MainForm()
        {
            InitializeComponent();

            DataGridViewCellStyle dataGridViewCellStyle = new DataGridViewCellStyle
            {
                Alignment = DataGridViewContentAlignment.MiddleRight
            };

            dgvTenants.AutoGenerateColumns = false;
            dgvTenants.RowHeadersVisible   = false;

            dgvTenants.Columns.Add(new DataGridViewTextBoxColumn
            {
                DataPropertyName = "TenantID",
                Visible          = false
            });

            dgvTenants.Columns.Add(new DataGridViewButtonColumn
            {
                HeaderText       = "Property No.",
                Width            = 75,
                DefaultCellStyle = dataGridViewCellStyle,
                DataPropertyName = "PropertyNo"
            });

            dgvTenants.Columns.Add(new DataGridViewTextBoxColumn
            {
                HeaderText       = "Tenant Name",
                Width            = 100,
                DefaultCellStyle = dataGridViewCellStyle,
                DataPropertyName = "TenantName"
            });

            dgvTenants.Columns.Add(new DataGridViewTextBoxColumn
            {
                HeaderText       = "Contract Amount",
                Width            = 105,
                DefaultCellStyle = dataGridViewCellStyle,
                DataPropertyName = "ContractAmount"
            });

            dgvTenants.Columns.Add(new DataGridViewTextBoxColumn
            {
                HeaderText       = "Start Date",
                Width            = 90,
                DefaultCellStyle = dataGridViewCellStyle,
                DataPropertyName = "StartContract"
            });

            dgvTenants.Columns.Add(new DataGridViewTextBoxColumn
            {
                HeaderText       = "End Date",
                Width            = 90,
                DefaultCellStyle = dataGridViewCellStyle,
                DataPropertyName = "EndContract"
            });

            DataGridViewCellStyle dgvButton = new DataGridViewCellStyle();

            dgvButton.Alignment = DataGridViewContentAlignment.MiddleCenter;

            dgvTenants.Columns.Add(new DataGridViewButtonColumn
            {
                Text = "INVOICES",
                UseColumnTextForButtonValue = true,
                Width            = 100,
                DefaultCellStyle = dgvButton
            });

            //dgvTenants.Columns.Add(new DataGridViewTextBoxColumn
            //{
            //    HeaderText = "Remarks",
            //    Width = 100,
            //    DefaultCellStyle = dataGridViewCellStyle,
            //    DataPropertyName = "Status"
            //});
            var LandlordList = SqliteData.GetLandlords();

            foreach (var landlord in LandlordList)
            {
                cmbLandlord.Items.Add(landlord.Name);
            }
        }
Ejemplo n.º 8
0
        private void InitDockLayout()
        {
            _mapForm      = new ControlMapForm();
            _mapForm.Text = "GIS地图";
            _mapForm.Show(dockPanel1, DockState.Document);
            _mapForm.CloseButton = false;
            _mapForm.UiInitAndInvoke();
            _mapForm.Activate();



            MouseMoveOperator mouseMoveOperate;
            MouseDownOperator mouseDownOperate;

            sfHandle = new ShapeFileHandle(_mapForm.Map);

            #region 加载gis地图
            string[] str = { @"D:\光纤传感监测系统\Monitor\Monitor\data\底图.shp", @"D:\光纤传感监测系统\Monitor\Monitor\data\省界WGS 84.shp", @"D:\光纤传感监测系统\Monitor\Monitor\data\海缆WGS 84.tif" };
            mapLayer        = new MapLayer();
            MainLayerHandle = mapLayer.AddLayer(_mapForm.Map, str, "底图");

            _mapForm.MainLayerHandle = MainLayerHandle;
            _mapForm.SetMainLayerHandle();
            #endregion


            //	_mapForm.Map.ZoomToMaxExtents();
            _mapForm.Map.ZoomToLayer(MainLayerHandle);



            #region  在地图上划线
            ClassLine line      = new ClassLine();
            ClassLine line_1    = new ClassLine();
            GisPoint  gisPoint  = new GisPoint();
            LineSet   lineSet   = new LineSet(tkMapColor.Yellow, 6.0f, tkDashStyle.dsSolid);
            LineSet   lineSet_1 = new LineSet(tkMapColor.Red, 5.0f, tkDashStyle.dsCustom);
            gisPoint.connectToDB("Data Source=" + new DirectoryInfo("../../../../").FullName + "Monitor\\Monitor\\data\\data.db");
            gisPoint.readData();
            gisPoint.InitLineData(line);
            line_1.startX = gisPoint.m_PointList[15].X;
            line_1.startY = gisPoint.m_PointList[15].Y;
            line_1.endX   = gisPoint.m_PointList[20].X;
            line_1.endY   = gisPoint.m_PointList[20].Y;

            drawLine = new classDrawLine(_mapForm.Map);
            drawLine.WriteLine(line, lineSet);
            drawLine.WriteLine(line_1, lineSet_1);
            #endregion

            #region   在gis地图中添加ais数据
            //1、获取数据库中数据
            SqliteData sqlite = new SqliteData("Data Source=" + new DirectoryInfo("../../../../").FullName +
                                               "Monitor\\Monitor\\data\\data.db");
            DataTable gisData = sqlite.readData("Point");

            //2、实例化AISData类
            ais           = new AISData(_mapForm.Map, gisData);
            drawPoint_Ais = new classDrawPoint(MapForm.Map);

            //3、在地图上加载ais数据
            pointSet = new PointSet("AisReal", tkDefaultPointSymbol.dpsTriangleUp, tkMapColor.Red, 16);
            drawPoint_Ais.CreatPoint(ais.point, pointSet);
            drawPoint_Ais.EditAttribute();
            sfHandle.AddMouseMoveShapeFile("Ais", drawPoint_Ais.LayerHandle);
            #endregion


            #region
            drawPoint = new classDrawPoint(_mapForm.Map);
            var pnt = new ClassPoint();
            pnt.x   = 121.907567728461;
            pnt.y   = 30.8729913928844;
            pnt.str = "图片详情";
            string path = new DirectoryInfo("../../../../").FullName + "Monitor\\Monitor\\data\\ship3.png";
            drawPoint.AddPicture(pnt, path);
            drawPoint.EditAttribute();
            sfHandle.AddMouseDownShapeFile("pic", drawPoint.LayerHandle);
            #endregion


            _mapForm.Sf_MouseMove = sfHandle.Sf_MouseMove;
            _mapForm.Sf_MouseDown = sfHandle.Sf_MouseDown;


            mouseMoveOperate = new MouseMoveOperator(Operation.AddLabel);
            mouseDownOperate = new MouseDownOperator(Operation.AddLabel);

            //传入委托
            MapForm.MouseMoveOperate = mouseMoveOperate;
            MapForm.mouseDownOperate = mouseDownOperate;

            //var point = new ClassPoint();
            //point.x = 121.907567728461;
            //point.y = 30.8739913928844;
            //addText = new classAddText(_mapForm.Map, MainLayerHandle);
            //addText.AddText(point.x, point.y);
        }