Esempio n. 1
0
    protected void signUp_Click(object sender, EventArgs e)
    {
        if ((newPass.Text.Length != 0) && (newId.Text.Length != 0))
        {
            string         sql2   = string.Format("SELECT Username FROM users WHERE Username = '******'", newId.Text);
            var            con    = new DBCon();
            var            reader = con.Execute(sql2);
            RegexUtilities util   = new RegexUtilities();
            bool           check  = util.IsValidEmail(newEmailid.Text);
            if (!reader.HasRows && check)
            {
                con.Close();

                string sql = string.Format("INSERT INTO users ([Username], [Password], [email]) VALUES ('{0}', '{1}', '{2}')", newId.Text, newPass.Text, newEmailid.Text);
                con.Execute(sql);
                checking.Text = "Account Created Successfully!";
                con.Close();
            }
            else if (reader.HasRows)
            {
                checking.Text = "Username Already Exists!";
                con.Close();
            }
            else if (!check)
            {
                checking.Text = "Invalid Email ID!";
                con.Close();
            }
            con.Close();
        }
        else
        {
            checking.Text = "Invalid Username or Password!";
        }
    }
Esempio n. 2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        var    con    = new DBCon();
        string sql    = string.Format("SELECT ID, Username, Password FROM users WHERE Username = '******' AND Password = '******'", loginId.Text, loginPass.Text);
        var    reader = con.Execute(sql);

        while (reader.Read())
        {
            Session["ID"]       = reader["ID"];
            Session["Password"] = reader["Password"];
        }
        if (reader.HasRows)
        {
            checking.Text       = "Success!";
            Session["Username"] = loginId.Text;

            con.Close();
            con.Close();
            Response.Redirect("mainpage.aspx");
        }
        else
        {
            checking.Text = "Invalid Username or Password!";
            con.Close();
            con.Close();
        }
    }
Esempio n. 3
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        var con = new DBCon();
        string sql = string.Format("SELECT ID, Username, Password FROM users WHERE Username = '******' AND Password = '******'", loginId.Text, loginPass.Text);
        var reader = con.Execute(sql);
        while (reader.Read())
        {
            Session["ID"] = reader["ID"];
            Session["Password"] = reader["Password"];
        }
        if (reader.HasRows)
        {
            checking.Text = "Success!";           
            Session["Username"] = loginId.Text;
            
            con.Close();
            con.Close();
            Response.Redirect("mainpage.aspx");
            
        }
        else
        {
            checking.Text = "Invalid Username or Password!";
            con.Close();
            con.Close();
        }
        

    }
Esempio n. 4
0
        public static List <ChampeignCharge> GetAll(int CID)
        {
            DBCon                  dBCon   = new DBCon();
            SqlCommand             cmd     = null;
            SqlDataReader          SDR     = null;
            List <ChampeignCharge> ListTmp = new List <ChampeignCharge>();
            string                 Query   = "SELECT * FROM  CustWallet where CID=" + CID.ToString();

            try
            {
                cmd = new SqlCommand(Query, dBCon.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    int             index  = 0;
                    ChampeignCharge ObjTmp = new ChampeignCharge();
                    ObjTmp.ChargeId   = SDR.GetInt32(index++);
                    ObjTmp.ChargeAmt  = SDR.GetDouble(index++);
                    ObjTmp.OID        = SDR.GetInt64(index++);
                    ObjTmp.CashBkId   = SDR.GetInt32(index++);
                    ObjTmp.CreateDate = SDR.GetDateTime(index++);
                    ObjTmp.OrgId      = SDR.GetInt32(index++);
                    ListTmp.Add(ObjTmp);
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { dBCon.Close(); }

            return(ListTmp);
        }
Esempio n. 5
0
    protected void submit_Click(object sender, EventArgs e)
    {
        DateTime t    = System.DateTime.Now;
        string   time = t.ToString();

        if (noteName.Text != "")
        {
            int    id     = Convert.ToInt32(Request.QueryString["id"]);
            var    con    = new DBCon();
            string sql    = string.Format("UPDATE Notes SET noteTitle = '{0}' WHERE ID = {1}", noteName.Text, id);
            var    reader = con.Execute(sql);
            con.Close();

            var    con2    = new DBCon();
            string sql2    = string.Format("UPDATE Notes SET note2 = '{0}' WHERE ID = {1}", noteBody.Text, id);
            var    reader2 = con2.Execute(sql2);
            con2.Close();


            var    con3    = new DBCon();
            string sql3    = string.Format("UPDATE Notes SET noteTime = '{0}' WHERE ID = {1}", time, id);
            var    reader3 = con3.Execute(sql3);
            con3.Close();
            errorLabelNotes.Text = sql2;

            Response.Redirect("Success.aspx");
        }
        else
        {
            errorLabelNotes.Text = "*Enter Title!";
        }
    }
Esempio n. 6
0
        public static List <OfferMenu> GetAll(int OfferTitleId)
        {
            DBCon            dBCon   = new DBCon();
            SqlCommand       cmd     = null;
            SqlDataReader    SDR     = null;
            List <OfferMenu> TmpList = new List <OfferMenu>();
            string           Query   = "SELECT * FROM  OfferMenu where OfferTitleId=" + OfferTitleId;

            try
            {
                cmd = new SqlCommand(Query, dBCon.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    int       index  = 0;
                    OfferMenu ObjTmp = new OfferMenu();
                    ObjTmp.MenuId         = SDR.GetInt32(index++);
                    ObjTmp.Name           = SDR.GetString(index++);
                    ObjTmp.IsComplementry = SDR.GetBoolean(index++);
                    ObjTmp.CBID           = SDR.GetInt32(index++);
                    ObjTmp.OfferTitleId   = SDR.GetInt32(index++);
                    ObjTmp.Min            = SDR.GetInt32(index++);
                    ObjTmp.Max            = SDR.GetInt32(index++);
                    ObjTmp.itemOffers     = ItemOffer.GetAll("Select *, dbo.GetItemName(ItemId),dbo.GetItemPrice(ItemId)  FROM  ItemOffer where MenuId=" + ObjTmp.MenuId + " and IsDeleted=0");
                    ObjTmp.TotalItmPrice  = ObjTmp.itemOffers.Sum(x => x.TotalItemPrice);
                    TmpList.Add(ObjTmp);
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { dBCon.Close(); }
            return(TmpList);
        }
Esempio n. 7
0
    protected void reminderSubmitButton_Click(object sender, EventArgs e)
    {
        int i = 0;

        if (newReminderTime.Text != "")
        {
            DateTime t1 = DateTime.Now;                                                                                                   //http://forums.asp.net/t/1025431.aspx?How+to+compare+Time+in+C+

            DateTime t2 = Convert.ToDateTime(string.Format("{0} {1}", newReminderDate.Text.ToString(), newReminderTime.Text.ToString())); //("{ 0:0000}", value)


            i = DateTime.Compare(t1, t2);
        }

        if (newReminderName.Text != "" && i < 0 && newReminderTime.Text != "")
        {
            var    con    = new DBCon();
            string sql    = string.Format("INSERT INTO Reminders ( [name], [reminder],[time],[userID] ) VALUES ( '{0}', '{1}', '{2} {3}',{4})", newReminderName.Text, newReminder.Text, newReminderDate.Text, newReminderTime.Text, Session["ID"]);
            var    reader = con.Execute(sql);
            con.Close();
            Response.Redirect("reminderSuccess.aspx");
        }
        else if (newReminderName.Text == "")
        {
            errorLabelReminder.Text = "*Enter Name!";
        }
        else if (i >= 0)
        {
            errorLabelReminder.Text = "*Enter correct Time!";
        }
        else
        {
            errorLabelReminder.Text = "*Enter correct Time!";
        }
    }
Esempio n. 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["Username"] == null)
        {
            Response.Redirect("redirectionpage.aspx");   // Help From http://stackoverflow.com/questions/12219246/submit-show-results-delay-3-seconds-and-redirect
        }
        ;

        mainPageUsername.Text = Session["Username"].ToString();

        string sql    = string.Format("SELECT * FROM Alarms WHERE userID={0}", Session["ID"]);
        var    db     = new DBCon();
        var    reader = db.Execute(sql);
        var    sb     = new StringBuilder();

        while (reader.Read())
        {
            sb.AppendLine("<tr>");
            var time = Convert.ToDateTime(reader["time"].ToString());
            sb.AppendLine(string.Format("<td class=\"time\">{0}</td>", time.ToLongTimeString()));
            sb.AppendLine("</tr>");
        }
        lbl_table.Text = sb.ToString();
        db.Close();
    }
Esempio n. 9
0
        public static OfferTitle GetOneByItems(int CBID)
        {
            DBCon         dBCon = new DBCon();
            SqlCommand    cmd   = null;
            SqlDataReader SDR   = null;
            OfferTitle    Tmp   = new OfferTitle();

            Tmp.TotalItemPrice = 0.00;
            string Query = "SELECT * FROM  OfferTitle where CBID=" + CBID.ToString();

            try
            {
                cmd = new SqlCommand(Query, dBCon.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    int        index  = 0;
                    OfferTitle ObjTmp = new OfferTitle();
                    ObjTmp.TitleId        = SDR.GetInt32(index++);
                    ObjTmp.CBID           = SDR.GetInt32(index++);
                    ObjTmp.Name           = SDR.GetString(index++);
                    ObjTmp.Discription    = SDR.GetString(index++);
                    ObjTmp.MaxOrdQty      = SDR.GetInt32(index++);
                    ObjTmp.FinalPrice     = SDR.GetDouble(index++);
                    ObjTmp.Tax            = SDR.GetDouble(index++);
                    ObjTmp.itemOffers     = ItemOffer.GetAll("Select *, dbo.GetItemName(ItemId),dbo.GetItemPrice(ItemId)  FROM  ItemOffer where CashBkId=" + ObjTmp.CBID + " and IsDeleted=0");
                    ObjTmp.TotalItemPrice = ObjTmp.itemOffers.Sum(x => x.TotalItemPrice);
                    Tmp = ObjTmp;
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { dBCon.Close(); }

            return(Tmp);
        }
Esempio n. 10
0
        public static OfferTitle GetOne(int CBID, int Type)
        {
            DBCon         dBCon = new DBCon();
            SqlCommand    cmd   = null;
            SqlDataReader SDR   = null;
            OfferTitle    Tmp   = new OfferTitle();
            string        Query = "SELECT * FROM  OfferTitle where CBID=" + CBID.ToString() + " and Type=" + Type;

            try
            {
                cmd = new SqlCommand(Query, dBCon.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    int        index  = 0;
                    OfferTitle ObjTmp = new OfferTitle();
                    ObjTmp.TitleId        = SDR.GetInt32(index++);
                    ObjTmp.CBID           = SDR.GetInt32(index++);
                    ObjTmp.Name           = SDR.GetString(index++);
                    ObjTmp.Discription    = SDR.GetString(index++);
                    ObjTmp.MaxOrdQty      = SDR.GetInt32(index++);
                    ObjTmp.FinalPrice     = SDR.GetDouble(index++);
                    ObjTmp.Tax            = SDR.GetDouble(index++);
                    ObjTmp.Type           = SDR.GetInt32(index++);
                    ObjTmp.KeepFixPrice   = SDR.GetBoolean(index++);
                    ObjTmp.OfferMenus     = OfferMenu.GetAll(ObjTmp.TitleId);
                    ObjTmp.TotalItemPrice = ObjTmp.OfferMenus.Sum(x => x.TotalItmPrice);
                    Tmp = ObjTmp;
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { dBCon.Close(); }

            return(Tmp);
        }
Esempio n. 11
0
    protected void submit_Click(object sender, EventArgs e)
    {
        DateTime t    = System.DateTime.Now;
        string   time = t.ToString();
        int      i    = 0;



        if (reminderName.Text != "")
        {
            int    id     = Convert.ToInt32(Request.QueryString["id"]);
            string id1    = id.ToString();
            var    con    = new DBCon();
            string sql    = string.Format("UPDATE Reminders SET name = '{0}' WHERE ID = {1}", reminderName.Text, id);
            var    reader = con.Execute(sql);
            con.Close();

            var    con2    = new DBCon();
            string sql2    = string.Format("UPDATE Reminders SET reminder = '{0}' WHERE ID = {1}", reminderBody.Text, id);
            var    reader2 = con2.Execute(sql2);
            con2.Close();

            Response.Redirect("success.aspx");
        }
        else
        {
            errorLabelreminder.Text = "*Enter Title!";
        }
    }
Esempio n. 12
0
    protected void submit_Click(object sender, EventArgs e)
    {
        DateTime t = System.DateTime.Now;
        string time = t.ToString();
        int i = 0;
       

        
        if(reminderName.Text != "")
        {
            int id = Convert.ToInt32(Request.QueryString["id"]);
            string id1 = id.ToString();           
            var con = new DBCon();                       
            string sql = string.Format("UPDATE Reminders SET name = '{0}' WHERE ID = {1}", reminderName.Text, id);
            var reader = con.Execute(sql);
            con.Close();

            var con2 = new DBCon();
            string sql2 = string.Format("UPDATE Reminders SET reminder = '{0}' WHERE ID = {1}", reminderBody.Text, id);
            var reader2 = con2.Execute(sql2);
            con2.Close();
            
            Response.Redirect("success.aspx");
        }
        else
            errorLabelreminder.Text = "*Enter Title!";
    }
Esempio n. 13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["Username"] == null)
            {
                Response.Redirect("redirectionpage.aspx"); // Help From http://stackoverflow.com/questions/12219246/submit-show-results-delay-3-seconds-and-redirect 
            };

            mainPageUsername.Text = Session["Username"].ToString();


            int id = Convert.ToInt32(Request.QueryString["id"]);
            var db = new DBCon();
            var reader = db.Execute(string.Format("SELECT * FROM Notes WHERE ID={0}", id));
            while (reader.Read())
            {
                noteName.Text = reader["noteTitle"].ToString();
                nn = reader["noteTitle"].ToString();
                ID = id;
                noteBody.Text = reader["note2"].ToString();
                DateTime.Text = reader["noteTime"].ToString();
            }
            
            db.Close();
        }
    }
Esempio n. 14
0
        public static List <TblData> GetAll(string Query)
        {
            List <TblData> ListTep = new List <TblData>();
            SqlCommand     cmd     = null;
            SqlDataReader  SDR     = null;
            DBCon          conn    = new DBCon();

            try
            {
                cmd = new SqlCommand(Query, conn.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    TblData formmdata = new TblData();
                    JObject jObject   = new JObject();
                    for (int i = 0; i < SDR.FieldCount; i++)
                    {
                        string fieldName = SDR.GetName(i);
                        var    test      = SDR.GetValue(i);
                        jObject.Add(fieldName, GetValues(SDR, i));
                    }
                    formmdata.Jobj = jObject;
                    ListTep.Add(formmdata);
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); conn.Close(); }
            return(ListTep);
        }
Esempio n. 15
0
        public static List <TblData> GetAll(string PName, JObject Params)
        {
            List <TblData> ListTep = new List <TblData>();
            SqlCommand     cmd     = null;
            SqlDataReader  SDR     = null;
            DBCon          conn    = new DBCon();

            try
            {
                cmd             = new SqlCommand(PName, conn.Con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                IList <string> keys = Params.Properties().Select(p => p.Name).ToList();
                for (int i = 0; i < keys.Count; i++)
                {
                    cmd.Parameters.AddWithValue(keys[i], Params[keys[i]].ToString());
                }
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    TblData formmdata = new TblData();
                    JObject jObject   = new JObject();
                    for (int i = 0; i < SDR.FieldCount; i++)
                    {
                        string fieldName = SDR.GetName(i);
                        var    test      = SDR.GetValue(i);
                        jObject.Add(fieldName, GetValues(SDR, i));
                    }
                    formmdata.Jobj = jObject;
                    ListTep.Add(formmdata);
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); conn.Close(); }
            return(ListTep);
        }
Esempio n. 16
0
        public static List <Wallet> GetAll(int CID, int OrgId)
        {
            DBCon         dBCon   = new DBCon();
            SqlCommand    cmd     = null;
            SqlDataReader SDR     = null;
            List <Wallet> ListTmp = new List <Wallet>();
            string        Query   = "SELECT * FROM  CustWallet where CID=" + CID.ToString() + " and OrgId=" + OrgId;

            try
            {
                cmd = new SqlCommand(Query, dBCon.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    int    index  = 0;
                    Wallet ObjTmp = new Wallet();
                    ObjTmp.WalletId    = SDR.GetInt32(index++);
                    ObjTmp.CID         = SDR.GetInt32(index++);
                    ObjTmp.OID         = SDR.GetInt64(index++);
                    ObjTmp.CashBkId    = SDR.GetInt32(index++);
                    ObjTmp.CashBkAmt   = SDR.GetDouble(index++);
                    ObjTmp.AmtActiveOn = SDR.GetDateTime(index++);
                    ObjTmp.OrgId       = SDR.GetInt32(index++);
                    ListTmp.Add(ObjTmp);
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { dBCon.Close(); }

            return(ListTmp);
        }
Esempio n. 17
0
        public static WalletAmt GetUnusedWalletAmt(int CID, int OrgId)
        {
            DBCon         dBCon  = new DBCon();
            SqlCommand    cmd    = null;
            SqlDataReader SDR    = null;
            WalletAmt     ObjTmp = new WalletAmt();

            try
            {
                cmd = new SqlCommand("GetUnusedWalletAmt", dBCon.Con);
                cmd.Parameters.AddWithValue("@CID", CID);
                cmd.Parameters.AddWithValue("@OrgID", OrgId);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                SDR             = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    int       index = 0;
                    WalletAmt Tmp   = new WalletAmt();
                    ObjTmp.CashBkAmt   = SDR.GetDouble(index++);
                    ObjTmp.DeductedAmt = SDR.GetDouble(index++);
                    ObjTmp             = Tmp;
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { dBCon.Close(); }

            return(ObjTmp);
        }
Esempio n. 18
0
        public static List <ItemOffer> GetAll(string Query)
        {
            DBCon            dBCon   = new DBCon();
            SqlCommand       cmd     = null;
            SqlDataReader    SDR     = null;
            List <ItemOffer> ListTmp = new List <ItemOffer>();

            try
            {
                cmd = new SqlCommand(Query, dBCon.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    int       index  = 0;
                    ItemOffer ObjTmp = new ItemOffer();
                    ObjTmp.ItemOfferId    = SDR.GetInt32(index++);
                    ObjTmp.ItemId         = SDR.GetInt32(index++);
                    ObjTmp.Min            = SDR.GetInt32(index++);
                    ObjTmp.Max            = SDR.GetInt32(index++);
                    ObjTmp.CashBkId       = SDR.GetInt32(index++);
                    ObjTmp.MenuId         = SDR.GetInt32(index++);
                    ObjTmp.MenuId         = SDR.GetInt32(index++);
                    ObjTmp.ItemName       = SDR.GetString(index++);
                    ObjTmp.TotalItemPrice = SDR.GetDouble(index++);
                    ListTmp.Add(ObjTmp);
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { dBCon.Close(); }

            return(ListTmp);
        }
Esempio n. 19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["Username"] == null)
            {
                Response.Redirect("redirectionpage.aspx"); // Help From http://stackoverflow.com/questions/12219246/submit-show-results-delay-3-seconds-and-redirect
            }
            ;

            mainPageUsername.Text = Session["Username"].ToString();


            int id     = Convert.ToInt32(Request.QueryString["id"]);
            var db     = new DBCon();
            var reader = db.Execute(string.Format("SELECT * FROM Notes WHERE ID={0}", id));
            while (reader.Read())
            {
                noteName.Text = reader["noteTitle"].ToString();
                nn            = reader["noteTitle"].ToString();
                ID            = id;
                noteBody.Text = reader["note2"].ToString();
                DateTime.Text = reader["noteTime"].ToString();
            }

            db.Close();
        }
    }
Esempio n. 20
0
    public static int Main(string[] args)
    {
        // DBConのデバッグログをコンソールに出す
        DBCon.UseConsoleLog = true;
        // SCSLibのOpeLogを使ってデバッグログを出力する場合は、
        // DBCon.UseDebugLog = true;

        // DBと接続する。
        using (DBCon db = new DBCon(DBCon.Type.PostgreSQL, // データベースの種類
                                    "localhost",           // データベースサーバ
                                    "mydb",                // データベース名
                                    "myuser",              // 接続ユーザ名
                                    "mypass")){            // 接続パスワード
            // SQL文を実行
            db.Execute("CREATE TABLE IF NOT EXISTS サンプルテーブル (ID INTEGER, 名前 VARCHAR(32), 電話番号 VARCHAR(16))");

            // INSERT文の実行例
            int           n;
            StringBuilder sql = new StringBuilder();
            sql.Append("INSERT INTO サンプルテーブル");
            sql.Append(" (ID,名前,電話番号)");
            sql.Append(" VALUES (1,'テスト一郎','03-4567-8901')");
            n = db.Execute(sql); // StringBuilderを直接渡すことができる。
            Console.WriteLine("{0}件登録しました", n);

            // usingを使っているので明示的にクローズする必要は無いが、念のため
            db.Close();
        }

        return(0);
    }
Esempio n. 21
0
    protected void newUsernameSubmit_Click(object sender, EventArgs e)
    {
        string sql2    = string.Format("UPDATE users SET Username = '******' WHERE ID = {1}", newUserName.Text, Session["ID"]);
        var    db2     = new DBCon();
        var    reader2 = db2.Execute(sql2);

        db2.Close();
        Session.RemoveAll();
        Response.Redirect("Default.aspx");
    }
Esempio n. 22
0
 protected void newUsernameSubmit_Click(object sender, EventArgs e)
 {
            
     string sql2 = string.Format("UPDATE users SET Username = '******' WHERE ID = {1}", newUserName.Text, Session["ID"]);
     var db2 = new DBCon();
     var reader2 = db2.Execute(sql2);        
     db2.Close();
     Session.RemoveAll();
     Response.Redirect("Default.aspx");
 }
Esempio n. 23
0
    protected void delete_Click(object sender, EventArgs e)
    {
        int    id     = Convert.ToInt32(Request.QueryString["id"]);
        var    con    = new DBCon();
        string sql    = string.Format("DELETE FROM Reminders WHERE ID={0}", id);
        var    reader = con.Execute(sql);

        con.Close();
        Response.Redirect("success.aspx");
    }
Esempio n. 24
0
 protected void alarmSubmitButton_Click(object sender, EventArgs e)
 {
     if (newAlarmTime.Text != "")
     {
         var    con    = new DBCon();
         string sql    = string.Format("INSERT INTO Alarms ( [time],[userID] ) VALUES ('{0}', {1})", newAlarmTime.Text, Session["ID"]);
         var    reader = con.Execute(sql);
         con.Close();
         Response.Redirect("alarmSuccess.aspx");
     }
 }
Esempio n. 25
0
        public int Save()
        {
            int        R     = 0;
            DBCon      dBCon = new DBCon();
            SqlCommand cmd   = null;

            try
            {
                string Query = "";
                if (this.TitleId == 0)
                {
                    Query = "Insert into  OfferTitle  values(@CBID,@Name,@Discription,@MaxOrdQty,@FinalPrice,@Tax,@Type,@KeepFixPrice); SELECT SCOPE_IDENTITY();";
                    cmd   = new SqlCommand(Query, dBCon.Con);
                    cmd.Parameters.AddWithValue("@CBID", this.CBID);
                    cmd.Parameters.AddWithValue("@Type", this.Type);
                }
                else
                {
                    Query = "update  OfferTitle set Name=@Name,Discription=@Discription,MaxOrdQty=@MaxOrdQty,FinalPrice=@FinalPrice,Tax=@Tax,KeepFixPrice=@KeepFixPrice where TitleId=@TitleId";
                    cmd   = new SqlCommand(Query, dBCon.Con);
                    cmd.Parameters.AddWithValue("@TitleId", this.TitleId);
                }
                cmd.Parameters.AddWithValue("@Name", this.Name);
                cmd.Parameters.AddWithValue("@Discription", this.Discription);
                cmd.Parameters.AddWithValue("@MaxOrdQty", this.MaxOrdQty);
                cmd.Parameters.AddWithValue("@FinalPrice", this.FinalPrice);
                cmd.Parameters.AddWithValue("@Tax", this.Tax);
                cmd.Parameters.AddWithValue("@KeepFixPrice", this.KeepFixPrice);
                if (this.TitleId == 0)
                {
                    R            = Convert.ToInt32(cmd.ExecuteScalar());
                    this.TitleId = R;
                }
                else
                {
                    R = cmd.ExecuteNonQuery();
                    if (R > 0)
                    {
                        R = this.TitleId;
                    }
                }
            }
            catch (Exception e) { e.ToString(); }
            finally
            {
                dBCon.Close();
                if (cmd != null)
                {
                    cmd.Dispose();
                }
            }
            return(R);
        }
Esempio n. 26
0
        }                                      //DR
        public int Save()
        {
            int        R     = 0;
            DBCon      dBCon = new DBCon();
            SqlCommand cmd   = null;

            try
            {
                string Query = "";
                if (this.WalletId == 0)
                {
                    Query = "Insert into  CustWallet  values(@CID,@OID,@CashBkId,@CashBkAmt,@AmtActiveOn,@OrgId,@DeductedAmt); SELECT SCOPE_IDENTITY();";
                    cmd   = new SqlCommand(Query, dBCon.Con);
                    cmd.Parameters.AddWithValue("@CID", this.CID);
                    cmd.Parameters.AddWithValue("@OID", this.OID);
                    cmd.Parameters.AddWithValue("@CashBkId", this.CashBkId);
                    cmd.Parameters.AddWithValue("@AmtActiveOn", this.AmtActiveOn);
                    cmd.Parameters.AddWithValue("@OrgId", this.OrgId);
                }
                else
                {
                    Query = "update  CustWallet set CashBkAmt=@CashBkAmt,DeductedAmt=@DeductedAmt where WalletId=@WalletId";
                    cmd   = new SqlCommand(Query, dBCon.Con);
                    cmd.Parameters.AddWithValue("@WalletId", this.WalletId);
                }

                cmd.Parameters.AddWithValue("@CashBkAmt", this.CashBkAmt);
                cmd.Parameters.AddWithValue("@DeductedAmt", this.DeductedAmt);
                if (this.WalletId == 0)
                {
                    R             = Convert.ToInt32(cmd.ExecuteScalar());
                    this.WalletId = R;
                }
                else
                {
                    R = cmd.ExecuteNonQuery();
                    if (R > 0)
                    {
                        R = this.WalletId;
                    }
                }
            }
            catch (Exception e) { e.ToString(); }
            finally
            {
                dBCon.Close();
                if (cmd != null)
                {
                    cmd.Dispose();
                }
            }
            return(R);
        }
Esempio n. 27
0
    protected void signUp_Click(object sender, EventArgs e)
    {
        if ((newPass.Text.Length != 0) && (newId.Text.Length != 0))
        {

           
            string sql2 = string.Format("SELECT Username FROM users WHERE Username = '******'", newId.Text);
            var con = new DBCon();
            var reader = con.Execute(sql2);
            RegexUtilities util = new RegexUtilities();
            bool check= util.IsValidEmail(newEmailid.Text);
            if (!reader.HasRows && check)
            {
                con.Close();
                
                string sql = string.Format("INSERT INTO users ([Username], [Password], [email]) VALUES ('{0}', '{1}', '{2}')", newId.Text, newPass.Text,newEmailid.Text);
                con.Execute(sql);
                checking.Text = "Account Created Successfully!";
                con.Close();
            }
            else if(reader.HasRows)
            {
                checking.Text = "Username Already Exists!";
                con.Close();
            }
            else if (!check)
            {
                checking.Text = "Invalid Email ID!";
                con.Close();
            }
            con.Close();

        }
        else
        {
            checking.Text = "Invalid Username or Password!";
            
        }
       
    }
Esempio n. 28
0
        public int Save()
        {
            int        R     = 0;
            DBCon      dBCon = new DBCon();
            SqlCommand cmd   = null;

            try
            {
                string Query = "";
                if (this.MenuId == 0)
                {
                    Query = "Insert into  OfferMenu  values(@Name,@IsComplementry,@CBID,@OfferTitleId,@Min,@Max); SELECT SCOPE_IDENTITY();";
                    cmd   = new SqlCommand(Query, dBCon.Con);
                    cmd.Parameters.AddWithValue("@CBID", this.CBID);
                }
                else
                {
                    Query = "update  OfferMenu set Name=@Name,IsComplementry=@IsComplementry,OfferTitleId=@OfferTitleId,Min=@Min,Max=@Max where MenuId=@MenuId";
                    cmd   = new SqlCommand(Query, dBCon.Con);
                    cmd.Parameters.AddWithValue("@MenuId", this.MenuId);
                }
                cmd.Parameters.AddWithValue("@Name", this.Name);
                cmd.Parameters.AddWithValue("@IsComplementry", this.IsComplementry);
                cmd.Parameters.AddWithValue("@OfferTitleId", this.OfferTitleId);
                cmd.Parameters.AddWithValue("@Min", this.Min);
                cmd.Parameters.AddWithValue("@Max", this.Max);
                if (this.MenuId == 0)
                {
                    R           = Convert.ToInt32(cmd.ExecuteScalar());
                    this.MenuId = R;
                }
                else
                {
                    R = cmd.ExecuteNonQuery();
                    if (R > 0)
                    {
                        R = this.MenuId;
                    }
                }
            }
            catch (Exception e) { e.ToString(); }
            finally
            {
                dBCon.Close();
                if (cmd != null)
                {
                    cmd.Dispose();
                }
            }
            return(R);
        }
Esempio n. 29
0
        public int Save()
        {
            int        R     = 0;
            DBCon      dBCon = new DBCon();
            SqlCommand cmd   = null;

            try
            {
                string Query = "";
                if (this.ItemOfferId == 0)
                {
                    Query = "Insert into  ItemOffer  values(@ItemId,@Min,@Max,@CashBkId,@IsDeleted,@MenuId); SELECT SCOPE_IDENTITY();";
                    cmd   = new SqlCommand(Query, dBCon.Con);
                    cmd.Parameters.AddWithValue("@ItemId", this.ItemId);
                    cmd.Parameters.AddWithValue("@CashBkId", this.CashBkId);
                    cmd.Parameters.AddWithValue("@MenuId", this.MenuId);
                }
                else
                {
                    Query = "update  ItemOffer set Min=@Min,Max=@Max,IsDeleted=@IsDeleted where ItemOfferId=@ItemOfferId";
                    cmd   = new SqlCommand(Query, dBCon.Con);
                    cmd.Parameters.AddWithValue("@ItemOfferId", this.ItemOfferId);
                }
                cmd.Parameters.AddWithValue("@Min", this.Min);
                cmd.Parameters.AddWithValue("@Max", this.Max);
                cmd.Parameters.AddWithValue("@IsDeleted", this.IsDeleted);
                if (this.ItemOfferId == 0)
                {
                    R = Convert.ToInt32(cmd.ExecuteScalar());
                    this.ItemOfferId = R;
                }
                else
                {
                    R = cmd.ExecuteNonQuery();
                    if (R > 0)
                    {
                        R = this.ItemOfferId;
                    }
                }
            }
            catch (Exception e) { e.ToString(); }
            finally
            {
                dBCon.Close();
                if (cmd != null)
                {
                    cmd.Dispose();
                }
            }
            return(R);
        }
Esempio n. 30
0
 protected void deleteAccButton_Click(object sender, EventArgs e)
 {
     if (password.Text == Session["Password"].ToString())
     {
         var    con    = new DBCon();
         string sql    = string.Format("DELETE FROM Notes WHERE userID={0}", Session["ID"]);
         var    reader = con.Execute(sql);
         con.Close();
         string sql2 = string.Format("DELETE FROM Reminders WHERE userID={0}", Session["ID"]);
         reader = con.Execute(sql2);
         con.Close();
         string sql3 = string.Format("DELETE FROM Alarms WHERE userID={0}", Session["ID"]);
         reader = con.Execute(sql3);
         con.Close();
         string sql4 = string.Format("DELETE FROM users WHERE ID={0}", Session["ID"]);
         reader = con.Execute(sql4);
         con.Close();
         Response.Redirect("Default.aspx");
     }
     else
     {
         errorDeleteAcc.Text = "Invalid Password!";
     }
 }
Esempio n. 31
0
        public static List <MyWallet> GetWalletAmt(int CID)
        {
            DBCon           dBCon   = new DBCon();
            SqlCommand      cmd     = null;
            SqlDataReader   SDR     = null;
            List <MyWallet> ListTmp = new List <MyWallet>();

            try
            {
                cmd = new SqlCommand("MyWallet", dBCon.Con);
                cmd.Parameters.AddWithValue("@CID", CID);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                SDR             = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    int      index = 0;
                    MyWallet Tmp   = new MyWallet();
                    Tmp.OrgId       = SDR.GetInt32(index++);
                    Tmp.CashBkAmt   = SDR.GetDouble(index++);
                    Tmp.deductedAmt = SDR.GetDouble(index++);
                    Tmp.OutLetName  = SDR.GetString(index++);
                    Tmp.isActive    = true;
                    ListTmp.Add(Tmp);
                }
                SDR.NextResult();
                if (SDR.HasRows)
                {
                    while (SDR.Read())
                    {
                        int      index = 0;
                        MyWallet Tmp   = new MyWallet();
                        Tmp.OrgId       = SDR.GetInt32(index++);
                        Tmp.CashBkAmt   = SDR.GetDouble(index++);
                        Tmp.deductedAmt = SDR.GetDouble(index++);
                        Tmp.OutLetName  = SDR.GetString(index++);
                        Tmp.isActive    = false;
                        ListTmp.Add(Tmp);
                    }
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { dBCon.Close(); }

            return(ListTmp);
        }
Esempio n. 32
0
        public static List <Cashback> GetAll(int OrgId, int TerminateSts = 0)
        {
            DBCon           dBCon   = new DBCon();
            SqlCommand      cmd     = null;
            SqlDataReader   SDR     = null;
            List <Cashback> ListTmp = new List <Cashback>();
            string          Query   = "SELECT * FROM  CashBack where OrgID=" + OrgId.ToString();

            if (TerminateSts > 0)
            {
                Query += "and TerminateSts = " + TerminateSts;
            }
            try
            {
                cmd = new SqlCommand(Query, dBCon.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    int      index  = 0;
                    Cashback ObjTmp = new Cashback();
                    ObjTmp.CashBkId      = SDR.GetInt32(index++);
                    ObjTmp.OrgID         = SDR.GetInt32(index++);
                    ObjTmp.StartDate     = SDR.GetDateTime(index++);
                    ObjTmp.ValidTill     = SDR.GetInt32(index++);
                    ObjTmp.ValidTillDate = SDR.GetDateTime(index++);
                    ObjTmp.CashBkType    = SDR.GetInt32(index++);
                    ObjTmp.Percentage    = SDR.GetDouble(index++);
                    ObjTmp.MaxAmt        = SDR.GetDouble(index++);
                    ObjTmp.BilAmt        = SDR.GetDouble(index++);
                    ObjTmp.RaiseDynamic  = SDR.GetBoolean(index++);
                    ObjTmp.CashBkStatus  = SDR.GetInt32(index++);
                    ObjTmp.SeatingIds    = SDR.GetString(index++);
                    ObjTmp.TerminateSts  = SDR.GetInt32(index++);
                    ObjTmp.CBUniqId      = SDR.GetInt64(index++);
                    ObjTmp.CampeignType  = SDR.GetInt32(index++);
                    ObjTmp.MaxCBLimit    = SDR.GetInt32(index++);
                    ObjTmp.OfferType     = SDR.GetInt32(index++);
                    ListTmp.Add(ObjTmp);
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { dBCon.Close(); }

            return(ListTmp);
        }
Esempio n. 33
0
    protected void noteSubmitButton_Click(object sender, EventArgs e)
    {
        DateTime t    = DateTime.Now;
        string   time = t.ToString();

        if (newNoteName.Text != "")
        {
            var    con    = new DBCon();
            string sql    = string.Format("INSERT INTO Notes ([noteTitle], [note2], [noteTime], [userID]) VALUES ('{0}', '{1}', '{2}',{3})", newNoteName.Text, newNote.Text, time, Session["ID"]);
            var    reader = con.Execute(sql);
            con.Close();
            Response.Redirect("noteSuccess.aspx");
        }
        else
        {
            errorLabelNotes.Text = "*Enter Title!";
        }
    }
Esempio n. 34
0
        public static Cashback Getone(int CashBkId)
        {
            DBCon         dBCon = new DBCon();
            SqlCommand    cmd   = null;
            SqlDataReader SDR   = null;
            Cashback      Tmp   = new Cashback();
            string        Query = "SELECT * FROM  CashBack where CashBkId=" + CashBkId.ToString();

            try
            {
                cmd = new SqlCommand(Query, dBCon.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    int      index  = 0;
                    Cashback ObjTmp = new Cashback();
                    ObjTmp.CashBkId      = SDR.GetInt32(index++);
                    ObjTmp.OrgID         = SDR.GetInt32(index++);
                    ObjTmp.StartDate     = SDR.GetDateTime(index++);
                    ObjTmp.ValidTill     = SDR.GetInt32(index++);
                    ObjTmp.ValidTillDate = SDR.GetDateTime(index++);
                    ObjTmp.CashBkType    = SDR.GetInt32(index++);
                    ObjTmp.Percentage    = SDR.GetDouble(index++);
                    ObjTmp.MaxAmt        = SDR.GetDouble(index++);
                    ObjTmp.BilAmt        = SDR.GetDouble(index++);
                    ObjTmp.RaiseDynamic  = SDR.GetBoolean(index++);
                    ObjTmp.CashBkStatus  = SDR.GetInt32(index++);
                    ObjTmp.SeatingIds    = SDR.GetString(index++);
                    ObjTmp.TerminateSts  = SDR.GetInt32(index++);
                    ObjTmp.CBUniqId      = SDR.GetInt64(index++);
                    ObjTmp.CampeignType  = SDR.GetInt32(index++);
                    ObjTmp.MaxCBLimit    = SDR.GetInt32(index++);
                    ObjTmp.OfferType     = SDR.GetInt32(index++);
                    ObjTmp.StrStartDate  = ObjTmp.StartDate.ToString("dd-MM-yyyy");
                    ObjTmp.ValidTillStr  = ObjTmp.ValidTillDate.ToString("dd-MM-yyyy");
                    Tmp = ObjTmp;
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { dBCon.Close(); }

            return(Tmp);
        }
Esempio n. 35
0
    protected void noteSubmitButton_Click(object sender, EventArgs e)
    {
        DateTime t = DateTime.Now;
        string time = t.ToString();

        if (newNoteName.Text != "")
        {
            
            
            var con = new DBCon();
            string sql = string.Format("INSERT INTO Notes ([noteTitle], [note2], [noteTime], [userID]) VALUES ('{0}', '{1}', '{2}',{3})",  newNoteName.Text, newNote.Text,time, Session["ID"]);
            var reader = con.Execute(sql);
            con.Close();
            Response.Redirect("noteSuccess.aspx");
        }
        else
            errorLabelNotes.Text = "*Enter Title!";
            

    }
Esempio n. 36
0
    protected void Page_Load(object sender, EventArgs e)
    {
       if (Session["Username"] == null)
        {
            Response.Redirect("redirectionpage.aspx"); // Help From http://stackoverflow.com/questions/12219246/submit-show-results-delay-3-seconds-and-redirect 
        };

        mainPageUsername.Text = Session["Username"].ToString();
        string sql = string.Format("SELECT * FROM Reminders WHERE userID={0}", Session["ID"]);
        var db = new DBCon();
        var reader = db.Execute(sql);
        var sb = new StringBuilder();
        while (reader.Read())
        {
            sb.AppendLine("<tr>");
            sb.AppendLine(string.Format("<td><a href='viewreminder.aspx?id={0}'>{1}</a></td>", reader["ID"], reader["name"]));
            sb.AppendLine("</tr>");
        }
        lbl_table.Text = sb.ToString();
        db.Close();
    }
Esempio n. 37
0
    protected void Page_Load(object sender, EventArgs e)
    {
          if (Session["Username"] == null)
          {
              Response.Redirect("redirectionpage.aspx"); // Help From http://stackoverflow.com/questions/12219246/submit-show-results-delay-3-seconds-and-redirect 
          };

          mainPageUsername.Text = Session["Username"].ToString();

        string sql = string.Format("SELECT * FROM Alarms WHERE userID={0}", Session["ID"]);
        var db = new DBCon();
        var reader = db.Execute(sql);
        var sb = new StringBuilder();
        while (reader.Read())
        {
            sb.AppendLine("<tr>");
            var time = Convert.ToDateTime(reader["time"].ToString());
            sb.AppendLine(string.Format("<td class=\"time\">{0}</td>", time.ToLongTimeString()));
            sb.AppendLine("</tr>");
        }
        lbl_table.Text = sb.ToString();
        db.Close();
    }
Esempio n. 38
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["Username"] == null)
        {
            Response.Redirect("redirectionpage.aspx"); // Help From http://stackoverflow.com/questions/12219246/submit-show-results-delay-3-seconds-and-redirect
        }
        ;

        mainPageUsername.Text = Session["Username"].ToString();
        string sql    = string.Format("SELECT * FROM Reminders WHERE userID={0}", Session["ID"]);
        var    db     = new DBCon();
        var    reader = db.Execute(sql);
        var    sb     = new StringBuilder();

        while (reader.Read())
        {
            sb.AppendLine("<tr>");
            sb.AppendLine(string.Format("<td><a href='viewreminder.aspx?id={0}'>{1}</a></td>", reader["ID"], reader["name"]));
            sb.AppendLine("</tr>");
        }
        lbl_table.Text = sb.ToString();
        db.Close();
    }
Esempio n. 39
0
    protected void reminderSubmitButton_Click(object sender, EventArgs e)
    {
        int i = 0;
        if (newReminderTime.Text != "")
        {
            DateTime t1 = DateTime.Now;             //http://forums.asp.net/t/1025431.aspx?How+to+compare+Time+in+C+

            DateTime t2 = Convert.ToDateTime(string.Format("{0} {1}", newReminderDate.Text.ToString(), newReminderTime.Text.ToString())); //("{ 0:0000}", value)


            i = DateTime.Compare(t1, t2);
        }

        if (newReminderName.Text != ""&& i < 0 && newReminderTime.Text != "")
            {
                var con = new DBCon();
                string sql = string.Format("INSERT INTO Reminders ( [name], [reminder],[time],[userID] ) VALUES ( '{0}', '{1}', '{2} {3}',{4})", newReminderName.Text, newReminder.Text, newReminderDate.Text, newReminderTime.Text, Session["ID"]);
                var reader = con.Execute(sql);
                con.Close();
               Response.Redirect("reminderSuccess.aspx");
               
            }
            else if (newReminderName.Text == "")
            {
                errorLabelReminder.Text = "*Enter Name!";
            }
            else if (i >= 0)
            {
                errorLabelReminder.Text = "*Enter correct Time!";
            }
             else
                errorLabelReminder.Text = "*Enter correct Time!";

    }
Esempio n. 40
0
    protected void alarmSubmitButton_Click(object sender, EventArgs e)
    {
       
        if (newAlarmTime.Text != "")
        {
            var con = new DBCon();
            string sql = string.Format("INSERT INTO Alarms ( [time],[userID] ) VALUES ('{0}', {1})", newAlarmTime.Text, Session["ID"]);
            var reader = con.Execute(sql);
            con.Close();
            Response.Redirect("alarmSuccess.aspx");
        }

        
       
    }
Esempio n. 41
0
    protected void submit_Click(object sender, EventArgs e)
    {
        DateTime t = System.DateTime.Now;
        string time = t.ToString();

        if (noteName.Text != "")
        {
            int id = Convert.ToInt32(Request.QueryString["id"]);
            var con = new DBCon();            
            string sql = string.Format("UPDATE Notes SET noteTitle = '{0}' WHERE ID = {1}", noteName.Text, id);
            var reader = con.Execute(sql);
            con.Close();
         
            var con2 = new DBCon();
            string sql2 = string.Format("UPDATE Notes SET note2 = '{0}' WHERE ID = {1}", noteBody.Text, id);            
           var reader2= con2.Execute(sql2);
            con2.Close();
                        

            var con3 = new DBCon();
            string sql3 = string.Format("UPDATE Notes SET noteTime = '{0}' WHERE ID = {1}", time, id);
            var reader3 = con3.Execute(sql3);
            con3.Close();
            errorLabelNotes.Text = sql2;

            Response.Redirect("Success.aspx");
        }
        else
            errorLabelNotes.Text = "*Enter Title!";

    }
Esempio n. 42
0
 protected void deleteAccButton_Click(object sender, EventArgs e)
 {
     if (password.Text == Session["Password"].ToString())
     {
         var con = new DBCon();
         string sql = string.Format("DELETE FROM Notes WHERE userID={0}", Session["ID"]);
         var reader = con.Execute(sql);
         con.Close();
         string sql2 = string.Format("DELETE FROM Reminders WHERE userID={0}", Session["ID"]);
         reader = con.Execute(sql2);
         con.Close();
         string sql3 = string.Format("DELETE FROM Alarms WHERE userID={0}", Session["ID"]);
         reader = con.Execute(sql3);
         con.Close();
         string sql4 = string.Format("DELETE FROM users WHERE ID={0}", Session["ID"]);
         reader = con.Execute(sql4);
         con.Close();
         Response.Redirect("Default.aspx");
     }
     else
         errorDeleteAcc.Text = "Invalid Password!";
     
 }
Esempio n. 43
0
    protected void delete_Click(object sender, EventArgs e)
    {
        int id = Convert.ToInt32(Request.QueryString["id"]);
        var con = new DBCon();

        string sql = string.Format("DELETE FROM Notes WHERE ID={0}", id );
        var reader = con.Execute(sql);
        con.Close();
        Response.Redirect("success.aspx");

    }