Exemplo n.º 1
0
        public bool UpdateFollowup(Followup element)
        {
            string sql = "update TF_Followup set MemberID=" + element.Member.ID + ", 跟进方式=" + element.回访方式.ID + ", 跟进结果=" + element.跟进结果.ID + ", 跟进时间='" + element.跟进时间 + "', 备注='" + element.备注 + "', 跟进人=" + element.跟进人.ID + " where ID=" + element.ID;
            int    r   = sqlHelper.ExecuteSql(sql);

            return(r > 0);
        }
Exemplo n.º 2
0
        public bool DeleteFollowup(Followup element)
        {
            string sql = "delete from TF_Followup where ID=" + element.ID;
            int    r   = sqlHelper.ExecuteSql(sql);

            return(r > 0);
        }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (selectMemberControl1.SelectedMembers.Count == 0)
            {
                MessageBox.Show("请选择会员!");
                selectMemberControl1.Focus();
                return;
            }
            Followup followup = new Followup();

            followup.Member = selectMemberControl1.SelectedMembers[0];//comboBox2.SelectedItem as Member;
            followup.回访方式   = comboBox3.SelectedItem as FollowupType;
            followup.跟进结果   = comboBox7.SelectedItem as FollowupResult;
            followup.跟进时间   = DateTime.Parse(textBox3.Text.Trim());
            followup.跟进人    = (selectStaffControl1.SelectedStaffs != null && selectStaffControl1.SelectedStaffs.Count > 0) ? selectStaffControl1.SelectedStaffs[0] : null;
            followup.备注     = textBox6.Text;
            FollowupLogic rl = FollowupLogic.GetInstance();
            int           id = rl.AddFollowup(followup);

            if (id > 0)
            {
                followup.ID = id;
                LoadFollowups();
                MessageBox.Show("添加成功!");
            }
        }
Exemplo n.º 4
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex > -1)
     {
         if (selectMemberControl1.SelectedMembers.Count == 0)
         {
             MessageBox.Show("请选择会员!");
             selectMemberControl1.Focus();
             return;
         }
         Followup followup = (Followup)comboBox1.SelectedItem;
         followup.Member = selectMemberControl1.SelectedMembers[0];//comboBox2.SelectedItem as Member;
         followup.回访方式   = comboBox3.SelectedItem as FollowupType;
         followup.跟进结果   = comboBox7.SelectedItem as FollowupResult;
         followup.跟进时间   = DateTime.Parse(textBox3.Text.Trim());
         followup.跟进人    = (selectStaffControl1.SelectedStaffs != null && selectStaffControl1.SelectedStaffs.Count > 0) ? selectStaffControl1.SelectedStaffs[0] : null;
         followup.备注     = textBox6.Text;
         FollowupLogic rl = FollowupLogic.GetInstance();
         if (rl.UpdateFollowup(followup))
         {
             LoadFollowups();
             MessageBox.Show("修改成功!");
         }
     }
     else
     {
         MessageBox.Show("先选定要修改的回访记录!");
     }
 }
Exemplo n.º 5
0
        public int AddFollowup(Followup element)
        {
            string sql = "insert into TF_Followup (MemberID, 跟进方式, 跟进结果, 跟进时间, 备注, 跟进人) values (" + element.Member.ID + ", " + element.回访方式.ID + ", " + element.跟进结果.ID + ", '" + element.跟进时间 + "', '" + element.备注 + "', " + element.跟进人.ID + "); select SCOPE_IDENTITY()";
            object obj = sqlHelper.ExecuteSqlReturn(sql);
            int    R;

            if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R))
            {
                return(R);
            }
            else
            {
                return(0);
            }
        }
Exemplo n.º 6
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex > -1)
     {
         if (MessageBox.Show("确定要删除该回访记录?", "删除提醒", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
         {
             Followup followup = (Followup)comboBox1.SelectedItem;
             if (FollowupLogic.GetInstance().DeleteFollowup(followup))
             {
                 LoadFollowups();
             }
         }
     }
     else
     {
         MessageBox.Show("先选定要删除的回访记录!");
     }
 }
Exemplo n.º 7
0
        public Followup GetFollowup(int id)
        {
            string    sql = "select * from TF_Followup where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                Followup element = new Followup();
                element.ID     = id;
                element.Member = MemberLogic.GetInstance().GetMember(Convert.ToInt32(dt.Rows[0]["MemberID"]));
                element.回访方式   = FollowupTypeLogic.GetInstance().GetFollowupType(Convert.ToInt32(dt.Rows[0]["跟进方式"]));
                element.跟进结果   = FollowupResultLogic.GetInstance().GetFollowupResult(Convert.ToInt32(dt.Rows[0]["跟进结果"]));
                element.跟进时间   = Convert.ToDateTime(dt.Rows[0]["跟进时间"]);
                element.跟进人    = StaffLogic.GetInstance().GetStaff(Convert.ToInt32(dt.Rows[0]["跟进人"]));
                element.备注     = dt.Rows[0]["备注"].ToString();
                return(element);
            }
            return(null);
        }
Exemplo n.º 8
0
        public List <Followup> GetAllFollowups()
        {
            List <Followup> elements = new List <Followup>();
            string          sql      = "select * from TF_Followup";
            DataTable       dt       = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    Followup element = new Followup();
                    element.ID     = Convert.ToInt32(dt.Rows[i]["ID"]);
                    element.Member = MemberLogic.GetInstance().GetMember(Convert.ToInt32(dt.Rows[i]["MemberID"]));
                    element.回访方式   = FollowupTypeLogic.GetInstance().GetFollowupType(Convert.ToInt32(dt.Rows[i]["跟进方式"]));
                    element.跟进结果   = FollowupResultLogic.GetInstance().GetFollowupResult(Convert.ToInt32(dt.Rows[i]["跟进结果"]));
                    element.跟进时间   = Convert.ToDateTime(dt.Rows[i]["跟进时间"]);
                    element.跟进人    = StaffLogic.GetInstance().GetStaff(Convert.ToInt32(dt.Rows[i]["跟进人"]));
                    element.备注     = dt.Rows[i]["备注"].ToString();
                    elements.Add(element);
                }
            }
            return(elements);
        }
Exemplo n.º 9
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex > -1)
     {
         Followup followup = comboBox1.SelectedItem as Followup;
         if (followup != null)
         {
             //comboBox2.SelectedIndex = GetIndexByMember(followup.Member, comboBox2);
             selectMemberControl1.SelectedMembers = new List <Member>()
             {
                 followup.Member
             };
             comboBox3.SelectedIndex            = GetIndexByFollowupType(followup.回访方式, comboBox3);
             comboBox4.SelectedIndex            = GetIndexByFollowupResult(followup.跟进结果, comboBox4);
             textBox3.Text                      = followup.跟进时间.ToString("yyyy-MM-dd");
             monthCalendar1.SelectionStart      = followup.跟进时间;
             selectStaffControl1.SelectedStaffs = new List <Staff>()
             {
                 followup.跟进人
             };
             textBox6.Text = followup.备注;
         }
     }
 }