Exemple #1
0
        private void button3_Click_1(object sender, EventArgs e)
        {
            string fileID = Guid.NewGuid().ToString();
            string Query  = "DELETE from client WHERE clientID ='" + id + "'";

            Helper.Execute(Query, DBConnect.conn);
            MessageBox.Show("Information deleted");
            ClientForm frm = new ClientForm();

            frm.MdiParent = MainForm.ActiveForm;
            frm.Dock      = DockStyle.Fill;
            frm.Show();
            this.Close();
        }
Exemple #2
0
        private void updateBtn_Click_1(object sender, EventArgs e)
        {
            string     filename = @"c:\Case\\images\" + id.Trim() + ".jpg";
            FileStream fstream  = new FileStream(filename, FileMode.Create);

            imgCapture.Image.Save(fstream, System.Drawing.Imaging.ImageFormat.Jpeg);
            fstream.Close();


            string image = @"c:\Case\\images\" + id.Trim() + ".jpg";

            if (System.IO.File.Exists(image))
            {
                try
                {
                    string filepath   = image;
                    string localPath  = new Uri(filepath).LocalPath;
                    string remotePath = Helper.uploadUrl;

                    WebClient theClient     = new WebClient();
                    byte[]    responseArray = theClient.UploadFile(remotePath, filepath);
                    Console.WriteLine("\nResponse Received.The contents of the file uploaded are:\n{0}", System.Text.Encoding.ASCII.GetString(responseArray));
                    theClient.Dispose();
                }
                catch (Exception c)
                {
                }
            }

            string Query;

            if (passwordTxtBx.Text != "")
            {
                Query = "UPDATE `client` SET `name`='" + this.nameTxtBx.Text + "',`email`='" + this.emailTxtBx.Text + "',`image`='" + id.Trim() + ".jpg" + "' ,`password`='" + Helper.MD5Hash(this.passwordTxtBx.Text) + "',`status`='" + this.statusCbx.Text + "',`contact`='" + this.contactTxtBx.Text + "',`address`='" + this.addressTxtBx.Text + "',`sync`='f',`lawyer`='" + supervisorCbx.Text + "',`action`='update' WHERE clientID = '" + id + "'";
            }
            else
            {
                Query = "UPDATE `client` SET `name`='" + this.nameTxtBx.Text + "',`email`='" + this.emailTxtBx.Text + "',`image`='" + id.Trim() + ".jpg" + "',`status`='" + this.statusCbx.Text + "',`contact`='" + this.contactTxtBx.Text + "',`address`='" + this.addressTxtBx.Text + "',`sync`='f',`lawyer`='" + supervisorCbx.Text + "',`action`='update' WHERE clientID = '" + id + "'";
            }
            Helper.Execute(Query, DBConnect.conn);
            MessageBox.Show("Information Updated");
            ClientForm frm = new ClientForm();

            frm.MdiParent = MainForm.ActiveForm;
            frm.Dock      = DockStyle.Fill;
            frm.Show();
            this.Close();
        }