/// <summary>
        /// 得到一个新的model,主要用于新建model时自动算theOrder
        /// </summary>
        /// <param name="model"></param>
        /// <param name="keyword"></param>
        /// <returns></returns>
        public tblSimpleInfo GetNewModel(tblSimpleInfo model, string keyword)
        {
            Type    type = GetTypeObj(keyword).GetType();
            dynamic obj  = type.Assembly.CreateInstance(type.ToString());

            return(_GetNewModel(obj, model));
        }
예제 #2
0
 public ActionResult WindowSaveClick(tblSimpleInfo mo, string PanelID, string ParentVariable)
 {
     //GetParentVariable(ParentVariable);
     //string[] ss = ParentVar.KeyWords.Split(CosValue.SPLITOPERATOR2);
     //SimpleDlgDataListManage smpDlgMan = (SimpleDlgDataListManage)GetDataListManage(ss[0], ss[1]);
     //tblSimpleInfo transModel = (tblSimpleInfo)smpDlgMan.GetSpecialModelFromCurrentModel(mo);
     //long nNewID = smpDlgMan.SaveOneSimpleRecord(transModel);
     //SetHiddenValue(PanelID + "_ExitCode", "1");
     return(this.Direct());
 }
        private tblSimpleInfo _GetNewModel <T>(T obj, tblSimpleInfo model) where T : class
        {
            short     nOrder = 1;
            ArrayList names  = new ArrayList();
            ArrayList values = new ArrayList();

            names.Add("DelFlag");
            values.Add(false);
            var      express = GetAndLambdaExpression <T>(names, values);
            var      order   = BuildOrder <T, short>("TheOrder");
            List <T> list    = GetRecord(express, order, false);

            if ((list != null) && (list.Count > 0))
            {
                nOrder = Convert.ToInt16(list[0].GetType().GetProperty("TheOrder").GetValue(list[0], null));
                nOrder++;
            }
            model.TheOrder = nOrder;
            return(model);
        }
예제 #4
0
 /// <summary>
 ///
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="sNowNames"></param>
 /// <param name="sNowValues"></param>
 /// <param name="sNowSigns"></param>
 /// <returns></returns>
 private object _GetDataComboboxModels <T>(T obj, string sNowNames = "", string sNowValues = "", string sNowSigns = "", bool bComboModel = true) where T : class
 {
     if (sNowNames != "ClearDataCombo")
     {
         Expression <Func <T, bool> > where = GetWhereForStore <T>(sNowNames, sNowValues, sNowSigns);
         Expression <Func <T, short> > order = null;
         try
         {
             order = GetNowOrder <T>("TheOrder", CosDataBase.SMALLINT_TYPE);
         }
         catch
         {
             order = null;
         }
         try
         {
             List <T> models = GetRecord(where, order);
             if (bComboModel)
             {
                 List <tblSimpleInfo> returnmodels = new List <tblSimpleInfo>();
                 foreach (T n in models)
                 {
                     tblSimpleInfo mm = new tblSimpleInfo();
                     mm.ID   = Convert.ToInt64(n.GetType().GetProperty("ID").GetValue(n, null));
                     mm.Name = Convert.ToString(n.GetType().GetProperty("Name").GetValue(n, null));
                     returnmodels.Add(mm);
                 }
                 return(returnmodels);
             }
             else
             {
                 return(models);
             }
         }
         catch (Exception e)
         {
             Console.WriteLine(e.Message);
         }
     }
     return(null);
 }
예제 #5
0
        protected override bool SetSearchWhere(string sData)
        {
            tblSimpleInfo model  = JSON.Deserialize <tblSimpleInfo>(sData);
            List <string> names  = new List <string>();
            List <string> values = new List <string>();
            List <string> signs  = new List <string>();

            if ((model.Name != null) && (model.Name != ""))
            {
                names.Add("Name"); values.Add(model.Name); signs.Add(SIGN.Like.ToString());
            }
            if ((model.Code != null) && (model.Code != ""))
            {
                names.Add("Code"); values.Add(model.Code); signs.Add(SIGN.Like.ToString());
            }

            SetHiddenValue(sDataListName + "_NowNames", string.Join(CosValue.SPLITOPERATOR1.ToString(), names.ToArray()));
            SetHiddenValue(sDataListName + "_NowValues", string.Join(CosValue.SPLITOPERATOR1.ToString(), values.ToArray()));
            SetHiddenValue(sDataListName + "_NowSigns", string.Join(CosValue.SPLITOPERATOR1.ToString(), signs.ToArray()));

            return(true);
        }