Пример #1
0
 public void loadstage()
 {
     FarPoint.Web.Spread.TextCellType tb = new FarPoint.Web.Spread.TextCellType();
     //FpSpreadstage.Sheets[0].AutoPostBack = true;
     //FpSpreadstage.ActiveSheetView.SheetCorner.Cells[0, 0].Text = "S.No";
     //FpSpreadstage.ActiveSheetView.SheetCorner.DefaultStyle.Font.Bold = true;
     FpSpreadstage.ActiveSheetView.DefaultRowHeight          = 25;
     FpSpreadstage.ActiveSheetView.Rows.Default.Font.Name    = "MS Sans Serif";
     FpSpreadstage.ActiveSheetView.Rows.Default.Font.Size    = FontUnit.Small;
     FpSpreadstage.ActiveSheetView.Rows.Default.Font.Bold    = false;
     FpSpreadstage.ActiveSheetView.Columns.Default.Font.Bold = false;
     FpSpreadstage.Sheets[0].RowHeader.Visible = false;
     FpSpreadstage.ActiveSheetView.Columns.Default.Font.Name           = "MS Sans Serif";
     FpSpreadstage.ActiveSheetView.Columns.Default.Font.Size           = FontUnit.Small;
     FpSpreadstage.ActiveSheetView.ColumnHeader.DefaultStyle.Font.Bold = true;
     FpSpreadstage.ActiveSheetView.ColumnHeader.DefaultStyle.Font.Name = "MS Sans Serif";
     FpSpreadstage.ActiveSheetView.ColumnHeader.DefaultStyle.Font.Size = FontUnit.Small;
     FpSpreadstage.VerticalScrollBarPolicy   = FarPoint.Web.Spread.ScrollBarPolicy.AsNeeded;
     FpSpreadstage.HorizontalScrollBarPolicy = FarPoint.Web.Spread.ScrollBarPolicy.AsNeeded;
     FarPoint.Web.Spread.ButtonCellType   btnmodify = new FarPoint.Web.Spread.ButtonCellType();
     FarPoint.Web.Spread.CheckBoxCellType cbxd      = new FarPoint.Web.Spread.CheckBoxCellType();
     FarPoint.Web.Spread.ComboBoxCellType cf        = new FarPoint.Web.Spread.ComboBoxCellType();
     cf.AutoPostBack   = true;
     cbxd.AutoPostBack = true;
     btnmodify.Text    = "Remove";
     FpSpreadstage.Sheets[0].RowCount    = 0;
     FpSpreadstage.Sheets[0].ColumnCount = 5;
     FpSpreadstage.Sheets[0].ColumnHeader.Cells[0, 0].Text = "S.No";
     FpSpreadstage.Sheets[0].ColumnHeader.Cells[0, 1].Text = "District";
     FpSpreadstage.Sheets[0].Columns[1].CellType           = cf;
     FpSpreadstage.Sheets[0].ColumnHeader.Cells[0, 2].Text = "Stage Name";
     FpSpreadstage.Sheets[0].ColumnHeader.Cells[0, 3].Text = "Address";
     FpSpreadstage.Sheets[0].ColumnHeader.Cells[0, 4].Text = "Select";
     FpSpreadstage.Sheets[0].Columns[4].CellType           = cbxd;
     //FpSpreadstage.Sheets[0].Columns[2].CellType = btnmodify;
     FpSpreadstage.Sheets[0].Columns[3].Visible         = true;
     FpSpreadstage.Sheets[0].Columns[0].HorizontalAlign = HorizontalAlign.Center;
     FpSpreadstage.Sheets[0].Columns[4].HorizontalAlign = HorizontalAlign.Center;
     //FpSpreadstage.Sheets[0].Columns[2].Font.Bold = true;
     FpSpreadstage.Sheets[0].Columns[0].Width = 40;
     FpSpreadstage.Sheets[0].Columns[1].Width = 200;
     FpSpreadstage.Sheets[0].Columns[2].Width = 350;
     FpSpreadstage.Sheets[0].Columns[3].Width = 340;
     FpSpreadstage.Sheets[0].Columns[4].Width = 50;
     FpSpreadstage.Sheets[0].PageSize         = 100;
     FpSpreadstage.Width  = 1000;
     FpSpreadstage.Height = 391;
     FpSpreadstage.SaveChanges();
     FpSpreadstage.CommandBar.Visible = false;
 }
Пример #2
0
    public void FpSpread2_UpdateCommand(object sender, FarPoint.Web.Spread.SpreadCommandEventArgs e)//del
    {
        FarPoint.Web.Spread.ButtonCellType btn         = new FarPoint.Web.Spread.ButtonCellType();
        FarPoint.Web.Spread.DoubleCellType txtserialNo = new FarPoint.Web.Spread.DoubleCellType();
        txtserialNo.ErrorMessage = "Allow only numbers";
        btn.ButtonType           = FarPoint.Web.Spread.ButtonType.LinkButton;
        btn.Text = "Quota Settings";
        string clgDetails = string.Empty;
        string actrow     = FpSpread1.Sheets[0].ActiveRow.ToString();
        string actcol     = FpSpread1.Sheets[0].ActiveColumn.ToString();

        if (actrow.Trim() != "" && actcol.Trim() != "")
        {
            clgDetails = Convert.ToString(FpSpread1.Sheets[0].Cells[Convert.ToInt32(actrow), Convert.ToInt32(actcol)].Text);
            if (clgDetails == "Quota")
            {
                btn.Text = "Quota Settings";
                FpSpread1.Sheets[0].Cells[Convert.ToInt32(actrow), 4].CellType = btn;
            }
            //else
            //{
            //    string[] prefix = new string[2];
            //    prefix[0] = "Prefix";
            //    prefix[1] = "Suffix";
            //    FarPoint.Web.Spread.ComboBoxCellType dropdown2 = new FarPoint.Web.Spread.ComboBoxCellType(prefix, prefix);
            //    FpSpread1.Sheets[0].Cells[Convert.ToInt32(actrow), 4].CellType = dropdown2;
            //}
            if (clgDetails == "Serial No")
            {
                string start = FpSpread1.Sheets[0].Cells[Convert.ToInt32(actrow), 1].Text;
                string end = FpSpread1.Sheets[0].Cells[Convert.ToInt32(actrow), 2].Text;
                int    difference = 0, startVal = 0, endVal = 0;
                int.TryParse(start, out startVal);
                int.TryParse(end, out endVal);
                difference = endVal - startVal;
                double maxValue = Math.Pow(10, difference);
                FpSpread1.Sheets[0].Cells[Convert.ToInt32(actrow), 4].CellType = txtserialNo;
                txtserialNo.MinimumValue = 0;
                txtserialNo.MaximumValue = maxValue - 1;
                txtserialNo.ErrorMessage = "Must Enter Between 0 and " + (maxValue - 1);
                txtserialNo.CssClass     = "txtbgColor";
                FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
                darkstyle.BackColor = ColorTranslator.FromHtml("#0BA6CB");
                darkstyle.ForeColor = Color.White;
            }
            if (checkSchoolSetting() == 0)
            {
                if (clgDetails == "College Acr" || clgDetails == "Department Acr" || clgDetails == "College Code" || clgDetails == "Year" || clgDetails == "Batch Year" || clgDetails == "Sem")
                {
                    string[] prefix = new string[2];
                    prefix[0] = "Prefix";
                    prefix[1] = "Suffix";
                    FarPoint.Web.Spread.ComboBoxCellType dropdown2 = new FarPoint.Web.Spread.ComboBoxCellType(prefix, prefix);
                    FpSpread1.Sheets[0].Cells[Convert.ToInt32(actrow), 4].CellType = dropdown2;
                }
                if (actcol == "4")
                {
                    if (btn.Text == "Quota Settings")
                    {
                        gridquota_DataBound();
                        alertpopwindow.Visible = true;
                    }
                }
            }
            else
            {
                if (clgDetails == "School Acr" || clgDetails == "Department Acr" || clgDetails == "Class Code" || clgDetails == "Year" || clgDetails == "Batch Year" || clgDetails == "Term")
                {
                    string[] prefix = new string[2];
                    prefix[0] = "Prefix";
                    prefix[1] = "Suffix";
                    FarPoint.Web.Spread.ComboBoxCellType dropdown2 = new FarPoint.Web.Spread.ComboBoxCellType(prefix, prefix);
                    FpSpread1.Sheets[0].Cells[Convert.ToInt32(actrow), 4].CellType = dropdown2;
                }
                if (actcol == "4")
                {
                    if (btn.Text == "Quota Settings")
                    {
                        gridquota_DataBound();
                        alertpopwindow.Visible = true;
                    }
                }
            }
        }
    }
Пример #3
0
 protected void Generate_Click(object sender, EventArgs e)
 {
     try
     {
         lblerror.Visible = false;
         DataSet ds      = new DataSet();
         string  clgcode = Session["collegecode"].ToString();
         FpSpread1.Sheets[0].RowHeader.Visible                        = false;
         FpSpread1.Sheets[0].AutoPostBack                             = false;
         FpSpread1.CommandBar.Visible                                 = false;
         FpSpread1.Sheets[0].RowCount                                 = 0;
         FpSpread1.Sheets[0].ColumnCount                              = 0;
         FpSpread1.Sheets[0].ColumnHeader.RowCount                    = 1;
         FpSpread1.Sheets[0].Columns.Count                            = 5;
         FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Text            = "S.No";
         FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Bold       = true;
         FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Name       = "Book Antiqua";
         FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Size       = FontUnit.Medium;
         FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].HorizontalAlign = HorizontalAlign.Center;
         FpSpread1.Columns[0].Width = 100;
         FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Text            = "From Digit";
         FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Bold       = true;
         FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Name       = "Book Antiqua";
         FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Size       = FontUnit.Medium;
         FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].HorizontalAlign = HorizontalAlign.Center;
         FpSpread1.Columns[1].Width = 100;
         FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Text            = "To Digit";
         FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Bold       = true;
         FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Name       = "Book Antiqua";
         FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Size       = FontUnit.Medium;
         FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].HorizontalAlign = HorizontalAlign.Center;
         FpSpread1.Columns[2].Width = 100;
         FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Text            = "Select";
         FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Bold       = true;
         FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Name       = "Book Antiqua";
         FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Size       = FontUnit.Medium;
         FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].HorizontalAlign = HorizontalAlign.Center;
         FpSpread1.Columns[3].Width = 100;
         FpSpread1.Sheets[0].ColumnHeader.Cells[0, 4].Text            = "Prefix/Suffix";
         FpSpread1.Sheets[0].ColumnHeader.Cells[0, 4].Font.Bold       = true;
         FpSpread1.Sheets[0].ColumnHeader.Cells[0, 4].Font.Name       = "Book Antiqua";
         FpSpread1.Sheets[0].ColumnHeader.Cells[0, 4].Font.Size       = FontUnit.Medium;
         FpSpread1.Sheets[0].ColumnHeader.Cells[0, 4].HorizontalAlign = HorizontalAlign.Center;
         FpSpread1.Columns[4].Width = 130;
         FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
         darkstyle.BackColor = ColorTranslator.FromHtml("#0BA6CB");
         darkstyle.ForeColor = Color.White;
         FpSpread1.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle;
         int val = 0;
         Int32.TryParse(txtsize.Text, out val);
         string[] item = new string[0];
         if (val > 0)
         {
             for (int v = 0; v <= val; v++)
             {
                 Array.Resize(ref item, item.Length + 1);
                 item[item.Length - 1] = Convert.ToString(v);
             }
         }
         FarPoint.Web.Spread.ComboBoxCellType dropdown1 = new FarPoint.Web.Spread.ComboBoxCellType();
         string query = "select distinct MasterCode,MasterValue from CO_MasterValues where MasterCriteria='ApplicationNumberGeneration' and CollegeCode='" + clgcode + "'";
         ds.Clear();
         ds = d2.select_method_wo_parameter(query, "Text");
         if (ds.Tables[0].Rows.Count > 0)
         {
             dropdown1.DataSource     = ds;
             dropdown1.DataTextField  = "MasterValue";
             dropdown1.DataValueField = "MasterCode";
         }
         dropdown1.AutoPostBack = false;
         FarPoint.Web.Spread.ButtonCellType btn = new FarPoint.Web.Spread.ButtonCellType();
         string[] prefix = new string[2];
         prefix[0] = "Prefix";
         prefix[1] = "Suffix";
         FarPoint.Web.Spread.ComboBoxCellType dropdown    = new FarPoint.Web.Spread.ComboBoxCellType(item, item);
         FarPoint.Web.Spread.ComboBoxCellType dropdown2   = new FarPoint.Web.Spread.ComboBoxCellType(prefix, prefix);
         FarPoint.Web.Spread.DoubleCellType   txtserialNo = new FarPoint.Web.Spread.DoubleCellType();
         btn.CssClass   = "textbox btn";
         btn.ButtonType = FarPoint.Web.Spread.ButtonType.LinkButton;
         btn.Text       = "+";
         DataSet CodeGenDS     = d2.select_method_wo_parameter("   select NumberType,NumberLength,ag.collegeCode,FRange,TRange,DifferentRange,HeaderCode, Case when convert(varchar(max), startNo)!=0 then convert(varchar(max),startNo) else (case when PrefixOrSufix=1 then 'Prefix' when PrefixOrSufix=2 then 'Suffix'  end) end as PrefixOrSufix,GenerationNumber,NumberSize,upper(MasterValue) as type,startNo from AdmissionNoGeneration ag,CO_MasterValues m where ag.collegecode='" + Convert.ToString(ddlclg.SelectedItem.Value) + "' and ag.headercode=m.MasterCode and MasterCriteria='ApplicationNumberGeneration' order by frange,trange ", "text");//ag.collegecode=m.collegecode and
         string  Frange        = string.Empty;
         string  Trange        = string.Empty;
         string  HeaderCode    = string.Empty;
         string  PrefixOrSufix = string.Empty;
         string  NumberSize    = string.Empty;
         string  type          = string.Empty;
         int     rangeDiff     = 0;
         int     StartNo       = 0;
         for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
         {
             FpSpread1.Sheets[0].RowCount++;
             FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Text            = Convert.ToString(FpSpread1.Sheets[0].RowCount);
             FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
             FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].CellType        = dropdown;
             FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Center;
             FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].CellType        = dropdown;
             FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].HorizontalAlign = HorizontalAlign.Center;
             dropdown1.ShowButton   = true;
             dropdown1.AutoPostBack = true;
             dropdown1.UseValue     = true;
             FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].CellType = dropdown1;
             FpSpread1.Sheets[0].Columns[3].CellType = dropdown1;
             FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].HorizontalAlign = HorizontalAlign.Center;
             FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].CellType        = dropdown2;
             FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].HorizontalAlign = HorizontalAlign.Center;
             if (CodeGenDS.Tables != null)//24.01.18 barath
             {
                 if (i < CodeGenDS.Tables[0].Rows.Count)
                 {
                     if (CodeGenDS.Tables[0].Rows.Count > 0)
                     {
                         Frange        = Convert.ToString(CodeGenDS.Tables[0].Rows[i]["FRange"]);
                         Trange        = Convert.ToString(CodeGenDS.Tables[0].Rows[i]["TRange"]);
                         HeaderCode    = Convert.ToString(CodeGenDS.Tables[0].Rows[i]["HeaderCode"]);
                         PrefixOrSufix = Convert.ToString(CodeGenDS.Tables[0].Rows[i]["PrefixOrSufix"]);
                         int.TryParse(Convert.ToString(CodeGenDS.Tables[0].Rows[i]["DifferentRange"]), out rangeDiff);
                         int.TryParse(Convert.ToString(CodeGenDS.Tables[0].Rows[i]["startNo"]), out StartNo);
                         NumberSize = Convert.ToString(CodeGenDS.Tables[0].Rows[i]["GenerationNumber"]);
                         type       = Convert.ToString(CodeGenDS.Tables[0].Rows[i]["type"]);
                         FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Text = Frange;
                         FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Text = Trange;
                         FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Text = HeaderCode;
                         FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].Text = PrefixOrSufix;
                         if (type == "QUOTA")
                         {
                             btn.Text = "Quota Settings";
                             FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].CellType = btn;
                         }
                         else if (type == "SERIAL NO")
                         {
                             FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].CellType = txtserialNo;
                             //string sd = generateApplicationNumber(StartNo, rangeDiff);
                             FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].Text = PrefixOrSufix;
                         }
                     }
                 }
             }
             FpSpread1.SaveChanges();
         }
         FpSpread1.Sheets[0].PageSize = FpSpread1.Sheets[0].RowCount;
         FpSpread1.SaveChanges();
         FpSpread1.Height  = 270;
         FpSpread1.Width   = 568;
         FpSpread1.Visible = true;
         btnSave.Visible   = true;
     }
     catch (Exception ex)
     {
     }
 }