Ejemplo n.º 1
0
        //string GenRoleID()
        //{
        //    string str = "select count(*) from tbl_RoleName where school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'";
        //    SqlCommand com = new SqlCommand();
        //    com.Connection = conn;
        //    if (conn.State==ConnectionState.Open)
        //    {
        //        conn.Close();
        //    }
        //    conn.Open();
        //    com.CommandType = CommandType.Text;
        //    com.CommandText = str;
        //    int count = Convert.ToInt32(com.ExecuteScalar()) + 1;
        //    txt_role_id.Text = "Role00" + count.ToString();
        //    txt_role_id.Attributes.Add("readonly", "readonly");
        //    return "Role00" + count.ToString();
        //}

        protected void btn_ok_Click(object sender, EventArgs e)
        {
            try {
                SqlCommand cmd_Roles = new SqlCommand();
                cmd_Roles.Connection = conn;
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                conn.Open();
                cmd_Roles.CommandType = CommandType.Text;
                cmd_Roles.CommandText = "INSERT INTO tbl_RoleName" +
                                        " (role_id,role_name,created_by,creation_dt,client_mac,school_code,branch)" +
                                        " values('" + txt_role_id.Text.ToString() + "'," +
                                        "'" + txt_name.Text + "'," +
                                        "'" + Session["uname"].ToString() + "'," +
                                        "'" + System.DateTime.Now.ToString() + "'," +
                                        "'" + Global_Class.getFormatMac(Global_Class.GetMACAddress()).ToString() + "'," +
                                        "'" + Session["schoolcode"].ToString() + "'," +
                                        "'" + Session["Branch"].ToString() + "')";
                int i = cmd_Roles.ExecuteNonQuery();
                if (i > 0)
                {
                    ShowMessage("New role created.");
                    txt_name.Text    = String.Empty;
                    txt_role_id.Text = Global_Class.GenerateID("select count(*) from tbl_RoleName where school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'", Session["schoolcode"] + "/Role00/");
                }
                else
                {
                    ShowMessage("Something went worng. Please Try Again.");
                    txt_role_id.Text = Global_Class.GenerateID("select count(*) from tbl_RoleName where school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'", Session["schoolcode"] + "/Role00/");
                }
            }
            catch (Exception ex) { ex.ToString(); }
        }
Ejemplo n.º 2
0
 protected void btn_save_Click(object sender, EventArgs e)
 {
     try {
         foreach (RepeaterItem item in rptCustomers.Items)
         {
             string room_name     = (item.FindControl("txt_name") as TextBox).Text;
             string amnties       = (item.FindControl("amnties_list") as DropDownList).SelectedItem.ToString();
             string type          = (item.FindControl("list_type") as DropDownList).SelectedItem.ToString();
             string st_no         = (item.FindControl("list_no_st") as DropDownList).SelectedItem.ToString();
             string building_name = building_list.SelectedItem.ToString();
             string entry_by      = Session["uname"].ToString();
             string entry_dt      = System.DateTime.Now.ToString();
             string mac           = Global_Class.getFormatMac(Global_Class.GetMACAddress()).ToString();
             SaveData(room_name, amnties, type, st_no, building_name, entry_by, entry_dt, mac);
         }
     }
     catch (Exception ex) { ex.ToString(); }
 }
Ejemplo n.º 3
0
        protected void btn_Signup_Click(object sender, EventArgs e)
        {
            String crntdt = DateTime.Now.ToString("dd/MM/yyyy");

            enddt = DateTime.Now.AddDays(7);
            String en_Dt = enddt.ToString("dd/MM/yyyy");

            DateTime idt  = DateTime.ParseExact(crntdt, "dd/MM/yyyy", null);
            DateTime rdt  = DateTime.ParseExact(en_Dt, "dd/MM/yyyy", null);
            TimeSpan span = rdt - idt;

            SqlCommand Chk = new SqlCommand("select * from tbl_TrialUsers where mobile='" + txt_mobile.Text + "'", conn);

            Chk.Connection = conn;
            if (conn.State == ConnectionState.Open)
            {
                conn.Close();
            }
            conn.Open();
            int i = Convert.ToInt32(Chk.ExecuteScalar());

            if (i > 0)
            {
                ShowMessage("This mobile number is already exist.");
            }
            else
            {
                String     str    = @"insert into tbl_TrialUsers
                         (user_name,password,mobile,email,sch_name,city,branch,sign_dt,end_dt,day_cnt,mac,ip,school_code) 
                         values('" + txt_name.Text + "','" + txt_pswd.Text + "','" + txt_mobile.Text + "','" + txt_email.Text + "','" + txt_sch.Text + "','" + txt_city.Text + "','" + txt_branch.Text + "','" + crntdt.ToString() + "','" + en_Dt.ToString() + "','" + span.TotalDays.ToString() + "','" + Global_Class.getFormatMac(Global_Class.GetMACAddress()).ToString() + "','" + GetIP().ToString() + "','" + GenID().ToString() + "')";
                SqlCommand Signup = new SqlCommand();
                Signup.Connection = conn;
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                conn.Open();
                Signup.CommandType = CommandType.Text;
                Signup.CommandText = str;
                try
                {
                    Signup.ExecuteNonQuery();
                    ShowMessage("Thank you for choosing us. Your 7 Trial has been started.");
                    txt_branch.Text = txt_city.Text = txt_email.Text = txt_mobile.Text = txt_name.Text = txt_pswd.Text = txt_sch.Text = String.Empty;
                }
                catch (Exception ex)
                {
                    Response.Write(ex.ToString());
                }
                finally
                {
                    Signup.Dispose();
                }
            }
        }
Ejemplo n.º 4
0
 protected void Unnamed11_Click(object sender, EventArgs e)
 {
     try {
         conn.Open();
         SqlCommand cmd = new SqlCommand("BOOK_ENTRY", conn);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.Add("@BOOKID", SqlDbType.VarChar, 50).Value           = txt_book_id.Text.ToString();
         cmd.Parameters.Add("@BOOKNAME", SqlDbType.VarChar, 50).Value         = txt_book_name.Text.ToString();
         cmd.Parameters.Add("@AUTHOR", SqlDbType.VarChar, 50).Value           = txt_author.Text.ToString();
         cmd.Parameters.Add("@ISBN", SqlDbType.VarChar, 50).Value             = txt_isbn.Text.ToString();
         cmd.Parameters.Add("@PRICE", SqlDbType.VarChar, 50).Value            = txt_price.Text.ToString();
         cmd.Parameters.Add("@QUANTITY", SqlDbType.VarChar, 50).Value         = txt_book_quantity.Text.ToString();
         cmd.Parameters.Add("@CATEGORY", SqlDbType.VarChar, 50).Value         = drp_cat.SelectedItem.Text.ToString();
         cmd.Parameters.Add("@SUBCATEGORY", SqlDbType.VarChar, 50).Value      = drp_sub_cat.SelectedItem.Text.ToString();
         cmd.Parameters.Add("@SUBCATEGORYVALUE", SqlDbType.VarChar, 50).Value = drp_sub_cat.SelectedValue.ToString();
         cmd.Parameters.Add("@PURCHASEDATE", SqlDbType.VarChar, 50).Value     = pur_date.Text.ToString();
         cmd.Parameters.Add("@PUBLISHDATE", SqlDbType.VarChar, 50).Value      = pub_date.Text.ToString();
         cmd.Parameters.Add("@LANGUAGE", SqlDbType.VarChar, 50).Value         = txt_lang.Text.ToString();
         cmd.Parameters.Add("@ENTRYDATE", SqlDbType.VarChar, 50).Value        = DateTime.Now.ToString("dd/MM/yyyy");
         cmd.Parameters.Add("@ENTRYBY", SqlDbType.VarChar, 50).Value          = Session["uname"].ToString();
         cmd.Parameters.Add("MACADDRESS", SqlDbType.VarChar, 50).Value        = Global_Class.getFormatMac(Global_Class.GetMACAddress()).ToString();
         cmd.Parameters.Add("@school_code", SqlDbType.VarChar, 100).Value     = Session["schoolcode"].ToString();
         cmd.Parameters.Add("branch", SqlDbType.VarChar, 100).Value           = Session["Branch"].ToString();
         cmd.ExecuteNonQuery();
         ShowMessage("Added Successfully");
         conn.Close();
     }
     catch (Exception ex) { ex.ToString(); }
 }
Ejemplo n.º 5
0
        protected void btn_Cat_Click(object sender, EventArgs e)
        {
            try {
                SqlCommand     cmd  = new SqlCommand("select * from tbl_BookCategory where cat_name='" + txt_cat.Text + "' and school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'", conn);
                SqlDataAdapter adpt = new SqlDataAdapter(cmd);
                DataSet        ds   = new DataSet();
                adpt.Fill(ds);
                int i = ds.Tables[0].Rows.Count;

                if (i > 0)
                {
                    ShowMessage("This category is already exists.");
                    ds.Clear();
                }
                else
                {
                    cmd             = new SqlCommand();
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = "insert into tbl_BookCategory " +
                                      "(cat_id,cat_name,cat_val,entry_dt,entry_by,mac_id,school_code,branch) " +
                                      "values('" + Global_Class.GenerateID("select count(*) from tbl_BookCategory where " +
                                                                           "school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'", Session["schoolcode"] + "/CAT/").ToString() + "'," +
                                      "'" + txt_cat.Text + "','" + Global_Class.Drp_val_gen("select count(*) from tbl_BookCategory where school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'", 0).ToString() + "','" + DateTime.Now.ToString("dd/MM/yyyy") + "','" + Session["uname"] + "','" + Global_Class.getFormatMac(Global_Class.GetMACAddress()) + "','" + Session["schoolcode"].ToString() + "','" + Session["Branch"].ToString() + "') ";
                    cmd.Connection = conn;
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                    conn.Open();
                    cmd.ExecuteNonQuery();
                    ShowMessage("Category saved.");
                    txt_id.Text     = Global_Class.GenerateID("select count(*) from tbl_BookCategory where school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'", Session["schoolcode"] + "/CAT/");
                    txt_sub_id.Text = Global_Class.GenerateID("select count(*) from tbl_BookSubCategory where school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'", Session["schoolcode"] + "/SUBCAT/");

                    fillcategory();
                    FillCatGrid();
                    FillSubCatGrid();
                    txt_cat.Text     = String.Empty;
                    txt_sub_cat.Text = String.Empty;
                }
            }
            catch (Exception ex) { ex.ToString(); }
        }
Ejemplo n.º 6
0
 protected void btn_add_Click(object sender, EventArgs e)
 {
     try {
         //ShowMessage("Hello");
         SqlCommand CheckBuild = new SqlCommand();
         CheckBuild.Connection = conn;
         if (conn.State == ConnectionState.Open)
         {
             conn.Close();
         }
         conn.Open();
         CheckBuild.CommandType = CommandType.Text;
         CheckBuild.CommandText = "SELECT COUNT (*) FROM tbl_Buildings where build_name='" + txt_building.Text + "' and school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "' ";
         int i = (int)CheckBuild.ExecuteScalar();
         if (i > 0)
         {
             ShowMessage("This building is already registered.");
         }
         else
         {
             SqlCommand insBuild = new SqlCommand();
             insBuild.Connection = conn;
             if (conn.State == ConnectionState.Open)
             {
                 conn.Close();
             }
             conn.Open();
             insBuild.CommandType = CommandType.StoredProcedure;
             insBuild.CommandText = "InsertBuild";
             insBuild.Parameters.Add("@build_id", SqlDbType.VarChar, 100).Value       = txt_id.Text.ToString();
             insBuild.Parameters.Add("@build_for", SqlDbType.VarChar, 100).Value      = drp_hostel_for.SelectedItem.ToString();
             insBuild.Parameters.Add("@build_name", SqlDbType.VarChar, 50).Value      = txt_building.Text.ToString();
             insBuild.Parameters.Add("@build_no", SqlDbType.VarChar, 100).Value       = txt_buildingno.Text.ToString();
             insBuild.Parameters.Add("@build_area", SqlDbType.VarChar, 100).Value     = txt_locality.Text.ToString();
             insBuild.Parameters.Add("@build_landmark", SqlDbType.VarChar, 100).Value = txt_landmark.Text.ToString();
             insBuild.Parameters.Add("@build_country", SqlDbType.VarChar, 100).Value  = country_list.SelectedItem.ToString();
             insBuild.Parameters.Add("@build_state", SqlDbType.VarChar, 100).Value    = state_list.SelectedItem.Text.ToString();
             insBuild.Parameters.Add("@build_city", SqlDbType.VarChar, 100).Value     = city_list.SelectedItem.ToString();
             insBuild.Parameters.Add("@build_contact", SqlDbType.VarChar, 100).Value  = txt_emg_co.Text.ToString();
             insBuild.Parameters.Add("@build_storey", SqlDbType.VarChar, 100).Value   = txt_storey.Text.ToString();
             insBuild.Parameters.Add("@build_rooms", SqlDbType.VarChar, 100).Value    = txt_total_rooms.Text.ToString();
             insBuild.Parameters.Add("@school", SqlDbType.VarChar, 100).Value         = getScoolName().ToString();
             insBuild.Parameters.Add("@branch", SqlDbType.VarChar, 100).Value         = Session["Branch"].ToString();
             insBuild.Parameters.Add("@created_by", SqlDbType.VarChar, 100).Value     = Session["uname"].ToString();
             insBuild.Parameters.Add("@date_time", SqlDbType.VarChar, 100).Value      = System.DateTime.Now;
             insBuild.Parameters.Add("@client_mac", SqlDbType.VarChar, 100).Value     = Global_Class.getFormatMac(Global_Class.GetMACAddress()).ToString();
             insBuild.Parameters.Add("@school_code", SqlDbType.VarChar, 100).Value    = Session["schoolcode"].ToString();
             insBuild.Parameters.Add("@branch", SqlDbType.VarChar, 100).Value         = Session["Branch"].ToString();
             insBuild.ExecuteNonQuery();
             ShowMessage("Build has been saved successfully.");
             txt_id.Text = Global_Class.GenerateID("select count(*) from tbl_Buildings where school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "' ", "Build#0");
             FillCountry();
             txt_building.Text = txt_buildingno.Text = txt_emg_co.Text = txt_landmark.Text = txt_locality.Text = txt_storey.Text = txt_total_rooms.Text = String.Empty;
         }
     }
     catch (Exception ex) { ex.ToString(); }
 }
Ejemplo n.º 7
0
 protected void Unnamed1_Click(object sender, EventArgs e)
 {
     try
     {
         SqlCommand check_User_Name = new SqlCommand("SELECT COUNT(*) FROM [tbl_UserFIle] WHERE ([USERID] = @USERID and school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "')", conn);
         check_User_Name.Parameters.AddWithValue("@USERID", txt_user_id.Text);
         int UserExist = (int)check_User_Name.ExecuteScalar();
         if (UserExist > 0)
         {
             ShowMessage("UserID Already Exists");
         }
         else
         {
             SqlCommand cmd_user = new SqlCommand();
             cmd_user.Connection = conn;
             if (conn.State == ConnectionState.Open)
             {
                 conn.Close();
             }
             conn.Open();
             cmd_user.CommandType = CommandType.Text;
             cmd_user.CommandText = "INSERT INTO tbl_UserFile (USERID,USERTYPE,EMPID,USERNAME,LOGINID,LOGINPSWD,CREATEDBY,DATEANDTIME,MAC,school_code,branch) VALUES('" + txt_user_id.Text.ToString() + "','" + drp_user_type.SelectedItem.ToString() + "','" + emp_id_list.SelectedItem.ToString() + "','" + txt_user_name.Text + "','" + txt_login_id.Text + "','" + txt_user_password.Text + "','" + Session["uname"].ToString() + "','" + System.DateTime.Now.ToString() + "','" + Global_Class.getFormatMac(Global_Class.GetMACAddress()).ToString() + "','" + Session["schoolcode"].ToString() + "','" + Session["Branch"].ToString() + "')";
             int i = cmd_user.ExecuteNonQuery();
             if (i > 0)
             {
                 ShowMessage("User Created.");
                 txt_user_id.Text = txt_user_name.Text = txt_login_id.Text = txt_user_password.Text = String.Empty;
                 txt_user_id.Text = Global_Class.GenerateID("select count(*) from tbl_UserFile where school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'", Session["schoolcode"] + "/USER/");
             }
         }
     }
     catch (Exception ex) { ex.ToString(); }
 }