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;
            }
        }
Exemple #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            int       EMP_ID = Convert.ToInt32(HttpContext.Current.Session["user"]);
            string    res    = "select * from Timesheets where Emp_ID=" + EMP_ID + " and week_id=(select max(week_id) from timesheets where Emp_ID=" + EMP_ID + ")";
            DataTable s      = db.SelectQry(res);


            y = s.Rows[0];
            List <Int32> hourslist = new List <int>();

            hourslist.Add(Convert.ToInt32(TextBox1.Text));
            hourslist.Add(Convert.ToInt32(TextBox2.Text));
            hourslist.Add(Convert.ToInt32(TextBox3.Text));
            hourslist.Add(Convert.ToInt32(TextBox4.Text));
            hourslist.Add(Convert.ToInt32(TextBox5.Text));

            Label9.Text  = DateTime.Parse(s.Rows[0].ItemArray[6].ToString()).AddDays(7).ToString();
            Label10.Text = DateTime.Parse(s.Rows[0].ItemArray[7].ToString()).AddDays(7).ToString();
            Label11.Text = (Convert.ToInt32(s.Rows[0].ItemArray[4].ToString()) + 1).ToString();
            //label12.Text = y[3];
            List <String> hrs = new List <string>();

            int       totalHours   = 0;
            int       docnum       = 412;
            string    docNumLatest = "select max(docnum) from Timesheets";
            DataTable doc          = db.SelectQry(docNumLatest);
            DataRow   docs         = doc.Rows[0];

            docnum = Convert.ToInt32(docs[0]);
            docnum = docnum + 1;
            for (int i = 0; i < hourslist.Count; i++)
            {
                totalHours = totalHours + hourslist[i];
                string detailsQuery = "INSERT INTO timesheets_details (docnum, doctype, emp_id, day_of_week,hours_worked, numvalue1, numvalue2, comments )" +
                                      "Values (" + docnum + ", 41, " + Label8.Text + "," + (i + 1) + ", " + hourslist[i] + ", 0, 0, 'Timesheet details for week day " + (i + 1) + "')";
                db.InsertUpdateDeleteQry(detailsQuery);
            }

            string start_time = DateTime.Parse(s.Rows[0].ItemArray[6].ToString()).AddDays(7).ToString();
            string end_time   = DateTime.Parse(s.Rows[0].ItemArray[7].ToString()).AddDays(7).ToString();
            string cmdString  = "insert into Timesheets (DocNum,DocType, EMp_id, Max_Hours, Week_Id, Total_Hours_Worked, Start_date, End_date, Numvalue1,Numvalue2 ,Comments ) Values "
                                + "(" + docnum + ", 41, " + Label8.Text + ", 40, " + Label11.Text + ", " + totalHours + " ,'" + DateTime.Parse(s.Rows[0].ItemArray[6].ToString()).AddDays(7).ToString() + "' ,'" + DateTime.Parse(s.Rows[0].ItemArray[7].ToString()).AddDays(7).ToString() + "', 0, 0 , 'Timesheet hours for week " + Label11.Text + "')";

            db.InsertUpdateDeleteQry(cmdString);
            //string retMessage = Utilities.DataBaseUtility.Execute(cmdString, value);
            CalculateGrossPay(Label11.Text, totalHours, EMP_ID, start_time, end_time);

            Label20.Text = "Successfully updated in timesheet";
        }
Exemple #3
0
        public static int Execute(IdentityObject ident, string _sqlCommand)
        {
            // int retcode = 0;         //string _message = "no errors";

            //OleDbConnection conn;
            //conn = GetConnectionObject();
            DB_Operations db = new DB_Operations();

            try
            {
                //if (ident.ActionLevel < 5)
                //{
                //   // _message = "command requires a higher permission level than " + ident.ActionLevel + " by user : "******"could not execute  " + _sqlCommand;
                }
                else
                {
                    return(0);  // "no errors";
                }
            }
            catch (Exception)
            {
                return(2);  // (e.ToString());
            }
        }
Exemple #4
0
        public static string Execute(string _sqlCommand, IdentityObject ident)
        {
            string _message = "no errors";
            //OleDbConnection conn;
            //conn = GetConnectionObject();
            //try
            //{
            //if (ident.ActionLevel < 5)
            //{
            //    _message = "command requires a higher permission level than " + ident.ActionLevel + " by user : "******"could not execute  " + _sqlCommand;
                return(_message);
            }
            else
            {
                return("no errors");
            }
            //}
            //catch (Exception e)
            //{
            //    return (e.ToString());
            //}
            //finally
        }
        public static void DeleteEntity(IdentityObject ident, string _tablename, string docNumStr, string docTypeStr)
        {
            // OleDbConnection conn = GetConnectionObject();
            //if (ident.ActionLevel < 5)
            //{
            //    _message = "command requires a higher permission level than " + ident.ActionLevel + " by user : "******"delete from {0} where DocNum = {1} ", _tablename, docNum); //, docType); //where DocNum = {1}",/* and
                //OleDbCommand cmd = new OleDbCommand(cmdStr, conn);
                //conn.Open();
                //cmd.ExecuteNonQuery();
                db.InsertUpdateDeleteQry(cmdStr);
            }
            catch (Exception e)
            {
                //MessageBox.Show("Error Report: " + e.Message);
            }
            //finally
            //{
            //    conn.Close();
            //}
            try
            {
                int    docNum  = Int32.Parse(docNumStr);
                int    docType = Int32.Parse(docTypeStr);
                string cmdStr2 = String.Format("delete from {0}_Details where DocNum = {1} ", _tablename, docNum);  //, docType); //where DocNum = {1}",/* and
                //OleDbCommand cmd2 = new OleDbCommand(cmdStr2, conn);
                //conn.Open();
                //cmd2.ExecuteNonQuery();
                db.InsertUpdateDeleteQry(cmdStr2);
            }
            catch (Exception)
            {
                //   MessageBox.Show("Error Report: " + e.Message);
            }
            //finally
            //{
            //    conn.Close();
            //}
        }