Esempio n. 1
0
        /// <summary>
        /// Bulk uploads the Periods to the database
        /// </summary>
        /// <param name="dt"></param>
        internal void CreatePeriodRecordBulk(DataTable dt)
        {
            var maps = new List <SqlBulkCopyColumnMapping>()
            {
                new SqlBulkCopyColumnMapping("PRD_CODE", "PRD_CODE"),
                new SqlBulkCopyColumnMapping("PRD_VALUE", "PRD_VALUE"),
                new SqlBulkCopyColumnMapping("PRD_FRQ_ID", "PRD_FRQ_ID")
            };

            using (ADO bulkAdo = new ADO("defaultConnection"))
            {
                bulkAdo.ExecuteBulkCopy("TD_PERIOD", maps, dt, false);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Reads all workflow requests for a given Release Code. You may also optionally filter by CurrentFlag (true or false)
        /// </summary>
        /// <param name="ado"></param>
        /// <param name="RlsCode"></param>
        /// <param name="CurrentFlag"></param>
        /// <returns></returns>
        internal List <WorkflowRequest_DTO> Read(ADO ado, int RlsCode, bool?CurrentFlag = null)
        {
            var inputParams = new List <ADO_inputParams>();

            inputParams.Add(new ADO_inputParams {
                name = "@RlsCode", value = RlsCode
            });
            if (CurrentFlag != null)
            {
                inputParams.Add(new ADO_inputParams {
                    name = "@WrqCurrentFlag", value = CurrentFlag
                });
            }


            List <WorkflowRequest_DTO> resultList = new List <WorkflowRequest_DTO>();
            var reader = ado.ExecuteReaderProcedure("Workflow_WorkflowRequest_Read", inputParams);

            foreach (var element in reader.data)
            {
                Security.ActiveDirectory_DTO requestUser = new Security.ActiveDirectory_DTO()
                {
                    CcnUsername = ReadString(element.CcnUsername)
                };
                Security.ActiveDirectory_ADO accAdo = new Security.ActiveDirectory_ADO();
                Security.Account_DTO_Read    accDto = new Security.Account_DTO_Read()
                {
                    CcnUsername = requestUser.CcnUsername
                };

                requestUser = accAdo.GetUser(ado, accDto);

                resultList.Add(
                    new WorkflowRequest_DTO()
                {
                    WrqDatetime        = ReadDateTime(element.WrqDatetime),
                    WrqExceptionalFlag = ReadBool(element.WrqExceptionalFlag),
                    WrqReservationFlag = ReadBool(element.WrqReservationFlag),
                    WrqArchiveFlag     = ReadBool(element.WrqArchiveFlag),
                    WrqCurrentFlag     = ReadBool(element.WrqCurrentFlag),
                    RqsCode            = ReadString(element.RqsCode),
                    RqsValue           = ReadString(element.RqsValue),
                    RequestAccount     = requestUser
                }

                    );
            }
            return(resultList);
        }
Esempio n. 3
0
        /// <summary>
        /// Creates a KeywordProduct from a data table
        /// </summary>
        /// <param name="dt"></param>
        internal void Create(DataTable dt)
        {
            //Before bulk inserting, we must map our datatable to the database table, column by column
            var maps = new List <SqlBulkCopyColumnMapping>()
            {
                new SqlBulkCopyColumnMapping("KPR_VALUE", "KPR_VALUE"),
                new SqlBulkCopyColumnMapping("KPR_PRC_ID", "KPR_PRC_ID"),
                new SqlBulkCopyColumnMapping("KPR_MANDATORY_FLAG", "KPR_MANDATORY_FLAG")
            };

            using (ADO bulkAdo = new ADO("defaultConnection"))
            {
                bulkAdo.ExecuteBulkCopy("TD_KEYWORD_PRODUCT", maps, dt, false);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Read indices from database
        /// </summary>
        /// <param name="ado"></param>

        /// <returns></returns>
        internal ADO_readerOutput Read(ADO ado, Database_DTO_Read databaseParam)
        {
            List <ADO_inputParams> inputParamList = new List <ADO_inputParams>();

            if (databaseParam.TableName != null)
            {
                inputParamList.Add(new ADO_inputParams()
                {
                    name = "@TableName", value = databaseParam.TableName
                });
            }
            var reader = ado.ExecuteReaderProcedure("Security_Database_ReadStatistic", inputParamList);

            return(reader);
        }
Esempio n. 5
0
        /// <summary>
        /// Bulk uploads the Variables to the database
        /// </summary>
        /// <param name="dt"></param>
        internal void CreateVariableRecordBulk(DataTable dt)
        {
            var maps = new List <SqlBulkCopyColumnMapping>()
            {
                new SqlBulkCopyColumnMapping("VRB_CODE", "VRB_CODE"),
                new SqlBulkCopyColumnMapping("VRB_VALUE", "VRB_VALUE"),
                new SqlBulkCopyColumnMapping("VRB_CLS_ID", "VRB_CLS_ID"),
                new SqlBulkCopyColumnMapping("VRB_ELIMINATION_FLAG", "VRB_ELIMINATION_FLAG")
            };

            using (ADO bulkAdo = new ADO("defaultConnection"))
            {
                bulkAdo.ExecuteBulkCopy("TD_VARIABLE", maps, dt, false);
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!(((bool)Session["Loged_In"]) && ((bool)Session["Admin"])))
        {
            Session.Abandon();
            Response.Redirect("Default.aspx");
        }
        DataTable doption = ADO.GetFullTable("Options", "ID=" + Session["ID"]);

        use_jobs       = bool.Parse(doption.Rows[0]["Use_Jobs"].ToString());
        num_of_sms     = int.Parse(doption.Rows[0]["Num_Of_SMS"].ToString());
        lacks          = ADO.GetFullTable("shift_lacks", "ID=" + Session["ID"]);
        table          = ADO.GetFullTable("Work_Table", "ID=" + Session["ID"] + " And Week =1");
        Width_Of_Boxes = 13;
    }
Esempio n. 7
0
        public void CreateStudentTest()
        {
            string connectionString = @"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=SQLServer.Database.Task6;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False";

            DateTime birth   = new DateTime(2015, 10, 5, 3, 4, 5);
            Students student = new Students()
            {
                Name = "Vasya", Surname = "Ivanov", Patronymic = "Petrovich", BirthDate = birth, IDGroupe = 1
            };
            ADO <Students> instance = new ADO <Students>(connectionString);

            instance.CreateElement(student);

            //Assert.Fail();
        }
        /// <summary>
        /// Deletes a Keyword Product
        /// </summary>
        /// <param name="Ado"></param>
        /// <param name="dto"></param>
        /// <param name="mandatoryOnly"></param>
        /// <returns></returns>
        internal int Delete(ADO Ado, Product_DTO dto, bool?mandatoryOnly = null)
        {
            Keyword_Product_ADO kpAdo = new Keyword_Product_ADO(Ado);
            Keyword_Product_DTO kpDto = new Keyword_Product_DTO();

            kpDto.PrcCode = dto.PrcCode;
            if (mandatoryOnly != null)
            {
                return(kpAdo.Delete(kpDto, mandatoryOnly));
            }
            else
            {
                return(kpAdo.Delete(kpDto));
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="request"></param>
        /// <param name="validator"></param>
        protected BaseTemplate(JSONRPC_API request, IValidator <T> validator)
        {
            Configuration_BSO.SetConfigFromFiles();
            Ado = new ADO("defaultConnection");

            if (ActiveDirectory.IsAuthenticated(request.userPrincipal))
            {
                SamAccountName = request.userPrincipal.SamAccountName.ToString();
            }

            Request   = request;
            Response  = new JSONRPC_Output();
            Validator = validator;
            Trace_BSO_Create.Execute(Ado, request);
        }
Esempio n. 10
0
        internal bool ExistsByEmail(ADO ado, string ccnEmail)
        {
            Account_DTO_Read dto = new Security.Account_DTO_Read();

            ADO_readerOutput output = this.Read(ado, dto, false, ccnEmail);

            if (output.hasData)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 11
0
        /// <summary>
        /// The Subscriber Key Cache is used for throttling traffic
        /// This method refreshes the Subscriber Key Cache
        /// </summary>
        /// <param name="ado"></param>
        internal void RefreshSubscriberKeyCache(ADO ado)
        {
            Subscriber_ADO sAdo     = new Subscriber_ADO(ado);
            var            response = sAdo.ReadSubscriberKeys();

            if (response.Count > 0)
            {
                List <string> sList = new List <string>();
                foreach (var item in response)
                {
                    sList.Add(item.SbrKey);
                }
                MemCacheD.Store_BSO("PxStat.Subscription", "Subscriber_BSO", "RefreshSubscriberKeyCache", "RefreshSubscriberKeyCache", sList, default(DateTime));
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Deletes a Keyword subject
        /// </summary>
        /// <param name="Ado"></param>
        /// <param name="subjectDto"></param>
        /// <param name="mandatoryOnly"></param>
        /// <returns></returns>
        internal int Delete(ADO Ado, Subject_DTO subjectDto, bool?mandatoryOnly = null)
        {
            Keyword_Subject_ADO ksAdo = new Keyword_Subject_ADO(Ado);
            Keyword_Subject_DTO ksDto = new Keyword_Subject_DTO();

            ksDto.SbjCode = subjectDto.SbjCode;
            if (mandatoryOnly != null)
            {
                return(ksAdo.Delete(ksDto, mandatoryOnly));
            }
            else
            {
                return(ksAdo.Delete(ksDto));
            }
        }
Esempio n. 13
0
    private bool check_available(string name)
    {
        DataTable lacks = ADO.GetFullTable("shift_lacks", "ID=" + Session["ID"]);
        DataTable table = ADO.GetFullTable("Work_Table", "ID=" + Session["ID"] + " And Week =1");

        foreach (DataRow lack in lacks.Rows)
        {
            string day = GetNameOfDayE(int.Parse(lack["day_s"].ToString()));
            if (!table.Rows[0][day + "_morning"].ToString().Contains(name) && !table.Rows[0][day + "_intermediate"].ToString().Contains(name) && !table.Rows[0][day + "_evening"].ToString().Contains(name) && ((name.Contains(lack["job"].ToString())) || (!name.Contains('|'))))
            {
                return(true);
            }
        }
        return(false);
    }
Esempio n. 14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["User_ID"] != null)
        {
            string Username = ADO.filter(Request.QueryString["User_ID"].ToString());
            bool   flag     = true;
            Response.Write("<script language='javascript'>");
            if (Username.Length < 3 || Username.Length > 15)
            {
                flag = false;
                Response.Write("opener.Registar_Request.USER_ID.style.backgroundColor = '#FF7777';");
                Response.Write("opener.Registar_Request.user_ans2.style.color = 'red';");
            }
            else
            {
                Response.Write("opener.Registar_Request.user_ans2.style.color = '';");
            }

            if (!CheckNameForLetterse(Username))
            {
                flag = false;
                Response.Write("opener.Registar_Request.USER_ID.style.backgroundColor = '#FF7777';");
                Response.Write("opener.Registar_Request.user_ans1.style.color = 'red';");
            }
            else
            {
                Response.Write("opener.Registar_Request.user_ans1.style.color = '';");
            }
            if (flag)
            {
                DataTable dtUseru = ADO.GetFullTable("Users", " UserName='******'");
                DataTable dtUserw = ADO.GetFullTable("Workers", " UserID='" + ADO.filter(Username) + "'");
                if ((dtUseru.Rows.Count > 0) || (dtUserw.Rows.Count > 0))
                {
                    Response.Write("opener.Registar_Request.USER_ID.style.backgroundColor = '#FF7777';");
                    Response.Write("opener.Registar_Request.user_ans.style.color = 'red';");
                    Response.Write("opener.Registar_Request.user_ans.value = 'תפוס!';");
                }
                else
                {
                    Response.Write("opener.Registar_Request.USER_ID.style.backgroundColor = '#99FF99';");
                    Response.Write("opener.Registar_Request.user_ans.style.color = 'green';");
                    Response.Write("opener.Registar_Request.user_ans.value = 'פנוי!';");
                }
            }
            Response.Write("self.close()</script>");
        }
    }
Esempio n. 15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (((bool)Session["Loged_In"]) && ((bool)Session["Admin"]))
        {
            int al = 1;
            if (Request.Form["intermediate_Shifts"] == null)
            {
                al = 0;
            }

            int uj = 1;
            Session["Use_Jobs"] = true;
            if (Request.Form["use_job"] == null)
            {
                uj = 0;
                Session["Use_Jobs"] = false;
            }
            string sql = "Update Options Set start_morning_shift='" + ADO.filter(Request.Form["SM2"].ToString()) + ":" + ADO.filter(Request.Form["SM1"].ToString()) +
                         "', end_morning_shift='" + ADO.filter(Request.Form["EM2"].ToString()) + ":" + ADO.filter(Request.Form["EM1"].ToString()) +
                         "', start_evening_shift='" + ADO.filter(Request.Form["SE2"].ToString()) + ":" + ADO.filter(Request.Form["SE1"].ToString()) +
                         "', end_evening_shift='" + ADO.filter(Request.Form["EE2"].ToString()) + ":" + ADO.filter(Request.Form["EE1"].ToString()) +
                         "', Length_Of_Boxes='" + ADO.filter(Request.Form["LOB"].ToString()) +
                         "', Length_Of_Temp_Boxes='" + (int.Parse(ADO.filter(Request.Form["LOTB"].ToString())) * 2) +
                         "', intermediate_Shifts='" + al +
                         "', shift_until='" + ADO.filter(Request.Form["deadline"].ToString()) +
                         "', Use_Jobs='" + uj +
                         "' where ID=" + Session["ID"];


            ADO.ExecuteNonQuery(sql);
            al = 1;
            if (Request.Form["const_Shifts"] == null)
            {
                al = 0;
            }

            sql = "Update Work_Table Set Allow_Changes='" + al + "' where ID=" + Session["ID"] + " And week=2";

            ADO.ExecuteNonQuery(sql);

            Response.Redirect("Shifts_next_week.aspx");
        }
        else
        {
            Session.Abandon();
            Response.Redirect("Default.aspx");
        }
    }
Esempio n. 16
0
        /// <summary>
        /// Checks if an account exists
        /// </summary>
        /// <param name="ado"></param>
        /// <param name="CcnUsername"></param>
        /// <returns></returns>
        internal bool Exists(ADO ado, string CcnUsername)
        {
            Account_DTO_Read dto = new Security.Account_DTO_Read();

            dto.CcnUsername = CcnUsername;
            ADO_readerOutput output = this.Read(ado, dto);

            if (output.hasData)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 17
0
    public void PrintAdmin()
    {
        DataRow dt = ADO.GetFullTable("Users", "ID=" + Session["ID"]).Rows[0];

        Response.Write("<table border='2' width='600' class='sample' align='center'><tr>");
        Response.Write("<th bgcolor='92a4b6'>שם מנהל</th>");
        Response.Write("<th bgcolor='92a4b6'>פלאפון</th>");
        Response.Write("<th bgcolor='92a4b6'>אימייל</th>");
        Response.Write("</tr><tr>");
        Response.Write("<td align='center'>" + dt["FName"].ToString() + "&nbsp;</td>");
        Response.Write("<td align='center'>" + dt["Phone"].ToString() + "&nbsp;</td>");
        Response.Write("<td align='center'><a href='mailto:" + dt["Email"].ToString() + "'>" + dt["Email"].ToString() + "</a>&nbsp;</td>");
        Response.Write("</tr>");

        Response.Write("</table>");
    }
Esempio n. 18
0
        public static bool checkLogin(string account, string pwd)
        {
            // ADO.selectByName(account);
            Console.WriteLine((ADO.selectByName(account).account));
            Console.WriteLine((ADO.selectByName(account).password));
            if (((ADO.selectByName(account).account) != null) && ((ADO.selectByName(account).password) != null))
            // if (((ADO.selectByName(account).account) == account) && ((ADO.selectByName(account).password) == pwd))
            {
                return(true);
            }
            else

            {
                return(false);
            }
        }
Esempio n. 19
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (((bool)Session["Loged_In"]) && ((bool)Session["Admin"]))
     {
         DataTable dr = ADO.GetFullTable("options", "ID=" + Session["ID"]);
         use_intermediate = bool.Parse(dr.Rows[0]["intermediate_Shifts"].ToString());
         use_jobs         = bool.Parse(dr.Rows[0]["Use_Jobs"].ToString());
         jobs             = ADO.GetFullTable("Jobs", "ID=" + Session["ID"]);
         dt = ADO.GetFullTable("AI_Optionts", "ID=" + Session["ID"]);
     }
     else
     {
         Session.Abandon();
         Response.Redirect("Default.aspx");
     }
 }
Esempio n. 20
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!(((bool)Session["Loged_In"]) && ((bool)Session["Admin"])))
     {
         Session.Abandon();
         Response.Redirect("Default.aspx");
     }
     if ((ADO.filter(Request.QueryString["week"]) == null) || (ADO.filter(Request.QueryString["week"].ToString()) != "1" && ADO.filter(Request.QueryString["week"].ToString()) != "0"))
     {
         Session.Abandon();
         Response.Redirect("Default.aspx");
     }
     week           = ADO.filter(Request.QueryString["week"].ToString());
     num_of_sms     = int.Parse(ADO.GetFullTable("Options", "ID=" + Session["ID"]).Rows[0]["Num_Of_SMS"].ToString());
     Width_Of_Boxes = 13;
 }
Esempio n. 21
0
        internal static void ExtendSession(ADO extendAdo, string CcnUsername)
        {
            try
            {
                DateTime expiry = DateTime.Now.AddSeconds(Configuration_BSO.GetCustomConfig(ConfigType.global, "session.length"));

                Login_ADO lAdo = new Login_ADO(extendAdo);

                lAdo.ExtendSession(CcnUsername, expiry);
            }
            catch (Exception ex)
            {
                //Swallow the error but log the error message.
                Log.Instance.Error("Failed to extend the user session - error message: " + ex.Message);
            }
        }
Esempio n. 22
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if ((bool)Session["Loged_In"] && (Request.QueryString["ID"] != null) && ADO.filter(Request.QueryString["ID"].ToString()) != "" && Request.QueryString["name"] != null && ADO.filter(Request.QueryString["name"].ToString()) != "")
     {
         string    lackID  = ADO.filter(Request.QueryString["ID"]);
         DataRow   dr      = ADO.GetFullTable("shift_lacks", "Lack_ID=" + lackID + "").Rows[0];
         DataTable dt      = ADO.GetFullTable("Work_Table", "ID=" + Session["ID"] + " AND week=1");
         string    day     = GetNameOfDayE(int.Parse(dr["day_s"].ToString()));
         string    session = GetSession(dr["session_s"].ToString());
         string    name    = Trans_To_hebrew(ADO.filter(Request.QueryString["name"]));
         if (!dt.Rows[0][day + "_" + session].ToString().Contains(name))
         {
             string Update_Shift = dt.Rows[0][day + "_" + session].ToString();
             //check if there is a lack
             Shift match_need = FindMatchNeed(dr["job"].ToString(), int.Parse(dr["day_s"].ToString()), GetSessionNum(dr["session_s"].ToString()), ADO.GetFullTable("AI_Optionts", "ID=" + Session["ID"]).Rows[0], dr["session_s"].ToString());
             if (GetNumOfWorkersIsShift(Update_Shift, dr["job"].ToString(), dr["session_s"].ToString(), (session == "intermediate")) < match_need.num_of_workers)
             {
                 Sort S = new Sort();
                 if (session == "intermediate")
                 {
                     Update_Shift += name + dr["session_s"] + "  ";
                     Update_Shift  = S.SortString(Update_Shift, true);
                 }
                 else
                 {
                     Update_Shift += name;
                     Update_Shift  = S.SortString(Update_Shift, false);
                 }
                 ADO.ExecuteNonQuery("Update Work_Table Set " + day + "_" + session + "='" + Update_Shift + "' Where ID=" + Session["ID"] + " And week=1");
                 if (int.Parse(dr["num_of_workers"].ToString()) == 1)
                 {
                     ADO.ExecuteNonQuery("Delete From shift_lacks Where Lack_ID=" + lackID);
                 }
                 else
                 {
                     ADO.ExecuteNonQuery("Update shift_lacks Set num_of_workers=" + (int.Parse(dr["num_of_workers"].ToString()) - 1) + " Where Lack_ID=" + lackID);
                 }
             }
         }
         Response.Redirect("lacks.aspx");
     }
     else
     {
         Session.Abandon();
         Response.Redirect("Default.aspx");
     }
 }
Esempio n. 23
0
        /// <summary>
        /// Reads Group and Account information for a supplied list of Group Codes
        /// </summary>
        /// <param name="ado"></param>
        /// <param name="groups"></param>
        /// <returns></returns>
        internal ADO_readerOutput ReadMultiple(ADO ado, List <string> groups)
        {
            ADO_readerOutput output = new ADO_readerOutput();

            List <ADO_inputParams> paramList = new List <ADO_inputParams>();

            DataTable dt = new DataTable();

            //dt.Columns.Add("K_VALUE");
            //dt.Columns.Add("Key");
            dt.Columns.Add("Value");

            //We can now add each search term as a row in the table
            foreach (string group in groups)
            {
                var row = dt.NewRow();
                //row["K_VALUE"] = word;
                //row["Key"] = null;
                row["Value"] = group;
                dt.Rows.Add(row);
            }

            ADO_inputParams param = new ADO_inputParams()
            {
                name = "@GroupList", value = dt
            };

            param.typeName = "ValueVarchar";
            paramList.Add(param);

            //Call the stored procedure
            output = ado.ExecuteReaderProcedure("Security_GroupAccount_ReadMultiple", paramList);

            //Read the result of the call to the database
            if (output.hasData)
            {
                Log.Instance.Debug("Data found");
            }
            else
            {
                //No data found
                Log.Instance.Debug("No data found");
            }

            //return the list of entities that have been found
            return(output);
        }
Esempio n. 24
0
        /// <summary>
        /// Delete performance entries
        /// </summary>
        /// <param name="ado"></param>
        /// <param name="dto"></param>
        /// <param name="ccnUsername"></param>
        /// <returns></returns>
        internal int Delete(ADO ado, dynamic dto, string ccnUsername)
        {
            var inputParams = new List <ADO_inputParams>()
            {
                // No parameters required as will be truncating whole table
            };
            var retParam = new ADO_returnParam()
            {
                name = "return", value = 0
            };

            //Attempting to create the new entity
            ado.ExecuteNonQueryProcedure("Security_Performance_Delete", inputParams, ref retParam);

            //Assign the returned value for checking and output
            return(retParam.value);
        }
Esempio n. 25
0
        internal bool Create(ADO Ado, string sbrPreference, string firebaseId, string lngIsoCode)
        {
            Subscriber_ADO ado           = new Subscriber_ADO(Ado);
            string         subscriberKey = GetSubscriberKey(firebaseId);

            if (ado.Create(sbrPreference, firebaseId, lngIsoCode, subscriberKey))
            {
                //Refresh the cache of valid subscriber keys
                //These are used for throttling
                RefreshSubscriberKeyCache(Ado);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 26
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["Wname"] == null || Session["Cname"] == null || Session["Wname"].ToString() == "" || Session["Cname"].ToString() == "")
        {
            Session.Abandon();
            Response.Redirect("Default.aspx");
        }
        if ((!Session["Wname"].ToString().Equals("5410c239adb1b45866f162e5ec829ca9")) ||
            (!Session["Cname"].ToString().Equals("2cb6e810b21db557600c5bd1ddba81b2")))
        {
            Session.Abandon();
            Response.Redirect("Default.aspx");
        }
        if (Request.QueryString["id"] != null && ADO.filter(Request.QueryString["id"].ToString()) != "")
        {
            DataTable dtU = ADO.GetFullTable("Users", " UserName='******'");
            if (dtU.Rows.Count > 0)
            {
                string sql = "DELETE FROM Users WHERE UserName ='******'";
                ADO.ExecuteNonQuery(sql);
                int id = int.Parse(dtU.Rows[0]["ID"].ToString());
                sql = "DELETE FROM Workers WHERE ID =" + id;
                ADO.ExecuteNonQuery(sql);
                sql = "DELETE FROM Options WHERE ID =" + id;
                ADO.ExecuteNonQuery(sql);
                sql = "DELETE FROM Work_Table WHERE ID =" + id;
                ADO.ExecuteNonQuery(sql);
            }
            else
            {
                DataTable dtW = ADO.GetFullTable("Workers", "UserID='" + ADO.filter(Request.QueryString["id"].ToString()) + "'");
                if (dtW.Rows.Count > 0)
                {
                    string sql = "DELETE FROM Workers WHERE UserID ='" + ADO.filter(Request.QueryString["id"].ToString()) + "'";
                    ADO.ExecuteNonQuery(sql);
                }
            }
        }
        else
        {
            Session.Abandon();
            Response.Redirect("Default.aspx");
        }

        Response.Redirect("Owner_Page.aspx");
    }
Esempio n. 27
0
        /// <summary>
        /// Read workflows
        /// </summary>
        /// <param name="ado"></param>
        /// <param name="dto"></param>
        /// <param name="ccnUsername"></param>
        /// <returns></returns>
        internal ADO_readerOutput Read(ADO ado, Workflow_DTO dto, string ccnUsername, string rqsCode = null)
        {
            ADO_readerOutput output = new ADO_readerOutput();

            var inputParams = new List <ADO_inputParams>()
            {
                new ADO_inputParams()
                {
                    name = "@RlsCode", value = dto.RlsCode
                },
                new ADO_inputParams()
                {
                    name = "@CcnUsername", value = ccnUsername
                }
            };

            inputParams.Add(new ADO_inputParams()
            {
                name = "@WrqCurrentRequestOnly", value = dto.WrqCurrentFlagOnly
            });

            if (rqsCode != null)
            {
                inputParams.Add(new ADO_inputParams()
                {
                    name = "@RqsCode", value = rqsCode
                });
            }

            //Call the stored procedure
            output = ado.ExecuteReaderProcedure("Workflow_Read", inputParams);

            //Read the result of the call to the database
            if (output.hasData)
            {
                Log.Instance.Debug("Data found");
            }
            else
            {
                //No data found
                Log.Instance.Debug("No data found");
            }

            //return the list of entities that have been found
            return(output);
        }
Esempio n. 28
0
    public void PrintList()
    {
        DataTable dt = ADO.GetFullTable("Jobs", "ID=" + Session["ID"]);
        int       i  = 1;

        Response.Write("<br><font size=4>");
        Response.Write("מספר תפקידים: " + dt.Rows.Count);
        Response.Write("</font>");
        Response.Write("<table border='2' width='600' class='sample'><tr>");
        Response.Write("<th bgcolor='92a4b6' width='10'></th>");
        Response.Write("<th bgcolor='92a4b6'>קיצור</th>");
        Response.Write("<th bgcolor='92a4b6'>תפקיד</th>");
        if ((bool)Session["Admin"])
        {
            Response.Write("<th bgcolor='92a4b6'>ערוך</th>");
            Response.Write("<th bgcolor='92a4b6'>מחק</th>");
        }
        Response.Write("</tr>");
        if (dt.Rows.Count == 0)
        {
            Response.Write("<tr>");
            Response.Write("<th colspan='6'><center>");
            Response.Write("לא הוגדרו תפקידים");
            Response.Write("</center></th>");
            Response.Write("</tr>");
        }

        else
        {
            foreach (DataRow dr in dt.Rows)
            {
                Response.Write("<tr>");
                Response.Write("<td>" + i + "</td>");
                Response.Write("<td>" + dr["Short_Job"].ToString() + "&nbsp;</td>");
                Response.Write("<td>" + dr["Job"].ToString() + "&nbsp;</td>");
                if ((bool)Session["Admin"])
                {
                    Response.Write("<td> <a href ='Update_Job.aspx?SJ=" + Trans_To_english(dr["Short_Job"].ToString()) + "'><center><img src='Pictures/edit.gif' border='0'></center></a></td>");
                    Response.Write("<td> <a href ='Delete_Job.aspx?SJ=" + Trans_To_english(dr["Short_Job"].ToString()) + "'><center><img src='Pictures/del.gif' border='0'></center></a></td>");
                }
                Response.Write("</tr>");
                i++;
            }
        }
        Response.Write("</table>");
    }
Esempio n. 29
0
        /// <summary>
        /// Delete method
        /// </summary>
        /// <param name="Ado"></param>
        /// <param name="rlsCode"></param>
        /// <param name="userName"></param>
        /// <returns></returns>
        internal int Delete(ADO Ado, int rlsCode, string userName, bool mandatoryKeywordsOnly)
        {
            Matrix_ADO adoMatrix = new Matrix_ADO(Ado);

            int deleted = adoMatrix.Delete(rlsCode, userName);

            Keyword_Release_ADO adoKeywordRelease = new Keyword_Release_ADO();

            deleted = adoKeywordRelease.Delete(Ado, rlsCode, null, mandatoryKeywordsOnly);

            Release_ADO adoRelease = new Release_ADO(Ado);


            deleted = adoRelease.Delete(rlsCode, userName);

            return(deleted);
        }
Esempio n. 30
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.Form["USER_ID"] != null)
        {
            DateTime dob = new DateTime(int.Parse(Request.Form["Year"]), int.Parse(Request.Form["Month"]), int.Parse(Request.Form["Day"]));

            string strSQL = "Insert INTO  Users (UserName, Passw, FName, Phone, Email, Cname, Date_Of_Birth, Reg_Date, Days_Left)" +
                            " values ('" + hashmd5.getMd5Hash(ADO.filter(Request.Form["USER_ID"].ToString().TrimEnd(' '))) + "','" +
                            ADO.filter(Request.Form["Password"].ToString().TrimEnd(' ')) + "','" +
                            ADO.filter(Request.Form["Full_Name"].ToString()) + "','" +
                            ADO.filter(Request.Form["phone_start"]) + "-" + ADO.filter(Request.Form["Phone"].ToString()) + "','" +
                            ADO.filter(Request.Form["E_Mail"].ToString().TrimEnd(' ')) + "','" +
                            ADO.filter(Request.Form["Company_Name"].ToString()) + "','" +
                            dob + "','" +
                            DateTime.Now + "','" +
                            DateTime.Now.AddDays(14) + "')";
            ADO.ExecuteNonQuery(strSQL);

            DataTable dt = ADO.GetFullTable("Users", " UserName='******' '))) + "'");
            strSQL = "Insert INTO  Work_Table(Allow_Changes, week, ID) values('0','0','" + dt.Rows[0][0] + "')";
            ADO.ExecuteNonQuery(strSQL);
            strSQL = "Insert INTO  Work_Table(Allow_Changes, week, ID) values('1','1','" + dt.Rows[0][0] + "')";
            ADO.ExecuteNonQuery(strSQL);
            strSQL = "Insert INTO  Work_Table(Allow_Changes, week, ID) values('0','2','" + dt.Rows[0][0] + "')";
            ADO.ExecuteNonQuery(strSQL);
            strSQL = "Insert INTO  Options(ID, start_morning_shift, end_morning_shift, start_evening_shift, end_evening_shift, Length_Of_Boxes, Length_Of_Temp_Boxes, intermediate_Shifts, Max_Workers, Max_Jobs, Last_Updated, AL_Sunday, AL_Monday, AL_Tuesday, AL_Wednesday, AL_Thursday, AL_Friday, AL_Saturday) values('" + dt.Rows[0][0] + "','10:00','17:00','17:00','23:00','8' ,'4', '0',30 , 5 ,'" + DateTime.Now + "',1,1,1,1,0,0,0)";
            ADO.ExecuteNonQuery(strSQL);
            strSQL = "Insert INTO  AI_Optionts(ID) values('" + dt.Rows[0][0] + "')";
            ADO.ExecuteNonQuery(strSQL);

            send_email();

            //update sessions
            Session["ID"]        = dt.Rows[0][0];
            Session["Admin"]     = true;
            Session["Cname"]     = dt.Rows[0]["CName"];
            Session["Wname"]     = dt.Rows[0]["FName"];
            Session["Loged_In"]  = true;
            Session["Use_Jobs"]  = false;
            Session["SMS_Left"]  = 0;
            Session["Days_Left"] = sum_of_days(DateTime.Parse(dt.Rows[0]["Days_Left"].ToString()));

            //redirect to Guide page
            Response.Redirect("Guide_Admin.aspx");
        }
    }