protected void btn_ftype_add_Click(object sender, EventArgs e) { try { SqlCommand CheckSub = new SqlCommand(); CheckSub.Connection = conn; CheckSub.CommandType = CommandType.Text; CheckSub.CommandText = "SELECT COUNT(*) FROM FEETYPEFILE WHERE FEETYPE = '" + txt_fee_type.Text + "' and school_code ='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'"; int SubExists = (int)CheckSub.ExecuteScalar(); if (SubExists > 0) { ShowMessage("This Fee Type with id ='" + txt_fee_code.Text + "' is already exists."); } else { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.Text; cmd.CommandText = "INSERT INTO FEETYPEFILE (FEECODE,FEETYPE,school_code,branch) VALUES('" + txt_fee_code.Text + "','" + txt_fee_type.Text + "','" + Session["schoolcode"].ToString() + "','" + Session["Branch"].ToString() + "')"; cmd.ExecuteNonQuery(); ShowMessage("Recorded To The System Successfully"); txt_fee_type.Text = ""; txt_fee_code.Text = Global_Class.GenerateID("select count(*) from FEETYPEFILE where school_code ='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'", "FEE#0"); } } catch (Exception ex) { ex.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (conn.State == ConnectionState.Open) { conn.Close(); } conn.Open(); txt_sub_code.Attributes.Add("readonly", "readonly"); btn_std_add.Style.Add("background-color", Session["ColorTheme"].ToString()); txt_sub_code.Text = Global_Class.GenerateID("select count(*) from SUBJECTFILE where school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'", Session["schoolcode"] + "/SUB/"); //SqlCommand CheckSub = new SqlCommand(); //CheckSub.Connection = conn; //CheckSub.CommandType = CommandType.Text; //CheckSub.CommandText = "SELECT COUNT(*) FROM SUBJECTFILE "; //int SubExists = (int)CheckSub.ExecuteScalar(); //if (SubExists == 0) //{ // lblcount.Visible = true; // lblcount.Text = "No Record Found"; //} //else //{ // lblcount.Visible = false; // bindGrid(); //} }
//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(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (conn.State == ConnectionState.Open) { conn.Close(); } conn.Open(); txt_empid.Attributes.Add("readonly", "readonly"); txt_empid.Text = Global_Class.GenerateID("select count(*) from ADDEMPLOYEE where school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'", Session["schoolcode"] + "/EMP/"); var gender = new List <string> { "Male", "Female" }; gender.Sort(); var jtyp = new List <string> { "Full Time", "Part Time", "Freelancer" }; jtyp.Sort(); lst_gender.DataSource = gender; lst_gender.DataBind(); lst_toe.DataSource = jtyp; lst_toe.DataBind(); } }
protected void btn_add_stream_Click(object sender, EventArgs e) { try { conn.Open(); SqlCommand CheckSub = new SqlCommand(); CheckSub.Connection = conn; CheckSub.CommandType = CommandType.Text; CheckSub.CommandText = "SELECT COUNT(*) FROM STREAMLIST WHERE ([STREAMNAME] = @STREAMLIST and school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "')"; CheckSub.Parameters.AddWithValue("@STREAMLIST", txt_stream_name.Text); int SubExists = (int)CheckSub.ExecuteScalar(); if (SubExists > 0) { ShowMessage("This Class with name ='" + txt_stream_name.Text + "' is already exists."); } else { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.Text; cmd.CommandText = "insert into STREAMLIST (STREAMCODE,STREAMNAME,school_code,branch) VALUES('" + txt_stram_code.Text + "','" + txt_stream_name.Text + "','" + Session["schoolcode"].ToString() + "','" + Session["Branch"].ToString() + "')"; cmd.ExecuteNonQuery(); ShowMessage("Recorded To The System Successfully"); txt_stream_name.Text = ""; txt_stram_code.Text = Global_Class.GenerateID("select count(*) from STREAMLIST where school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'", Session["schoolcode"] + "/STREAM/"); } conn.Close(); } catch (Exception ex) { ex.ToString(); } }
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(); } }
protected void btn_std_add_Click(object sender, EventArgs e) { try { SqlCommand CheckSub = new SqlCommand(); CheckSub.Connection = conn; CheckSub.CommandType = CommandType.Text; CheckSub.CommandText = "SELECT COUNT(*) FROM SUBJECTFILE WHERE ([SUBJECTNAME] = @subjectcode and school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "')"; CheckSub.Parameters.AddWithValue("@subjectcode", txt_sub_name.Text); int SubExists = (int)CheckSub.ExecuteScalar(); if (SubExists > 0) { ShowMessage("This subject with id ='" + txt_sub_code.Text + "' is already exists."); } else { SqlCommand cmd = new SqlCommand("addsubject", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@SUBJECTCODE", SqlDbType.VarChar, 50).Value = txt_sub_code.Text.ToString(); cmd.Parameters.Add("@SUBJECTNAME", SqlDbType.VarChar, 50).Value = txt_sub_name.Text.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("Recorded To The System Successfully"); txt_sub_name.Text = ""; txt_sub_code.Text = Global_Class.GenerateID("select count(*) from SUBJECTFILE where school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'", Session["schoolcode"] + "/SUB/"); } } catch (Exception ex) { ex.ToString(); } }
protected void btn_section_add_Click(object sender, EventArgs e) { try { SqlCommand CheckSub = new SqlCommand(); CheckSub.Connection = conn; CheckSub.CommandType = CommandType.Text; CheckSub.CommandText = "SELECT COUNT(*) FROM sections WHERE ([section_name] = @section_name and school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "' )"; CheckSub.Parameters.AddWithValue("@section_name", txt_section_name.Text); int SubExists = (int)CheckSub.ExecuteScalar(); if (SubExists > 0) { ShowMessage("This section with id ='" + txt_section_name.Text + "' is already exists."); } else { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.Text; cmd.CommandText = "insert into sections (section_id,section_name,school_code,branch) VALUES('" + txt_section_id.Text + "','" + txt_section_name.Text + "','" + Session["schoolcode"].ToString() + "','" + Session["Branch"].ToString() + "')"; cmd.ExecuteNonQuery(); ShowMessage("Recorded To The System Successfully"); txt_section_id.Text = Global_Class.GenerateID("select count(*) from sections where school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'", Session["schoolcode"] + "/SEC/"); txt_section_name.Text = ""; } } catch (Exception ex) { ex.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { txt_id.Attributes.Add("readonly", "readonly"); txt_id.Text = Global_Class.GenerateID("select count(*) from tbl_Buildings where school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "' ", Session["schoolcode"] + "/Build/"); if (!IsPostBack) { FillCountry(); } }
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(); } }
protected void btn_add_Click(object sender, EventArgs e) { try { conn.Open(); SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.Text; cmd.CommandText = "insert into ADDEMPLOYEE(SCHOOL_CODE,BRANCH,EMPLOYEE_ID,FIRSTNAME,LASTNAME,GENDER,DOB,PHONENO,ADDRESS1,ADDRESS2,CITY,STATE,COUNTRY,EMERGENCYNO,RELATION,DOJ,DESIGNATION,OFFICIALEMAILID,TYPEOFEMPLOYEE,BANKNAME,ACNO,IFSCCODE,PANNO,PFNO,UANNO,BASICSALARY,HRA,CONVEYANCE)" + "values('" + Session["schoolcode"].ToString() + "','" + Session["Branch"].ToString() + "','" + txt_empid.Text.ToString() + "'," + "'" + txt_fname.Text.ToString() + "','" + txt_lname.Text.ToString() + "','" + lst_gender.SelectedItem.Text.ToString() + "'," + "'" + txt_dob.Text.ToString() + "','" + txt_phone.Text.ToString() + "','" + txt_add1.Text.ToString() + "','" + txt_add2.Text.ToString() + "'," + "'" + txt_city.Text.ToString() + "','" + txt_state.Text.ToString() + "','" + txt_country.Text.ToString() + "','" + txt_emg_co.Text.ToString() + "'," + "'" + txt_emg_name.Text.ToString() + "','" + txt_doj.Text.ToString() + "','" + txt_designation.Text.ToString() + "','" + txt_email.Text.ToString() + "'," + "'" + lst_toe.SelectedItem.Text.ToString() + "','" + txt_bank.Text.ToString() + "','" + txt_acc.Text.ToString() + "'," + "'" + txt_ifsc.Text.ToString() + "','" + TextBox12.Text.ToString() + "','" + txt_pf.Text.ToString() + "','" + txt_uan.Text.ToString() + "'," + "'" + txt_bs.Text.ToString() + "','" + txt_hra.Text.ToString() + "','" + txt_convey.Text.ToString() + "')"; //cmd.Parameters.Add("@SCHOOL_CODE", SqlDbType.VarChar, 50).Value = Session["schoolcode"].ToString(); //cmd.Parameters.Add("@BRANCH", SqlDbType.VarChar, 50).Value = Session["Branch"].ToString(); //cmd.Parameters.Add("@EMPLOYEE_ID", SqlDbType.VarChar).Value = txt_empid.Text.ToString(); //cmd.Parameters.Add("@FIRSTNAME", SqlDbType.VarChar, 50).Value = txt_fname.Text.ToString(); //cmd.Parameters.Add("@LASTNAME", SqlDbType.VarChar, 50).Value = txt_lname.Text.ToString(); //cmd.Parameters.Add("@GENDER", SqlDbType.VarChar, 50).Value = lst_gender.SelectedItem.Text.ToString(); //cmd.Parameters.Add("@DOB", SqlDbType.VarChar, 50).Value = txt_dob.Text.ToString(); //cmd.Parameters.Add("@PHONENO", SqlDbType.VarChar, 50).Value = txt_phone.Text.ToString(); //cmd.Parameters.Add("@ADDRESS1", SqlDbType.VarChar, 50).Value = txt_add1.Text.ToString(); //cmd.Parameters.Add("@ADDRESS2", SqlDbType.VarChar, 50).Value = txt_add2.Text.ToString(); //cmd.Parameters.Add("@CITY", SqlDbType.VarChar, 50).Value = txt_city.Text.ToString(); //cmd.Parameters.Add("@STATE", SqlDbType.VarChar, 50).Value = txt_state.Text.ToString(); //cmd.Parameters.Add("@COUNTRY", SqlDbType.VarChar, 50).Value = txt_country.Text.ToString(); //cmd.Parameters.Add("@EMERGENCYNO", SqlDbType.VarChar, 50).Value = txt_emg_co.Text.ToString(); //cmd.Parameters.Add("@RELATION", SqlDbType.VarChar, 50).Value = txt_emg_name.Text.ToString(); //cmd.Parameters.Add("@DOJ", SqlDbType.VarChar, 50).Value = txt_doj.Text.ToString(); //cmd.Parameters.Add("@DESIGNATION", SqlDbType.VarChar, 50).Value = txt_designation.Text.ToString(); //cmd.Parameters.Add("@OFFICIALEMAILID", SqlDbType.VarChar, 50).Value = txt_email.Text.ToString(); //cmd.Parameters.Add("@TYPEOFEMPLOYEE", SqlDbType.VarChar, 50).Value = lst_toe.SelectedItem.Text.ToString(); //cmd.Parameters.Add("@BANKNAME", SqlDbType.VarChar, 50).Value = txt_bank.Text.ToString(); //cmd.Parameters.Add("@ACNO", SqlDbType.VarChar, 50).Value = txt_acc.Text.ToString(); //cmd.Parameters.Add("@IFSCCODE", SqlDbType.VarChar, 50).Value = txt_ifsc.Text.ToString(); //cmd.Parameters.Add("@PANNO", SqlDbType.VarChar, 50).Value = TextBox12.Text.ToString(); //cmd.Parameters.Add("@PFNO", SqlDbType.VarChar, 50).Value = txt_pf.Text.ToString(); //cmd.Parameters.Add("@UANNO", SqlDbType.VarChar, 50).Value = txt_uan.Text.ToString(); //cmd.Parameters.Add("@BASICSALARY", SqlDbType.VarChar, 50).Value = txt_bs.Text.ToString(); //cmd.Parameters.Add("@HRA", SqlDbType.VarChar, 50).Value = txt_hra.Text.ToString(); //cmd.Parameters.Add("@CONVEYANCE", SqlDbType.VarChar, 50).Value = txt_convey.Text.ToString(); cmd.ExecuteNonQuery(); ShowMessage("Added Successfully"); txt_empid.Text = Global_Class.GenerateID("select count(*) from ADDEMPLOYEE where school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'", Session["schoolcode"] + "/EMP/"); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { if (conn.State == ConnectionState.Open) { conn.Close(); } conn.Open(); txt_routeid.Text = Global_Class.GenerateID("select count(*) from ROUTE where school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'", Session["schoolcode"] + "/ROUTE/"); txt_routeid.Enabled = false; }
protected void Page_Load(object sender, EventArgs e) { if (conn.State == ConnectionState.Open) { conn.Close(); } conn.Open(); txt_user_id.Attributes.Add("readonly", "readonly"); 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/"); }
protected void Page_Load(object sender, EventArgs e) { if (conn.State == ConnectionState.Open) { conn.Close(); } conn.Open(); txt_fee_code.Attributes.Add("readonly", "readonly"); btn_ftype_add.Style.Add("background-color", Session["ColorTheme"].ToString()); txt_fee_code.Text = Global_Class.GenerateID("select count(*) from FEETYPEFILE where school_code ='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'", Session["schoolcode"] + "/FEE/"); }
protected void Crt_route(object sender, EventArgs e) { try { string str = "insert into ROUTE (ROUTEID,ROUTENAME,AREA,school_code,branch) values('" + txt_routeid.Text + "','" + txt_routename.Text + "','" + txt_area.Text + "', '" + Session["schoolcode"].ToString() + "','" + Session["Branch"].ToString() + "')"; SqlCommand cmd = new SqlCommand(str, conn); cmd.ExecuteNonQuery(); ShowMessage("Route Created"); txt_routeid.Text = Global_Class.GenerateID("select count(*) from ROUTE where school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'", Session["schoolcode"] + "/ROUTE/"); } catch (Exception ex) { ex.ToString(); } }
//void autogenerated() //{ // string str = "select count(*) from VEHICLE where school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'"; // SqlCommand com = new SqlCommand(str, conn); // int count = Convert.ToInt16(com.ExecuteScalar()) + 1; // txt_vechileid.Text = "VECL - 0" + count.ToString(); //} protected void crt_vehicle(object sender, EventArgs e) { try { string str = "insert into VEHICLE (ID,VEHICLE_NO,VEHICLE_TYPE,SEAT_CAPACITY,school_code,branch) values('" + txt_vechileid.Text + "','" + txt_vechile_no.Text + "','" + vechile_type.SelectedItem.Text.ToString() + "','" + txt_seat_capacity.Text + "','" + Session["schoolcode"].ToString() + "','" + Session["Branch"].ToString() + "')"; SqlCommand cmd = new SqlCommand(str, conn); cmd.ExecuteNonQuery(); ShowMessage("Vehicle Created"); txt_vechileid.Text = Global_Class.GenerateID("select count(*) from VEHICLE where school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'", Session["schoolcode"] + "/VECL/"); } catch (Exception ex) { ex.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { txt_id.Attributes.Add("readonly", "readonly"); txt_sub_id.Attributes.Add("readonly", "readonly"); txt_cat.Focus(); 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(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (conn.State == ConnectionState.Open) { conn.Close(); } txt_stram_code.Attributes.Add("readonly", "readonly"); btn_add_stream.Style.Add("background-color", Session["ColorTheme"].ToString()); txt_stram_code.Text = Global_Class.GenerateID("select count(*) from STREAMLIST where school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'", Session["schoolcode"] + "/STREAM/"); } }
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(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (conn.State == ConnectionState.Open) { conn.Close(); } conn.Open(); txt_dob.Attributes.Add("readonly", "readonly"); txt_std_id.Attributes.Add("readonly", "readonly"); txt_doa.Attributes.Add("readonly", "readonly"); txt_sc_branch.Attributes.Add("readonly", "readonly"); txt_session.Attributes.Add("readonly", "readonly"); txt_session.Text = DateTime.Now.Year.ToString() + " - " + (DateTime.Now.Year + 1).ToString(); txt_sc_branch.Text = Session["Branch"].ToString(); //autogenerated(); fillCountry(); fillclass(); } txt_std_id.Text = Global_Class.GenerateID("select count(*) from ST_PROFILE where school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'", Session["schoolcode"] + "/ST/"); }
protected void btn_class_add_Click(object sender, EventArgs e) { try { SqlCommand CheckSub = new SqlCommand(); CheckSub.Connection = conn; CheckSub.CommandType = CommandType.Text; CheckSub.CommandText = "SELECT COUNT(*) FROM CLASSFILE WHERE CLASSNAME = '" + txt_class_name.Text + "' and school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "' "; int SubExists = (int)CheckSub.ExecuteScalar(); if (SubExists > 0) { ShowMessage("This class is already exists."); } else { if (int.Parse(txt_class_name.Text) > 12) { ShowMessage("This class is not valid."); txt_class_name.Text = ""; } else { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.Text; cmd.CommandText = "insert into CLASSFILE" + " (CLASSCODE,CLASSNAME,CLASS_VAL,school_code,branch)" + " VALUES('" + txt_class_code.Text + "','" + txt_class_name.Text + "','" + Global_Class.Drp_val_gen("select count(*) from CLASSFILE where school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'", 0).ToString() + "','" + Session["schoolcode"].ToString() + "','" + Session["Branch"].ToString() + "')"; cmd.ExecuteNonQuery(); ShowMessage("Recorded To The System Successfully"); txt_class_code.Text = Global_Class.GenerateID("select count(*) from CLASSFILE where school_code='" + Session["schoolcode"].ToString() + "' and branch='" + Session["Branch"].ToString() + "'", Session["schoolcode"] + "/CLS/"); txt_class_name.Text = ""; } } } catch (Exception ex) { ex.ToString(); } }