Beispiel #1
0
    public void btn_warningmsg_Click(object sender, EventArgs e)
    {
        img4.Visible           = false;
        lbl_warning_alert.Text = "Are you sure you want delete";

        int savecc = 0;

        FpSpread1.SaveChanges();
        string activerow = FpSpread1.ActiveSheetView.ActiveRow.ToString();
        string sql       = "delete  from CO_MarkMaster where  MarkMasterpk = '" + FpSpread1.Sheets[0].Cells[Convert.ToInt32(activerow), 1].Tag.ToString() + "' ";
        int    qry       = d2.update_method_wo_parameter(sql, "Text");

        savecc++;
        if (savecc > 0)
        {
            bindclg1();
            BindType();
            lbl_alert.Text    = "Deleted Successfully";
            lbl_alert.Visible = true;
            imgdiv3.Visible   = true;
            mark();
            txt_type2.Text = "";
            txt_abtn.Text  = "";
            txt_point.Text = "";
        }
        Addmark.Visible = false;
    }
Beispiel #2
0
 protected void FpSpread1_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         FpSpread1.SaveChanges();
         string activrow = "";
         activrow = FpSpread1.Sheets[0].ActiveRow.ToString();
         if (activrow != "" && activrow != "-1")
         {
             string stage    = FpSpread1.Sheets[0].Cells[int.Parse(activrow), 1].Text.ToString();
             int    hy_order = 0;
             for (int i = 0; i <= Convert.ToInt16(FpSpread1.Sheets[0].RowCount) - 1; i++)
             {
                 string tempstage = FpSpread1.Sheets[0].Cells[i, 1].Text.ToString();
                 //if (stage == tempstage)
                 //{
                 int isval = Convert.ToInt32(FpSpread1.Sheets[0].Cells[i, 3].Value);
                 if (isval == 1)
                 {
                     hy_order++;
                     FpSpread1.Sheets[0].Cells[Convert.ToInt32(activrow), 3].Locked = true;
                 }
                 //  }
             }
             if (hy_order > 0)
             {
                 FpSpread1.Sheets[0].Cells[Convert.ToInt32(activrow), 4].Text = hy_order.ToString();
             }
         }
     }
     catch
     {
     }
 }
 protected void ddlpagecount_SelectedIndexChanged(object sender, EventArgs e)
 {
     FpSpread1.Visible = true;
     //btnprintmaster.Visible = true;
     FpSpread1.SaveChanges();
     ddlpage();
 }
 protected void Fpspread1_render(object sender, EventArgs e)
 {
     if (check == true)
     {
         FpSpread1.SaveChanges();
         ddlcollegeadd.Items.Clear();
         ddldegreeadd.Items.Clear();
         ddldeptadd.Items.Clear();
         string activrow  = string.Empty;
         string activecol = string.Empty;
         activrow  = FpSpread1.Sheets[0].ActiveRow.ToString();
         activecol = FpSpread1.Sheets[0].ActiveColumn.ToString();
         if (!string.IsNullOrEmpty(activrow) && activrow != "-1")
         {
             int    actrow     = Convert.ToInt32(activrow);
             string clgcode    = Convert.ToString(FpSpread1.Sheets[0].Cells[actrow, 0].Tag);
             string courseId   = Convert.ToString(FpSpread1.Sheets[0].Cells[actrow, 1].Tag);
             string strCourse  = Convert.ToString(FpSpread1.Sheets[0].Cells[actrow, 1].Text);
             string degId      = Convert.ToString(FpSpread1.Sheets[0].Cells[actrow, 2].Tag);
             string strDeg     = Convert.ToString(FpSpread1.Sheets[0].Cells[actrow, 2].Text);
             string vission    = Convert.ToString(FpSpread1.Sheets[0].Cells[actrow, 3].Text);
             string mission    = Convert.ToString(FpSpread1.Sheets[0].Cells[actrow, 4].Text);
             string getclgname = d2.GetFunction("select collname from collinfo where college_code='" + clgcode + "'");
             ddlcollegeadd.Items.Add(new ListItem(getclgname, clgcode));
             ddldegreeadd.Items.Add(new ListItem(strCourse, courseId));
             ddldeptadd.Items.Add(new ListItem(strDeg, degId));
             txtvission.Text = vission;
             txtmission.Text = mission;
             btnsave.Text    = "Update";
             divadd.Visible  = true;
         }
     }
 }
Beispiel #5
0
    protected void FpSpread1_OnCellClick(object sender, EventArgs e)
    {
        string activerow = FpSpread1.ActiveSheetView.ActiveRow.ToString();
        string activecol = FpSpread1.ActiveSheetView.ActiveColumn.ToString();

        cellclick = true;
        FpSpread1.SaveChanges();
    }
    protected void btnsave_Click(object sender, EventArgs e)
    {
        try
        {
            FpSpread1.SaveChanges();

            string commonsubject = "";
            for (int i = 0; i < FpSpread1.Sheets[0].RowCount; i++)
            {
                int isval = Convert.ToInt32(FpSpread1.Sheets[0].Cells[i, 7].Value);
                if (isval > 0)
                {
                    commonsubject = FpSpread1.Sheets[0].Cells[i, 7].Tag.ToString();
                }
            }
            if (commonsubject.Trim() == "")
            {
                errmsg.Visible = true;
                errmsg.Text    = "Please Select The Common Subject And Than Proceed";
                return;
            }
            Boolean saveflag = false;
            string  strquery = "";
            int     savval   = 0;
            for (int i = 0; i < FpSpread1.Sheets[0].RowCount; i++)
            {
                int isval = Convert.ToInt32(FpSpread1.Sheets[0].Cells[i, 6].Value);
                if (isval > 0)
                {
                    saveflag = true;
                    string subno = FpSpread1.Sheets[0].Cells[i, 7].Tag.ToString();
                    strquery = "if exists(select * from tbl_equal_subject_Grade_System where exam_year='" + ddlexamyear.SelectedValue.ToString() + "' and exam_month='" + ddlmonth.SelectedValue.ToString() + "' and Subject_no='" + subno + "')";
                    strquery = strquery + " update tbl_equal_subject_Grade_System set Common_Subject_no='" + commonsubject + "' where exam_year='" + ddlexamyear.SelectedValue.ToString() + "' and exam_month='" + ddlmonth.SelectedValue.ToString() + "' and Subject_no='" + subno + "'";
                    strquery = strquery + " else insert into tbl_equal_subject_Grade_System(exam_year,exam_month,Subject_no,Common_Subject_no) values('" + ddlexamyear.SelectedValue.ToString() + "','" + ddlmonth.SelectedValue.ToString() + "','" + subno + "','" + commonsubject + "')";
                    savval   = d2.update_method_wo_parameter(strquery, "Text");
                }
            }
            if (saveflag == true)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "clientScript", "alert('Saved Successfully!')", true);
                LoadDetails();
            }
            else
            {
                errmsg.Visible = true;
                errmsg.Text    = "Please Select The Equal Subject And Than Proceed";
                return;
            }
        }
        catch (Exception ex)
        {
            errmsg.Visible = true;
            errmsg.Text    = ex.ToString();
        }
    }
    public void showterms()
    {
        FpSpread1.Sheets[0].RowCount = 0;


        string istrm   = "";
        string trmdesc = "";

        string[] spilttrmdesc;
        string   againtrmdesc = "";

        sql = "select * from IM_POSettings where collegecode='" + Session["collegecode"].ToString() + "'";
        ds.Clear();
        ds = da.select_method_wo_parameter(sql, "Text");
        if (ds.Tables[0].Rows.Count > 0)
        {
            FpSpread1.Sheets[0].Rows.Count++;
            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].CellType = chkboxsel_all;
            chkboxsel_all.AutoPostBack = true;
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                istrm = ds.Tables[0].Rows[0]["IsTerms"].ToString();
                if (istrm.Trim() == "True")
                {
                    trmdesc = ds.Tables[0].Rows[0]["TermsDesc"].ToString();
                    if (trmdesc != "")
                    {
                        spilttrmdesc = trmdesc.Split(';');
                        for (int j = 0; j < spilttrmdesc.Length; j++)
                        {
                            againtrmdesc = spilttrmdesc[j].ToString();

                            //dt.Rows.Add(againtrmdesc);
                            FpSpread1.Sheets[0].Rows.Count++;

                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].Rows.Count - 1, 0].Text = Convert.ToString(FpSpread1.Sheets[0].Rows.Count - 1);
                            // FpSpread2.Sheets[0].Cells[FpSpread2.Sheets[0].Rows.Count - 1, 2].CellType = txtceltype;
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].Rows.Count - 1, 1].Text   = Convert.ToString(againtrmdesc);
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].CellType = chkboxcol;
                        }
                    }
                }
            }
            FpSpread1.Sheets[0].PageSize = FpSpread1.Sheets[0].RowCount;
            FpSpread1.SaveChanges();

            FpSpread1.Visible = true;
            if (FpSpread1.Sheets[0].Rows.Count == 1)
            {
                FpSpread1.Sheets[0].RowCount = 0;
            }
        }
    }
    protected void FpSpread1_Selectedindexchange(object sender, EventArgs e)
    {
        try
        {
            FpSpread1.SaveChanges();
            if (cellclick == true)
            {
                rb_earn.Checked  = false;
                rb_tpres.Checked = false;
                rb_gnrl.Checked  = false;

                ddl_popclg.SelectedIndex = ddl_popclg.Items.IndexOf(ddl_popclg.Items.FindByValue(ddl_college.SelectedItem.Value));
                ddl_popclg.Enabled       = false;
                btn_save.Text            = "Update";
                btndel.Visible           = true;
                string activerow = FpSpread1.ActiveSheetView.ActiveRow.ToString();
                string activecol = FpSpread1.ActiveSheetView.ActiveColumn.ToString();
                string leavename = FpSpread1.Sheets[0].Cells[Convert.ToInt32(activerow), 1].Text.ToString();
                txt_leavename.Text = leavename;
                string shortform = FpSpread1.Sheets[0].Cells[Convert.ToInt32(activerow), 2].Text.ToString();
                txt_shrtfm.Text = shortform;
                string lblid = FpSpread1.Sheets[0].Cells[Convert.ToInt32(activerow), 7].Text.ToString();
                oldlname.Text         = lblid;
                txt_leavename.Enabled = false;
                txt_shrtfm.Enabled    = false;

                for (int i = 0; i < FpSpread1.Sheets[0].Rows.Count; i++)
                {
                    if (Convert.ToInt32(FpSpread1.Sheets[0].Cells[Convert.ToSByte(activerow), 3].Value) == 1)
                    {
                        rb_earn.Checked  = true;
                        rb_tpres.Checked = false;
                        rb_gnrl.Checked  = false;
                    }
                    if (Convert.ToInt32(FpSpread1.Sheets[0].Cells[Convert.ToSByte(activerow), 4].Value) == 1)
                    {
                        rb_earn.Checked  = false;
                        rb_tpres.Checked = true;
                        rb_gnrl.Checked  = false;
                    }
                    if (Convert.ToInt32(FpSpread1.Sheets[0].Cells[Convert.ToSByte(activerow), 5].Value) == 1)
                    {
                        rb_earn.Checked  = false;
                        rb_tpres.Checked = false;
                        rb_gnrl.Checked  = true;
                    }
                }
            }
        }
        catch { }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["collegecode"] == null)
     {
         Response.Redirect("~/Default.aspx");
     }
     usercode     = Session["usercode"].ToString();
     collegecode1 = Session["collegecode"].ToString();
     if (!IsPostBack)
     {
         Session["Optional subject"] = null;
         questiondiv.Visible         = false;
         FpSpread1.SaveChanges();
     }
 }
 public void btn_reset_Click(object sender, EventArgs e)
 {
     FpSpread1.SaveChanges();
     if (FpSpread1.Sheets[0].RowCount > 0)
     {
         for (int i = 0; i < FpSpread1.Sheets[0].RowCount; i++)
         {
             for (int j = 2; j < FpSpread1.Sheets[0].ColumnCount; j++)
             {
                 FpSpread1.Sheets[0].Cells[i, j].Text = "";
             }
         }
     }
     FpSpread1.SaveChanges();
 }
 protected void btndeletefp1_Click(object sender, EventArgs e)
 {
     try
     {
         string data = "";
         FpSpread1.SaveChanges();
         for (int iy = 1; iy < FpSpread1.Sheets[0].RowCount; iy++)
         {
             if (Convert.ToInt32(FpSpread1.Sheets[0].Cells[iy, 2].Value) == 0)
             {
                 if (data == "")
                 {
                     data = FpSpread1.Sheets[0].Cells[iy, 1].Text.ToString();
                 }
                 else
                 {
                     data = data + ";" + FpSpread1.Sheets[0].Cells[iy, 1].Text.ToString();
                 }
             }
         }
         if (data != "")
         {
             sql = "update IM_POSettings set TermsDesc='" + data + "'  where collegecode='" + Session["collegecode"].ToString() + "' ";
             int a = da.update_method_wo_parameter(sql, "text");
         }
         else
         {
             sql = "select * from IM_POSettings ";
             ds.Clear();
             ds = da.select_method_wo_parameter(sql, "Text");
             if (ds.Tables[0].Rows.Count > 0)
             {
                 sql = "update IM_POSettings set TermsDesc=''  where collegecode='" + Session["collegecode"].ToString() + "' ";
                 int a = da.update_method_wo_parameter(sql, "text");
             }
         }
         showterms();
     }
     catch
     {
     }
 }
    //protected bool getCheckCount()
    //{
    //    bool boolSave = false;
    //    foreach (GridViewRow row in FpSpread1.Rows)
    //    {
    //        CheckBox cbsel = (CheckBox)row.FindControl("cbselect");
    //        if (!cbsel.Checked)
    //            continue;
    //        boolSave = true;
    //    }
    //    return boolSave;
    //}
    protected bool getCheckCount()
    {
        FpSpread1.SaveChanges();
        bool boolSave = false;

        for (int i = 0; i < FpSpread1.Rows.Count; i++)
        {
            byte check = Convert.ToByte(FpSpread1.Sheets[0].Cells[i, 1].Value);
            if (check == 1)
            {
                //string groupname = Convert.ToString(FpSpread1.Sheets[0].Cells[i, 2].Text);
                //string staffcode = Convert.ToString(FpSpread1.Sheets[0].Cells[i, 2].Text);
                //string updQ = "update staffmaster set sms_groupname='" + groupname + "' where staff_code='" + staffcode + "'";
                //int upd = d2.update_method_wo_parameter(updQ, "Text");
                //continue;
                boolSave = true;
            }
        }
        return(boolSave);
    }
    //protected void Fpspread2_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
    //{
    //    try
    //    {
    //        if (e.Row.RowType == DataControlRowType.Header)
    //        {
    //            e.Row.Cells[6].Attributes["onclick"] = Page.ClientScript.GetPostBackEventReference(this.Fpspread1, "Select$" + e.Row.RowIndex);
    //        }
    //    }
    //    catch { }
    //}
    //protected void Fpspread2_RowCommand(object sender, GridViewCommandEventArgs e)
    //{
    //    try
    //    {
    //        if (e.CommandName == "Select")
    //        {

    //        }

    //    }
    //    catch
    //    {

    //    }
    //}

    //protected void Fpspread1_UpdateCommand(object sender, FarPoint.Web.Spread.SpreadCommandEventArgs e)
    //{
    //    string actrow = Convert.ToString(e.SheetView.ActiveRow).Trim();
    //    if (flag_true == false && actrow == "0")
    //    {
    //        for (int j = 1; j < Convert.ToInt16(Fpspread2.Sheets[0].RowCount); j++)
    //        {
    //            string actcol = Convert.ToString(e.SheetView.ActiveColumn).Trim();
    //            string seltext = Convert.ToString(e.EditValues[Convert.ToInt16(actcol)]).Trim();
    //            if (seltext != "System.Object")
    //                Fpspread2.Sheets[0].Cells[j, Convert.ToInt16(actcol)].Text = Convert.ToString(seltext).Trim();
    //        }
    //        flag_true = true;
    //    }
    //}
    protected void Btndelete_Click(object sender, EventArgs e)
    {
        try
        {
            int count = 0;
            //string datefrom = string.Empty;
            Hashtable hat   = new Hashtable();
            string    date1 = string.Empty;
            date1 = txtFromDate.Text.ToString();
            DateTime dt1         = new DateTime();// Convert.ToDateTime(datefrom.ToString());
            bool     isValidDate = DateTime.TryParseExact(date1, "dd/MM/yyyy", null, DateTimeStyles.None, out dt1);
            int      isval       = 0;
            FpSpread1.SaveChanges();
            for (int s = 1; s < FpSpread1.Sheets[0].RowCount; s++)
            {
                //Convert.ToInt32(FpSpread1.Sheets[0].Cells[s, 4].Value);
                int.TryParse(Convert.ToString(FpSpread1.Sheets[0].Cells[s, 4].Value), out isval);
                if (isval == 1)
                {
                    string batchYear = FpSpread1.Sheets[0].Cells[s, 1].Text;
                    string degCode   = Convert.ToString(FpSpread1.Sheets[0].Cells[s, 2].Note);
                    hat.Clear();
                    hat.Add("@batchyear", batchYear);
                    hat.Add("@degreecode", degCode);
                    hat.Add("@doubleDate", dt1.ToString("MM/dd/yyyy"));
                    hat.Add("@college_code", Convert.ToString(ddlCollege.SelectedValue));
                    count = da.update_method_with_parameter("Delete_Doubleday_schdl", hat, "sp");
                }
            }
            if (count > 0)
            {
                divPopAlert.Visible = true;
                lblAlertMsg.Visible = true;
                lblAlertMsg.Text    = "Delete Successfully";
            }
        }
        catch
        {
        }
    }
Beispiel #14
0
 protected void Fpspread1_render(object sender, EventArgs e)
 {
     if (flag_true == true)
     {
         FpSpread1.SaveChanges();
         string activrow = "";
         activrow = FpSpread1.Sheets[0].ActiveRow.ToString();
         string activecol = FpSpread1.Sheets[0].ActiveColumn.ToString();
         int    actcol    = Convert.ToInt16(activecol);
         int    hy_order  = 0;
         for (int i = 0; i <= Convert.ToInt16(FpSpread1.Sheets[0].RowCount) - 1; i++)
         {
             int isval = Convert.ToInt32(FpSpread1.Sheets[0].Cells[i, actcol].Value);
             if (isval == 1)
             {
                 hy_order++;
                 FpSpread1.Sheets[0].Cells[Convert.ToInt32(activrow), actcol].Locked = true;
             }
         }
         FpSpread1.Sheets[0].Cells[Convert.ToInt32(activrow), actcol + 1].Text = hy_order.ToString();
     }
 }
Beispiel #15
0
    protected void FpSpread1_ButtonCommand(object sender, EventArgs e)
    {
        FpSpread1.SaveChanges();
        string activerow = FpSpread1.ActiveSheetView.ActiveRow.ToString();
        string activecol = FpSpread1.ActiveSheetView.ActiveColumn.ToString();

        if (activecol == "3")
        {
            int act1 = Convert.ToInt32(activerow);
            int act2 = Convert.ToInt16(activecol);
            if (FpSpread1.Sheets[0].Cells[act1, act2].Value.ToString() == "1")
            {
                flag_true = true;
                FpSpread1.Sheets[0].Cells[act1, act2 + 1].Text = "";
            }
            else
            {
                flag_true = false;
            }
        }
        FpSpread1.SaveChanges();
    }
 protected void FpSpread1_OnButtonCommand(object sender, EventArgs e)
 {
     if (ViewState["Acadamic_Isgeneral"] != null)
     {
         FpSpread1.SaveChanges();
         int activerow = FpSpread1.ActiveSheetView.ActiveRow;
         int activecol = FpSpread1.ActiveSheetView.ActiveColumn;
         int checkval  = Convert.ToInt32(FpSpread1.Sheets[0].Cells[activerow, activecol].Value);
         if (checkval == 1)
         {
             for (int i = 3; i < FpSpread1.Sheets[0].ColumnCount; i++)
             {
                 if (i == Convert.ToInt32(activecol))
                 {
                     FpSpread1.Sheets[0].Cells[activerow, i].Value = 1;
                 }
                 else
                 {
                     FpSpread1.Sheets[0].Cells[activerow, i].Value = 0;
                 }
             }
         }
     }
 }
 protected void btnPrioritySave_Click(object sender, EventArgs e)
 {
     try
     {
         bool UpdateFlag = false;
         FpSpread1.SaveChanges();
         for (int i = 0; i <= Convert.ToInt16(FpSpread1.Sheets[0].RowCount) - 1; i++)
         {
             int isval = Convert.ToInt32(FpSpread1.Sheets[0].Cells[i, 2].Value);
             if (isval == 1)
             {
                 string GetPriority = Convert.ToString(FpSpread1.Sheets[0].Cells[i, 3].Text);
                 string GetID       = Convert.ToString(FpSpread1.Sheets[0].Cells[i, 1].Tag);
                 string UpdQuery    = "update IT_GroupMaster set Priority='" + GetPriority + "' where ITGroupPK='" + GetID + "' and collegeCode='" + ddlcolload.SelectedValue + "'";
                 int    Upd         = d2.update_method_wo_parameter(UpdQuery, "Text");
                 if (Upd > 0)
                 {
                     UpdateFlag = true;
                 }
             }
         }
         if (UpdateFlag)
         {
             imgdiv2.Visible   = true;
             lbl_alerterr.Text = "Update Successfully";
         }
         else
         {
             imgdiv2.Visible   = true;
             lbl_alerterr.Text = "Not Updated";
         }
     }
     catch
     {
     }
 }
Beispiel #18
0
 protected void btnResetPriority_Click(object sender, EventArgs e)
 {
     try
     {
         bool check = false;
         if (FpSpread1.Sheets[0].Rows.Count > 0)
         {
             for (int i = 0; i < FpSpread1.Sheets[0].Rows.Count; i++)
             {
                 FpSpread1.Sheets[0].Cells[i, 3].Locked = false;
                 FpSpread1.Sheets[0].Cells[i, 3].Value  = 0;
                 FpSpread1.Sheets[0].Cells[i, 4].Text   = "";
                 check = true;
             }
         }
         FpSpread1.SaveChanges();
         if (check)
         {
             lbl_alert.Text  = "Reset Successfully";
             imgdiv2.Visible = true;
         }
     }
     catch { }
 }
    public void btndel_Click(object sender, EventArgs e)
    {
        try
        {
            int savecc = 0;
            FpSpread1.SaveChanges();

            string activerow = FpSpread1.ActiveSheetView.ActiveRow.ToString();
            string sql       = "delete  from leave_category where  LeaveMasterPK = '" + FpSpread1.Sheets[0].Cells[Convert.ToInt32(activerow), 7].Text.ToString() + "' and college_code= '" + collegecode + "'";
            int    qry       = d2.update_method_wo_parameter(sql, "Text");
            savecc++;
            if (savecc > 0)
            {
                lbl_alert.Text    = "Deleted Successfully";
                lbl_alert.Visible = true;
                imgdiv2.Visible   = true;
                btn_go_Click(sender, e);
            }
        }
        catch (Exception ex)
        {
            d2.sendErrorMail(ex, collegecode, "LeaveMaster_Alter.aspx");
        }
    }
    protected void btn_go_Click(object sender, EventArgs e)
    {
        try
        {
            hide();

            FpSpread1.Sheets[0].RowCount     = 0;
            FpSpread1.Sheets[0].ColumnCount  = 0;
            FpSpread1.CommandBar.Visible     = false;
            FpSpread1.Sheets[0].AutoPostBack = true;
            FpSpread1.Height = 1000;
            FpSpread1.Width  = 600;
            FpSpread1.Sheets[0].ColumnHeader.RowCount = 1;
            FpSpread1.Sheets[0].RowHeader.Visible     = false;
            FpSpread1.Sheets[0].ColumnCount           = 8;
            FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
            darkstyle.BackColor = ColorTranslator.FromHtml("#0CA6CA");
            darkstyle.ForeColor = Color.White;
            FpSpread1.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle;
            FpSpread1.Visible = true;
            FarPoint.Web.Spread.CheckBoxCellType chkall = new FarPoint.Web.Spread.CheckBoxCellType();
            FarPoint.Web.Spread.CheckBoxCellType chk    = new FarPoint.Web.Spread.CheckBoxCellType();
            chkall.AutoPostBack = false;

            string selqry = "select category,shortname,status,LeaveMasterPK from leave_category where college_Code='" + collegecode1 + "'";
            ds.Clear();
            ds = d2.select_method_wo_parameter(selqry, "text");

            if (ds.Tables[0].Rows.Count > 0)
            {
                FpSpread1.Sheets[0].Rows.Count = ds.Tables[0].Rows.Count;
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    FpSpread1.Sheets[0].Cells[i, 3].CellType = chk;
                    FpSpread1.Sheets[0].Cells[i, 4].CellType = chk;
                    FpSpread1.Sheets[0].Cells[i, 5].CellType = chk;
                    FpSpread1.Sheets[0].Cells[i, 6].CellType = chk;
                    FpSpread1.Sheets[0].Cells[i, 3].Locked   = true;
                    FpSpread1.Sheets[0].Cells[i, 4].Locked   = true;
                    FpSpread1.Sheets[0].Cells[i, 5].Locked   = true;
                    FpSpread1.Sheets[0].Cells[i, 6].Locked   = true;

                    FpSpread1.Sheets[0].Cells[i, 0].Text      = Convert.ToString(i + 1);
                    FpSpread1.Sheets[0].Cells[i, 0].Font.Name = "Book Antiqua";
                    FpSpread1.Sheets[0].Cells[i, 1].Text      = ds.Tables[0].Rows[i]["category"].ToString();
                    FpSpread1.Sheets[0].Cells[i, 1].Font.Name = "Book Antiqua";
                    FpSpread1.Sheets[0].Cells[i, 2].Text      = ds.Tables[0].Rows[i]["shortname"].ToString();
                    FpSpread1.Sheets[0].Cells[i, 2].Font.Name = "Book Antiqua";
                    FpSpread1.Sheets[0].Cells[i, 7].Value     = ds.Tables[0].Rows[i]["LeaveMasterPK"].ToString();
                    FpSpread1.Sheets[0].Cells[i, 7].Font.Name = "Book Antiqua";

                    FpSpread1.Sheets[0].Cells[i, 3].Font.Name = "Book Antiqua";
                    FpSpread1.Sheets[0].Cells[i, 4].Font.Name = "Book Antiqua";
                    FpSpread1.Sheets[0].Cells[i, 5].Font.Name = "Book Antiqua";
                    string statusss = ds.Tables[0].Rows[i]["status"].ToString();
                    if (statusss.Trim() == "2")
                    {
                        FpSpread1.Sheets[0].Cells[i, 3].Value = 1;
                    }
                    if (statusss.Trim() == "0")
                    {
                        FpSpread1.Sheets[0].Cells[i, 4].Value = 1;
                    }
                    if (statusss.Trim() == "1")
                    {
                        FpSpread1.Sheets[0].Cells[i, 5].Value = 1;
                    }
                }
                FpSpread1.Sheets[0].ColumnHeader.Columns[0].Width = 60;
                FpSpread1.Sheets[0].ColumnHeader.Columns[1].Width = 244;
                FpSpread1.Sheets[0].ColumnHeader.Columns[2].Width = 150;
                FpSpread1.Sheets[0].ColumnHeader.Columns[3].Width = 102;
                FpSpread1.Sheets[0].ColumnHeader.Columns[4].Width = 102;
                FpSpread1.Sheets[0].ColumnHeader.Columns[5].Width = 102;
                FpSpread1.Sheets[0].ColumnHeader.Columns[6].Width = 102;

                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, 1].Text      = "Leave Name";
                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, 2].Text      = "Short Form";
                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, 3].Text      = "Earn Leave";
                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, 4].Text      = "Treated As Present";
                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, 5].Text      = "Treated As LOP";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 5].Font.Bold = true;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 5].Font.Name = "Book Antiqua";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 6].Text      = "Select";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 6].Font.Bold = true;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 6].Font.Name = "Book Antiqua";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 7].Text      = "Id";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 7].Font.Bold = true;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 7].Font.Name = "Book Antiqua";
                FpSpread1.Sheets[0].Columns[7].Visible = false;
                FpSpread1.Sheets[0].Columns[6].Visible = false;
                for (int i = 0; i < FpSpread1.Sheets[0].Columns.Count; i++)
                {
                    FpSpread1.Sheets[0].ColumnHeader.Columns[i].HorizontalAlign = HorizontalAlign.Center;
                    FpSpread1.Sheets[0].ColumnHeader.Columns[i].Font.Name       = "Book Antiqua";
                    FpSpread1.Sheets[0].ColumnHeader.Columns[i].Font.Bold       = true;
                    FpSpread1.Sheets[0].ColumnHeader.Columns[i].Font.Size       = FontUnit.Medium;
                    FpSpread1.Sheets[0].Columns[i].HorizontalAlign = HorizontalAlign.Center;
                }
                FpSpread1.Sheets[0].Columns[1].HorizontalAlign = HorizontalAlign.Left;
                FpSpread1.Sheets[0].Columns[2].HorizontalAlign = HorizontalAlign.Left;

                FpSpread1.SaveChanges();
                FpSpread1.Sheets[0].PageSize = ds.Tables[0].Rows.Count;
                FpSpread1.Visible            = true;
                addnew.Visible    = false;
                div1.Visible      = true;
                rptprint.Visible  = true;
                lbl_error.Visible = false;
            }
            else
            {
                lbl_error.Visible = true;
                lbl_error.Text    = "No Records Found";
            }
        }
        catch (Exception ex)
        {
            d2.sendErrorMail(ex, collegecode1, "LeaveMaster_Alter.aspx");
        }
    }
Beispiel #21
0
    protected void btn_go_OnClick(object sender, EventArgs e)
    {
        try
        {
            string deptcode   = rs.GetSelectedItemsValueAsString(cbl_degree);
            string degreecode = rs.GetSelectedItemsValueAsString(cbl_branch);
            string batch      = rs.GetSelectedItemsValueAsString(cbl_batch);

            string housepk = rs.GetSelectedItemsValueAsString(cb1_housing);
            if (deptcode.Trim() != "" && degreecode.Trim() != "" && batch.Trim() != "" && !string.IsNullOrEmpty(housepk.Trim()))
            {
                rs.Fpreadheaderbindmethod("S.No-50/House Name-100/Student Name-200/Roll No-150/Reg No-150/Admission No-150/Gender-90/Section-70/" + lbl_degreeT.Text + "-100/" + lbl_branchT.Text + "-200/ Semester-100", FpSpread1, "FALSE");
                q1 = "select r.App_No,r.roll_no,r.Reg_No,r.Roll_Admit,r.stud_name,case when sex='0' then 'Male' when sex='1' then 'Female' end sex ,r.degree_code,dt.Dept_Name,c.Course_Name ,r.Batch_Year,r.Current_Semester,c.Course_Id,r.sections,hd.housename from Registration r, degree d,Department dt,Course C,applyn a inner join HousingDetails hd on a.studhouse=hd.housePK where a.app_no =r.App_No and d.Degree_Code =r.degree_code and d.Dept_Code =dt.Dept_Code and c.Course_Id =d.Course_Id and isconfirm ='1'  and hd.housePK in('" + housepk + "')";
                string type = string.Empty;
                switch (Convert.ToUInt32(ddl_searchtype.SelectedValue))
                {
                case 0:
                    type = "r.roll_no";
                    break;

                case 1:
                    type = "r.reg_no";
                    break;

                case 2:
                    type = "r.Roll_Admit";
                    break;

                case 3:
                    type = "r.app_no";
                    break;
                }
                if (txt_searchappno.Text.Trim() != "")
                {
                    q1 += " and " + type + "='" + txt_searchappno.Text.Trim() + "'";
                }
                else
                {
                    q1 += " and r.degree_code in('" + degreecode + "')and r.Batch_Year in('" + batch + "') and c.Course_Id in('" + deptcode + "') and r.college_code='" + Convert.ToString(ddlcollege.SelectedItem.Value) + "'  ";
                }

                ds.Clear();
                ds = d2.select_method_wo_parameter(q1, "text");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        FpSpread1.Sheets[0].Rows.Count++;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Text = Convert.ToString(FpSpread1.Sheets[0].Rows.Count);
                        FpSpread1.Sheets[0].Columns[3].Visible = false;
                        FpSpread1.Sheets[0].Columns[4].Visible = false;
                        FpSpread1.Sheets[0].Columns[5].Visible = false;
                        if (Convert.ToString(Session["Rollflag"]) == "1")
                        {
                            FpSpread1.Sheets[0].Columns[3].Visible = true;
                        }
                        if (Convert.ToString(Session["Regflag"]) == "1")
                        {
                            FpSpread1.Sheets[0].Columns[4].Visible = true;
                        }
                        if (Convert.ToString(Session["Admissionflag"]) == "1")
                        {
                            FpSpread1.Sheets[0].Columns[5].Visible = true;
                        }
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Text             = Convert.ToString(dr["housename"]);
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Text             = Convert.ToString(dr["stud_name"]);
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Text             = Convert.ToString(dr["roll_no"]);
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].Text             = Convert.ToString(dr["Reg_No"]);
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 5].Text             = Convert.ToString(dr["Roll_Admit"]);
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 6].Text             = Convert.ToString(dr["sex"]);
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 7].Text             = Convert.ToString(dr["sections"]);
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 8].Text             = Convert.ToString(dr["Course_Name"]);
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 9].Text             = Convert.ToString(dr["Dept_Name"]);
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 10].Text            = Convert.ToString(dr["Current_Semester"]);
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Locked           = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Locked           = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Locked           = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Locked           = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].Locked           = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 5].Locked           = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 6].Locked           = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 7].Locked           = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 8].Locked           = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 9].Locked           = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 10].Locked          = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].HorizontalAlign  = HorizontalAlign.Center;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Font.Size        = FontUnit.Medium;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Font.Name        = "Book Antiqua";
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].HorizontalAlign  = HorizontalAlign.Left;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Font.Size        = FontUnit.Medium;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Font.Name        = "Book Antiqua";
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].HorizontalAlign  = HorizontalAlign.Left;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Font.Size        = FontUnit.Medium;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Font.Name        = "Book Antiqua";
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].HorizontalAlign  = HorizontalAlign.Left;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Font.Size        = FontUnit.Medium;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Font.Name        = "Book Antiqua";
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].HorizontalAlign  = HorizontalAlign.Left;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].Font.Size        = FontUnit.Medium;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].Font.Name        = "Book Antiqua";
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 5].HorizontalAlign  = HorizontalAlign.Left;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 5].Font.Size        = FontUnit.Medium;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 5].Font.Name        = "Book Antiqua";
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 6].HorizontalAlign  = HorizontalAlign.Left;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 6].Font.Size        = FontUnit.Medium;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 6].Font.Name        = "Book Antiqua";
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 7].HorizontalAlign  = HorizontalAlign.Center;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 7].Font.Size        = FontUnit.Medium;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 7].Font.Name        = "Book Antiqua";
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 8].HorizontalAlign  = HorizontalAlign.Center;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 8].Font.Size        = FontUnit.Medium;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 8].Font.Name        = "Book Antiqua";
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 9].HorizontalAlign  = HorizontalAlign.Left;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 9].Font.Size        = FontUnit.Medium;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 9].Font.Name        = "Book Antiqua";
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 10].HorizontalAlign = HorizontalAlign.Center;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 10].Font.Size       = FontUnit.Medium;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 10].Font.Name       = "Book Antiqua";
                    }
                    FpSpread1.Sheets[0].PageSize = FpSpread1.Sheets[0].RowCount;
                    FpSpread1.Visible            = true;
                    FpSpread1.SaveChanges();
                    lbl_error.Visible = false;
                    rptprint.Visible  = true;
                }
                else
                {
                    rptprint.Visible  = false;
                    FpSpread1.Visible = false;
                    lbl_error.Visible = true;
                    lbl_error.Text    = "No Record Founds";
                }
            }
            else
            {
                rptprint.Visible  = false;
                FpSpread1.Visible = false;
                lbl_error.Visible = true;
                lbl_error.Text    = "Please Select All The Fields";
            }
        }
        catch (Exception f)
        {
            rptprint.Visible  = false;
            FpSpread1.Visible = false;
            lbl_error.Visible = true;
            lbl_error.Text    = f.ToString();
        }
    }
    public void Prioriry()
    {
        try
        {
            CreateGroup.Visible    = false;
            CreatePriority.Visible = true;
            CreateMapping.Visible  = false;
            string Query = "select GroupName,ITGroupPK,Priority from IT_GroupMaster where parentCode=0 and collegeCode ='" + ddlcolload.SelectedValue + "'";
            ds.Clear();
            ds = d2.select_method_wo_parameter(Query, "Text");
            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                FpSpread1.Visible                         = true;
                FpSpread1.Sheets[0].RowCount              = 0;
                FpSpread1.Sheets[0].ColumnCount           = 0;
                FpSpread1.CommandBar.Visible              = false;
                FpSpread1.Sheets[0].AutoPostBack          = false;
                FpSpread1.Sheets[0].ColumnHeader.RowCount = 1;
                FpSpread1.Sheets[0].RowHeader.Visible     = false;
                FpSpread1.Sheets[0].ColumnCount           = 4;
                FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
                darkstyle.BackColor = ColorTranslator.FromHtml("#0CA6CA");
                darkstyle.ForeColor = Color.White;
                FpSpread1.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle;

                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].HorizontalAlign = HorizontalAlign.Center;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Name       = "Book Antiqua";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Size       = FontUnit.Medium;
                FpSpread1.Columns[0].Locked = true;
                FpSpread1.Columns[0].Width  = 50;

                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Text            = "Group Name";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Bold       = true;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].HorizontalAlign = HorizontalAlign.Center;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Name       = "Book Antiqua";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Font.Size       = FontUnit.Medium;
                FpSpread1.Columns[1].Width = 200;

                FarPoint.Web.Spread.CheckBoxCellType chkall = new FarPoint.Web.Spread.CheckBoxCellType();
                chkall.AutoPostBack = true;

                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Text            = "Set Priority";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Bold       = true;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].HorizontalAlign = HorizontalAlign.Center;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Name       = "Book Antiqua";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Font.Size       = FontUnit.Medium;
                FpSpread1.Columns[2].Width = 75;

                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Text            = "Priority";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Bold       = true;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].HorizontalAlign = HorizontalAlign.Center;
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Name       = "Book Antiqua";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Font.Size       = FontUnit.Medium;
                FpSpread1.Columns[3].Locked = true;
                FpSpread1.Columns[3].Width  = 75;

                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(i + 1);
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Font.Size       = FontUnit.Medium;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Font.Name       = "Book Antiqua";

                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Text = Convert.ToString(ds.Tables[0].Rows[i]["GroupName"]);
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Tag  = Convert.ToString(ds.Tables[0].Rows[i]["ITGroupPK"]);

                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Font.Name       = "Book Antiqua";
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Center;

                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].CellType        = chkall;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Value           = 0;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].HorizontalAlign = HorizontalAlign.Center;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Font.Size       = FontUnit.Medium;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Font.Name       = "Book Antiqua";

                    string Prioriry = Convert.ToString(ds.Tables[0].Rows[i]["Priority"]);
                    if (Prioriry.Trim() != "" && Prioriry.Trim() != "0")
                    {
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Text   = Prioriry.ToString();
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Locked = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Value  = 1;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Locked = true;
                    }
                    else
                    {
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Text = "";
                    }
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].HorizontalAlign = HorizontalAlign.Center;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Font.Size       = FontUnit.Medium;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Font.Name       = "Book Antiqua";
                }
                FpSpread1.Visible            = true;
                FpSpread1.Sheets[0].PageSize = FpSpread1.Sheets[0].RowCount;
                FpSpread1.SaveChanges();
                FpSpread1.Height = 400;
                FpSpread1.Width  = 600;
                lblalert.Visible = false;
            }
            else
            {
                FpSpread1.Visible = false;
                imgdiv2.Visible   = true;
                lbl_alerterr.Text = "Not Updated";
            }
        }
        catch
        {
        }
    }
    protected void loadSpread(DataSet ds)
    {
        try
        {
            #region design
            FpSpread1.Sheets[0].RowCount              = 0;
            FpSpread1.Sheets[0].ColumnCount           = 0;
            FpSpread1.Sheets[0].ColumnHeader.RowCount = 1;
            FpSpread1.CommandBar.Visible              = false;
            FpSpread1.Sheets[0].AutoPostBack          = true;

            FpSpread1.Sheets[0].RowHeader.Visible = false;
            FpSpread1.Sheets[0].ColumnCount       = 5;
            FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
            darkstyle.BackColor = ColorTranslator.FromHtml("#0CA6CA");
            darkstyle.ForeColor = Color.White;
            FpSpread1.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle;

            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Text            = "S.No";
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].ForeColor       = ColorTranslator.FromHtml("#000000");
            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.Sheets[0].Columns[0].HorizontalAlign = HorizontalAlign.Center;

            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Text          = "Degree";
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].ForeColor     = ColorTranslator.FromHtml("#000000");
            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].VerticalAlign = VerticalAlign.Middle;
            FpSpread1.Sheets[0].Columns[1].VerticalAlign = VerticalAlign.Middle;

            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Text          = "Department";
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].ForeColor     = ColorTranslator.FromHtml("#000000");
            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].VerticalAlign = VerticalAlign.Middle;
            FpSpread1.Sheets[0].Columns[2].HorizontalAlign             = HorizontalAlign.Left;
            FpSpread1.Sheets[0].Columns[2].Width = 350;

            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Text          = "Vision";
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].ForeColor     = ColorTranslator.FromHtml("#000000");
            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].VerticalAlign = VerticalAlign.Middle;
            FpSpread1.Sheets[0].Columns[3].HorizontalAlign             = HorizontalAlign.Left;
            FpSpread1.Sheets[0].Columns[3].Width = 500;

            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 4].Text          = "Mission";
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 4].ForeColor     = ColorTranslator.FromHtml("#000000");
            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].VerticalAlign = VerticalAlign.Middle;
            FpSpread1.Sheets[0].Columns[4].HorizontalAlign             = HorizontalAlign.Left;
            FpSpread1.Sheets[0].Columns[4].Width = 500;
            //  FarPoint.Web.Spread.CheckBoxCellType cb = new FarPoint.Web.Spread.CheckBoxCellType();
            //cb.AutoPostBack = true;
            #endregion

            #region value
            for (int row = 0; row < ds.Tables[0].Rows.Count; row++)
            {
                FpSpread1.Sheets[0].RowCount++;

                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Text            = Convert.ToString(row + 1);
                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Tag             = Convert.ToString(ds.Tables[0].Rows[row]["college_code"]);
                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Font.Size       = FontUnit.Medium;
                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Font.Name       = "Book Antiqua";

                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Text            = Convert.ToString(ds.Tables[0].Rows[row]["Course_Name"]);
                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Tag             = Convert.ToString(ds.Tables[0].Rows[row]["Course_id"]);
                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Left;
                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Font.Size       = FontUnit.Medium;
                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Font.Name       = "Book Antiqua";

                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Text            = Convert.ToString(ds.Tables[0].Rows[row]["dept_name"]);
                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Tag             = Convert.ToString(ds.Tables[0].Rows[row]["Degree_Code"]);
                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].HorizontalAlign = HorizontalAlign.Left;
                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Font.Size       = FontUnit.Medium;
                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Font.Name       = "Book Antiqua";

                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Text            = Convert.ToString(ds.Tables[0].Rows[row]["deg_vission"]);
                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].HorizontalAlign = HorizontalAlign.Left;
                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Font.Size       = FontUnit.Medium;
                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Font.Name       = "Book Antiqua";

                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].Text            = Convert.ToString(ds.Tables[0].Rows[row]["deg_mission"]);
                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].HorizontalAlign = HorizontalAlign.Left;
                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].Font.Size       = FontUnit.Medium;
                FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].Font.Name       = "Book Antiqua";
            }
            FpSpread1.Sheets[0].SetColumnMerge(1, FarPoint.Web.Spread.Model.MergePolicy.Always);
            FpSpread1.Visible             = true;
            print.Visible                 = true;
            FpSpread1.ShowHeaderSelection = false;
            FpSpread1.Sheets[0].PageSize  = FpSpread1.Sheets[0].RowCount;
            FpSpread1.SaveChanges();
            lblvalidation1.Text = "";
            txtexcelname.Text   = "";
            #endregion
        }
        catch { }
    }
Beispiel #24
0
    public void bindspread()
    {
        try
        {
            FpSpread1.Sheets[0].RowCount    = 0;
            FpSpread1.Sheets[0].ColumnCount = 0;
            strquery = "SELECT DISTINCT Stage_ID,S.Stage_Name,R.Veh_ID,len(r.Veh_ID),(select priority from tbl_vechile_priority p where p.veh_id=r.veh_id and p.stage_id=s.Stage_ID) as periorty FROM RouteMaster R,Vehicle_Master V,Stage_Master S WHERE R.Veh_ID = V.Veh_ID AND R.Stage_Name = S.Stage_ID";
            if (ddlstage.SelectedItem.ToString() != "All")
            {
                strquery = strquery + " and R.Stage_Name = '" + ddlstage.SelectedValue.ToString() + "' ";
            }
            strquery = strquery + " order by S.Stage_Name,len(r.Veh_ID),R.Veh_ID";
            ds       = d2.select_method_wo_parameter(strquery, "Text");
            if (ds.Tables[0].Rows.Count > 0)
            {
                lblrptname.Visible     = true;
                txtexcelname.Visible   = true;
                btnxl.Visible          = true;
                btnprintmaster.Visible = true;
                Printcontrol.Visible   = false;
                FpSpread1.Visible      = true;
                btnsave.Enabled        = true;
                btnreset.Enabled       = true;

                FpSpread1.Sheets[0].ColumnHeader.RowCount = 1;
                FpSpread1.Sheets[0].ColumnCount           = 5;
                FpSpread1.Sheets[0].RowCount = 0;

                FpSpread1.Sheets[0].Columns[0].HorizontalAlign     = HorizontalAlign.Center;
                FpSpread1.Sheets[0].ColumnHeader.Rows[0].BackColor = Color.AliceBlue;
                FpSpread1.Sheets[0].ColumnHeader.Rows[0].Height    = 25;

                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Text = "S.No";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Text = "Stage";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Text = "Vehicle";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Text = "Select";
                FpSpread1.Sheets[0].ColumnHeader.Cells[0, 4].Text = "Priority";

                FarPoint.Web.Spread.TextCellType txt = new FarPoint.Web.Spread.TextCellType();
                FpSpread1.Sheets[0].Columns[0].CellType = txt;
                FpSpread1.Sheets[0].Columns[1].CellType = txt;
                FpSpread1.Sheets[0].Columns[2].CellType = txt;
                FpSpread1.Sheets[0].Columns[4].CellType = txt;
                FarPoint.Web.Spread.CheckBoxCellType chk = new FarPoint.Web.Spread.CheckBoxCellType();
                chk.AutoPostBack = true;
                FpSpread1.Sheets[0].SetColumnMerge(1, FarPoint.Web.Spread.Model.MergePolicy.Always);

                FpSpread1.Sheets[0].Columns[0].Width = 75;
                FpSpread1.Sheets[0].Columns[1].Width = 250;
                FpSpread1.Sheets[0].Columns[2].Width = 150;
                FpSpread1.Sheets[0].Columns[3].Width = 50;
                FpSpread1.Sheets[0].Columns[4].Width = 100;

                int    srno     = 0;
                string stageid  = "";
                string priority = "";

                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    FpSpread1.Sheets[0].RowCount++;
                    srno++;
                    stageid  = ds.Tables[0].Rows[i]["Stage_ID"].ToString();
                    priority = ds.Tables[0].Rows[i]["periorty"].ToString();
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Text     = srno.ToString();
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Text     = ds.Tables[0].Rows[i]["Stage_Name"].ToString();
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Tag      = stageid;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Text     = ds.Tables[0].Rows[i]["Veh_ID"].ToString();
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].CellType = chk;
                    if (priority.Trim() != "0" && priority.Trim() != "" && priority.Trim().ToLower() != null)
                    {
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].Text = priority;
                    }
                    else
                    {
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].Text = "";
                    }
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Left;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].HorizontalAlign = HorizontalAlign.Left;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].HorizontalAlign = HorizontalAlign.Center;
                    FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].HorizontalAlign = HorizontalAlign.Center;
                }
            }
            else
            {
                lblrptname.Visible     = false;
                txtexcelname.Visible   = false;
                btnxl.Visible          = false;
                btnprintmaster.Visible = false;
                Printcontrol.Visible   = false;
                FpSpread1.Visible      = false;
                errmsg.Visible         = true;
                errmsg.Text            = "no Records Found";
                btnsave.Enabled        = false;
                btnreset.Enabled       = false;
            }
            FpSpread1.Sheets[0].PageSize = FpSpread1.Sheets[0].RowCount;

            FpSpread1.SaveChanges();
            int h1 = 100;
            for (int i = 0; i < FpSpread1.Sheets[0].RowCount; i++)
            {
                h1 = h1 + FpSpread1.Sheets[0].Rows[i].Height;
            }

            if (h1 < 500)
            {
                FpSpread1.Height = h1;
            }
            else
            {
                FpSpread1.Height = 500;
            }

            h1 = 20;
            for (int i = 0; i < FpSpread1.Sheets[0].ColumnCount; i++)
            {
                h1 = h1 + FpSpread1.Sheets[0].Columns[i].Width;
            }
            FpSpread1.Width = h1;
        }
        catch
        {
        }
    }
    public void btnsave_Click(object sender, EventArgs e)
    {
        try
        {
            DateTime dt           = new DateTime();
            string   dtaccessdate = DateTime.Now.ToString();
            string   dtaccesstime = DateTime.Now.ToLongTimeString();
            FpSpread1.SaveChanges();

            if (cb_allowallmonth.Checked == true)
            {
                if (cbl_hostelname.Items.Count > 0)
                {
                    for (int i = 0; i < cbl_hostelname.Items.Count; i++)
                    {
                        if (cbl_hostelname.Items[i].Selected == true)
                        {
                            string hostelcode = Convert.ToString(cbl_hostelname.Items[i].Value);
                            if (FpSpread1.Sheets[0].ColumnCount > 2)
                            {
                                for (int ik = 2; ik < FpSpread1.Sheets[0].ColumnCount; ik++)
                                {
                                    for (int k = 0; k < cbl_month.Items.Count; k++)
                                    {
                                        if (cbl_month.Items[k].Selected == true)
                                        {
                                            string getmonthvalue = Convert.ToString(cbl_month.Items[k].Value);
                                            if (FpSpread1.Sheets[0].RowCount > 0)
                                            {
                                                for (int row = 0; row < FpSpread1.Sheets[0].RowCount; row++)
                                                {
                                                    string currentday = Convert.ToString(FpSpread1.Sheets[0].Cells[row, 1].Text);
                                                    string dayamount  = Convert.ToString(FpSpread1.Sheets[0].Cells[row, ik].Text);
                                                    if (dayamount.Trim() != "" && dayamount.Trim() != null)
                                                    {
                                                        string query      = "";
                                                        string rebatetype = "";
                                                        if (rdbdate.Checked == true)
                                                        {
                                                            if (cb_allowallmonth.Checked == true)
                                                            {
                                                                rebatetype = "1";
                                                                query      = "if exists (select * from HM_RebateMaster where RebateActDays ='" + currentday + "' and RebateMonth='" + getmonthvalue + "' and  HostelFK='" + hostelcode + "' and RebateType='" + rebatetype + "') update HM_RebateMaster set RebateDays ='" + dayamount + "'  where  RebateActDays ='" + currentday + "' and RebateMonth='" + getmonthvalue + "' and  HostelFK='" + hostelcode + "' and RebateType='" + rebatetype + "'else insert into HM_RebateMaster (RebateType,RebateMonth,RebateDays,RebateActDays,HostelFK) values ('" + rebatetype + "','" + getmonthvalue + "','" + dayamount + "','" + currentday + "','" + hostelcode + "' )";
                                                            }
                                                        }
                                                        else
                                                        {
                                                            if (cb_allowallmonth.Checked == true)
                                                            {
                                                                rebatetype = "2";
                                                                query      = "if exists (select * from HM_RebateMaster where RebateActDays ='" + currentday + "' and RebateMonth='" + getmonthvalue + "' and  HostelFK='" + hostelcode + "' and RebateType='" + rebatetype + "') update HM_RebateMaster set RebateAmount ='" + dayamount + "'  where  RebateActDays ='" + currentday + "' and RebateMonth='" + getmonthvalue + "' and  HostelFK='" + hostelcode + "' and RebateType='" + rebatetype + "'else insert into HM_RebateMaster (RebateType,RebateMonth,RebateAmount,RebateActDays,HostelFK) values ('" + rebatetype + "','" + getmonthvalue + "','" + dayamount + "','" + currentday + "','" + hostelcode + "' )";
                                                            }
                                                        }
                                                        int ivalue = d2.update_method_wo_parameter(query, "Text");
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                imgdiv2.Visible  = true;
                                lblalerterr.Text = "Saved Successfully";
                            }
                        }
                    }
                }
            }
            else
            {
                if (cbl_hostelname.Items.Count > 0)
                {
                    for (int i = 0; i < cbl_hostelname.Items.Count; i++)
                    {
                        if (cbl_hostelname.Items[i].Selected == true)
                        {
                            string hostelcode = Convert.ToString(cbl_hostelname.Items[i].Value);
                            if (FpSpread1.Sheets[0].ColumnCount > 2)
                            {
                                for (int ik = 2; ik < FpSpread1.Sheets[0].ColumnCount; ik++)
                                {
                                    string getmonthvalue = Convert.ToString(FpSpread1.Sheets[0].ColumnHeader.Cells[0, ik].Tag);
                                    if (FpSpread1.Sheets[0].RowCount > 0)
                                    {
                                        for (int row = 0; row < FpSpread1.Sheets[0].RowCount; row++)
                                        {
                                            string currentday = Convert.ToString(FpSpread1.Sheets[0].Cells[row, 1].Text);
                                            string dayamount  = Convert.ToString(FpSpread1.Sheets[0].Cells[row, ik].Text);
                                            if (dayamount.Trim() != "" && dayamount.Trim() != null)
                                            {
                                                string query      = "";
                                                string rebatetype = "";
                                                if (rdbdate.Checked == true)
                                                {
                                                    rebatetype = "1";
                                                    query      = "if exists (select * from HM_RebateMaster where RebateActDays ='" + currentday + "' and RebateMonth='" + getmonthvalue + "' and  HostelFK='" + hostelcode + "' and RebateType='" + rebatetype + "') update HM_RebateMaster set RebateDays ='" + dayamount + "'  where  RebateActDays ='" + currentday + "' and RebateMonth='" + getmonthvalue + "' and  HostelFK='" + hostelcode + "' and RebateType='" + rebatetype + "'else insert into HM_RebateMaster (RebateType,RebateMonth,RebateDays,RebateActDays,HostelFK) values ('" + rebatetype + "','" + getmonthvalue + "','" + dayamount + "','" + currentday + "','" + hostelcode + "' )";
                                                }
                                                else
                                                {
                                                    rebatetype = "2";
                                                    query      = " if exists (select * from HM_RebateMaster where RebateActDays ='" + currentday + "' and RebateMonth='" + getmonthvalue + "' and  HostelFK='" + hostelcode + "' and RebateType='" + rebatetype + "') update HM_RebateMaster set RebateAmount ='" + dayamount + "'  where  RebateActDays ='" + currentday + "' and RebateMonth='" + getmonthvalue + "' and  HostelFK='" + hostelcode + "' and RebateType='" + rebatetype + "'else insert into HM_RebateMaster (RebateType,RebateMonth,RebateAmount,RebateActDays,HostelFK) values ('" + rebatetype + "','" + getmonthvalue + "','" + dayamount + "','" + currentday + "','" + hostelcode + "' )";
                                                }

                                                int ivalue = d2.update_method_wo_parameter(query, "Text");
                                            }
                                        }
                                    }
                                }
                                imgdiv2.Visible  = true;
                                lblalerterr.Text = "Saved Successfully";
                            }
                        }
                    }
                }
            }
            btn_go_Click(sender, e);
        }
        catch
        {
        }
    }
    public void btn_go_Click(object sender, EventArgs e)
    {
        try
        {
            div_report.Visible   = false;
            Printcontrol.Visible = false;
            FpSpread1.Visible    = false;
            FpSpread1.SaveChanges();
            string itemheadercode = "";
            for (int i = 0; i < cbl_hostelname.Items.Count; i++)
            {
                if (cbl_hostelname.Items[i].Selected == true)
                {
                    if (itemheadercode == "")
                    {
                        itemheadercode = "" + cbl_hostelname.Items[i].Value.ToString() + "";
                    }
                    else
                    {
                        itemheadercode = itemheadercode + "'" + "," + "'" + cbl_hostelname.Items[i].Value.ToString() + "";
                    }
                }
            }

            string month = "";
            for (int i = 0; i < cbl_month.Items.Count; i++)
            {
                if (cbl_month.Items[i].Selected == true)
                {
                    if (month == "")
                    {
                        month = "" + cbl_month.Items[i].Value.ToString() + "";
                    }
                    else
                    {
                        month = month + "'" + "," + "'" + cbl_month.Items[i].Value.ToString() + "";
                    }
                }
            }
            if (txt_hostelname.Text == "--Select--")
            {
                lblerror.Visible  = true;
                lblerror.Text     = "Kindly Select The Hostel";
                btnsave.Visible   = false;
                btn_reset.Visible = false;
            }
            else
            {
                if (txt_month.Text == "--Select--")
                {
                    lblerror.Visible  = true;
                    lblerror.Text     = "Kindly Select The Month";
                    btnsave.Visible   = false;
                    btn_reset.Visible = false;
                    //FpSpread1.Visible = false;
                }
                else
                {
                    //FpSpread1.Visible = true;
                    if (itemheadercode.Trim() != "")
                    {
                        FpSpread1.Sheets[0].RowCount              = 0;
                        FpSpread1.Sheets[0].ColumnCount           = 0;
                        FpSpread1.CommandBar.Visible              = false;
                        FpSpread1.Sheets[0].AutoPostBack          = false;
                        FpSpread1.Sheets[0].ColumnHeader.RowCount = 1;
                        FpSpread1.Sheets[0].RowHeader.Visible     = false;
                        FpSpread1.Sheets[0].ColumnCount           = 1;


                        FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
                        darkstyle.BackColor = ColorTranslator.FromHtml("#0CA6CA");
                        darkstyle.ForeColor = Color.White;
                        FpSpread1.ActiveSheetView.ColumnHeader.DefaultStyle = darkstyle;

                        FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Text            = "S.No";
                        FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Size       = FontUnit.Medium;
                        FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Font.Name       = "Book Antiqua";
                        FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].HorizontalAlign = HorizontalAlign.Center;
                        FpSpread1.Columns[0].Width  = 50;
                        FpSpread1.Columns[0].Locked = true;

                        FpSpread1.Sheets[0].ColumnCount++;
                        FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Text            = "Days";
                        FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].HorizontalAlign = HorizontalAlign.Center;
                        FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Font.Name       = "Book Antiqua";
                        FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Font.Size       = FontUnit.Medium;
                        FpSpread1.Columns[1].Width  = 150;
                        FpSpread1.Columns[1].Locked = true;

                        for (int i = 0; i < cbl_month.Items.Count; i++)
                        {
                            if (cbl_month.Items[i].Selected == true)
                            {
                                FpSpread1.Sheets[0].ColumnCount++;
                                FarPoint.Web.Spread.DoubleCellType db = new FarPoint.Web.Spread.DoubleCellType();
                                db.ErrorMessage = "Enter only Numbers";
                                FpSpread1.Columns[FpSpread1.Sheets[0].ColumnCount - 1].CellType = db;

                                // FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, i].HorizontalAlign = HorizontalAlign.Center;
                                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Text            = Convert.ToString(cbl_month.Items[i].Text);
                                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Tag             = Convert.ToString(cbl_month.Items[i].Value);
                                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].HorizontalAlign = HorizontalAlign.Center;
                                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Font.Name       = "Book Antiqua";
                                FpSpread1.Sheets[0].ColumnHeader.Cells[0, FpSpread1.Sheets[0].ColumnCount - 1].Font.Size       = FontUnit.Medium;
                                FpSpread1.Columns[1].Width = 150;
                            }
                        }
                        for (int row = 0; row < 31; row++)
                        {
                            FpSpread1.Sheets[0].RowCount++;
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Text            = Convert.ToString(row + 1);
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Font.Size       = FontUnit.Medium;
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Font.Name       = "Book Antiqua";
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Text            = Convert.ToString(row + 1);
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Center;
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Font.Size       = FontUnit.Medium;
                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Font.Name       = "Book Antiqua";
                        }
                        DataView dv         = new DataView();
                        string   query      = "";
                        string   rebatetype = "";
                        if (rdbdate.Checked == true)
                        {
                            rebatetype = "1";
                        }
                        else
                        {
                            rebatetype = "2";
                        }
                        query = "select RebateActDays, RebateDays,RebateAmount  ,RebateMonth  from HM_RebateMaster where HostelFK in ('" + itemheadercode + "') and RebateMonth in ('" + month + "') and RebateType ='" + rebatetype + "'";
                        //}
                        //else
                        //{
                        //    rebatetype = "2";
                        //    query = "select Actual_Day, Grant_Day,Grant_Amount  ,Rebate_Month  from Rebate_Master where Hostel_Code in ('" + itemheadercode + "') and Rebate_Month in ('" + month + "') and Rebate_Type ='" + rebatetype + "'";
                        //}
                        ds1 = d2.select_method_wo_parameter(query, "Text");
                        if (ds1.Tables[0].Rows.Count > 0)
                        {
                            if (FpSpread1.Sheets[0].ColumnCount > 2)
                            {
                                for (int ik = 2; ik < FpSpread1.Sheets[0].ColumnCount; ik++)
                                {
                                    string getmonthvalue = Convert.ToString(FpSpread1.Sheets[0].ColumnHeader.Cells[0, ik].Tag);
                                    if (FpSpread1.Sheets[0].RowCount > 0)
                                    {
                                        for (int row = 0; row < FpSpread1.Sheets[0].RowCount; row++)
                                        {
                                            string currentday = Convert.ToString(FpSpread1.Sheets[0].Cells[row, 1].Text);

                                            ds1.Tables[0].DefaultView.RowFilter = "RebateActDays='" + currentday + "' and RebateMonth='" + getmonthvalue + "'";
                                            dv = ds1.Tables[0].DefaultView;
                                            if (dv.Count > 0)
                                            {
                                                if (rdbdate.Checked == true)
                                                {
                                                    FpSpread1.Sheets[0].Cells[row, ik].Text            = Convert.ToString(dv[0]["RebateDays"]);
                                                    FpSpread1.Sheets[0].Cells[row, ik].HorizontalAlign = HorizontalAlign.Right;
                                                }
                                                else
                                                {
                                                    FpSpread1.Sheets[0].Cells[row, ik].Text            = Convert.ToString(dv[0]["RebateAmount"]);
                                                    FpSpread1.Sheets[0].Cells[row, ik].HorizontalAlign = HorizontalAlign.Right;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        //25.04.16
                        //if (txt_allmonth.Text.Trim() != "")
                        //{
                        //    if (FpSpread1.Sheets[0].ColumnCount > 2)
                        //    {
                        //        for (int i = 0; i < FpSpread1.Sheets[0].ColumnCount - 2; i++)
                        //        {
                        //            int k = 0;
                        //            for (int row = 0; row < 31; row++)
                        //            {
                        //                k++;
                        //                FpSpread1.Sheets[0].Cells[k - 1, i + 2].Text = Convert.ToString(txt_allmonth.Text);
                        //                FpSpread1.Sheets[0].Cells[k - 1, i + 2].HorizontalAlign = HorizontalAlign.Center;
                        //                FpSpread1.Sheets[0].Cells[k - 1, i + 2].Font.Size = FontUnit.Medium;
                        //                FpSpread1.Sheets[0].Cells[k - 1, i + 2].Font.Name = "Book Antiqua";
                        //            }
                        //        }
                        //    }
                        //}
                    }
                    FpSpread1.Visible  = true;
                    div_report.Visible = true;
                    //div1.Visible = true;
                    lblerror.Visible             = false;
                    btnsave.Visible              = true;
                    btn_reset.Visible            = true;
                    FpSpread1.Sheets[0].PageSize = FpSpread1.Sheets[0].RowCount;
                }
            }
        }
        catch
        {
        }
    }
Beispiel #27
0
    protected void btn_go_Click(object sender, EventArgs e)
    {
        try
        {
            lbl_error.Visible = false;
            FpSpread1.SaveChanges();
            FpSpread1.Sheets[0].RowCount              = 0;
            FpSpread1.Sheets[0].ColumnCount           = 0;
            FpSpread1.CommandBar.Visible              = false;
            FpSpread1.Sheets[0].AutoPostBack          = true;
            FpSpread1.Sheets[0].ColumnHeader.RowCount = 1;
            FpSpread1.Sheets[0].RowHeader.Visible     = false;
            FpSpread1.Sheets[0].ColumnCount           = 4;
            FarPoint.Web.Spread.StyleInfo darkstyle = new FarPoint.Web.Spread.StyleInfo();
            darkstyle.BackColor = ColorTranslator.FromHtml("#0CA6CA");
            darkstyle.ForeColor = Color.White;
            FpSpread1.ActiveSheetView.ColumnHeader.DefaultStyle          = darkstyle;
            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].HorizontalAlign = HorizontalAlign.Center;
            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].Columns[0].HorizontalAlign               = HorizontalAlign.Center;
            FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Text            = "Header";
            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.Sheets[0].ColumnHeader.Cells[0, 2].Text            = "Questions";
            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.Sheets[0].ColumnHeader.Cells[0, 3].Text            = "Question Option";
            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.Sheets[0].ColumnHeader.Columns[0].Width            = 59;
            FpSpread1.Sheets[0].ColumnHeader.Columns[1].Width            = 150;
            FpSpread1.Sheets[0].ColumnHeader.Columns[2].Width            = 328;
            string headercode   = rs.GetSelectedItemsValueAsString(cbl_header1);
            string questionfk   = rs.GetSelectedItemsValueAsString(cbl_question1);
            string markmasterfk = rs.GetSelectedItemsValueAsString(cbl_option1);

            string q1 = " select FeedBackMasterPK from CO_FeedBackMaster where FeedBackName='" + ddl_feedback1.SelectedItem.Value + "'";
            ds.Clear();
            ds = d2.select_method_wo_parameter(q1, "text");
            string FeedBackMasterPK = GetdatasetRowstring(ds, "FeedBackMasterPK");
            q1 = " select distinct t.TextVal,q.Question,m.MarkType,qt.QuestionmasterFK,qt.HeaderCode,qt.MarkMasterFK,q.CollegeCode  from Co_Question_Type qt,CO_MarkMaster m,CO_QuestionMaster q,TextValTable t,CO_FeedBackQuestions fq where q.QuestionMasterPK=fq.QuestionMasterFK and t.TextCode= qt.HeaderCode and qt.MarkMasterFK=m.MarkMasterPK and qt.QuestionmasterFK=q.QuestionMasterPK and qt.HeaderCode=q.HeaderCode and m.CollegeCode=q.CollegeCode and q.HeaderCode in('" + headercode + "') and qt.MarkMasterFK in('" + markmasterfk + "') and  qt.FeedbackFk=fq.FeedBackMasterFK and qt.FeedbackFk in('" + FeedBackMasterPK + "') and qt.QuestionmasterFK in('" + questionfk + "') order by TextVal";
            ds.Clear();
            ds = d2.select_method_wo_parameter(q1, "text"); int row = 0;
            if (ds.Tables.Count > 0)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < cbl_header1.Items.Count; i++)
                    {
                        if (cbl_header1.Items[i].Selected == true)
                        {
                            for (int j = 0; j < cbl_question1.Items.Count; j++)
                            {
                                if (cbl_question1.Items[j].Selected == true)
                                {
                                    ds.Tables[0].DefaultView.RowFilter = " HeaderCode='" + cbl_header1.Items[i].Value + "' and  QuestionmasterFK='" + cbl_question1.Items[j].Value + "'"; //and MarkType='"++"' and
                                    DataView dv = ds.Tables[0].DefaultView;
                                    if (dv.Count > 0)
                                    {
                                        foreach (DataRowView dr in dv)
                                        {
                                            row++;
                                            FpSpread1.Sheets[0].RowCount++;
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Text            = row.ToString();
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Font.Size       = FontUnit.Medium;
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Font.Name       = "Book Antiqua";
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Text            = Convert.ToString(dr["TextVal"]);
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Center;
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].VerticalAlign   = VerticalAlign.Middle;
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Font.Size       = FontUnit.Medium;
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Font.Name       = "Book Antiqua";
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Text            = Convert.ToString(dr["Question"]);
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].HorizontalAlign = HorizontalAlign.Center;
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].VerticalAlign   = VerticalAlign.Middle;
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Font.Size       = FontUnit.Medium;
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Font.Name       = "Book Antiqua";
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Text            = Convert.ToString(dr["MarkType"]);
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].HorizontalAlign = HorizontalAlign.Center;
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Font.Size       = FontUnit.Medium;
                                            FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Font.Name       = "Book Antiqua";
                                            FpSpread1.Visible = true;
                                            rptprint1.Visible = true;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    FpSpread1.Sheets[0].PageSize = FpSpread1.Sheets[0].Rows.Count;
                    FpSpread1.Sheets[0].SetColumnMerge(1, FarPoint.Web.Spread.Model.MergePolicy.Always);
                    FpSpread1.Sheets[0].SetColumnMerge(2, FarPoint.Web.Spread.Model.MergePolicy.Always);
                }
                else
                {
                    lbl_error.Visible = true;
                    lbl_error.Text    = "No Records Found";
                    FpSpread1.Visible = false;
                    rptprint1.Visible = false;
                }
            }
            else
            {
                lbl_error.Visible = true;
                lbl_error.Text    = "No Records Found";
                FpSpread1.Visible = false;
                rptprint1.Visible = false;
            }
            FpSpread1.Sheets[0].PageSize = FpSpread1.Sheets[0].RowCount;
        }
        catch
        {
        }
    }
Beispiel #28
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Session["collegecode"] == null) //Aruna For Back Button
            {
                Response.Redirect("~/Default.aspx");
            }
            errmsg.Visible = false;
            FpSpread1.SaveChanges();
            if (!IsPostBack)
            {
                FpSpread1.CommandBar.Visible  = false;
                FpSpread1.Sheets[0].SheetName = " ";
                FpSpread1.Sheets[0].SheetCorner.Columns[0].Visible = false;
                FpSpread1.Sheets[0].Columns.Default.VerticalAlign  = VerticalAlign.Middle;
                FpSpread1.Sheets[0].Rows.Default.HorizontalAlign   = HorizontalAlign.Left;
                FpSpread1.Sheets[0].Rows.Default.VerticalAlign     = VerticalAlign.Middle;
                FpSpread1.Sheets[0].DefaultStyle.Font.Name         = "Book Antiqua";
                FpSpread1.Sheets[0].DefaultStyle.Font.Size         = FontUnit.Medium;
                FpSpread1.Sheets[0].DefaultStyle.Font.Bold         = false;

                FarPoint.Web.Spread.StyleInfo style1 = new FarPoint.Web.Spread.StyleInfo();
                style1.Font.Size       = 12;
                style1.Font.Bold       = true;
                style1.HorizontalAlign = HorizontalAlign.Center;
                style1.ForeColor       = System.Drawing.Color.Black;
                FpSpread1.Sheets[0].SheetCornerStyle          = new FarPoint.Web.Spread.StyleInfo(style1);
                FpSpread1.Sheets[0].ColumnHeader.DefaultStyle = new FarPoint.Web.Spread.StyleInfo(style1);
                FpSpread1.Sheets[0].ColumnHeader.DefaultStyle.HorizontalAlign = HorizontalAlign.Center;
                FpSpread1.Sheets[0].AllowTableCorner = true;


                FpSpread1.Pager.Position  = FarPoint.Web.Spread.PagerPosition.Bottom;
                FpSpread1.Pager.Mode      = FarPoint.Web.Spread.PagerMode.Both;
                FpSpread1.Pager.Align     = HorizontalAlign.Right;
                FpSpread1.Pager.Font.Bold = true;
                FpSpread1.Pager.Font.Name = "Book Antiqua";
                FpSpread1.Pager.ForeColor = System.Drawing.Color.DarkGreen;
                FpSpread1.Pager.BackColor = System.Drawing.Color.Beige;
                FpSpread1.Pager.BackColor = System.Drawing.Color.AliceBlue;
                FpSpread1.Pager.PageCount = 5;
                FpSpread1.Visible         = false;


                FpSpread1.Pager.Position  = FarPoint.Web.Spread.PagerPosition.Bottom;
                FpSpread1.Pager.Mode      = FarPoint.Web.Spread.PagerMode.Both;
                FpSpread1.Pager.Align     = HorizontalAlign.Left;
                FpSpread1.Pager.Font.Bold = true;
                FpSpread1.Pager.Font.Name = "Book Antiqua";
                FpSpread1.Pager.ForeColor = Color.DarkGreen;
                // FpSpread1.Pager.BackColor = Color.Beige;
                // FpSpread1.Pager.BackColor = Color.AliceBlue;
                FpSpread1.Sheets[0].Columns.Default.VerticalAlign       = VerticalAlign.Middle;
                FpSpread1.Sheets[0].Rows.Default.HorizontalAlign        = HorizontalAlign.Left;
                FpSpread1.Sheets[0].Rows.Default.VerticalAlign          = VerticalAlign.Middle;
                FpSpread1.Sheets[0].DefaultStyle.Font.Name              = "Book Antiqua";
                FpSpread1.Sheets[0].DefaultStyle.Font.Size              = FontUnit.Medium;
                FpSpread1.Sheets[0].DefaultStyle.Font.Bold              = false;
                FpSpread1.SheetCorner.Columns[0].Visible                = false;
                FpSpread1.Sheets[0].ColumnHeader.DefaultStyle.Font.Name = "Book Antiqua";
                FpSpread1.Sheets[0].DefaultStyle.Font.Bold              = false;
                FpSpread1.Sheets[0].DefaultStyle.Font.Size              = FontUnit.Medium;

                loadstage();
            }
        }
        catch
        {
        }
    }
Beispiel #29
0
    protected void btn_go_OnClick(object sender, EventArgs e)
    {
        try
        {
            #region Order by

            string orderby_Setting = d2.GetFunction("select value from master_Settings where settings='order_by'");
            string strorder        = ",len(r.roll_no)";
            if (orderby_Setting == "0")
            {
                strorder = ",len(r.roll_no)";
            }
            else if (orderby_Setting == "1")
            {
                strorder = ",len(r.Reg_No)";
            }
            else if (orderby_Setting == "2")
            {
                strorder = ",r.Stud_Name";
            }
            else if (orderby_Setting == "0,1,2")
            {
                strorder = ",len(r.roll_no),len(r.Reg_No),r.stud_name";
            }
            else if (orderby_Setting == "0,1")
            {
                strorder = ",len(r.roll_no),len(r.Reg_No)";
            }
            else if (orderby_Setting == "1,2")
            {
                strorder = ",len(r.Reg_No),r.Stud_Name";
            }
            else if (orderby_Setting == "0,2")
            {
                strorder = ",len(r.roll_no),r.Stud_Name";
            }

            #endregion
            //FarPoint.Web.Spread.TextCellType txt;
            FarPoint.Web.Spread.TextCellType txt = new FarPoint.Web.Spread.TextCellType();
            string degreecode = rs.GetSelectedItemsValueAsString(cbl_degree);
            string deptcode   = rs.GetSelectedItemsValueAsString(cbl_branch);
            string batchyear  = ddl_batch.SelectedItem.Text;
            //string sem = rs.GetSelectedItemsValueAsString(cbl_sem);
            DateTime FromDate = new DateTime();
            DateTime ToDate   = new DateTime();
            string[] fromdate = txtfromdate.Text.Split('/');
            string[] todate   = txttodate.Text.Split('/');
            FromDate = Convert.ToDateTime(fromdate[1] + "/" + fromdate[0] + "/" + fromdate[2]);
            ToDate   = Convert.ToDateTime(todate[1] + "/" + todate[0] + "/" + todate[2]);

            if (ddlCatogery.SelectedValue.ToString() == "1")
            {
                q1 = "select distinct R.Stud_Name ,r.Roll_no,R.Reg_No, Convert(varchar(10),R.batch_year)+' - '+ Convert(varchar(10),c.Course_name)+' - '+de.Acronym+' - '+Convert(varchar(10),R.current_semester)  as Degreedet,Convert(varchar(20),re.readm_date,103) as ReadmittedDate ,Convert(varchar(10), re.newbatch_year) +' - ' + Convert(varchar(10),re.Readm_Semester) +' SEM' as ReadmittedSemester  from Readmission re,REgistration R,Degree de,Department dep,Course c where R.App_No=re.App_No and c.Course_id=de.Course_id and de.college_code=c.college_code and dep.Dept_code=de.Dept_code and dep.college_code=de.college_code and R.college_code=dep.college_code and R.degree_code=de.Degree_code and c.Course_id IN ('" + degreecode + "') and R.batch_year in ('" + batchyear + "') and dep.dept_code in('" + deptcode + "') and re.Dis_Date  between '" + FromDate.ToString("MM/dd/yyyy") + "' and '" + ToDate.ToString("MM/dd/yyyy") + "' and REadmitreason='2' ";   //REadmitreason 1 for Prolong Absent Students
            }
            else if (ddlCatogery.SelectedValue.ToString() == "2")
            {
                q1 = "select distinct R.Stud_Name ,r.Roll_no,R.Reg_No, Convert(varchar(10),R.batch_year)+' - '+ Convert(varchar(10),c.Course_name)+' - '+de.Acronym+' - '+Convert(varchar(10),R.current_semester)  as Degreedet,Convert(varchar(20),re.readm_date,103) as ReadmittedDate ,Convert(varchar(10), re.newbatch_year) +' - ' + Convert(varchar(10),re.Readm_Semester) +' SEM' as ReadmittedSemester  from Readmission re,REgistration R,Degree de,Department dep,Course c where R.App_No=re.App_No and c.Course_id=de.Course_id and de.college_code=c.college_code and dep.Dept_code=de.Dept_code and dep.college_code=de.college_code and R.college_code=dep.college_code and R.degree_code=de.Degree_code and c.Course_id IN ('" + degreecode + "') and R.batch_year in ('" + batchyear + "') and dep.dept_code in('" + deptcode + "') and re.Dis_Date  between '" + FromDate.ToString("MM/dd/yyyy") + "' and '" + ToDate.ToString("MM/dd/yyyy") + "'  and REadmitreason='1' ";  //REadmitreason 1 for Discontinued Students
            }

            //q1 += " order by " + strorder.TrimStart(',') + " ";
            if (deptcode.Trim() != "" && degreecode.Trim() != "")  //&& sem.Trim() != ""
            {
                ds.Clear();
                ds = d2.select_method_wo_parameter(q1, "Text");
                if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                {
                    //rs.Fpreadheaderbindmethod("S.No-50/Student Name-220/Roll No-130/Reg No-150/Degree Details-180/Readmitted Date-120/Semester-140/", FpSpread1, "FALSE");
                    rs.Fpreadheaderbindmethod("S.No/Student Name/Roll No/Reg No/Degree Details/Readmitted Date/Semester/", FpSpread1, "TRUE");

                    FpSpread1.Sheets[0].Rows.Count++;

                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        FpSpread1.Sheets[0].Rows.Count++;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Text = Convert.ToString(FpSpread1.Sheets[0].Rows.Count - 1);
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Text = Convert.ToString(FpSpread1.Sheets[0].Rows.Count - 1);
                        //  FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Tag = Convert.ToString(dr["degree_code"]);

                        if (Convert.ToString(Session["Rollflag"]) == "1")
                        {
                            FpSpread1.Sheets[0].Columns[3].Visible = true;
                        }
                        if (Convert.ToString(Session["Regflag"]) == "1")
                        {
                            FpSpread1.Sheets[0].Columns[4].Visible = true;
                        }

                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].CellType = txt;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].CellType = txt;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].CellType = txt;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Text     = Convert.ToString(dr["Stud_Name"]);
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Text     = Convert.ToString(dr["Roll_no"]);
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Text     = Convert.ToString(dr["Reg_No"]);
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].Text     = Convert.ToString(dr["Degreedet"]);
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 5].Text     = Convert.ToString(dr["ReadmittedDate"]);
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 6].Text     = Convert.ToString(dr["ReadmittedSemester"]);

                        FarPoint.Web.Spread.TextCellType txtclType = new FarPoint.Web.Spread.TextCellType();
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 5].CellType = txtclType;

                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Locked          = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Locked          = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Locked          = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Locked          = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].Locked          = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 5].Locked          = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 6].Locked          = true;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].HorizontalAlign = HorizontalAlign.Center;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Font.Size       = FontUnit.Medium;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 0].Font.Name       = "Book Antiqua";
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].HorizontalAlign = HorizontalAlign.Left;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Font.Size       = FontUnit.Medium;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 1].Font.Name       = "Book Antiqua";
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].HorizontalAlign = HorizontalAlign.Left;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Font.Size       = FontUnit.Medium;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 2].Font.Name       = "Book Antiqua";
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].HorizontalAlign = HorizontalAlign.Left;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Font.Size       = FontUnit.Medium;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 3].Font.Name       = "Book Antiqua";
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].HorizontalAlign = HorizontalAlign.Left;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].Font.Size       = FontUnit.Medium;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 4].Font.Name       = "Book Antiqua";
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 5].HorizontalAlign = HorizontalAlign.Left;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 5].Font.Size       = FontUnit.Medium;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 5].Font.Name       = "Book Antiqua";
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 6].HorizontalAlign = HorizontalAlign.Left;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 6].Font.Size       = FontUnit.Medium;
                        FpSpread1.Sheets[0].Cells[FpSpread1.Sheets[0].RowCount - 1, 6].Font.Name       = "Book Antiqua";
                        FpSpread1.Sheets[0].Columns[7].Visible = false;
                    }
                    FpSpread1.Sheets[0].PageSize = FpSpread1.Sheets[0].RowCount;

                    FpSpread1.Visible = true;
                    FpSpread1.SaveChanges();
                    lbl_error.Visible = false;
                    print.Visible     = true;
                }
                else
                {
                    FpSpread1.Visible = false;
                    lbl_error.Visible = true;
                    lbl_error.Text    = "No Record Founds";
                }
            }
            else
            {
                FpSpread1.Visible = false;
                lbl_error.Visible = true;
                lbl_error.Text    = "Please Select All Fields";
            }
        }
        catch { }
    }
Beispiel #30
0
 protected void FpSpread2_SelectedIndexChanged(Object sender, EventArgs e)
 {
     FpSpread1.SaveChanges();
 }