Exemple #1
0
        private void Search()
        {
            string classical = this.cbClassical.Text.Trim();
            string type      = this.cbType.Text.Trim();

            if (classical == string.Empty && type == string.Empty)
            {
                // MessageBoxHelper.Show("请至少选择一个条件再查询!");
                return;
            }
            string condition = "where 1=1 ";

            if (classical != string.Empty)
            {
                condition += " and cn_classical like '%" + classical + "%'";
            }
            if (type != string.Empty && type != "请选择")
            {
                condition += " and cn_type like '%" + type + "%'";
            }
            VehiclePhotoAccess access = new VehiclePhotoAccess();

            this.photos = access.SearchList(condition);
            this.ReloadCollection();
        }
        public ArrayList SearchList(string condition)
        {
            ArrayList list = new ArrayList();
            string    sql  = "select id,cn_classical,cn_type,picture,suffix,xuhao from table_vehicle_photo " + condition + " order by cn_classical,cn_type";
            DataTable dt   = this.access.SelectDataTable(sql, "table_vehicle_photo");

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    list.Add(VehiclePhotoAccess.GetFromDataRow(dr));
                }
            }
            return(list);
        }
Exemple #3
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (this.listView1.SelectedIndices != null && this.listView1.SelectedIndices.Count == 1)
     {
         VehiclePhoto temp = this.photos[this.listView1.SelectedIndices[0]] as VehiclePhoto;
         if (MessageBoxHelper.Confirm("确定删除" + temp.Cn_Classical + "-" + temp.Cn_Type + "吗?"))
         {
             VehiclePhotoAccess access = new VehiclePhotoAccess();
             if (access.Delete(temp))
             {
                 this.photos.RemoveAt(this.listView1.SelectedIndices[0]);
                 this.listView1.Items.Remove(this.listView1.SelectedItems[0]);
             }
         }
     }
     else
     {
         MessageBoxHelper.Show("请先选中需要删除的照片!");
     }
 }
Exemple #4
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (this.listView1.SelectedIndices != null && this.listView1.SelectedIndices.Count == 1)
            {
                VehiclePhoto temp = this.photos[this.listView1.SelectedIndices[0]] as VehiclePhoto;
                if (MessageBoxHelper.Confirm("ȷ��ɾ��" + temp.Cn_Classical + "-" + temp.Cn_Type + "��"))
                {
                    VehiclePhotoAccess access = new VehiclePhotoAccess();
                    if (access.Delete(temp))
                    {
                        this.photos.RemoveAt(this.listView1.SelectedIndices[0]);
                        this.listView1.Items.Remove(this.listView1.SelectedItems[0]);

                    }
                }
            }
            else
            {
                MessageBoxHelper.Show("����ѡ����Ҫɾ������Ƭ��");
            }
        }
Exemple #5
0
        private void Search()
        {
            string classical = this.cbClassical.Text.Trim();
            string type = this.cbType.Text.Trim();
            if (classical == string.Empty && type == string.Empty)
            {
               // MessageBoxHelper.Show("������ѡ��һ�������ٲ�ѯ��");
                return;

            }
            string condition = "where 1=1 ";
            if (classical != string.Empty)
            {
                condition += " and cn_classical like '%" + classical + "%'";
            }
            if (type != string.Empty && type != "��ѡ��")
            {
                condition += " and cn_type like '%" + type + "%'";
            }
            VehiclePhotoAccess access = new VehiclePhotoAccess();
            this.photos = access.SearchList(condition);
            this.ReloadCollection();
        }
Exemple #6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (this.picPhoto.Image == null)
            {
                MessageBoxHelper.Show("请先选择一个照片!");
                return;
            }
            string classical = this.cbClassical.Text.Trim();
            string type      = this.cbType.Text.Trim();

            if (classical == string.Empty || classical == "请选择")
            {
                MessageBoxHelper.Show("请选择或者输入中文品牌!");
                return;
            }
            if (type == string.Empty || type == "请选择")
            {
                MessageBoxHelper.Show("请选择或者输入车辆型号!");
                return;
            }
            VehiclePhotoAccess access = new VehiclePhotoAccess();
            VehiclePhoto       photo  = new VehiclePhoto();

            photo.Cn_Classical = classical;
            photo.Cn_Type      = type;
            photo.Picture      = this.picPhoto.Image;
            photo.Suffix       = this.suffix;
            bool result = access.Add(photo);

            if (result)
            {
                if (access.UpdateImage(access.GetLasted().Id, photo.Picture))
                {
                    object obj = access.ExecuteScalar("select count(*) from table_dict where c_grouptype='中文品牌' and c_text='" + this.cbClassical.Text + "'");
                    if (Convert.ToInt32(obj) == 0)
                    {
                        Dict temp = new Dict();
                        temp.Text        = this.cbClassical.Text;
                        temp.Value       = this.cbClassical.Text;
                        temp.Valid       = "有效";
                        temp.GroupType   = "中文品牌";
                        temp.Description = temp.Text;
                        FT.DAL.Orm.SimpleOrmOperator.Create(temp);
                        ArrayList lists = this.cbClassical.DataSource as ArrayList;
                        lists.Add(temp);
                        this.cbClassical.DataSource = lists;
                        //this.cbClassical.Items.Add(temp.Text);
                    }
                    object obj2 = access.ExecuteScalar("select count(*) from table_dict where c_grouptype='车辆型号' and c_text='" + this.cbType.Text + "'");
                    if (Convert.ToInt32(obj2) == 0)
                    {
                        Dict temp = new Dict();
                        temp.Text        = this.cbType.Text;
                        temp.Value       = this.cbType.Text;
                        temp.Valid       = "有效";
                        temp.GroupType   = "车辆型号";
                        temp.Description = this.cbClassical.Text;
                        FT.DAL.Orm.SimpleOrmOperator.Create(temp);
                        ArrayList lists = this.cbType.DataSource as ArrayList;
                        lists.Add(temp);
                        this.cbType.DataSource = lists;
                        //this.cbType.Items.Add(temp.Text);
                    }
                    MessageBoxHelper.Show("添加成功!");
                    //Constant.InitCbCnClassical(this.cbClassical);
                }
                else
                {
                    MessageBoxHelper.Show("更新图片过程失败!");
                }
            }
            else
            {
                MessageBoxHelper.Show("添加数据失败!");
            }
        }
Exemple #7
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (this.picPhoto.Image == null)
            {
                MessageBoxHelper.Show("����ѡ��һ����Ƭ��");
                return;
            }
            string classical = this.cbClassical.Text.Trim();
            string type = this.cbType.Text.Trim();
            if (classical == string.Empty || classical == "��ѡ��")
            {
                MessageBoxHelper.Show("��ѡ�������������Ʒ�ƣ�");
                return;

            }
            if (type == string.Empty || type == "��ѡ��")
            {
                MessageBoxHelper.Show("��ѡ��������복���ͺţ�");
                return;
            }
            VehiclePhotoAccess access = new VehiclePhotoAccess();
            VehiclePhoto photo = new VehiclePhoto();
            photo.Cn_Classical = classical;
            photo.Cn_Type = type;
            photo.Picture = this.picPhoto.Image;
            photo.Suffix = this.suffix;
            bool result = access.Add(photo);
            if (result)
            {
                if (access.UpdateImage(access.GetLasted().Id, photo.Picture))
                {
                    object obj=access.ExecuteScalar("select count(*) from table_dict where c_grouptype='����Ʒ��' and c_text='" + this.cbClassical.Text + "'");
                    if (Convert.ToInt32(obj) == 0)
                    {
                        Dict temp = new Dict();
                        temp.Text = this.cbClassical.Text;
                        temp.Value = this.cbClassical.Text;
                        temp.Valid = "��Ч";
                        temp.GroupType = "����Ʒ��";
                        temp.Description = temp.Text;
                        FT.DAL.Orm.SimpleOrmOperator.Create(temp);
                        ArrayList lists = this.cbClassical.DataSource as ArrayList;
                        lists.Add(temp);
                        this.cbClassical.DataSource = lists;
                        //this.cbClassical.Items.Add(temp.Text);
                    }
                    object obj2 = access.ExecuteScalar("select count(*) from table_dict where c_grouptype='�����ͺ�' and c_text='" + this.cbType.Text + "'");
                    if (Convert.ToInt32(obj2) == 0)
                    {
                        Dict temp = new Dict();
                        temp.Text = this.cbType.Text;
                        temp.Value = this.cbType.Text;
                        temp.Valid = "��Ч";
                        temp.GroupType = "�����ͺ�";
                        temp.Description = this.cbClassical.Text;
                        FT.DAL.Orm.SimpleOrmOperator.Create(temp);
                        ArrayList lists = this.cbType.DataSource as ArrayList;
                        lists.Add(temp);
                        this.cbType.DataSource = lists;
                        //this.cbType.Items.Add(temp.Text);
                    }
                    MessageBoxHelper.Show("��ӳɹ���");
                    //Constant.InitCbCnClassical(this.cbClassical);
                }
                else
                {
                    MessageBoxHelper.Show("����ͼƬ����ʧ�ܣ�");
                }

            }
            else
            {
                MessageBoxHelper.Show("�������ʧ�ܣ�");
            }
        }