Exemple #1
0
        protected void Button_Save_Click(object sender, EventArgs e)
        {
            try
            {
                Error.Visible = false;
                GenDoc myDoc = new GenDoc();
                ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "ClientScript", "alert('function disabled; Are you sure that you want to save ? ')", true);

                string        _tableName = txtTableName.Text;
                List <string> myData     = new List <string>();
                string[]      records    = TextBox_Details.Text.Split('\r');
                for (int i = 0; i < records.Length; i++)
                {
                    myData.Add(records[i].ToString().Trim());
                }

                DB_Operations con = new DB_Operations();

                myDoc = new GenDoc(myData);
                //SqlCommand objcmd = new SqlCommand("Insert into Interview values ('" + myData + "')");
                int retcode  = con.InsertUpdateDeleteQry("Insert into Interview values ('" + myData + "')");
                int retcode2 = con.InsertUpdateDeleteQry("Insert into Interview values ('" + myDoc + "')");
            }

            catch (Exception ex)
            {
                Error.Visible = true;
            }
        }
        protected virtual void button_GetDocument(string cmdStr)
        {
            try
            {
                //_documentNum = Int32.Parse(textBox_DocNum.Text);
                //_documentType = Int32.Parse(textBox_DocType.Text);
                panel1.Visible = true;

                //    List<string> myData = Utilities.DataBaseUtility.GetDocumentData(textBox_TableName.Text, _documentType, _documentNum);
                List <string> myData = Utilities.DataBaseUtility.GetDocumentData(cmdStr);// textBox_Cmd.Text);
                if (myData.Count < 2)
                {
                    MessageBox.Show("can't find document for : " + cmdStr);
                }
                myData.RemoveAt(0);
                myDoc = new GenDoc(myData);
                //  string cmdStr = "select * from GenDocs " +
                //           String.Format("where docNum = {0} and docType = {1}", _documentID, _documentType);
                textBox_DataStrings.Text = myData[0];

                //List<string> _records = Utilities.DataBaseUtility.GetList(cmdStr);
                listBox_DataStrings.Items.Clear();
                listBox_DataStrings.Items.Add(myData[0]);
                string[] fields = myData[0].Split(',');
                textBox_ProcessID.Text = fields[0].ToString();
                int docNumber = Int32.Parse(textBox_ProcessID.Text);
                textBox_DocType.Text  = fields[1].ToString();
                textBox_ExtAgent.Text = fields[2].ToString();
                textBox_IntAgent.Text = fields[3].ToString();
                textBox_Status.Text   = fields[4].ToString();
                //   textBox_TableName.Text =
                textBox_ProcessID.Text    = fields[5].ToString();
                textBox_TextValue1.Text   = fields[6].ToString();
                textBox_TextValue2.Text   = fields[7].ToString();   //  StatusDate
                textBox_QuotedAmount.Text = fields[8].ToString();   //  quotedAmount
                textBox_ActualAmount.Text = fields[9].ToString();   //  actualAmount
                textBox_Comment.Text      = fields[10].ToString();
                string cmdStr2 = String.Format("select * from {0}_Details where docNum = {1} and doctype = {2}",
                                               textBox_TableName.Text.Trim(), textBox_DocNum.Text, textBox_DocType.Text);
                _documentValues          = Utilities.DataBaseUtility.GetTable(cmdStr2);
                dataGridView1.DataSource = _documentValues;
                myData = Utilities.DataBaseUtility.GetList(cmdStr2);
                if (myData.Count < 3)
                {
                    return;
                }
                for (int i = 1; i < myData.Count; i++)
                {
                    textBox_DataStrings.Text += "\r\n" + myData[i];
                    listBox_DataStrings.Items.Add(myData[i]);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("  error in reading GenDocs " + ex.Message);
            }
        }
        protected virtual void button_ValidateData_Click(object sender, EventArgs e)
        {
            List <string> datastrings = new List <string>();

            listBox_DataStrings.Items.Clear();
            StringBuilder dataString1 = new StringBuilder();

            dataString1.Append(textBox_DocNum.Text + " ,");
            dataString1.Append(textBox_DocType.Text + " ,");
            dataString1.Append(textBox_ExtAgent.Text + " ,");
            dataString1.Append(textBox_IntAgent.Text + " ,");
            dataString1.Append(textBox_Status.Text + " ,");
            dataString1.Append(textBox_ProcessID.Text + " ,");
            dataString1.Append("'" + textBox_TextValue1.Text + "' ,");
            dataString1.Append("'" + textBox_TextValue2.Text + "' ,");
            dataString1.Append(textBox_QuotedAmount.Text + " ,");
            dataString1.Append(textBox_ActualAmount.Text + " ,");
            dataString1.Append("'" + textBox_Comment.Text + "'");
            listBox_DataStrings.Items.Add(dataString1.ToString());
            datastrings.Add(dataString1.ToString());
            int lastrow = dataGridView1.Rows.Count - 1;

            for (int i = 0; i < lastrow; i++)
            {
                StringBuilder dataString2 = new StringBuilder();
                dataString2.Append(dataGridView1.Rows[i].Cells[0].Value.ToString());
                for (int j = 1; j < 7; j++)
                {
                    dataString2.Append(" ," + (dataGridView1.Rows[i].Cells[j]).Value.ToString());
                }
                dataString2.Append(" ,'" + (dataGridView1.Rows[i].Cells[7]).Value.ToString() + "'");
                listBox_DataStrings.Items.Add(dataString2.ToString());
                datastrings.Add(dataString1.ToString());
            }
            GenDoc testObject  = new GenDoc(datastrings);
            int    returnValue = 0; // testObject.CheckValues(datastrings);

            string[] fieldNames = { "DocNumber",  "DocType",    "ExternalRef", "InternalRef", "Status", "DocRef",
                                    "TextValue1", "TextValue2", "NumValue1",   "NumValue2",   "Comment" };
            if (returnValue > 0)
            {
                int      indx         = returnValue;
                string[] fields       = datastrings[0].Split(',');
                string   errorMessage = string.Format(" Error in {0}. \r\n \r\n Error in field {1}. \r\n Value {2} is not valid", textBox_TableName.Text, fieldNames[indx], fields[indx]);
                MessageBox.Show(errorMessage);
            }
        }
Exemple #4
0
        private void button_Save_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("are you sure that you want to save ?", "Verify Operation",
                                              MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            if (dr == DialogResult.No)
            {
                MessageBox.Show(" Operation Cancelled by user ");
                return;
            }

            GenDoc myDoc   = new GenDoc(dataStringsList);
            int    retcode = myDoc.SaveDocument(base.ident, "Interview", textBox_DocNum.Text, textBox_DocType.Text, dataStringsList);

            MessageBox.Show("Schedule new Interview successfully");
            this.Close();
        }
Exemple #5
0
        private void button_Save_Click_1(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("are you sure that you want to save ?", "Verify Operation",
                                              MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            if (dr == DialogResult.No)
            {
                MessageBox.Show(" Operation Cancelled by user ");
                return;
            }
            //   (response == "yes")
            string        _tableName = textBox_TableName.Text;
            List <string> myData     = new List <string>();

            for (int i = 0; i < listBox_DataStrings.Items.Count; i++)
            {
                myData.Add(listBox_DataStrings.Items[i].ToString());
            }
            int    myDataCount = myData.Count;
            GenDoc myDoc       = new GenDoc(myData);
            int    retcode     = myDoc.SaveDocument(base.ident, _tableName, textBox_DocNum.Text, textBox_DocType.Text, myData);
            // string retMessage = myDoc.SaveDocument(base.ident, textBox_TableName.Text, textBox_DocumentID.Text, textBox_DocType.Text, myData);
        }
        private void button_ValidateData_Click(object sender, EventArgs e)
        {
            List<string> datastrings = new List<string>();
            listBox_DataStrings.Items.Clear();
            StringBuilder dataString1 = new StringBuilder();
            dataString1.Append(textBox_DocNum.Text + " ,");
            dataString1.Append(textBox_DocType.Text + " ,");
            dataString1.Append(textBox_empID.Text + " ,");
            dataString1.Append(textBox_manID.Text + " ,");
            dataString1.Append(textBox_docRef.Text + " ,");
            dataString1.Append(textBox_status.Text + " ,");
            dataString1.Append("'" + textBox_startDate.Text + "' ,");
            dataString1.Append("'" + textBox_endDate.Text + "' ,");
            dataString1.Append(textBox_workHours.Text + " ,");
            dataString1.Append(textBox_overTime.Text + " ,");
            dataString1.Append(textBox_approve.Text.Trim() + ",");
            dataString1.Append("'" + textBox_comments.Text + "'");
            Console.WriteLine(dataString1.ToString());

            listBox_DataStrings.Items.Add(dataString1.ToString());
            datastrings.Add(dataString1.ToString());
            int lastrow = dataGridView1.Rows.Count - 1;
            for (int i = 0; i < lastrow; i++)
            {
                StringBuilder dataString2 = new StringBuilder();
                dataString2.Append(dataGridView1.Rows[i].Cells[0].Value.ToString());
                for (int j = 1; j < 11; j++)
                    dataString2.Append(" ," + (dataGridView1.Rows[i].Cells[j]).Value.ToString());
                dataString2.Append(" ,'" + (dataGridView1.Rows[i].Cells[11]).Value.ToString() + "'");
                listBox_DataStrings.Items.Add(dataString2.ToString());
                datastrings.Add(dataString1.ToString());

            }
            GenDoc testObject = new GenDoc(datastrings);
            int returnValue = testObject.CheckValues(datastrings);
            string[] fieldNames = {"DocNumber","DocType","Employee ID(IntRef)","Manager ID(ExtRef)","Status","DocRef",
                                   "Period Start Date","Period End Date","Work Hours","Overtime","Approval","Comments"};
            if (returnValue > 0)
            {
                int indx = returnValue;
                string[] fields = datastrings[0].Split(',');
                string errorMessage = string.Format(" Error in {0}. \r\n \r\n Error in field {1}. \r\n Value {2} is not valid", textBox_TableName.Text, fieldNames[indx], fields[indx]);
                MessageBox.Show(errorMessage);
            }
        }
        private void button_GetDoc_Click(object sender, EventArgs e)
        {
            {
                // try
                // {
                _documentNum = Int32.Parse(textBox_DocNum.Text);
                _documentType = Int32.Parse(textBox_DocType.Text);
                panel1.Visible = true;
                string cmdStr = string.Format(" select * from {0} where DocType = {1} and DocNum = {2} ",
                                                    textBox_TableName.Text, _documentType, _documentNum);
                //    List<string> myData = Utilities.DataBaseUtility.GetDocumentData(textBox_TableName.Text, _documentType, _documentNum);
                List<string> myData = Utilities.DataBaseUtility.GetDocumentData(textBox_Cmd.Text);
                if (myData.Count < 2)
                {
                    MessageBox.Show("can't find document for : " + cmdStr);
                }
                myData.RemoveAt(0);
                myDoc = new GenDoc(myData);
                //  string cmdStr = "select * from GenDocs " +
                //           String.Format("where docNum = {0} and docType = {1}", _documentID, _documentType);
                textBox_DataStrings.Text = myData[0];

                //List<string> _records = Utilities.DataBaseUtility.GetList(cmdStr);
                listBox_DataStrings.Items.Clear();
                listBox_DataStrings.Items.Add(myData[0]);
                string[] fields = myData[0].Split(',');
                textBox_status.Text = fields[0].ToString();
                int docNumber = Int32.Parse(textBox_status.Text);
                textBox_DocType.Text = fields[1].ToString();
                textBox_empID.Text = fields[2].ToString();
                textBox_manID.Text = fields[3].ToString();
                textBox_docRef.Text = fields[4].ToString();

                textBox_status.Text = fields[5].ToString();
                textBox_startDate.Text = fields[6].ToString();
                textBox_endDate.Text = fields[7].ToString();
                textBox_workHours.Text = fields[8].ToString();
                textBox_overTime.Text = fields[9].ToString();
                textBox_approve.Text = fields[10].ToString();
                textBox_comments.Text = fields[11].ToString();
                string cmdStr2 = String.Format("select * from {0} where docNum = {1} and doctype = {2}",
                           textBox_TableName.Text.Trim(), _documentNum, _documentType);
                _documentValues = Utilities.DataBaseUtility.GetTable(cmdStr2);
                dataGridView1.DataSource = _documentValues;
                myData = Utilities.DataBaseUtility.GetList(cmdStr2);
                if (myData.Count < 3) return;

                for (int i = 1; i < myData.Count; i++)
                {

                    textBox_DataStrings.Text += "\r\n" + myData[i];
                    listBox_DataStrings.Items.Add(myData[i]);
                }
            }
        }
        private void button_ValidateData_Click(object sender, EventArgs e)
        {
            List<string> datastrings = new List<string>();
            listBox_DataStrings.Items.Clear();
            StringBuilder dataString1 = new StringBuilder();
            dataString1.Append(textBox_DocNum.Text + " ,");
            dataString1.Append(textBox_DocType.Text + " ,");
            dataString1.Append(textBox_ExtAgent.Text + " ,");
            dataString1.Append(textBox_IntAgent.Text + " ,");
            dataString1.Append(textBox_Status.Text + " ,");
            dataString1.Append(textBox_ProcessID.Text + " ,");
            dataString1.Append("'" +textBox_TextValue1.Text + "' ,");
            dataString1.Append("'" +textBox_TextValue2.Text + "' ,");
            dataString1.Append(textBox_QuotedAmount.Text + " ,");
            dataString1.Append(textBox_ActualAmount.Text + " ,");
            dataString1.Append("'" + textBox_Comment.Text +"'");
            listBox_DataStrings.Items.Add(dataString1.ToString());
            datastrings.Add(dataString1.ToString());
            int lastrow = dataGridView1.Rows.Count - 1;
            for (int i = 0; i < lastrow; i++)
            {
                StringBuilder dataString2 = new StringBuilder();
                dataString2.Append(dataGridView1.Rows[i].Cells[0].Value.ToString());
                for (int j = 1; j < 7; j++)
                    dataString2.Append(" ," + (dataGridView1.Rows[i].Cells[j]).Value.ToString());
                    dataString2.Append(" ,'" + (dataGridView1.Rows[i].Cells[7]).Value.ToString() + "'");
                listBox_DataStrings.Items.Add(dataString2.ToString());
                datastrings.Add(dataString1.ToString());

            }
            GenDoc testObject = new GenDoc(datastrings);
            int returnValue = testObject.CheckValues(datastrings);
            string[] fieldNames = {"DocNumber","DocType","ExternalRef","InternalRef","Status","DocRef",
                                   "TextValue1","TextValue2","NumValue1","NumValue2","Comment"};
            if (returnValue > 0)
            {
                int indx =  returnValue;
                string[] fields = datastrings[0].Split(',');
                string errorMessage = string.Format(" Error in {0}. \r\n \r\n Error in field {1}. \r\n Value {2} is not valid", textBox_TableName.Text, fieldNames[indx], fields[indx]);
                MessageBox.Show(errorMessage);
            }
        }
        private void button_GetDocument_Click(object sender, EventArgs e)
        {
            // try
               // {
                _documentNum = Int32.Parse(textBox_DocNum.Text);
                _documentType = Int32.Parse(textBox_DocType.Text);
                panel1.Visible = true;
                string cmdStr = string.Format(" select * from {0} where DocType = {1} and DocNum = {2} ",
                                                    textBox_TableName.Text, _documentType, _documentNum);
            //    List<string> myData = Utilities.DataBaseUtility.GetDocumentData(textBox_TableName.Text, _documentType, _documentNum);
                List<string> myData = Utilities.DataBaseUtility.GetDocumentData( textBox_Cmd.Text);
                if (myData.Count < 2)
                {
                    MessageBox.Show("can't find document for : " + cmdStr);
                }
                myData.RemoveAt(0);
                myDoc = new GenDoc(myData);
              //  string cmdStr = "select * from GenDocs " +
              //           String.Format("where docNum = {0} and docType = {1}", _documentID, _documentType);
                textBox_DataStrings.Text = myData[0];

                //List<string> _records = Utilities.DataBaseUtility.GetList(cmdStr);
                listBox_DataStrings.Items.Clear();
                listBox_DataStrings.Items.Add(myData[0]);
                string[] fields = myData[0].Split(',');
                textBox_ProcessID.Text = fields[0].ToString();
                int docNumber = Int32.Parse(textBox_ProcessID.Text);
                textBox_DocType.Text = fields[1].ToString();
                textBox_ExtAgent.Text = fields[2].ToString();
                textBox_IntAgent.Text = fields[3].ToString();
                textBox_Status.Text = fields[4].ToString();

                textBox_ProcessID.Text = fields[5].ToString();
                textBox_TextValue1.Text = fields[6].ToString();
                textBox_TextValue2.Text = fields[7].ToString();     //  StatusDate
                textBox_QuotedAmount.Text = fields[8].ToString();     //  quotedAmount
                textBox_ActualAmount.Text = fields[9].ToString();     //  actualAmount
                textBox_Comment.Text = fields[10].ToString();
                string cmdStr2 = String.Format("select * from {0}_Details where docNum = {1} and doctype = {2}",
                           textBox_TableName.Text.Trim(),  _documentNum, _documentType);
                _documentValues = Utilities.DataBaseUtility.GetTable(cmdStr2);
                dataGridView1.DataSource = _documentValues;
                myData  = Utilities.DataBaseUtility.GetList(cmdStr2);
                if (myData.Count < 3) return;
                for (int i = 1; i < myData.Count; i++)
                {
                    textBox_DataStrings.Text += "\r\n" + myData[i];
                    listBox_DataStrings.Items.Add(myData[i]);
                }
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show("  error in reading GenDocs " + ex.Message);
            //}
        }