Exemple #1
0
        /// <summary>
        /// 初始化维修类型
        /// </summary>
        /// <returns></returns>
        private void InitWorkType(ISession session)
        {
            WorkCodeType1 wct1 = new WorkCodeType1();
            wct1.Code = "01";
            wct1.Name = "灯饰";
            session.Save(wct1);

            wct1 = new WorkCodeType1();
            wct1.Code = "02";
            wct1.Name = "水暖";
            session.Save(wct1);

            wct1 = new WorkCodeType1();
            wct1.Code = "03";
            wct1.Name = "家具";
            session.Save(wct1);

            wct1 = new WorkCodeType1();
            wct1.Code = "04";
            wct1.Name = "门窗";
            session.Save(wct1);

            wct1 = new WorkCodeType1();
            wct1.Code = "05";
            wct1.Name = "家电";
            session.Save(wct1);

            wct1 = new WorkCodeType1();
            wct1.Code = "06";
            wct1.Name = "空调";
            session.Save(wct1);

            wct1 = new WorkCodeType1();
            wct1.Code = "07";
            wct1.Name = "木地板";
            session.Save(wct1);

            wct1 = new WorkCodeType1();
            wct1.Code = "08";
            wct1.Name = "墙地砖";
            session.Save(wct1);

            wct1 = new WorkCodeType1();
            wct1.Code = "09";
            wct1.Name = "墙纸";
            session.Save(wct1);

            wct1 = new WorkCodeType1();
            wct1.Code = "10";
            wct1.Name = "地钻";
            session.Save(wct1);

            wct1 = new WorkCodeType1();
            wct1.Code = "11";
            wct1.Name = "乳胶漆";
            session.Save(wct1);

            wct1 = new WorkCodeType1();
            wct1.Code = "12";
            wct1.Name = "疏通";
            session.Save(wct1);

            wct1 = new WorkCodeType1();
            wct1.Code = "13";
            wct1.Name = "搬运";
            session.Save(wct1);

            wct1 = new WorkCodeType1();
            wct1.Code = "14";
            wct1.Name = "其它";
            session.Save(wct1);

            //##############################################################
            WorkCodeType2 wct2 = new WorkCodeType2();
            wct2.Code = "01";
            wct2.Name = "安装";
            session.Save(wct2);

            wct2 = new WorkCodeType2();
            wct2.Code = "02";
            wct2.Name = "清洗";
            session.Save(wct2);

            wct2 = new WorkCodeType2();
            wct2.Code = "03";
            wct2.Name = "维修";
            session.Save(wct2);

            wct2 = new WorkCodeType2();
            wct2.Code = "04";
            wct2.Name = "翻新";
            session.Save(wct2);

            wct2 = new WorkCodeType2();
            wct2.Code = "05";
            wct2.Name = "张贴";
            session.Save(wct2);

            wct2 = new WorkCodeType2();
            wct2.Code = "06";
            wct2.Name = "其它";
            session.Save(wct2);

            //##############################################################
            ICriteria criteria=session.CreateCriteria(typeof(WorkCodeType1));
            IList<WorkCodeType1> wct1s= criteria.List<WorkCodeType1>();

            criteria = session.CreateCriteria(typeof(WorkCodeType2));
            IList<WorkCodeType2> wct2s = criteria.List<WorkCodeType2>();

            foreach (WorkCodeType1 t1 in wct1s)
            {
                foreach (WorkCodeType2 t2 in wct2s)
                {
                    WorkCodeType wct = new WorkCodeType();
                    wct.Type1 = t1;
                    wct.Type2 = t2;
                    session.Save(wct);
                }
            }
        }
 public ActionResult UpdateWorkCodeType2(WorkCodeType2 workCodeType2)
 {
     return Json(workCodeType2Oper.Update(workCodeType2));
 }
 public ActionResult DelWorkCodeType2(WorkCodeType2 workCodeType2)
 {
     return Json(workCodeType2Oper.Del(workCodeType2));
 }
 public ActionResult AddWorkCodeType2(WorkCodeType2 workCodeType2)
 {
     return Json(workCodeType2Oper.Add(workCodeType2));
 }