Exemplo n.º 1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (PUsername.Text != "" && PPassword.Text != "")
            {
                using (MD5 md5Hash = MD5.Create())
                {
                    string password = GetMd5Hash(md5Hash, PPassword.Text);
                    PPassword.Text = password;
                }
                DataView obstaja = (DataView)SqlDataSource6.Select(DataSourceSelectArguments.Empty);

                if (!(obstaja[0][0].ToString()).Equals("0"))
                {
                    DataView isAdmin = (DataView)SqlDataSource7.Select(DataSourceSelectArguments.Empty);

                    if (((isAdmin[0][0].ToString()).Equals("1")))
                    {
                        Session["UIme"] = PUsername.Text;
                        Response.Redirect("Administration.aspx");
                    }
                    else
                    {
                        PError.Text = "Nimate administratorske pravice";
                    }
                }
                else
                {
                    PError.Text = "Ne obstaja user.";
                }
            }
            else
            {
                PError.Text = "Dopolnite obadva polja.";
            }
        }
Exemplo n.º 2
0
 protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (DropDownList1.SelectedValue == "Inner")
     {
         DataView mydata = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
         GridView3.DataSource          = mydata;
         GridView3.AutoGenerateColumns = true;
         GridView3.DataBind();
     }
     else if (DropDownList1.SelectedValue == "Left")
     {
         DataView mydata = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);
         GridView3.DataSource          = mydata;
         GridView3.AutoGenerateColumns = true;
         GridView3.DataBind();
     }
     else if (DropDownList1.SelectedValue == "Right")
     {
         DataView mydata = (DataView)SqlDataSource5.Select(DataSourceSelectArguments.Empty);
         GridView3.DataSource          = mydata;
         GridView3.AutoGenerateColumns = true;
         GridView3.DataBind();
     }
     else
     {
         DataView mydata = (DataView)SqlDataSource6.Select(DataSourceSelectArguments.Empty);
         GridView3.DataSource          = mydata;
         GridView3.AutoGenerateColumns = true;
         GridView3.DataBind();
     }
 }
Exemplo n.º 3
0
 public bool sendmailfun(string subject, string body)
 {
     try
     {
         string      mailstring = "";
         string      host       = "";
         string      pass       = "";
         IDataReader reader     = ((IDataReader)((IEnumerable)SqlDataSource6.Select(DataSourceSelectArguments.Empty)));
         while (reader.Read())
         {
             mailstring = reader["config_mail"].ToString();
             pass       = reader["config_pass"].ToString();
             host       = reader["config_host"].ToString();
         }
         SmtpClient SmtpServer = new SmtpClient();
         SmtpServer.Credentials = new System.Net.NetworkCredential(mailstring, pass);
         SmtpServer.Port        = 25;
         SmtpServer.Host        = host;
         SmtpServer.EnableSsl   = false;
         MailMessage mail = new MailMessage();
         mail.From = new MailAddress(mailstring);
         mail.To.Add(mailstring);
         mail.Subject    = subject;
         mail.Body       = body;
         mail.IsBodyHtml = true;
         SmtpServer.Send(mail);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
 protected void AssignStudent(object sender, EventArgs e)
 {
     Page.ClientScript.RegisterStartupScript(GetType(), "id", "toggle_forms('AssignStudentClass')", true);
     if (Page.IsValid)
     {
         DBHandler.DBHandler   db = new DBHandler.DBHandler(con);
         Entities.personalInfo t1 = new Entities.personalInfo()
         {
             pKId = Session["School"].ToString(),
         };
         Entities.StudentSubject t2 = new Entities.StudentSubject()
         {
             pKId = SchoolID.Value,
             year = Year.Text,
         };
         Entities.Class c1 = new Entities.Class()
         {
             className = DropDownList1.SelectedValue,
         };
         Entities.Section s1 = new Entities.Section()
         {
             sectionName = DropDownList2.SelectedValue,
         };
         db.AssignStudentClass(t1, t2, c1, s1);
         SqlDataSource6.DataBind();
         GridView1.DataBind();
     }
 }
 protected void updateVehicle_button_Click(object sender, EventArgs e)
 {
     //get input
     //do update stored procedure
     SqlDataSource6.Update();
     MultiView1.ActiveViewIndex = 0;
     error_label.Text           = "Update Successful";
 }
        protected void DetailsView2_ItemInserting(object sender, DetailsViewInsertEventArgs e)
        {
            SqlDataSource6.InsertParameters["semesterID"].DefaultValue = GridView1.SelectedValue.ToString();
            SqlDataSource6.InsertParameters["moduleCode"].DefaultValue = ((DropDownList)DetailsView2.Rows[1].Cells[1].FindControl("DropDownList6")).SelectedValue;

            SqlDataSource6.InsertParameters["lecturerName"].DefaultValue = ((TextBox)DetailsView2.Rows[2].Cells[1].FindControl("TextBox1")).Text;
            SqlDataSource6.Insert();

            Session["selectedSemester"] = GridView1.SelectedValue;
        }
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int         rowIdx = int.Parse(e.CommandArgument.ToString());
        GridViewRow gvr    = GridView1.Rows[rowIdx];
        int         id     = 0;

        int.TryParse(gvr.Cells[1].Text, out id);
        String lid = gvr.Cells[2].Text;

        if (e.CommandName == "allocate")
        {
            try {
                String   building     = (gvr.FindControl("cmbBuilding") as DropDownList).SelectedValue;
                String   reference    = (gvr.FindControl("txtRef") as TextBox).Text;
                DateTime trnDate      = DateTime.Now;
                String   amt          = gvr.Cells[5].Text;
                String   description  = gvr.Cells[4].Text;
                int      period       = int.Parse((gvr.FindControl("cmbPeriod") as DropDownList).SelectedValue);
                bool     alloc        = false;
                DateTime dt           = DateTime.Parse(gvr.Cells[3].Text);
                String   build        = building;
                String   b2           = (building == "UNA" ? "" : building);
                String   oldReference = description;
                if (period != 0 && reference != "")
                {
                    String sql = "IF EXISTS (SELECT * FROM tblUnallocated WHERE lid = " + lid + ")";
                    sql += " UPDATE tblUnallocated SET amount = '" + amt + "', building = '" + building + "', allocatedDate = '" + trnDate.ToString("yyyy/MM/dd") + "', allocated = 'True', allocatedCode = '" + b2 + "', reference = '" + reference + "', period = " + period + " WHERE (lid = " + lid + ")";
                    sql += " ELSE ";
                    sql += " INSERT INTO tblUnallocated(lid, trnDate, building, amount, description, reference, period, allocatedDate, allocatedCode, trustpost)";
                    sql += " VALUES(" + lid + ", '" + gvr.Cells[3].Text + "', '" + building + "', " + amt.ToString() + ", '" + description + "', '" + reference + "', " + period.ToString();
                    sql += ", '" + trnDate + "', '" + b2 + "', 'False');";
                    sql += " UPDATE tblLedgerTransactions SET allocate = 'True' WHERE id = " + lid;
                    String sqlReply = utils.executeQuery(sql, null);
                    if (sqlReply == "")
                    {
                        getBuilding(lid, trnDate.ToString("dd/MM/yyyy"), amt, description, reference, period.ToString(), building, alloc, dt, oldReference);
                    }
                    else
                    {
                        lblError.Text = sqlReply;
                    }
                }
            } catch { }
        }
        else if (e.CommandName == "Remove")
        {
            String DeleteCommand = "DELETE FROM tblUnallocated WHERE id = " + id.ToString() + "; DELETE FROM tblLedgerTransactions WHERE id = " + lid;
            utils.executeQuery(DeleteCommand, null);
            SqlDataSource5.Select(new DataSourceSelectArguments());
            SqlDataSource5.DataBind();
            GridView1.DataBind();
        }
        SqlDataSource6.Select(new DataSourceSelectArguments());
        GridView1.DataBind();
    }
Exemplo n.º 8
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        //SqlDataSource2.DataBind();
        //SqlDataSource4.DataBind();
        //SqlDataSource7.DataBind();
        SqlDataSource6.DataBind();
        SqlDataSource5.DataBind();

        //GridView1.DataBind();
        GridView2.DataBind();
        ////DetailsView1.DataBind();
        DetailsView2.DataBind();
        //System.Threading.Thread.Sleep(2000);
        //Response.Redirect("Admin.aspx?companyListBox.SelectedValue=" + companyListBox.SelectedValue);
    }
Exemplo n.º 9
0
    protected void btn2_Click(object sender, EventArgs e)
    {
        String Year = DropDownList1.SelectedValue;
        String sqlx = "SELECT DISTINCT UnitType FROM SchoolTable WHERE Year='" + Year + "'";

        SqlDataSource1.SelectCommand = sqlx;
        DataView dv = (DataView)SqlDataSource1.Select(new DataSourceSelectArguments());

        for (int i = 0; i < dv.Count; i++)
        {
            String uType = (String)dv[i][0];
            String Sql   = "select count(UnitName) from SchoolTable where UnitType='" + uType + "' AND Year='" + Year + "' AND Status='Activated'";
            SqlDataSource2.SelectCommand = Sql;
            DataView dv1   = (DataView)SqlDataSource2.Select(new DataSourceSelectArguments());
            int      uName = (int)dv1[0][0];
            String   msqlx = "select count(StudFullName) from StudentTable where UnitType='" + uType + "' AND Year='" + Year + "' AND Status='Activated'";
            SqlDataSource3.SelectCommand = msqlx;
            DataView dv2   = (DataView)SqlDataSource3.Select(new DataSourceSelectArguments());
            int      sName = (int)dv2[0][0];
            float    rf    = float.Parse(txtEnterRegistrationFeesForStudent.Text);
            float    t1    = sName * rf;
            String   msql  = "select count(FullName) from UnitLeaderTable where UnitType='" + uType + "' AND Year='" + Year + "' AND SupportingLeader='false' AND Status='Activated'";
            SqlDataSource4.SelectCommand = msql;
            DataView dv3    = (DataView)SqlDataSource4.Select(new DataSourceSelectArguments());
            int      ulName = (int)dv3[0][0];
            String   msqlv  = "select count(FullName) from UnitLeaderTable where UnitType='" + uType + "' AND Year='" + Year + "' AND SupportingLeader='true' AND Status='Activated'";
            int      sut;
            DataView dv4 = (DataView)SqlDataSource5.Select(new DataSourceSelectArguments());
            if (dv4.Count == 1)
            {
                sut = (int)dv4[0][0];
            }
            else
            {
                sut = 0;
            }

            float  urs    = float.Parse(txtEnterFeesForUnitLeader.Text);
            float  total  = (ulName + sut) * urs;
            int    mtotal = sName + ulName + sut;
            float  rtotal = t1 + total;
            String query  = "INSERT INTO UnitInformation (UnitType, TotalUnits, TotalStudent, StudentRegistrationFees, StudentTotalFees, TotalUnitLeader, TotalSupportingLeader, UnitLeaderRegistrationFees, UnitLeaderTotalFees, TotalMembers, TotalFees, Year)  VALUES('" + uType + "'," + uName + "," + sName + "," + rf + "," + t1 + "," + ulName + "," + sut + "," + urs + "," + total + "," + mtotal + "," + rtotal + ",'" + Year + "')";
            SqlDataSource6.InsertCommand = query;
            int n = SqlDataSource6.Insert();
        }
        Response.Write("<script>alert('Data inserted successfully...')</script>");
        CleartextBoxes(this);
    }
Exemplo n.º 10
0
 protected void Button10_Click(object sender, EventArgs e)
 {
     try
     {
         SqlDataSource2.Insert();
         DataView  dv = (DataView)SqlDataSource6.Select(DataSourceSelectArguments.Empty);
         DataTable dt = dv.ToTable();
         Label1.Text = dt.Rows[0][0].ToString();
         SqlDataSource7.Insert();
         Response.Redirect("~/UserPage/UserElectricityServices.aspx");
     }
     catch (Exception ee)
     {
         // Response.Redirect("~/MainPage/Home.aspx");
     }
 }
        protected void DetailsView2_ItemInserting(object sender, DetailsViewInsertEventArgs e)
        {
            try
            {
                SqlDataSource6.InsertParameters["semesterID"].DefaultValue = GridView1.SelectedValue.ToString();


                SqlDataSource6.InsertParameters["moduleCode"].DefaultValue = ((DropDownList)DetailsView2.Rows[1].Cells[1].FindControl("DropDownList6")).SelectedValue;

                SqlDataSource6.InsertParameters["lecturerName"].DefaultValue = ((TextBox)DetailsView2.Rows[2].Cells[1].FindControl("TextBox1")).Text;
                SqlDataSource6.Insert();

                Session["selectedSemester"] = GridView1.SelectedValue;
            }
            catch (Exception er)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "alert('Select a semester!')", true);
            }
        }
Exemplo n.º 12
0
    protected void btn2_Click(object sender, EventArgs e)
    {
        String Year = DropDownList1.SelectedValue;
        String sqlx = "SELECT DISTINCT UnitType FROM SchoolTable WHERE Year='" + Year + "'";

        SqlDataSource1.SelectCommand = sqlx;
        DataView ds = (DataView)SqlDataSource1.Select(new DataSourceSelectArguments());

        for (int a = 0; a < ds.Count; a++)
        {
            String uType = (String)ds[a][0];
            String Sql   = "select UnitName from SchoolTable where UnitType='" + uType + "' AND Year='" + Year + "' AND CharterNo IS NOT NULL AND Checked IS NULL";
            SqlDataSource2.SelectCommand = Sql;
            DataView dv = (DataView)SqlDataSource2.Select(new DataSourceSelectArguments());
            for (int i = 0; i < dv.Count; i++)
            {
                String uName = (String)dv[i][0];
                String msql  = "select count(StudFullName) from StudentTable where UnitName='" + uName + "' AND Year='" + Year + "'";
                String msqlx = "select count(FullName) from UnitLeaderTable where UnitName='" + uName + "' AND Year='" + Year + "'";
                SqlDataSource3.SelectCommand = msql;
                SqlDataSource4.SelectCommand = msqlx;
                DataView dv1   = (DataView)SqlDataSource3.Select(new DataSourceSelectArguments());
                DataView dv2   = (DataView)SqlDataSource4.Select(new DataSourceSelectArguments());
                int      st    = (int)dv1[0][0];
                int      ut    = (int)dv2[0][0];
                int      total = st + ut;
                int      cal   = st * (int.Parse(txtEnterTotalFeesForStudent.Text) - int.Parse(txtEnterOfficeContributionForStudent.Text)) + ut * (int.Parse(txtEnterTotalFeesForUnitLeader.Text) - int.Parse(txtEnterOfficeContributionForUnitLeader.Text));
                String   query = "INSERT INTO Confirmation (UnitName, Students, UnitLeader, Total, TotalRs, Year, UnitType, Checked) VALUES('" + uName + "'," + st + "," + ut + "," + total + "," + cal + ",'" + Year + "','" + uType + "', 'False')";
                SqlDataSource6.InsertCommand = query;
                try
                {
                    int n = SqlDataSource6.Insert();
                }
                catch (Exception er)
                {
                    Response.Write(er);
                }
            }
        }
        Response.Write("<script>alert('Data inserted successfully...')</script>");
        CleartextBoxes(this);
    }
Exemplo n.º 13
0
        protected void btnCadastrar_Click(object sender, EventArgs e)
        {
            Usuarios User = new Usuarios();

            User = (Usuarios)Session["usuario"];

            SqlDataSource1.SelectParameters["IDCond"].DefaultValue = Convert.ToString(User.Cond);

            SqlDataSource4.UpdateParameters["Nome"].DefaultValue  = ddlNome.SelectedItem.Value;
            SqlDataSource4.UpdateParameters["Bloco"].DefaultValue = ddlBloco.SelectedItem.Value;
            SqlDataSource4.UpdateParameters["Apart"].DefaultValue = ddlApartamento.SelectedItem.Value;

            SqlDataSource5.UpdateParameters["Nome"].DefaultValue  = ddlNome0.SelectedItem.Value;
            SqlDataSource5.UpdateParameters["Bloco"].DefaultValue = ddlBloco0.SelectedItem.Value;
            SqlDataSource5.UpdateParameters["Apart"].DefaultValue = ddlApartamento0.SelectedItem.Value;

            SqlDataSource4.Update();
            SqlDataSource5.Update();
            SqlDataSource6.Update();
        }
Exemplo n.º 14
0
        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (DropDownList1.SelectedValue)
            {
            case "Inner":
            {
                DataView myData = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
                GridView3.DataSource          = myData;
                GridView3.AutoGenerateColumns = true;
                GridView3.DataBind();
            }
            break;

            case "Left Outer":
            {
                DataView myData = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);
                GridView3.DataSource          = myData;
                GridView3.AutoGenerateColumns = true;
                GridView3.DataBind();
            }
            break;

            case "Right Outer":
            {
                DataView myData = (DataView)SqlDataSource5.Select(DataSourceSelectArguments.Empty);
                GridView3.DataSource          = myData;
                GridView3.AutoGenerateColumns = true;
                GridView3.DataBind();
            }
            break;

            case "Full Outer":
            {
                DataView myData = (DataView)SqlDataSource6.Select(DataSourceSelectArguments.Empty);
                GridView3.DataSource          = myData;
                GridView3.AutoGenerateColumns = true;
                GridView3.DataBind();
            }
            break;
            }
        }
Exemplo n.º 15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            StringBuilder varname1 = new StringBuilder();
            varname1.Append("select  * from CONFIG_MST_CYBOSPLUS where   category='TRADER' ");

            SqlDataSource1.SelectCommand = varname1.ToString();
            DataView dv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);

            DataRow[] dr = dv.Table.Select("code='BALANCE'");
            tbMaxMoney.Text = string.Format("{0:C}", int.Parse(dr[0]["VALUE"].ToString()));

            dr            = dv.Table.Select("code='BUDGET'");
            tbBudget.Text = string.Format("{0:C}", int.Parse(dr[0]["VALUE"].ToString()));

            dr = dv.Table.Select("code='BUYCONDITION_QTY'");
            tbMinCount.Text = string.Format("{0}", int.Parse(dr[0]["VALUE"].ToString()));

            //dr = dv.Table.Select("code='BUYCONDITION_QTY_SIGNAL'");
            //tbMinCountSignal.Text = string.Format("{0}", int.Parse(dr[0]["VALUE"].ToString()));

            dr             = dv.Table.Select("code='ORDERSTOCKCOUNT-DATA'");
            tbQtyData.Text = string.Format("{0}", int.Parse(dr[0]["VALUE"].ToString()));

            dr = dv.Table.Select("code='ORDERSTOCKCOUNT-SIGNAL'");
            tbQtySignal.Text = string.Format("{0}", int.Parse(dr[0]["VALUE"].ToString()));

            dr = dv.Table.Select("code='SELLEARNINGRATE_MINUS'");
            tbSellRateMinus.Text = string.Format("{0:N3}", double.Parse(dr[0]["VALUE"].ToString()));

            dr = dv.Table.Select("code='SELLEARNINGRATE_MINUS_SIGNAL'");
            tbSellRateMinusSignal.Text = string.Format("{0:N3}", double.Parse(dr[0]["VALUE"].ToString()));

            SqlDataSource6.SelectCommand = @"select  DAY || '.' || HOUR || ':' || MINUTE from    (    select extract(day from (systimestamp - max(A.WORK_DTTS)) ) DAY          ,extract(hour from (systimestamp - max(A.WORK_DTTS)) ) HOUR          ,extract(minute from (systimestamp - max(A.WORK_DTTS)) ) MINUTE    from CPMARKETWATCHS a) ";
            DataView dvv = (DataView)SqlDataSource6.Select(DataSourceSelectArguments.Empty);
            lbMarketWatch.Text = dvv[0][0].ToString();
        }
    }
Exemplo n.º 16
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        Double amount = Convert.ToDouble(TextBox2.Text) * Convert.ToInt32(TextBox3.Text);

        TextBox7.Text = amount.ToString("n2");
        DataView dvgroup     = (DataView)SqlDataSource9.Select(DataSourceSelectArguments.Empty);
        int      returncount = (int)dvgroup.Table.Rows[0][0];

        if (returncount >= 1)
        {
            Label11.Text = "Unable to Insert same Facility";
        }
        else
        {
            Label11.Text = "";
            SqlDataSource4.Insert();
            DataView dvx = (DataView)SqlDataSource6.Select(DataSourceSelectArguments.Empty);
            Double   tl  = (Double)dvx.Table.Rows[0][0];
            Label10.Text = tl.ToString("n2");
            Response.Redirect(Request.RawUrl);
        }
    }
Exemplo n.º 17
0
    protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            if (DataBinder.Eval(e.Row.DataItem, "fb_id").ToString() == Session["fb_id"].ToString() || Session["user_group"].ToString() == "1")
            {
            }
            else
            {
                e.Row.Cells[6].Text = "";
                e.Row.Cells[7].Text = "";
            }

            if ((e.Row.RowState & DataControlRowState.Edit) > 0)
            {
                SqlDataSource5.SelectParameters["id"].DefaultValue = ((DropDownList)e.Row.FindControl("DropDownList1")).SelectedValue;
                SqlDataSource5.Select(DataSourceSelectArguments.Empty);
                DropDownList DdlCountry = (DropDownList)e.Row.FindControl("DropDownList2");
                // bind DropDown manually
                DdlCountry.DataBind();
                DdlCountry.SelectedValue = DataBinder.Eval(e.Row.DataItem, "id1").ToString();

                SqlDataSource6.SelectParameters["id"].DefaultValue = ((DropDownList)e.Row.FindControl("DropDownList1")).SelectedValue;
                SqlDataSource6.Select(DataSourceSelectArguments.Empty);
                DropDownList DdlCountry2 = (DropDownList)e.Row.FindControl("DropDownList3");
                // bind DropDown manually
                DdlCountry2.DataBind();
                DdlCountry2.SelectedValue = DataBinder.Eval(e.Row.DataItem, "id2").ToString();

                SqlDataSource7.SelectParameters["id"].DefaultValue = ((DropDownList)e.Row.FindControl("DropDownList1")).SelectedValue;
                SqlDataSource7.Select(DataSourceSelectArguments.Empty);
                DropDownList DdlCountry3 = (DropDownList)e.Row.FindControl("DropDownList4");
                // bind DropDown manually
                DdlCountry3.DataBind();
                DdlCountry3.SelectedValue = DataBinder.Eval(e.Row.DataItem, "id3").ToString();
            }
        }
    }
        //protected void  insertButton_click()
        //{
        //    try
        //    {
        //        SqlDataSource6.InsertParameters["semesterID"].DefaultValue = GridView1.SelectedValue.ToString();


        //        SqlDataSource6.InsertParameters["moduleCode"].DefaultValue = ((DropDownList)DetailsView2.Rows[1].Cells[1].FindControl("DropDownList6")).SelectedValue;

        //        SqlDataSource6.InsertParameters["lecturerName"].DefaultValue = ((TextBox)DetailsView2.Rows[2].Cells[1].FindControl("TextBox1")).Text;
        //        SqlDataSource6.Insert();

        //        Session["selectedSemester"] = GridView1.SelectedValue;
        //    }
        //    catch (Exception er)
        //    {
        //        ClientScript.RegisterStartupScript(this.GetType(), "", "alert('Select a semester')", true);
        //    }
        //    GridView2.Visible = true;
        //    this.setGriview2(GridView1.SelectedValue.ToString());
        //    DetailsView2.DataBind();
        //    UpdatePanel3.Update();
        //}

        protected void insertButton_click(object sender, EventArgs e)
        {
            try
            {
                SqlDataSource6.InsertParameters["semesterID"].DefaultValue = GridView1.SelectedValue.ToString();


                SqlDataSource6.InsertParameters["moduleCode"].DefaultValue = ((DropDownList)DetailsView2.Rows[1].Cells[1].FindControl("DropDownList6")).SelectedValue;

                SqlDataSource6.InsertParameters["lecturerName"].DefaultValue = ((TextBox)DetailsView2.Rows[2].Cells[1].FindControl("TextBox1")).Text;
                SqlDataSource6.Insert();

                Session["selectedSemester"] = GridView1.SelectedValue;
            }
            catch (Exception er)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "alert('Select a semester')", true);
            }
            GridView2.Visible = true;
            this.setGriview2(GridView1.SelectedValue.ToString());
            DetailsView2.DataBind();
            UpdatePanel3.Update();
        }
Exemplo n.º 19
0
        protected void LoginBtn_Click(object sender, EventArgs e)
        {
            using (MD5 md5Hash = MD5.Create())
            {
                string password = GetMd5Hash(md5Hash, PPassword.Text);
                PPassword.Text = password;
            }

            DataView obstaja = (DataView)SqlDataSource6.Select(DataSourceSelectArguments.Empty);

            if (!(obstaja[0][0].ToString()).Equals("0"))
            {
                Session["UIme"] = PUsername.Text;
                ausers.Add(Session["UIme"].ToString());
                redir = true;
                Response.Redirect("Chat.aspx");
            }
            else
            {
                PError.Text    = "Uporabniško ime in geslo se ne ujemata, vnesite znova.";
                PUsername.Text = "";
                PPassword.Text = "";
            }
        }
Exemplo n.º 20
0
    public bool sendmail(string subject, string body)
    {
        //try
        //{
        string      mailstring = "*****@*****.**";
        string      host       = "mail.dd.net.sa";
        string      pass       = "******";
        IDataReader reader     = ((IDataReader)((IEnumerable)SqlDataSource6.Select(DataSourceSelectArguments.Empty)));

        while (reader.Read())
        {
            mailstring = reader["send_mail"].ToString();
            pass       = reader["pass"].ToString();
            host       = reader["host"].ToString();
        }
        SmtpClient SmtpServer = new SmtpClient();

        SmtpServer.Credentials = new System.Net.NetworkCredential(mailstring, pass);
        SmtpServer.Port        = 25;
        SmtpServer.Host        = host;
        SmtpServer.EnableSsl   = false;
        MailMessage mail = new MailMessage();

        mail.From = new MailAddress(mailstring);
        mail.To.Add(mailstring);
        mail.Subject    = subject;
        mail.Body       = body;
        mail.IsBodyHtml = true;
        SmtpServer.Send(mail);
        return(true);
        //}
        //catch
        //{
        //    return false;
        //}
    }
Exemplo n.º 21
0
 protected void Button10_Click1(object sender, EventArgs e)
 {
     SqlDataSource6.SelectCommand = "SELECT [ID_MaraProd], [MarcaP] FROM [MarcaProd] WHERE MarcaP like '%" + TextBox3.Text + "%'";
     SqlDataSource6.DataBind();
 }
Exemplo n.º 22
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Label2.Text  = DateTime.Now.ToString("D");
        Label14.Text = "";
        Label16.Text = "";
        Label33.Text = "";
        Label34.Text = "";
        Label35.Text = "";
        Label36.Text = "";
        Label24.Text = "";
        Label47.Text = "";
        DataView dv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);

        foreach (DataRow dr in dv.Table.Rows)
        {
            Cname        = (string)dv.Table.Rows[x][0];
            Cadd         = (string)dv.Table.Rows[x][1];
            Ccomp        = (string)dv.Table.Rows[x][2];
            Label14.Text = Label14.Text + Cname;
            Label33.Text = Label33.Text + Cadd;
            Label34.Text = Label34.Text + Ccomp;
            Label16.Text = Label16.Text + Cname;
            Label35.Text = Label35.Text + Cadd;
            Label36.Text = Label36.Text + Ccomp;
            Label24.Text = Label24.Text + Cname;
        }
        Venue.Text   = "";
        VAdd.Text    = "";
        N.Text       = "";
        Label37.Text = "";
        DataView dv1 = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);

        foreach (DataRow dr in dv1.Table.Rows)
        {
            Vname = (string)dv1.Table.Rows[x][0];
            Vadd  = (string)dv1.Table.Rows[x][1];
            Ename = (string)dv1.Table.Rows[x][2];
            Edate = (DateTime)dv1.Table.Rows[x][3];

            Venue.Text   = Venue.Text + Vname;
            VAdd.Text    = VAdd.Text + Vadd;
            N.Text       = N.Text + Ename;
            Label37.Text = Edate.ToString("D");
        }
        Label40.Text = "";
        Label41.Text = "";
        Label43.Text = "";
        Label44.Text = "";
        Label42.Text = "";
        Label1.Text  = "";
        DataView dv2 = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);

        foreach (DataRow dr in dv2.Table.Rows)
        {
            RF           = (double)dv2.Table.Rows[x][0];
            Total        = (double)dv2.Table.Rows[x][4];
            OE           = (double)dv2.Table.Rows[x][1];
            PB           = (double)dv2.Table.Rows[x][2];
            RPH          = (double)dv2.Table.Rows[x][3];
            DL           = (DateTime)dv2.Table.Rows[x][5];
            Label40.Text = Label40.Text + RF.ToString("n2");
            Label41.Text = Label41.Text + Total.ToString("n2");
            Label43.Text = Label43.Text + OE.ToString("n2");
            Label44.Text = Label44.Text + PB.ToString("n2");
            Label42.Text = Label42.Text + RPH.ToString("n2");
            Label1.Text  = DL.ToString("D");
        }
        Label45.Text = "";
        DataView dv3 = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);

        foreach (DataRow dr in dv3.Table.Rows)
        {
            Edate  = (DateTime)dv3.Table.Rows[x][0];
            Estime = (TimeSpan)dv3.Table.Rows[x][1];
            Eetime = (TimeSpan)dv3.Table.Rows[x][2];

            Label45.Text = Edate.ToString("D") + ' ' + ConvertMode(Estime.ToString()) + ' ' + '-' + ' ' + ConvertMode(Eetime.ToString());
        }
        Label46.Text = "";
        DataView dv4 = (DataView)SqlDataSource5.Select(DataSourceSelectArguments.Empty);

        foreach (DataRow dr in dv4.Table.Rows)
        {
            Aname        = (string)dv4.Table.Rows[x][0];
            Ades         = (string)dv4.Table.Rows[x][3];
            qty          = (int)dv4.Table.Rows[x][1];
            Label46.Text = Label46.Text + ' ' + Ades + ' ' + qty.ToString() + ' ' + "pcs" + ", ";
            x++;
        }
        Label3.Text = "";
        Label4.Text = "";
        string check = Label46.Text;
        int    lg    = check.Length;

        if (x > 0)
        {
            Label3.Text  = "<li> Amenity- ";
            check        = check.Substring(0, lg - 2);
            Label46.Text = check + ";";
            Label4.Text  = "</li>";
        }
        Label47.Text = "";
        DataView dv5 = (DataView)SqlDataSource6.Select(DataSourceSelectArguments.Empty);

        foreach (DataRow dr in dv5.Table.Rows)
        {
            Fname        = (string)dv5.Table.Rows[y][0];
            Fdes         = (string)dv5.Table.Rows[y][1];
            Label47.Text = Label47.Text + Fname + ' ' + Fdes + ", ";
            y++;
        }
        string check2 = Label47.Text;
        int    lg2    = check2.Length;

        Label5.Text = "";
        Label6.Text = "";
        if (y > 0)
        {
            Label5.Text  = "<li> Facility- ";
            check2       = check2.Substring(0, lg2 - 2);
            Label47.Text = check2 + ";";
            Label6.Text  = "</li>";
        }

        Label48.Text = "";
        DataView dv6 = (DataView)SqlDataSource7.Select(DataSourceSelectArguments.Empty);

        foreach (DataRow dr in dv6.Table.Rows)
        {
            Fname        = (string)dv6.Table.Rows[z][0];
            Fdes         = (string)dv6.Table.Rows[z][1];
            Label48.Text = Label48.Text + Mname + ' ' + Mdes + ", ";
            z++;
        }

        string check3 = Label48.Text;
        int    lg3    = check3.Length;

        if (lg3 != 0)
        {
            check3       = check3.Substring(0, lg3 - 2);
            Label48.Text = check3 + ";";
        }
    }
Exemplo n.º 23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        String y = "select DISTINCT [Year] from SchoolTable";

        SqlDataSource9.SelectCommand = y;
        DataView dv = (DataView)SqlDataSource9.Select(new DataSourceSelectArguments());

        for (int i = 0; i < dv.Count; i++)
        {
            if (dv[i][0] != DBNull.Value)
            {
                String year = (String)dv[i][0];

                String sql1 = "select count(UnitName) from SchoolTable where UnitType='Cub' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource1.SelectCommand = sql1;
                DataView dv1 = (DataView)SqlDataSource1.Select(new DataSourceSelectArguments());
                int      cub = (int)dv1[0][0];

                String sql2 = "select count(UnitName) from SchoolTable where UnitType='Scout' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource2.SelectCommand = sql2;
                DataView dv2   = (DataView)SqlDataSource2.Select(new DataSourceSelectArguments());
                int      scout = (int)dv2[0][0];

                String sql3 = "select count(UnitName) from SchoolTable where UnitType='Rover' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource3.SelectCommand = sql3;
                DataView dv3   = (DataView)SqlDataSource3.Select(new DataSourceSelectArguments());
                int      rover = (int)dv3[0][0];

                String sql4 = "select count(UnitName) from SchoolTable where UnitType='Bulbul' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource4.SelectCommand = sql4;
                DataView dv4    = (DataView)SqlDataSource4.Select(new DataSourceSelectArguments());
                int      bulbul = (int)dv4[0][0];

                String sql5 = "select count(UnitName) from SchoolTable where UnitType='Guide' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource5.SelectCommand = sql5;
                DataView dv5   = (DataView)SqlDataSource5.Select(new DataSourceSelectArguments());
                int      guide = (int)dv5[0][0];

                String sql6 = "select count(UnitName) from SchoolTable where UnitType='Ranger' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource6.SelectCommand = sql6;
                DataView dv6    = (DataView)SqlDataSource6.Select(new DataSourceSelectArguments());
                int      ranger = (int)dv6[0][0];

                String sql7 = "select count(UnitName) from SchoolTable where UnitType='Bunny' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource7.SelectCommand = sql7;
                DataView dv7   = (DataView)SqlDataSource7.Select(new DataSourceSelectArguments());
                int      bunny = (int)dv7[0][0];

                int total = cub + scout + rover + bulbul + guide + ranger + bunny;

                String sql9 = "select count(StudFullName) from StudentTable where UnitType='Cub' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource9.SelectCommand = sql9;
                DataView dv9  = (DataView)SqlDataSource9.Select(new DataSourceSelectArguments());
                int      cub1 = (int)dv9[0][0];

                String sql10 = "select count(StudFullName) from StudentTable where UnitType='Scout' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource10.SelectCommand = sql10;
                DataView dv10   = (DataView)SqlDataSource10.Select(new DataSourceSelectArguments());
                int      scout1 = (int)dv10[0][0];

                String sql11 = "select count(StudFullName) from StudentTable where UnitType='Rover' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource11.SelectCommand = sql11;
                DataView dv11   = (DataView)SqlDataSource11.Select(new DataSourceSelectArguments());
                int      rover1 = (int)dv11[0][0];

                String sql12 = "select count(StudFullName) from StudentTable where UnitType='Bulbul' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource12.SelectCommand = sql12;
                DataView dv12    = (DataView)SqlDataSource12.Select(new DataSourceSelectArguments());
                int      bulbul1 = (int)dv12[0][0];

                String sql13 = "select count(StudFullName) from StudentTable where UnitType='Guide' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource13.SelectCommand = sql13;
                DataView dv13   = (DataView)SqlDataSource13.Select(new DataSourceSelectArguments());
                int      guide1 = (int)dv13[0][0];

                String sql14 = "select count(StudFullName) from StudentTable where UnitType='Ranger' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource14.SelectCommand = sql14;
                DataView dv14    = (DataView)SqlDataSource14.Select(new DataSourceSelectArguments());
                int      ranger1 = (int)dv14[0][0];

                String sql15 = "select count(StudFullName) from StudentTable where UnitType='Bunny' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource15.SelectCommand = sql15;
                DataView dv15   = (DataView)SqlDataSource15.Select(new DataSourceSelectArguments());
                int      bunny1 = (int)dv7[0][0];

                int total1 = cub1 + scout1 + rover1 + bulbul1 + guide1 + ranger1 + bunny1;

                String sql16 = "select count(UnitName) from SchoolTable where Year='" + year + "' AND Status='Activated'";
                SqlDataSource16.SelectCommand = sql16;
                DataView dv16 = (DataView)SqlDataSource16.Select(new DataSourceSelectArguments());
                int      unit = (int)dv16[0][0];

                String sql17 = "select SUM(khTotalContri) from SchoolTable where Year='" + year + "'";
                SqlDataSource17.SelectCommand = sql17;
                DataView dv17 = (DataView)SqlDataSource17.Select(new DataSourceSelectArguments());
                int      amt;
                if (dv17[0][0] != DBNull.Value)
                {
                    amt = (int)dv17[0][0];
                }
                else
                {
                    amt = 0;
                }
                String sql18 = "select count(SchoolName) from SchoolTable where Year='" + year + "' AND Status='Activated'";
                SqlDataSource18.SelectCommand = sql18;
                DataView dv18 = (DataView)SqlDataSource18.Select(new DataSourceSelectArguments());
                int      sch  = (int)dv18[0][0];

                String sql19 = "select count(SchoolName) from SchoolTable where SchoolType='PrimarySchool' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource19.SelectCommand = sql19;
                DataView dv19 = (DataView)SqlDataSource19.Select(new DataSourceSelectArguments());
                int      sch1 = (int)dv19[0][0];

                String sql20 = "select count(SchoolName) from SchoolTable where SchoolType='SecondarySchool' AND Year='" + year + "' AND Status='Activated'";
                SqlDataSource20.SelectCommand = sql20;
                DataView dv20 = (DataView)SqlDataSource20.Select(new DataSourceSelectArguments());
                int      sch2 = (int)dv20[0][0];

                int    total3 = sch1 + sch2;
                String update = "Select * from StatisticalData where Year='" + year + "'";
                SqlDataSource21.SelectCommand = update;
                DataView dv21 = (DataView)SqlDataSource21.Select(new DataSourceSelectArguments());
                if (dv21.Count != 0)
                {
                    String query = "update StatisticalData set Cub=" + cub + ", Scout=" + scout + ", Rover=" + rover + ", Bulbul=" + bulbul + ", Guide=" + guide + ", Ranger=" + ranger + ", Bunny=" + bunny + ", Total=" + total + ", Cub1=" + cub1 + ", Scout1=" + scout1 + ", Rover1=" + rover1 + ", Bulbul1=" + bulbul1 + ", Guide1=" + guide1 + ", Ranger1=" + ranger1 + ", Bunny1=" + bunny1 + ", Total1=" + total1 + ", TotalUnits=" + unit + ", CollectedFees=" + amt + ", TotalParticipatedSchools=" + sch + ", PrimarySchool=" + sch1 + ", SecondarySchool=" + sch2 + ", TotalMembers=" + total3 + " where Year='" + year + "'";
                    SqlDataSource22.UpdateCommand = query;
                    int n = SqlDataSource22.Update();
                }
                else
                {
                    String insert1 = "insert into StatisticalData (Year, Cub, Scout, Rover, Bulbul, Guide, Ranger, Bunny, Total, Cub1, Scout1, Rover1, Bulbul1, Guide1, Ranger1, Bunny1, Total1, TotalUnits, CollectedFees, TotalParticipatedSchools, PrimarySchool, SecondarySchool, TotalMembers) Values('" + year + "'," + cub + "," + scout + "," + rover + "," + bulbul + "," + guide + "," + ranger + "," + bunny + "," + total + "," + cub1 + "," + scout1 + "," + rover1 + "," + bulbul1 + "," + guide1 + "," + ranger1 + "," + bunny1 + "," + total1 + "," + unit + "," + amt + "," + sch + "," + sch1 + "," + sch2 + "," + total3 + ")";
                    SqlDataSource8.InsertCommand = insert1;
                    int n1 = SqlDataSource8.Insert();
                }
            }
        }
        Server.Transfer("Statistical2.aspx");
    }
Exemplo n.º 24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Double   oa  = 0;
        Double   pb  = 0;
        DataView dv1 = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);

        Label1.Text = (string)dv1.Table.Rows[0][1];
        Label2.Text = (string)dv1.Table.Rows[0][2];
        DateTime rdate = (DateTime)dv1.Table.Rows[0][6];

        Label3.Text = rdate.ToString("MM/dd/yyyy");

        Double era = (Double)dv1.Table.Rows[0][4];

        if (dv1.Table.Rows[0][5] is DBNull)
        {
            Label6.Text = ""; Label7.Text = "";
        }
        else
        {
            pb          = (Double)dv1.Table.Rows[0][5];
            Label6.Text = "Performance Bond";
            Label7.Text = pb.ToString("n2");
        }

        if (dv1.Table.Rows[0][3] is DBNull)
        {
        }
        else
        {
            oa          = (Double)dv1.Table.Rows[0][3];
            Label5.Text = oa.ToString("n2");
        }

        Label4.Text = era.ToString("n2");

        era         = oa + era + pb;
        Label8.Text = era.ToString("n2");

        if (dv1.Table.Rows[0][7] is DBNull)
        {
            Label9.Text = "No Reservation Fee.";
        }
        else
        {
            Double rf = (Double)dv1.Table.Rows[0][7];
            Label9.Text = rf.ToString("n2");
        }
        int vid = (int)dv1.Table.Rows[0][8];

        TextBox4.Text = vid.ToString();
        TextBox8.Text = Request.QueryString["newId"];
        DataView dvy = (DataView)SqlDataSource8.Select(DataSourceSelectArguments.Empty);

        if ((int)dvy.Table.Rows[0][0] >= 1)
        {
            DataView dvx = (DataView)SqlDataSource6.Select(DataSourceSelectArguments.Empty);
            Double   tl  = (Double)dvx.Table.Rows[0][0];
            Label10.Text = tl.ToString("n2");
        }
        else
        {
            Label10.Text = "0";
        }

        DataView dva = (DataView)rsvamntyCount.Select(DataSourceSelectArguments.Empty);

        if ((int)dva.Table.Rows[0][0] >= 1)
        {
            DataView dvb = (DataView)rsvamntySum.Select(DataSourceSelectArguments.Empty);
            Double   tl2 = (Double)dvb.Table.Rows[0][0];
            Label12.Text = tl2.ToString("n2");
        }
        else
        {
            Label12.Text = "0";
        }
        DataView dvz = (DataView)rsvmiscCount.Select(DataSourceSelectArguments.Empty);

        if ((int)dvz.Table.Rows[0][0] >= 1)
        {
            DataView dvw = (DataView)rsvmiscSum.Select(DataSourceSelectArguments.Empty);
            Double   tl3 = (Double)dvw.Table.Rows[0][0];
            Label13.Text = tl3.ToString("n2");
        }
        else
        {
            Label13.Text = "0";
        }

        Label11.Text      = "";
        TextBox3.ReadOnly = true;

        Double gtotal = Convert.ToDouble(Label8.Text) + Convert.ToDouble(Label10.Text) + Convert.ToDouble(Label12.Text) + Convert.ToDouble(Label13.Text);

        Label14.Text = gtotal.ToString("n2");
        rsvupdatetotal.Update();
    }
        protected void Button1_Click(object sender, EventArgs e)
        {
            DataView    dv  = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
            DataRowView drv = dv[0];

            Table1.Rows[1].Cells[0].Text = drv["BUGS"].ToString();

            DataView    dv1  = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);
            DataRowView drv1 = dv1[0];

            Table1.Rows[1].Cells[1].Text = drv1["BUGS"].ToString();

            DataView    dv2  = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
            DataRowView drv2 = dv2[0];

            Table1.Rows[1].Cells[2].Text = drv2["BUGS"].ToString();

            DataView    dv3  = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);
            DataRowView drv3 = dv3[0];

            Table1.Rows[1].Cells[3].Text = drv3["BUGS"].ToString();

            DataView    dv5  = (DataView)SqlDataSource5.Select(DataSourceSelectArguments.Empty);
            DataRowView drv5 = dv5[0];

            Table2.Rows[1].Cells[0].Text = drv5["BUGS"].ToString();

            DataView    dv6  = (DataView)SqlDataSource6.Select(DataSourceSelectArguments.Empty);
            DataRowView drv6 = dv6[0];

            Table2.Rows[1].Cells[1].Text = drv6["BUGS"].ToString();

            DataView    dv7  = (DataView)SqlDataSource7.Select(DataSourceSelectArguments.Empty);
            DataRowView drv7 = dv7[0];

            Table2.Rows[1].Cells[2].Text = drv7["BUGS"].ToString();

            DataView    dv8  = (DataView)SqlDataSource8.Select(DataSourceSelectArguments.Empty);
            DataRowView drv8 = dv8[0];

            Table2.Rows[1].Cells[3].Text = drv8["BUGS"].ToString();

            DataView    dv9  = (DataView)SqlDataSource9.Select(DataSourceSelectArguments.Empty);
            DataRowView drv9 = dv9[0];

            Table3.Rows[1].Cells[0].Text = drv9["BUGS"].ToString();

            DataView    dv10  = (DataView)SqlDataSource10.Select(DataSourceSelectArguments.Empty);
            DataRowView drv10 = dv10[0];

            Table3.Rows[1].Cells[1].Text = drv10["BUGS"].ToString();

            DataView    dv11  = (DataView)SqlDataSource11.Select(DataSourceSelectArguments.Empty);
            DataRowView drv11 = dv11[0];

            Table3.Rows[1].Cells[2].Text = drv11["BUGS"].ToString();

            DataView    dv12  = (DataView)SqlDataSource12.Select(DataSourceSelectArguments.Empty);
            DataRowView drv12 = dv12[0];

            Table3.Rows[1].Cells[3].Text = drv12["BUGS"].ToString();
        }
    protected void btnNext_Click(object sender, EventArgs e)
    {
        //save project code to cookie
        if (!Page.IsValid)
        {
            return;
        }
        else
        {
            ManageCookie mgCookie = new ManageCookie();
            users        ck       = mgCookie.ReadCookies();

            // update to database
            SqlParameter pj_code = new SqlParameter("@pj_code", SqlDbType.NVarChar, 15);
            pj_code.Direction = ParameterDirection.Input;
            pj_code.Value     = lblProjectCode.Text;

            SqlParameter p_id = new SqlParameter("@p_id", SqlDbType.Int);
            p_id.Direction = ParameterDirection.Input;
            p_id.Value     = ck.p_id;

            SqlParameter d_id = new SqlParameter("@d_id", SqlDbType.NVarChar, 20);
            d_id.Direction = ParameterDirection.Input;
            d_id.Value     = ck.d_id;

            SqlParameter mi_id = new SqlParameter("@mi_id", SqlDbType.NVarChar, 25);
            mi_id.Direction = ParameterDirection.Input;
            mi_id.Value     = ck.mi_id;

            SqlParameter pj_name = new SqlParameter("@pj_name", SqlDbType.NVarChar, 500);
            pj_name.Direction = ParameterDirection.Input;
            pj_name.Value     = txtProjectName.Text;

            SqlParameter pj_yut_id = new SqlParameter("@pj_yut_id", SqlDbType.Int);
            pj_yut_id.Direction = ParameterDirection.Input;
            pj_yut_id.Value     = ddlYudtasad.SelectedValue;

            SqlParameter pj_year = new SqlParameter("@pj_year", SqlDbType.NVarChar, 4);
            pj_year.Direction = ParameterDirection.Input;
            pj_year.Value     = ddlYear.SelectedValue;

            SqlParameter pj_budget_money = new SqlParameter("@pj_budget_money", SqlDbType.Float);
            pj_budget_money.Direction = ParameterDirection.Input;
            pj_budget_money.Value     = txtBudget.Text.Replace(",", "");

            SqlParameter pj_budget = new SqlParameter("@pj_budget", SqlDbType.NVarChar, 50);
            pj_budget.Direction = ParameterDirection.Input;
            pj_budget.Value     = txtBudget.Text;

            SqlParameter pj_budget_category = new SqlParameter("@pj_budget_category", SqlDbType.NVarChar, 200);
            pj_budget_category.Direction = ParameterDirection.Input;
            pj_budget_category.Value     = DropDownList2.SelectedValue;

            //SqlParameter pj_integrateProject = new SqlParameter("@pj_integrateProject", SqlDbType.NVarChar);
            //pj_integrateProject.Direction = ParameterDirection.Input;
            ////pj_integrateProject.Value = txtIntegrate.Text;
            //pj_integrateProject.Value = string.Empty;

            //SqlParameter pj_relateDept = new SqlParameter("@pj_relateDept", SqlDbType.NVarChar);
            //pj_relateDept.Direction = ParameterDirection.Input;
            ////pj_relateDept.Value = txtRelate.Text;
            //pj_relateDept.Value = string.Empty;

            SqlParameter pj_status = new SqlParameter("@pj_status", SqlDbType.NVarChar);
            pj_status.Direction = ParameterDirection.Input;
            pj_status.Value     = Request.QueryString["status"];

            insertParameters.Add(pj_code);
            insertParameters.Add(p_id);
            insertParameters.Add(d_id);
            insertParameters.Add(mi_id);
            insertParameters.Add(pj_name);
            insertParameters.Add(pj_yut_id);
            insertParameters.Add(pj_year);
            insertParameters.Add(pj_budget);
            insertParameters.Add(pj_budget_money);
            //insertParameters.Add(pj_integrateProject);
            //insertParameters.Add(pj_relateDept);
            insertParameters.Add(pj_status);
            insertParameters.Add(pj_budget_category);

            try
            {
                SqlDataSource44.Update();

                //keep project code in cookie for usage in follwing pages
                mgCookie.UpdateCookies("pj_code", lblProjectCode.Text);
            }
            catch (Exception ex)
            {
                //ELMA Log
                Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            }


            SqlDataSource6.SelectCommand = "SELECT pj_id FROM [projects] where pj_code = '" + lblProjectCode.Text + "' and pj_status = '" + Request.QueryString["status"] + "'";
            SqlDataSource6.DataBind();

            DataView dv1 = (DataView)SqlDataSource6.Select(DataSourceSelectArguments.Empty);

            //keep project code in cookie for usage in follwing pages
            mgCookie.UpdateCookies("pj_id", dv1.Table.Rows[0]["pj_id"].ToString());

            Response.Redirect("project_filter.aspx");
        }
    }