Example #1
0
        public JsonResult CarTyreCombo(string q, string textField, string valueField = "ID", string orderBy = "ID", bool ascending = false, string condition = "")
        {
            JqGridRequest request = new JqGridRequest();
            var           list    = this.service.GetGenericService <TyreInfo>().All(condition, orderBy, ascending);

            if (!string.IsNullOrEmpty(q))
            {
                list = list.Where(p => p.ID.Contains(q) || (p.BreedCode == null? 1 == 0: p.BreedCode.Contains(q)))
                       .ToList();
            }
            var dataList = list.Select(p => new
            {
                Text = string.Format("<strong>{0}[{1}]</strong><br/><span style='color:Green;'>{2}:{3}</span><br/>{4}:{5}<br/>{6}:{7}<br/>{8}:{9}<br/>",
                                     p.ID,
                                     p.BreedCode,
                                     Lang.Tyre_InstallPlace,
                                     p.InstallPlace,
                                     Lang.Tyre_Type,
                                     p.TyreType,
                                     Lang.Tyre_Model,
                                     p.TyreModel,
                                     Lang.Tyre_Spec,
                                     p.TyreSpec),

                Value = HelperExtensions.Eval(p, valueField)
            });

            return(Json(new SelectList(dataList, "Value", "Text")));
        }
        public JsonResult TodayTaskCombo1(string q, string textField, string valueField = "ID", string orderBy = "ID", bool ascending = false, string condition = "")
        {
            JqGridRequest request = new JqGridRequest();
            //var list = this.service.ProduceTask.All();
            var list = this.service.ProduceTask.Query().Where(m => m.BuildTime > DateTime.Now.AddDays(-7)).ToList();

            if (!string.IsNullOrEmpty(q))
            {
                list = list.Where(p => p.ID.Contains(q) || p.ProjectName.Contains(q))
                       .ToList();
            }

            var dataList = list.Select(p => new
            {
                Text = string.Format("<strong>{0}[{9}]</strong><br/>{5}:{1}<br/>{6}:{2}<br/>{7}:{3}<br/>{8}:{4}",
                                     HelperExtensions.Eval(p, textField),
                                     p.Contract.CustName,
                                     p.ConStrength,
                                     p.ConsPos,
                                     p.CastMode,
                                     Lang.Entity_Property_CustName,
                                     Lang.Entity_Property_ConStrength,
                                     Lang.Entity_Property_ConsPos,
                                     Lang.Entity_Property_CastMode,
                                     p.ID),

                Value = HelperExtensions.Eval(p, valueField)
            });

            return(Json(new SelectList(dataList, "Value", "Text")));
        }
Example #3
0
        public override ActionResult Combo(string q, string textField, string valueField = "ID", string orderBy = "ID", bool ascending = false, string condition = "")
        {
            IList <GoodsInfo> data;

            if (string.IsNullOrEmpty(q))
            {
                data = this.service.GetGenericService <GoodsInfo>().Find(condition, 1, 30, orderBy, ascending ? "ASC" : "DESC");
            }
            else
            {
                string where = string.Format("({0} like '%{1}%') ", textField, q.Replace("'", ""));
                if (!string.IsNullOrEmpty(condition))
                {
                    where += " AND " + condition;
                }
                data = this.m_ServiceBase.Find(
                    where,
                    1,
                    30,
                    orderBy,
                    ascending ? "ASC" : "DESC");
            }


            var dataList = data.Select(p => new
            {
                //Text = string.Format("<strong>{0} ({3}) [{7}]</strong><br/>{4}:{1}<br/>{5}:{2}<br/>{6}:{3}<br/>{8}:{9}",
                //        HelperExtensions.Eval(p, textField),
                //        p.GoodsName,
                //        p.uPrice,
                //        p.unit,
                //        "名称",
                //        "单价",
                //        "单位",
                //        p.ID,"型号",p.GoodsModel),
                Text = string.Format("<strong>{0} ({3}) [{7}]</strong><br/>{5}:{2}<br/>{6}:{3}<br/>{8}:{9}",
                                     HelperExtensions.Eval(p, textField),
                                     p.GoodsName,
                                     p.uPrice,
                                     p.unit,
                                     "名称",
                                     "单价",
                                     "单位",
                                     p.ID, "型号", p.GoodsModel),

                Value = HelperExtensions.Eval(p, valueField)
            });

            return(Json(new SelectList(dataList, "Value", "Text")));
        }
Example #4
0
        public ActionResult GetCompany(string q, string textField, string valueField = "ID", string orderBy = "ID", bool ascending = false, string condition = "")
        {
            IList <Company> data;

            q = FilterSpecial(q);
            if (string.IsNullOrEmpty(q))
            {
                data = this.service.Company.Find(condition, 1, 30, orderBy, ascending ? "ASC" : "DESC");
            }
            else
            {
                string where = string.Format("({0} like '%{1}%' or ID like '%{1}%') ", textField, q);
                if (!string.IsNullOrEmpty(condition))
                {
                    where += " AND " + condition;
                }
                data = this.service.Company.Find(
                    where,
                    1,
                    30,
                    orderBy,
                    ascending ? "ASC" : "DESC");
            }

            var dataList = data.Select(p => new
            {
                Text = string.Format("<strong>{0}</strong>" +
                                     "[<span class='PId'>{9}</span>]<br/>{5}:<span class='PAddr'>{1}</span><br/>{6}:<span class='Plink'>{2}</span><br/>{7}:<span class='PTel'>{3}</span>" +
                                     "<br/>{8}:<span class='PRmark'>{4}</span>",
                                     HelperExtensions.Eval(p, textField),
                                     p.CompAddr,
                                     p.LinkMan,
                                     p.Tel,
                                     p.Principal,
                                     "站地址",
                                     "联系人",
                                     "联系电话",
                                     "负责人",
                                     p.ID),

                Value = HelperExtensions.Eval(p, valueField)
            });

            return(Json(new SelectList(dataList, "Value", "Text")));
        }
        /// <summary>
        /// 组合任务单数据显示在autocomplete
        /// </summary>
        /// <param name="q"></param>
        /// <param name="textField"></param>
        /// <param name="valueField"></param>
        /// <param name="orderBy"></param>
        /// <param name="ascending"></param>
        /// <param name="condition"></param>
        /// <returns></returns>
        public override ActionResult Combo(string q, string textField, string valueField = "ID", string orderBy = "ID", bool ascending = false, string condition = "")
        {
             

            IList <ProduceTask> data;

            if (string.IsNullOrEmpty(q))
            {
                data = this.service.ProduceTask.Find(condition, 1, 30, orderBy, ascending ? "ASC" : "DESC");
            }
            else
            {
                string where = string.Format("({0} like '%{1}%' or ID like '%{1}%') ", textField, q);
                if (!string.IsNullOrEmpty(condition))
                {
                    where += " AND " + condition;
                }
                data = m_ServiceBase.Find(
                    where,
                    1,
                    30,
                    orderBy,
                    ascending ? "ASC" : "DESC");
            }



            var dataList = data.Select(p => new {
                Text = string.Format("<strong>{0} [{9}]</strong><br/>{5}:{1}<br/>{6}:{2}<br/>{7}:{3}<br/>{8}:{4}",
                                     HelperExtensions.Eval(p, textField),
                                     p.Contract.CustName,
                                     p.ConStrength,
                                     p.ConsPos,
                                     p.CastMode,
                                     Lang.Entity_Property_CustName,
                                     Lang.Entity_Property_ConStrength,
                                     Lang.Entity_Property_ConsPos,
                                     Lang.Entity_Property_CastMode,
                                     p.ID),

                Value = HelperExtensions.Eval(p, valueField)
            });

            return(Json(new SelectList(dataList, "Value", "Text")));
        }
        //public ActionResult Dianzi(string ID)
        //{
        //    StockPact sp = this.service.GetGenericService<StockPact>().Get(ID);
        //    if (sp.IsDianzi == 0)
        //    {
        //        List<StuffIn> si = this.service.GetGenericService<StuffIn>().Query().Where(p => p.StockPactID == sp.ID).ToList();
        //        switch (sp.DianziType)
        //        {
        //            case "垫时长":
        //                DateTime dt = sp.ValidFrom.AddDays(Convert.ToDouble(sp.DianziNum));
        //                if (dt < DateTime.Now)
        //                {
        //                    sp.DianziMoney = si.Where(p => p.InDate < dt).Sum(p => p.TotalPrice);
        //                    sp.IsDianzi = 1;
        //                    this.m_ServiceBase.Update(sp);
        //                    return OperateResult(true, Lang.Msg_Operate_Success, null);
        //                };
        //                break;
        //            case "垫数量":
        //                if (si.Sum(p => p.InNum) >= sp.DianziNum)
        //                {
        //                    sp.DianziMoney = si.OrderBy(p => p.InDate).FirstOrDefault().UnitPrice * sp.DianziNum;
        //                    sp.IsDianzi = 1;
        //                    this.m_ServiceBase.Update(sp);
        //                    return OperateResult(true, Lang.Msg_Operate_Success, null);
        //                };
        //                break;
        //            case "垫金额":
        //                if (si.Sum(p => p.TotalPrice) >= sp.DianziNum)
        //                {
        //                    sp.DianziMoney = sp.DianziNum;
        //                    sp.IsDianzi = 1;
        //                    this.m_ServiceBase.Update(sp);
        //                    return OperateResult(true, Lang.Msg_Operate_Success, null);
        //                }
        //                break;
        //            default:
        //                break;
        //        };
        //        return OperateResult(true, "该合同未完成垫资或并未填写垫资项", null);
        //    }
        //    return OperateResult(true, "该合同已完成垫资", null);
        //}

        /// <summary>
        /// 定义下拉列表样式
        /// </summary>
        /// <param name="q"></param>
        /// <param name="textField"></param>
        /// <param name="valueField"></param>
        /// <param name="orderBy"></param>
        /// <param name="ascending"></param>
        /// <param name="condition"></param>
        /// <returns></returns>
        public override ActionResult Combo(string q, string textField, string valueField = "ID", string orderBy = "ID", bool ascending = false, string condition = "")
        {
            IList <StockPact> data;

            if (string.IsNullOrEmpty(q))
            {
                data = this.service.GetGenericService <StockPact>().Find(condition, 1, 30, orderBy, ascending ? "ASC" : "DESC");
            }
            else
            {
                string where = string.Format("{0} like '%{1}%' or SupplyInfo.ShortName like '%{1}%'", textField, q.Replace("'", ""), "PactName");
                if (!string.IsNullOrEmpty(condition))
                {
                    where += " AND " + condition;
                }
                data = m_ServiceBase.Find(
                    where,
                    1,
                    30,
                    orderBy,
                    ascending ? "ASC" : "DESC");
            }

            var dataList = data.Select(p => new
            {
                Text = string.Format("<strong>{0}</strong><br/>{5}:{1}<br/>{6}:{2}<br/>{7}:{3}<br/>{8}:{4}",
                                     HelperExtensions.Eval(p, textField),
                                     p.ID,
                                     p.SupplyName,
                                     p.PactName,
                                     p.StuffInfo.StuffName + "," + (p.StuffInfo1 == null ? "" : p.StuffInfo1.StuffName) + "," + (p.StuffInfo2 == null ? "" : p.StuffInfo2.StuffName) + "," + (p.StuffInfo3 == null ? "" : p.StuffInfo3.StuffName) + "," + (p.StuffInfo4 == null ? "" : p.StuffInfo4.StuffName),
                                     Lang.Entity_Property_ID,
                                     "供货厂商",
                                     Lang.Entity_Property_StockPactName,
                                     Lang.Entity_Property_StuffName),

                Value = HelperExtensions.Eval(p, valueField)
            });

            return(Json(new SelectList(dataList, "Value", "Text")));
        }
        /// <summary>
        /// 组合任务单数据显示在autocomplete
        /// </summary>
        /// <param name="q"></param>
        /// <param name="textField"></param>
        /// <param name="valueField"></param>
        /// <param name="orderBy"></param>
        /// <param name="ascending"></param>
        /// <param name="condition"></param>
        /// <returns></returns>
        public override ActionResult Combo(string q, string textField, string valueField = "ID", string orderBy = "ID", bool ascending = false, string condition = "")
        {
            IList <Contract> data;

            q = FilterSpecial(q);
            if (string.IsNullOrEmpty(q))
            {
                data = this.service.Contract.Find(condition, 1, 30, orderBy, ascending ? "ASC" : "DESC");
            }
            else
            {
                string where = string.Format("({0} like '%{1}%' or ID like '%{1}%') ", textField, q);
                if (!string.IsNullOrEmpty(condition))
                {
                    where += " AND " + condition;
                }
                data = this.service.Contract.Find(
                    where,
                    1,
                    30,
                    orderBy,
                    ascending ? "ASC" : "DESC");
            }

            var dataList = data.Select(p => new
            {
                Text = string.Format("<strong>{0}</strong>[{5}]<br/>{3}:{1}<br/>{4}:{2}",
                                     HelperExtensions.Eval(p, textField),
                                     p.CustName,
                                     p.ContractName,
                                     Lang.Entity_Property_CustName,
                                     Lang.Entity_Property_ContractName,
                                     p.ID),

                Value = HelperExtensions.Eval(p, valueField)
            });

            return(Json(new SelectList(dataList, "Value", "Text")));
        }
Example #8
0
        /// <summary>
        /// 返回jqgrid searchoptions 需要的下拉列表html代码
        /// </summary>
        /// <param name="textField"></param>
        /// <param name="valueField"></param>
        /// <param name="orderBy"></param>
        /// <param name="ascending"></param>
        /// <param name="condition"></param>
        /// <returns></returns>
        public virtual ActionResult SearchSelect(
            string textField,
            string valueField = "ID",
            string orderBy    = "ID",
            bool ascending    = true,
            string condition  = "")
        {
            IList <TEntity> data = m_ServiceBase.All(new List <string> {
                textField, valueField
            },
                                                     condition,
                                                     orderBy,
                                                     ascending
                                                     );

            var list = data.Select(p => string.Format("<option value=\"{0}\">{1}</option>", HelperExtensions.Eval(p, valueField), HelperExtensions.Eval(p, valueField)))
                       .ToList();

            return(Content(string.Format("<select><option value=\"\"></option>{0}</select>", string.Join("", list))));
        }