Пример #1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        int query = 0;

        try
        {
            if (txtgymname.Text != "" && txtAcry.Text != "")
            {
                name = Convert.ToString(txtgymname.Text);
                acry = Convert.ToString(txtAcry.Text);
                Fpload1.SaveChanges();
                sql   = "if exists (select * from HM_GymMaster where GymAcr='" + acry + "' and GymName='" + name + "') update HM_GymMaster set GymAcr='" + acry + "',GymName='" + name + "' where GymAcr='" + acry + "' and GymName='" + name + "' else insert into HM_GymMaster(GymName,GymAcr) values ('" + name + "','" + acry + "')";
                query = d2.update_method_wo_parameter(sql, "TEXT");
                if (query != 0)
                {
                    Div1.Visible      = false;
                    imgAlert.Visible  = true;
                    lbl_alert.Visible = true;
                    lbl_alert.Text    = "Saved Successfully";
                    //gymmaster();
                }
            }
            else
            {
                Div1.Visible     = false;
                imgAlert.Visible = true;
                lbl_alert.Text   = "Please Enter The Gym Details!";
            }
        }
        catch
        {
        }
    }
    protected void delete()
    {
        try
        {
            string sqld = string.Empty;
            string acr  = string.Empty;
            string stno = string.Empty;
            string siz  = string.Empty;

            int query = 0;
            Fpload1.SaveChanges();
            string firstdate = Convert.ToString(txt_frmdate.Text);
            dt    = new DateTime();
            split = firstdate.Split('/');
            dt    = Convert.ToDateTime(split[1] + '/' + split[0] + '/' + split[2]);
            DateTime date     = dt.Date;
            DateTime currdate = DateTime.Now.Date;
            string   currtime = DateTime.Now.ToLongTimeString();
            if (Fpload1.Rows.Count > 0)
            {
                Fpload1.SaveChanges();
                for (int row = 0; row < Fpload1.Sheets[0].RowCount; row++)
                {
                    int checkval = Convert.ToInt32(Fpload1.Sheets[0].Cells[row, 1].Value);
                    if (checkval == 1)
                    {
                        dep  = Convert.ToString(Fpload1.Sheets[0].Cells[row, 2].Tag);
                        acr  = Convert.ToString(Fpload1.Sheets[0].Cells[row, 3].Text);
                        stno = Convert.ToString(Fpload1.Sheets[0].Cells[row, 4].Text);
                        siz  = Convert.ToString(Fpload1.Sheets[0].Cells[row, 5].Text);
                        if (acr != "" && stno != "" && siz != "" && dep != "")
                        {
                            sqld  = "delete from InwardCodeSettings where CollegeCode='" + Convert.ToString(collegecode) + "' and FromDate='" + date.ToString("MM/dd/yyyy") + "' and DeptCode='" + dep + "'";
                            query = d2.update_method_wo_parameter(sqld, "Text");
                        }
                    }
                }
                if (query != 0)
                {
                    Divdelete.Visible = true;
                    Label3.Visible    = true;
                    Label3.Text       = "Deleted Successfully";
                    Div3.Visible      = false;
                    surediv.Visible   = false;
                }
                else
                {
                    Label3.Text = "Not Saved";
                }
            }
        }
        catch (Exception ex) { }
    }
    protected void btnupdate_Click(object sender, EventArgs e)
    {
        int query = 0;

        try
        {
            string sqlu = string.Empty;
            string acr  = string.Empty;
            string stno = string.Empty;
            string siz  = string.Empty;

            Fpload1.SaveChanges();
            int activerow = Fpload1.ActiveSheetView.ActiveRow;
            int activecol = Fpload1.ActiveSheetView.ActiveColumn;
            dep  = Convert.ToString(Fpload1.Sheets[0].Cells[activerow, 2].Tag);
            acr  = Convert.ToString(Fpload1.Sheets[0].Cells[activerow, 3].Text);
            stno = Convert.ToString(Fpload1.Sheets[0].Cells[activerow, 4].Text);
            siz  = Convert.ToString(Fpload1.Sheets[0].Cells[activerow, 5].Text);

            string firstdate = Convert.ToString(txt_frmdate.Text);
            dt    = new DateTime();
            split = firstdate.Split('/');
            dt    = Convert.ToDateTime(split[1] + '/' + split[0] + '/' + split[2]);
            DateTime date     = dt.Date;
            DateTime currdate = DateTime.Now.Date;
            string   currtime = DateTime.Now.ToLongTimeString();


            sqlu = "update InwardCodeSettings set InwardAcr='" + acr + "' , InwardSize='" + siz + "' ,  InwardStNo='" + stno + "' ,  FromTime='" + currtime + "' , FromDate='" + date.ToString("MM/dd/yyyy") + "'  where  DeptCode='" + dep + "' and  CollegeCode='" + Convert.ToString(collegecode) + "'";

            int qry = d2.update_method_wo_parameter(sqlu, "Text");
            if (qry != 0)
            {
                Div1.Visible   = true;
                Label3.Visible = true;
                Label3.Text    = "Updated Successfully";
            }
            else
            {
                Div1.Visible     = false;
                lblalerterr.Text = "No Record Found!";
            }
        }
        catch
        {
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        int query = 0;


        string sqls = string.Empty;
        string acr  = string.Empty;
        string stno = string.Empty;
        string siz  = string.Empty;

        try
        {
            Fpload1.SaveChanges();

            string firstdate = Convert.ToString(txt_frmdate.Text);
            dt    = new DateTime();
            split = firstdate.Split('/');
            dt    = Convert.ToDateTime(split[1] + '/' + split[0] + '/' + split[2]);
            DateTime date     = dt.Date;
            DateTime currdate = DateTime.Now.Date;
            string   currtime = DateTime.Now.ToLongTimeString();
            bool     check    = false;
            int      inscount = 0;

            if (Fpload1.Rows.Count > 0)
            {
                Fpload1.SaveChanges();
                for (int row = 0; row < Fpload1.Sheets[0].RowCount; row++)
                {
                    int checkval = Convert.ToInt32(Fpload1.Sheets[0].Cells[row, 1].Value);
                    if (checkval == 1)
                    {
                        dep  = Convert.ToString(Fpload1.Sheets[0].Cells[row, 2].Tag);
                        acr  = Convert.ToString(Fpload1.Sheets[0].Cells[row, 3].Text);
                        stno = Convert.ToString(Fpload1.Sheets[0].Cells[row, 4].Text);
                        siz  = Convert.ToString(Fpload1.Sheets[0].Cells[row, 5].Text);


                        if (acr != "" && stno != "" && siz != "" && dep != "")
                        {
                            sqls = "if exists (select * from InwardCodeSettings where InwardAcr='" + acr + "' and InwardSize='" + siz + "' and  InwardStNo='" + stno + "' and CollegeCode='" + Convert.ToString(collegecode) + "' and  FromTime='" + currtime + "' and FromDate='" + date.ToString("MM/dd/yyyy") + "' and DeptCode='" + dep + "') update InwardCodeSettings set InwardAcr='" + acr + "' , InwardSize='" + siz + "' ,  InwardStNo='" + stno + "' , CollegeCode='" + Convert.ToString(collegecode) + "' ,  FromTime='" + currtime + "' , FromDate='" + date.ToString("MM/dd/yyyy") + "' , DeptCode='" + dep + "'  where InwardAcr='" + acr + "' and InwardSize='" + siz + "' and  InwardStNo='" + stno + "' and CollegeCode='" + Convert.ToString(collegecode) + "' and  FromTime='" + currtime + "' and FromDate='" + date.ToString("MM/dd/yyyy") + "' and DeptCode='" + dep + "' else insert into InwardCodeSettings (InwardAcr,InwardSize,InwardStNo,CollegeCode,FromTime,FromDate,DeptCode) values('" + acr + "','" + siz + "','" + stno + "','" + Convert.ToString(collegecode) + "','" + currtime + "','" + date.ToString("MM/dd/yyyy") + "','" + dep + "')";

                            inscount = d2.update_method_wo_parameter(sqls, "Text");
                        }
                    }
                }
                if (inscount != 0)
                {
                    Div1.Visible   = true;
                    Label3.Visible = true;
                    Label3.Text    = "Saved Successfully";
                }
                else
                {
                    Label3.Text = "Not Saved";
                }
            }
        }


        catch
        {
        }
    }
Пример #5
0
    private void loadspreaddetails(DataSet ds)
    {
        try
        {
            loadspreadHeader(ds);

            FarPoint.Web.Spread.TextCellType txtCell = new FarPoint.Web.Spread.TextCellType();
            int sno = 0;


            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                for (int row = 0; row < ds.Tables[0].Rows.Count; row++)
                {
                    Fpload1.Sheets[0].RowCount++;
                    sno++;
                    Gym_Name    = Convert.ToString(ds.Tables[0].Rows[row]["GymName"]).Trim();
                    Gym_Acroynm = Convert.ToString(ds.Tables[0].Rows[row]["GymAcr"]).Trim();
                    Gym_PK      = Convert.ToString(ds.Tables[0].Rows[row]["GymPK"]).Trim();



                    Fpload1.Sheets[0].Cells[Fpload1.Sheets[0].RowCount - 1, 0].CellType = txtCell;
                    Fpload1.Sheets[0].Cells[Fpload1.Sheets[0].RowCount - 1, 1].CellType = txtCell;
                    Fpload1.Sheets[0].Cells[Fpload1.Sheets[0].RowCount - 1, 2].CellType = txtCell;
                    Fpload1.Sheets[0].Cells[Fpload1.Sheets[0].RowCount - 1, 3].CellType = txtCell;



                    Fpload1.Sheets[0].Cells[Fpload1.Sheets[0].RowCount - 1, 0].Text = Convert.ToString(sno);

                    Fpload1.Sheets[0].Cells[Fpload1.Sheets[0].RowCount - 1, 1].Text = Gym_Name;
                    Fpload1.Sheets[0].Cells[Fpload1.Sheets[0].RowCount - 1, 2].Text = Gym_Acroynm;
                    Fpload1.Sheets[0].Cells[Fpload1.Sheets[0].RowCount - 1, 3].Text = Gym_PK;



                    Fpload1.Sheets[0].Cells[Fpload1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
                    Fpload1.Sheets[0].Cells[Fpload1.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Left;
                    Fpload1.Sheets[0].Cells[Fpload1.Sheets[0].RowCount - 1, 2].HorizontalAlign = HorizontalAlign.Left;
                    Fpload1.Sheets[0].Cells[Fpload1.Sheets[0].RowCount - 1, 3].HorizontalAlign = HorizontalAlign.Left;


                    Fpload1.Sheets[0].Cells[Fpload1.Sheets[0].RowCount - 1, 0].VerticalAlign = VerticalAlign.Middle;
                    Fpload1.Sheets[0].Cells[Fpload1.Sheets[0].RowCount - 1, 1].VerticalAlign = VerticalAlign.Middle;
                    Fpload1.Sheets[0].Cells[Fpload1.Sheets[0].RowCount - 1, 2].VerticalAlign = VerticalAlign.Middle;
                    Fpload1.Sheets[0].Cells[Fpload1.Sheets[0].RowCount - 1, 3].VerticalAlign = VerticalAlign.Middle;



                    Fpload1.Sheets[0].Cells[Fpload1.Sheets[0].RowCount - 1, 0].Locked = true;
                    Fpload1.Sheets[0].Cells[Fpload1.Sheets[0].RowCount - 1, 1].Locked = true;
                    Fpload1.Sheets[0].Cells[Fpload1.Sheets[0].RowCount - 1, 2].Locked = true;
                }

                Fpload1.Sheets[0].Columns[0].Width   = 50;
                Fpload1.Sheets[0].Columns[1].Width   = 150;
                Fpload1.Sheets[0].Columns[2].Width   = 100;
                Fpload1.Sheets[0].Columns[3].Visible = false;


                Fpload1.Sheets[0].PageSize = Fpload1.Sheets[0].RowCount;
                Fpload1.SaveChanges();
                Fpload1.Visible        = true;
                lbprint.Visible        = true;
                lblrptname.Visible     = true;
                txtexcelname.Visible   = true;
                btn_excel.Visible      = true;
                btnprintmaster.Visible = true;
            }
        }

        catch
        {
        }
    }