Пример #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (promotionTemplateConfig == null)
            {
                promotionTemplateConfig = new EntityPromotionTemplateConfig();
            }
            promotionTemplateConfig.planPeriod  = dtePlanDate.Text;
            promotionTemplateConfig.planWay     = cboWays.Text;
            promotionTemplateConfig.planContent = cboContent.Text;
            promotionTemplateConfig.planRemind  = txtTips.Text;

            IsRequireRefresh = true;
        }
Пример #2
0
        /// <summary>
        /// 模板配置
        /// </summary>
        /// <param name="parms"></param>
        /// <returns></returns>
        public List <EntityPromotionTemplateConfig> GetPromotionTemplateConfigs(List <EntityParm> parms = null)
        {
            List <EntityPromotionTemplateConfig> data = null;
            SqlHelper svc = new SqlHelper(EnumBiz.onlineDB);
            string    Sql = string.Empty;

            Sql = @"select  a.id,
                            templateId,
                            planMonth,
                            planDay,
                            b.planWay,
                            c.planContent,
                            planRemind,
                            isEnabled,
                            bakField1,
                            bakField2,
                            createDate,
                            createId,
                            creator,
                            modifyDate,
                            modifyId,
                            modifyName
                      from promotionTemplateConfig a
                            left join promotionWayConfig b
                            on a.planWay = b.id
                            left join promotionContentConfig c
                            on a.planContent = c.id  order by planMonth,planDay";
            DataTable dt = svc.GetDataTable(Sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                data = new List <EntityPromotionTemplateConfig>();
                EntityPromotionTemplateConfig vo = null;
                foreach (DataRow dr in dt.Rows)
                {
                    vo             = new EntityPromotionTemplateConfig();
                    vo.id          = dr["id"].ToString();
                    vo.templateId  = dr["templateId"].ToString();
                    vo.planMonth   = dr["planMonth"].ToString();
                    vo.planPeriod  = (DateTime.Now.AddMonths(Function.Int(dr["planMonth"]) - 1).AddDays(Function.Int(dr["planDay"]))).ToString("yyyy-MM-dd");;
                    vo.planDay     = dr["planDay"].ToString();
                    vo.planWay     = dr["planWay"].ToString();
                    vo.planContent = dr["planContent"].ToString();
                    vo.planRemind  = dr["planRemind"].ToString();
                    vo.isEnabled   = dr["isEnabled"].ToString();
                    data.Add(vo);
                }
            }
            return(data);
        }
Пример #3
0
        /// <summary>
        ///
        /// </summary>
        public override void New()
        {
            frmPopup2040101 frm = new frmPopup2040101();

            frm.ShowDialog();

            if (frm.IsRequireRefresh)
            {
                EntityPromotionTemplateConfig vo = frm.promotionTemplateConfig;

                if (!lstPromotionSelect.Exists(r => r.planPeriod == vo.planPeriod && r.planWay == vo.planWay && r.planContent == vo.planContent))
                {
                    lstPromotionSelect.Add(vo);
                    gcPlan.DataSource = lstPromotionSelect;
                    gcPlan.RefreshDataSource();
                }
            }
        }
Пример #4
0
        /// <summary>
        ///
        /// </summary>
        public override void Delete()
        {
            if (gvPlan.SelectedRowsCount > 0)
            {
                List <EntityPromotionTemplateConfig> lstTmp = new List <EntityPromotionTemplateConfig>();
                for (int i = 0; i <= gvPlan.RowCount; i++)
                {
                    if (gvPlan.IsRowSelected(i))
                    {
                        EntityPromotionTemplateConfig ptPlan = gvPlan.GetRow(i) as EntityPromotionTemplateConfig;
                        lstTmp.Add(ptPlan);
                    }
                }

                foreach (var vo in lstTmp)
                {
                    lstPromotionSelect.Remove(vo);
                }

                gcPlan.DataSource = lstPromotionSelect;
                gcPlan.RefreshDataSource();
            }
        }
Пример #5
0
        private void gvPromotionTemplateConfig_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            if (e.RowHandle >= 0)
            {
                EntityPromotionTemplateConfig vo = GetRowTemplateConfigObject();
                if (gvPromotionTemplateConfig.IsRowSelected(e.RowHandle))
                {
                    gvPromotionTemplateConfig.UnselectRow(e.RowHandle);
                    lstPromotionSelect.Remove(vo);
                }
                else
                {
                    gvPromotionTemplateConfig.SelectRow(e.RowHandle);
                    if (!lstPromotionSelect.Exists(r => r.id == vo.id))
                    {
                        lstPromotionSelect.Add(vo);
                    }
                }

                gcPlan.DataSource = lstPromotionSelect;
                gcPlan.RefreshDataSource();
            }
        }
Пример #6
0
 private void gvPromotionTemplate_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
 {
     if (e.RowHandle >= 0)
     {
         EntityPromotionTemplate vo = GetRowTemplateObject();
         gcPromotionTemplateConfig.DataSource = lstPromotionTemplateConfig.FindAll(r => r.templateId == vo.id);
         gcPromotionTemplateConfig.RefreshDataSource();
         List <EntityPromotionTemplateConfig> lstTmp = lstPromotionSelect.FindAll(r => r.templateId == vo.id);
         if (lstTmp != null && lstTmp.Count > 0)
         {
             foreach (var tmp in lstTmp)
             {
                 for (int i = 0; i < gvPromotionTemplateConfig.RowCount; i++)
                 {
                     EntityPromotionTemplateConfig ptConfig = gvPromotionTemplateConfig.GetRow(i) as EntityPromotionTemplateConfig;
                     if (tmp.id == ptConfig.id)
                     {
                         gvPromotionTemplateConfig.SelectRow(i);
                     }
                 }
             }
         }
     }
 }