Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string clasName  = this.txtClassName.Text?.Trim();
            string spName    = this.txtSpName.Text?.Trim();
            string conStr    = Home.Constr;
            string NameSpace = this.textBox1.Text?.Trim();
            SPlist sp        = new SPlist();

            sp.Spname     = spName;
            sp.ClassName  = clasName;
            sp.MethodName = txtMethod.Text;
            sp.IsNonQuery = checkBox2.Checked;
            sp.IsSingle   = checkBox3.Checked;

            SpParamResultDetail m = new CodeGenerator().GenerateModel(spName, clasName, _constr, NameSpace);

            if (checkBox1.Checked)
            {
                if (string.IsNullOrEmpty(txtMethod.Text))
                {
                    MessageBox.Show("Provide Name for Repo Method");
                }
                else
                {
                    m.RepoMethod = new CodeGenerator().GenerateRepoMethod(sp);
                }
            }

            SpParamClass objparam = new SpParamClass(m);

            objparam.ShowDialog();
        }
Example #2
0
        private void btnGo_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtNameSpace.Text))
            {
                MessageBox.Show("Prove Value for Name space ");
                return;
            }

            List <SPlist> lst  = new List <SPlist>();
            CodeGenerator _gen = new CodeGenerator();

            for (int rows = 0; rows < dataGridView1.Rows.Count; rows++)
            {
                SPlist obj = new SPlist();
                obj.Spname     = dataGridView1.Rows[rows].Cells["spname"].Value?.ToString();
                obj.ClassName  = dataGridView1.Rows[rows].Cells["Classname"].Value?.ToString();
                obj.MethodName = dataGridView1.Rows[rows].Cells["MethodName"].Value?.ToString();
                obj.IsNonQuery = Convert.ToBoolean(dataGridView1.Rows[rows].Cells["IsNonQuery"].Value);
                obj.IsSingle   = Convert.ToBoolean(dataGridView1.Rows[rows].Cells["IsSingle"].Value);
                if (!string.IsNullOrEmpty(obj.Spname))
                {
                    lst.Add(obj);
                }
            }
            SpParamResultDetail m = _gen.GenerateModel(lst, Home.Constr, txtNameSpace.Text);

            m.Consts = _gen.GenerateConsts(lst);

            if (checkBox1.Checked)
            {
                if (!string.IsNullOrEmpty(textBox2.Text) && !string.IsNullOrEmpty(textBox2.Text))
                {
                    m.Repo = _gen.GenerateRepo(lst, textBox2.Text, textBox3.Text);
                }

                else
                {
                    MessageBox.Show("Please provide Value for Repo Namesapce and Repo class");
                }
            }

            SpParamClass objparam = new SpParamClass(m);

            objparam.ShowDialog();
        }