Пример #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (txtAi.Text.Trim().Length == 0)
            {
                MessageBox.Show("类别名称不能为空!");
                txtAi.Focus();
                return;
            }

            GoldenLadyWS.Service serivce = new GoldenLadyWS.Service();
            bool   flag = true;
            string sql  = "insert into SMSAi (name,forwarddays,sendtime) Values ('" + txtAi.Text.Trim() + "',0,'00:00:00')";

            if (serivce.ExecuteCommandText(sql) <= 0)
            {
                flag = false;
            }
            int newid = Convert.ToInt32(serivce.GetDataSet("select MAX(id) from SMSAi").Tables[0].Rows[0][0].ToString());

            sql = "insert into SMSUsefulExpressions (id,content1) values (" + newid + ",'" + txtUsefulExpressions1.Text.Trim() + "')";
            if (serivce.ExecuteCommandText(sql) <= 0)
            {
                flag = false;
            }
            if (flag)
            {
                MessageBox.Show("添加成功!");
                this.DialogResult = DialogResult.Yes;
            }
            else
            {
                MessageBox.Show("添加失败!");
            }
        }
Пример #2
0
        private void frmOption_Load(object sender, EventArgs e)
        {
            GoldenLadyWS.Service service = new GoldenLadyWS.Service();
            //string Sql = " select su.id as '编号', name as '通知类别',content1 as '自定义短语1',content2 as '自定义短语2',forwarddays as '提前通知天数',sendtime as '发送时间' from SMSAi sa,SMSUsefulExpressions su where sa.id=su.id";
            string Sql = " select su.id as id, name,content1,forwarddays,sendtime from SMSAi sa,SMSUsefulExpressions su where sa.id=su.id";

            myds           = service.GetDataSet(Sql);
            dgv.DataSource = myds.Tables[0];
            for (int i = 0; i < dgv.Rows.Count; i++)
            {
                int id = Convert.ToInt32(dgv.Rows[i].Cells["编号"].Value.ToString());
                if (id >= 1 && id <= 6)
                {
                    dgv.Rows[i].DefaultCellStyle.BackColor = Color.Yellow;
                }

                //2013-01-07 qiuqianquan
                string name = dgv.Rows[i].Cells["通知类别"].Value.ToString().Trim();
                if (name == "选片预约提醒" || name == "取件预约提醒" || name == "看版预约提醒" || name == "看版取消提醒" || name == "选片取消提醒" || name == "取件取消提醒" || name == "摄影取消提醒" || name == "摄影预约提醒")
                {
                    dgv.Rows[i].DefaultCellStyle.BackColor = Color.Yellow;//摄影取消提醒
                }
            }
        }