예제 #1
0
        public JsonResult GetAllOrderPeopleInfos(string str)
        {
            PageModel ret = new PageModel();

            Models.UserModel  user           = Session["UserModel"] as Models.UserModel;
            BLL.SubscriberBLL _SubscriberBLL = new SubscriberBLL();
            PageModel         pg             = _SubscriberBLL.GetSubscriber(0, "", "", "", "", "", "", user.OrgID._ToStr(), 0, 0);
            var js = JsonConvert.SerializeObject(pg);

            return(Json(js, JsonRequestBehavior.AllowGet));
        }
        private void DashboardForm_Activated(object sender, EventArgs e)
        {
            subscriberBLL = new SubscriberBLL();
            materialBLL   = new MaterialBLL();
            borrbll       = new BorrowBLL();

            comboMembers.SelectedIndex = 0;

            txtTotalMembers.Text    = subscriberBLL.GetTotalCountSubscribers().ToString();
            txtTotalMaterials.Text  = materialBLL.GetTotalCountMaterials().ToString();
            txtTotalBorrowings.Text = borrbll.GetTotalCountBorrowings().ToString();
        }
예제 #3
0
        /// <summary>
        /// 初始化订户新增修改界面
        /// </summary>
        /// <returns></returns>
        public ActionResult OrderPeopleInfo_AddEdit()
        {
            Models.UserModel user = Session["UserModel"] as Models.UserModel;
            int addeditcode       = Request["addeditcode"]._ToInt32();

            if (addeditcode > 0)
            {
                BLL.SubscriberBLL _SubscriberBLL = new SubscriberBLL();
                PageModel         pg             = _SubscriberBLL.GetSubscriber(addeditcode, "", "", "", "", "", "", user.OrgID._ToStr());
                ViewData.Model = pg;
            }
            else
            {
                ViewData.Model = null;
            }
            return(View());
        }
        private void btnDisplayTable_Click_1(object sender, EventArgs e)
        {
            subscriberBLL          = new SubscriberBLL();
            gridMembers.DataSource = null;

            if (comboMembers.SelectedIndex == 0)
            {
                gridMembers.DataSource = subscriberBLL.GetAll().Where(x => x.IsActive == true);
            }
            else if (comboMembers.SelectedIndex == 1)
            {
                gridMembers.DataSource = subscriberBLL.Get5LastSubscribers().Where(x => x.IsActive == true);
            }
            else if (comboMembers.SelectedIndex == 2)
            {
                gridMembers.DataSource = subscriberBLL.Get10LastSubscribers().Where(x => x.IsActive == true);
            }
        }
예제 #5
0
        public JsonResult OrderPeopleInfo_AddEdits(string str)
        {
            BLL.SubscriberBLL _SubscriberBLL = new SubscriberBLL();
            JObject           o = null;

            string   content = string.Empty;
            retValue ret     = new retValue();

            PMS.Models.UserModel userModel = Session["UserModel"] as PMS.Models.UserModel;
            int userid = userModel._ID;

            if (!string.IsNullOrEmpty(str))
            {
                o = JObject.Parse(str);

                string ID       = o["ID"]._ToStrTrim();
                string MGUID    = o["MGUID"]._ToStrTrim();
                string OrderNo  = o["OrderNo"]._ToStrTrim();
                string UnitName = o["UnitName"]._ToStrTrim();
                string Address  = o["Address"]._ToStrTrim();
                string Name     = o["Name"]._ToStrTrim();
                string Phone    = o["Phone"]._ToStrTrim();
                string Roads    = o["Roads"]._ToStrTrim();
                string State    = o["State"]._ToStrTrim();
                //新增
                if (string.IsNullOrEmpty(ID))
                {
                    ret = _SubscriberBLL.Insert(OrderNo, UnitName, Name, Phone, Address, Roads, userid);
                }
                //更新
                else
                {
                    ret = _SubscriberBLL.UpdateByPK(ID._ToInt32(), OrderNo, UnitName, Name, Phone, Address, "", MGUID);
                }
            }
            content = ret.toJson();

            var js = JsonConvert.SerializeObject(ret);

            return(Json(js, JsonRequestBehavior.AllowGet));
        }
예제 #6
0
        public JsonResult OrderPeopleInfo_Deletes(string str)
        {
            BLL.SubscriberBLL _SubscriberBLL = new SubscriberBLL();
            retValue          ret            = new retValue();
            string            content        = string.Empty;
            DataTable         dt             = str.ToTable();
            string            ids            = "";

            foreach (DataRow item in dt.Rows)
            {
                if (!string.IsNullOrEmpty(item["ID"]._ToStrTrim()))
                {
                    ids += item["ID"]._ToStrTrim() + ",";
                }
            }
            ret     = _SubscriberBLL.DeleteByPK(ids.Remove(ids.Length - 1));
            content = ret.toJson();
            var js = JsonConvert.SerializeObject(ret);

            return(Json(js, JsonRequestBehavior.AllowGet));
        }
예제 #7
0
        public ActionResult OrderPeopleInfos(int page, int limit, string test1, string test2,
                                             string Province, string CompanyCity, string CompanyUnderCity,
                                             string CompanyUnderArea, string OrderNo, string Name)
        {
            PageModel ret = new PageModel();

            BLL.SubscriberBLL _SubscriberBLL = new SubscriberBLL();

            JObject o = null;

            string content = string.Empty;

            Models.UserModel user  = Session["UserModel"] as Models.UserModel;
            string           OrgID = "";

            if (Province._ToInt32() > 0)
            {
                OrgID = Province;
            }
            if (CompanyCity._ToInt32() > 0)
            {
                OrgID = CompanyCity;
            }
            if (CompanyUnderCity._ToInt32() > 0)
            {
                OrgID = CompanyUnderCity;
            }
            if (CompanyUnderArea._ToInt32() > 0)
            {
                OrgID = CompanyUnderArea;
            }
            PageModel pg = _SubscriberBLL.GetSubscriber(0, OrderNo, Name, "", OrgID, test1, test2, user.OrgID._ToStr(), limit, page);
            var       js = JsonConvert.SerializeObject(pg);

            return(Content(js));
        }
        private void BtnSearch_Click_1(object sender, EventArgs e)
        {
            int  n;
            bool isNumeric = int.TryParse(txtSubscriberID.Text, out n);

            int  m;
            bool isMaterialId = int.TryParse(txtMaterialID.Text, out m);

            if (isNumeric && isMaterialId)
            {
                sbll = new SubscriberBLL();
                rbll = new ReservationBLL();
                mbll = new MaterialBLL();


                mbo = mbll.Get(m);
                sbo = sbll.Get(n);



                if (sbo != null && mbo.MaterialId > 0)
                {
                    re = rbll.GetReservationBySubscriberIdAndMaterialId(sbo.SubscriberId, mbo.MaterialId);

                    txtName.Text           = $"{sbo.Name} {sbo.LastName}";
                    txtAddress.Text        = sbo.Address;
                    txtEmail.Text          = sbo.Email;
                    txtPhoneNumber.Text    = sbo.PhoneNo;
                    txtPersonalNumber.Text = sbo.PersonalNo;

                    txtMaterialName.Text = mbo.Title;
                    txtMaterialType.Text = mbo._MaterialType._MaterialType;
                    txtAuthor.Text       = mbo._Author.AuthorName;
                    txtLocated.Text      = mbo._Shelf.Location;

                    if (re == null)
                    {
                        txtReserved.Text = "No";
                    }
                    else
                    {
                        txtReserved.Text = "Yes";
                    }



                    if (mbo.AvailableCoppies > 0)
                    {
                        txtAvailability.Text = "Yes";
                    }
                    else
                    {
                        txtAvailability.Text = "No";
                    }
                }
                else
                {
                    if (sbo == null && mbo.MaterialId < 1)
                    {
                        MessageBox.Show($"Material and Subscriber are not found", $"ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else if (sbo == null)
                    {
                        MessageBox.Show($"Subscriber is not found", $"ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else if (mbo.MaterialId < 1)
                    {
                        MessageBox.Show($"Material is not found", $"ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
            else if (txtMaterialID.Text == string.Empty && txtSubscriberID.Text == string.Empty)
            {
                MessageBox.Show($"Material and Subscriber are empty", $"ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (txtMaterialID.Text == string.Empty)
            {
                MessageBox.Show($"Material ID field is empty", $"ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (txtSubscriberID.Text == string.Empty)
            {
                MessageBox.Show($"Subscriber ID field is empty", $"ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                MessageBox.Show($"Material or Subscriber is not valid", $"ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        private void DashboardForm_Load(object sender, EventArgs e)
        {
            subscriberBLL = new SubscriberBLL();
            borrbll       = new BorrowBLL();
            mtbll         = new MaterialTypeBLL();
            mbll          = new MaterialBLL();

            try
            {
                MonthBorrowStatistics = borrbll.Last12MonthBorrowStatistics();

                subscribers  = subscriberBLL.BestSubscribers().ToList();
                materialList = mbll.GetAll();

                chartMaterials.Dock = DockStyle.Fill;

                Series series = new Series("Material", ViewType.Line);
                series.DataSource         = MonthBorrowStatistics;
                series.ArgumentDataMember = "Month";
                series.ValueDataMembers.AddRange("BorrowingsCount");
                chartMaterials.Series.Add(series);

                LineSeriesView view = (LineSeriesView)series.View;
                view.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True;

                series.LabelsVisibility             = DevExpress.Utils.DefaultBoolean.True;
                series.Label.ResolveOverlappingMode = ResolveOverlappingMode.HideOverlapped;

                // Create a chart title.
                ChartTitle chartTitle = new ChartTitle();
                chartTitle.Text = "Months Timeline";
                chartMaterials.Titles.Add(chartTitle);

                // Customize axes.
                XYDiagram diagram = chartMaterials.Diagram as XYDiagram;
                diagram.AxisX.DateTimeScaleOptions.GridSpacing = 9;
                diagram.AxisX.WholeRange.SideMarginsValue      = 0.5;
                diagram.AxisY.WholeRange.AlwaysShowZeroLevel   = false;

                // Hide a legend if necessary.
                chartMaterials.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False;
            }
            catch (Exception)
            {
            }

            //SideBySide chart

            //ChartControl sideBySideBarChart = chartMaterials;

            //Series series1 = new Series("Side-by-Side Bar Series 1", ViewType.Pie3D);
            //series1.DataSource = materialList;

            //series1.ArgumentDataMember = "Title";
            //series1.ValueDataMembers.AddRange("MaterialId");


            //sideBySideBarChart.Series.Add(series1);

            //sideBySideBarChart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True;

            //((XYDiagram)sideBySideBarChart.Diagram).Rotated = true;

            //ChartTitle chartTitle1 = new ChartTitle();
            //chartTitle1.Text = "Side-by-Side Bar Chart";
            //sideBySideBarChart.Titles.Add(chartTitle1);

            //Add the chart to the form.
            //sideBySideBarChart.Dock = DockStyle.Left;

            try
            {
                materials = mbll.MostBorrowedBooks();

                Series serie = new Series("Materials", ViewType.Bar);
                serie.ArgumentScaleType = ScaleType.Qualitative;
                serie.ValueScaleType    = ScaleType.Numerical;

                serie.ArgumentDataMember = "Title";
                serie.ValueDataMembers.AddRange("Borrowings");
                chartMostBorrowedMaterials.Series.Add(serie);
                chartMostBorrowedMaterials.DataSource = materials;
            }
            catch (Exception)
            {
            }

            // PIE CHART =>

            try
            {
                mts = mtbll.MostBorrowedMaterialTypes();
                piechart.Titles.Add(new ChartTitle()
                {
                    Text = "MaterialTypes"
                });

                Series series1 = new Series("Most borrowed MaterialTypes", ViewType.Pie);
                series1.DataSource         = mts;
                series1.ArgumentDataMember = "_MaterialType";
                series1.ValueDataMembers.AddRange("Borrowings");

                piechart.Series.Add(series1);

                series1.LegendTextPattern = "{A}";



                ((PieSeriesLabel)series1.Label).Position = PieSeriesLabelPosition.TwoColumns;

                ((PieSeriesLabel)series1.Label).ResolveOverlappingMode = ResolveOverlappingMode.Default;

                PieSeriesView myView = (PieSeriesView)series1.View;

                // Specify a data filter to explode points.
                myView.ExplodedPointsFilters.Add(new SeriesPointFilter(SeriesPointKey.Value_1,
                                                                       DataFilterCondition.GreaterThanOrEqual, 9));
                myView.ExplodedPointsFilters.Add(new SeriesPointFilter(SeriesPointKey.Argument,
                                                                       DataFilterCondition.NotEqual, "Others"));
                myView.ExplodeMode = PieExplodeMode.UseFilters;
                myView.ExplodedDistancePercentage = 30;
                myView.RuntimeExploding           = true;

                // Customize the legend.
                piechart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True;

                // Add the chart to the form.
                piechart.Dock = DockStyle.Fill;
            }
            catch (Exception)
            {
            }
        }