Exemplo n.º 1
0
 public override bool InsertObject(string tableNam, CommonEntityBase model)
 {
     try
     {
         cpsHelper.insertSingle(string.Format("{0}_{1}", tableNam, model.PrimaryKey), SerializeToXml(model));
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemplo n.º 2
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (textBox3.Text.Equals("") && textBox4.Text.Equals("") && textBox5.Text.Equals("") && textBox6.Text.Equals("") && textBox7.Text.Equals("") && textBox8.Text.Equals("") && textBox9.Text.Equals("") && textBox10.Text.Equals("") && comboBox1.Text.Equals(""))
            {
                MessageBox.Show("FILL THE DETAILS");
                textBox3.Text  = "";
                textBox4.Text  = "";
                textBox5.Text  = "";
                textBox6.Text  = "";
                textBox7.Text  = "";
                textBox8.Text  = "";
                textBox9.Text  = "";
                textBox10.Text = "";
                comboBox1.Text = "";
            }

            else
            {
                try
                {
                    if (radioButton1.Checked == true)
                    {
                        // string PATH = @"Person.xml";
                        List <string> connectionStrings = new List <string>();
                        connectionStrings.Add("tcps://cloud-eu-0.clusterpoint.com:9008");
                        connectionStrings.Add("tcps://cloud-eu-1.clusterpoint.com:9008");
                        connectionStrings.Add("tcps://cloud-eu-2.clusterpoint.com:9008");
                        connectionStrings.Add("tcps://cloud-eu-3.clusterpoint.com:9008");

                        Dictionary <string, string> additionalParams = new Dictionary <string, string>();
                        additionalParams["account"] = "649";

                        CPS_Connection cpsConn = new CPS_Connection(new CPS_LoadBalancer(connectionStrings), "cabs", "*****@*****.**", "suraj@123", "document", "//document/id", additionalParams

                                                                    );
                        //cpsConn.setDebug(true);
                        //cpsConn.setCustomSSLValidation("addtrustexternalcaroot.crt", "cloud-eu.clusterpoint.com");
                        CPS_Simple cpsSimple = new CPS_Simple(cpsConn);

                        XmlWriter xmlWriter = XmlWriter.Create(PATH);

                        // xmlWriter.WriteStartDocument();
                        xmlWriter.WriteStartElement("document");

                        xmlWriter.WriteStartElement("mobile");
                        xmlWriter.WriteString(textBox4.Text);
                        xmlWriter.WriteEndElement();


                        xmlWriter.WriteStartElement("name");
                        xmlWriter.WriteString(textBox3.Text);
                        xmlWriter.WriteEndElement();


                        xmlWriter.WriteStartElement("email");
                        xmlWriter.WriteString(textBox5.Text);
                        xmlWriter.WriteEndElement();

                        xmlWriter.WriteStartElement("payment");
                        xmlWriter.WriteString(comboBox1.Text);
                        xmlWriter.WriteEndElement();

                        xmlWriter.WriteStartElement("pickup");
                        xmlWriter.WriteString(textBox6.Text);
                        xmlWriter.WriteEndElement();

                        xmlWriter.WriteStartElement("dropby");
                        xmlWriter.WriteString(textBox7.Text);
                        xmlWriter.WriteEndElement();

                        xmlWriter.WriteStartElement("date");
                        xmlWriter.WriteString(textBox8.Text);
                        xmlWriter.WriteEndElement();

                        xmlWriter.WriteStartElement("time");
                        xmlWriter.WriteString(textBox10.Text);
                        xmlWriter.WriteEndElement();

                        xmlWriter.WriteStartElement("address");
                        xmlWriter.WriteString(textBox9.Text);
                        xmlWriter.WriteEndElement();

                        xmlWriter.WriteEndDocument();

                        xmlWriter.Close();

                        string id = textBox4.Text;


                        XmlDocument doc2 = new XmlDocument();
                        doc2.Load(PATH);

                        // Insert

                        cpsSimple.insertSingle(id, doc2.DocumentElement);



                        Form3 newForm = new Form3();
                        newForm.Show();
                        this.Hide();
                    }
                    else if (radioButton2.Checked == true)
                    {
                        Class1.pickup = textBox6.Text;
                        Class1.dropby = textBox7.Text;
                        Class1.date   = textBox8.Text;
                        Class1.time   = textBox10.Text;
                        Form4 newForm = new Form4();
                        newForm.Show();
                        this.Hide();
                    }
                    else
                    {
                        Form3 newForm = new Form3();
                        newForm.Show();
                        this.Hide();
                    }
                }

                catch (CPS_Exception ex)
                {
                    // error message can be retrieved using ex.ToString()

                    //  MessageBox.Show(ex.ToString());
                    textBox3.Text  = "";
                    textBox4.Text  = "";
                    textBox5.Text  = "";
                    textBox6.Text  = "";
                    textBox7.Text  = "";
                    textBox8.Text  = "";
                    textBox9.Text  = "";
                    textBox10.Text = "";
                    comboBox1.Text = "";
                }
            }
        }
Exemplo n.º 3
0
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox3.Text.Equals("") && textBox4.Text.Equals("") && textBox5.Text.Equals("") && textBox6.Text.Equals("") && textBox7.Text.Equals(""))
                {
                    MessageBox.Show("FILL THE DETAILS");
                    textBox1.Text = "";
                    textBox2.Text = "";
                    textBox3.Text = "";
                    textBox4.Text = "";
                    textBox5.Text = "";
                }

                if (textBox1.Text.Equals(""))
                {
                    MessageBox.Show("FULL NAME is empty");
                    textBox1.Text = "";
                }
                if (textBox2.Text.Equals(""))
                {
                    MessageBox.Show("MOBILE NUMBER is empty");
                    textBox2.Text = "";
                }
                if (textBox3.Text.Equals(""))
                {
                    MessageBox.Show("EMAIL is empty");
                    textBox3.Text = "";
                }
                if (textBox4.Text.Equals("") && textBox5.Text.Equals(""))
                {
                    MessageBox.Show("PASSWORD is empty");
                    textBox4.Text = "";
                    textBox5.Text = "";
                }
                else
                {
                    if (textBox4.Text == textBox5.Text)
                    {
                        // string PATH = @"Person.xml";
                        List <string> connectionStrings = new List <string>();
                        connectionStrings.Add("tcps://cloud-eu-0.clusterpoint.com:9008");
                        connectionStrings.Add("tcps://cloud-eu-1.clusterpoint.com:9008");
                        connectionStrings.Add("tcps://cloud-eu-2.clusterpoint.com:9008");
                        connectionStrings.Add("tcps://cloud-eu-3.clusterpoint.com:9008");

                        Dictionary <string, string> additionalParams = new Dictionary <string, string>();
                        additionalParams["account"] = "649";

                        CPS_Connection cpsConn = new CPS_Connection(new CPS_LoadBalancer(connectionStrings), "myapp", "*****@*****.**", "suraj@123", "document", "//document/id", additionalParams

                                                                    );
                        //cpsConn.setDebug(true);
                        //cpsConn.setCustomSSLValidation("addtrustexternalcaroot.crt", "cloud-eu.clusterpoint.com");
                        CPS_Simple cpsSimple = new CPS_Simple(cpsConn);

                        XmlWriter xmlWriter = XmlWriter.Create(PATH);

                        // xmlWriter.WriteStartDocument();
                        xmlWriter.WriteStartElement("document");

                        xmlWriter.WriteStartElement("fname");
                        xmlWriter.WriteString(textBox1.Text);
                        xmlWriter.WriteEndElement();

                        xmlWriter.WriteStartElement("id");
                        xmlWriter.WriteString(textBox2.Text);
                        xmlWriter.WriteEndElement();

                        xmlWriter.WriteStartElement("email");
                        xmlWriter.WriteString(textBox3.Text);
                        xmlWriter.WriteEndElement();

                        xmlWriter.WriteStartElement("pwd");
                        xmlWriter.WriteString(textBox4.Text);
                        xmlWriter.WriteEndElement();


                        xmlWriter.WriteEndDocument();

                        xmlWriter.Close();

                        string id1 = "";

                        XmlDocument doc1 = new XmlDocument();
                        doc1.Load(PATH);

                        // Insert
                        cpsSimple.insertSingle(id1, doc1.DocumentElement);


                        Form1 newForm = new Form1();
                        newForm.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("PASSWORD MISMATCH");
                        textBox4.Text = "";
                        textBox5.Text = "";
                    }
                }
            }
            catch (CPS_Exception ex)
            {
                // error message can be retrieved using ex.ToString()
                ex.ToString();
                MessageBox.Show("MOBILE NUMBER EXISTS");
                textBox1.Text = "";
                textBox2.Text = "";
                textBox3.Text = "";
                textBox4.Text = "";
                textBox5.Text = "";
            }
        }