Example #1
0
        public Boolean updateDocEmpMapping(docempmapping doc, docempmapping prevdoc)
        {
            Boolean status   = true;
            string  utString = "";

            try
            {
                string updateSQL = "update DocEmpMapping set EmployeeID='" + doc.EmployeeID + "'," +
                                   "SeniorEmployeeID='" + doc.SeniorEmployeeID + "'," +
                                   " Status=" + doc.DocumentStatus +
                                   " where DocumentID='" + prevdoc.DocumentID + "'" +
                                   " and EmployeeID='" + prevdoc.EmployeeID + "'" +
                                   " and SeniorEmployeeID='" + prevdoc.SeniorEmployeeID + "'";
                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("update", "DocEmpMapping", "", updateSQL) +
                           Main.QueryDelimiter;
                if (!UpdateTable.UT(utString))
                {
                    status = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
                status = false;
            }
            return(status);
        }
Example #2
0
        public Boolean validateDocument(docempmapping doc)
        {
            Boolean status = true;

            try
            {
                if (doc.DocumentID.Trim().Length == 0 || doc.DocumentID == null)
                {
                    return(false);
                }
                if (doc.EmployeeID.Trim().Length == 0 || doc.EmployeeID == null)
                {
                    return(false);
                }
                if (doc.SeniorEmployeeID.Trim().Length == 0 || doc.SeniorEmployeeID == null ||
                    doc.EmployeeID.Trim() == doc.SeniorEmployeeID.Trim())
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
            return(status);
        }
Example #3
0
        public Boolean insertDocEmpMapping(docempmapping doc)
        {
            Boolean status   = true;
            string  utString = "";

            try
            {
                DateTime cdt       = DateTime.Now;
                string   updateSQL = "insert into DocEmpMapping (DocumentID,EmployeeID,SeniorEmployeeID,Status,CreateTime,CreateUser)" +
                                     "values (" +
                                     "'" + doc.DocumentID + "'," +
                                     "'" + doc.EmployeeID + "'," +
                                     "'" + doc.SeniorEmployeeID + "'," +
                                     doc.DocumentStatus + "," +
                                     "GETDATE()" + "," +
                                     "'" + Login.userLoggedIn + "'" + ")";
                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("insert", "DocEmpMapping", "", updateSQL) +
                           Main.QueryDelimiter;
                if (!UpdateTable.UT(utString))
                {
                    status = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
                status = false;
            }
            return(status);
        }
Example #4
0
        public List <docempmapping> getDocEmpMapping()
        {
            docempmapping        docempmappingrec;
            List <docempmapping> DocEmpMappings = new List <docempmapping>();

            try
            {
                SqlConnection conn  = new SqlConnection(Login.connString);
                string        query = "select a.DocumentID, b.DocumentName,a.EmployeeID,c.Name, a.SeniorEmployeeID," +
                                      "d.Name, a.status from DocEmpMapping a, Document b, " +
                                      "Employee c, Employee d where a.DocumentID=b.DocumentID and " +
                                      "a.EmployeeID=c.EmployeeID and a.SeniorEmployeeID=d.EmployeeID " +
                                      "order by a.DocumentID,c.Name";

                SqlCommand cmd = new SqlCommand(query, conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    docempmappingrec                    = new docempmapping();
                    docempmappingrec.DocumentID         = reader.GetString(0);
                    docempmappingrec.DocumentName       = reader.GetString(1);
                    docempmappingrec.EmployeeID         = reader.GetString(2);
                    docempmappingrec.EmployeeName       = reader.GetString(3);
                    docempmappingrec.SeniorEmployeeID   = reader.GetString(4);
                    docempmappingrec.SeniorEmployeeName = reader.GetString(5);
                    docempmappingrec.DocumentStatus     = reader.GetInt32(6);
                    DocEmpMappings.Add(docempmappingrec);
                }
                conn.Close();
            }
            catch (Exception)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
            return(DocEmpMappings);
        }