public static DetailAwardInstance_M ToViewModel(award_instance instance)
 {
     return(new DetailAwardInstance_M()
     {
         awardtypename = instance.award_type.awardname,
         state = instance.state,
         instanceid = instance.instanceid,
         instancename = instance.instancename,
         starttime = instance.starttime,
         endtime = instance.endtime,
         bonus = instance.bonus
     });
 }
        public static EditAwardInstance_M ToViewModel(award_instance instance, List <SelectListItem> awardtype)
        {
            return(new EditAwardInstance_M()
            {
                _awardtype = awardtype,

                awardtypeid = instance.awardtypeid,
                state = instance.state,
                instanceid = instance.instanceid,
                instancename = instance.instancename,
                starttime = instance.starttime,
                endtime = instance.endtime,
                bonus = instance.bonus
            });
        }
Esempio n. 3
0
        //添加奖项实例表,奖项实例基本信息表,奖项材料实例表(同时添加)
        public bool AddAwardInstanceAndBaseinfoAndMaterial(award_instance award_instance_list)
        {
            var awardtypebaseInfolist = FindATBList(award_instance_list.awardtypeid);                    //该奖项类型的所有基本信息列表
            var awardAboutMaterial    = FindAwardTypeAboutMaterialList(award_instance_list.awardtypeid); //查找该奖项类型的所有有关的材料

            Db.award_instance.Add(new award_instance()
            {
                instanceid   = award_instance_list.instanceid,
                awardtypeid  = award_instance_list.awardtypeid,
                state        = 0,//当创建一个奖项实例的时候,默认该实例的状态是未开放
                instancename = award_instance_list.instancename,
                starttime    = award_instance_list.starttime,
                endtime      = award_instance_list.endtime,
                bonus        = award_instance_list.bonus
            });
            foreach (var item in awardtypebaseInfolist)//讲该奖项类型的所有基本信息添加到奖项实例基本信息的表
            {
                Db.award_instance_baseInfo.Add(new award_instance_baseInfo()
                {
                    baseInfoid         = item.baseinfoid,
                    instanceid         = award_instance_list.instanceid,
                    instancebaseinfoid = DateTime.Now.Random(),
                    sequence           = item.sequence
                });
            }
            foreach (var item in awardAboutMaterial)//将该奖项类型的所有有关材料添加到奖项实例跟材料联系的表
            {
                Db.award_materia_instance.Add(new award_materia_instance()
                {
                    materialtypeid          = item.Value,
                    instanceid              = award_instance_list.instanceid,
                    awardmaterialinstanceid = DateTime.Now.Random(),
                    count = 0
                });
            }
            return(Db.Saved()?true:false);
        }
 public static DistributionTotalCount_M ToViewModel(award_batch_instance batch_instance, award_batch batch, award_instance award_Instance, string batchinstanceid)
 {
     return(new DistributionTotalCount_M()
     {
         batch_name = batch.batchname,
         award_instance_name = award_Instance.instancename,
         batchinstanceid = batchinstanceid,
         batchid = batch_instance.batchid,
         instanceid = batch_instance.instanceid,
         total_count = batch_instance.total_count
     });
 }