Пример #1
0
    protected void ClearAll()
    {
        var EmpDs = from e in HRMLinq.Emp_Masts
                    orderby e.EmpName
                    select new { EmpId = e.Id, e.EmpName };

        ddlEmployee.Enabled = true;
        ddlEmployee.Items.Clear();
        ddlEmployee.DataSource     = EmpDs; //BLayer.FillEmp("");
        ddlEmployee.DataValueField = "EmpId";
        ddlEmployee.DataTextField  = "EmpName";
        ddlEmployee.DataBind();
        ddlEmployee.Items.Insert(0, new ListItem("--Select Employee--", "0"));

        DDLEmpGroup.SelectedIndex = 0;

        ddlBloodGrp.SelectedIndex = 0;

        var DeptDs = from dept in HRMLinq.Dept_Masts
                     orderby dept.DeptName
                     select new { DeptId = dept.Id, dept.DeptName };

        DDLDeptName.Items.Clear();
        DDLDeptName.DataSource     = DeptDs; //BLayer.FillDept();
        DDLDeptName.DataValueField = "DeptId";
        DDLDeptName.DataTextField  = "DeptName";
        DDLDeptName.DataBind();
        DDLDeptName.Items.Insert(0, new ListItem("--Select Department--", "0"));

        DDLDesignation.Items.Clear();
        DDLDesignation.Items.Insert(0, new ListItem("---Select Designation---", "0"));

        rblGender.SelectedIndex = 0;

        TxtFDOJ.Text      = "";
        TxtTDOJ.Text      = "";
        TxtFDOB.Text      = "";
        TxtTDOB.Text      = "";
        TxtFLeftDate.Text = "";
        TxtTLeftDate.Text = "";

        var ContryDs = from c in HRMLinq.Country_Masts
                       orderby c.CountryName
                       select new { CountryId = c.Id, c.CountryName };

        ddlCountry.Items.Clear();
        ddlCountry.DataSource     = ContryDs; //BLayer.FillCountry();
        ddlCountry.DataValueField = "CountryId";
        ddlCountry.DataTextField  = "CountryName";
        ddlCountry.DataBind();
        ddlCountry.Items.Insert(0, new ListItem("--Select Country--", "0"));

        ddlState.Items.Clear();
        ddlState.Items.Insert(0, new ListItem("---Select State---", "0"));

        ddlCity.Items.Clear();
        ddlCity.Items.Insert(0, new ListItem("---Select City---", "0"));

        ddlEmployee.Focus();
    }
Пример #2
0
    protected void ClearAll()
    {
        try
        {
            LblMsg.Text = "";

            HidFldId.Value  = "";
            TxtEmpName.Text = "";

            DDLDeptName.Items.Clear();
            DDLDeptName.DataSource     = BLayer.FillDept();
            DDLDeptName.DataValueField = "DeptId";
            DDLDeptName.DataTextField  = "DeptName";
            DDLDeptName.DataBind();
            DDLDeptName.Items.Insert(0, new ListItem("--Select Department--", "0"));

            DDLDesignation.Items.Clear();
            DDLDesignation.Items.Add("---Select Designation---");

            DDLEmpGroup.SelectedIndex = 0;

            TxtFJobTime.Text        = "";
            TxtTJobTime.Text        = "";
            TxtTotHours.Text        = "";
            TxtBasicSal.Text        = "";
            TxtDOJ.Text             = "";
            TxtDOB.Text             = "";
            rblGender.SelectedIndex = 0;
            TxtEMailId.Text         = "";
            TxtPassword.Text        = "";

            ddlCountry.Items.Clear();
            ddlCountry.DataSource     = BLayer.FillCountry();
            ddlCountry.DataValueField = "CountryId";
            ddlCountry.DataTextField  = "CountryName";
            ddlCountry.DataBind();
            ddlCountry.Items.Insert(0, new ListItem("--Select Country--", "0"));

            ddlState.Items.Clear();
            ddlState.Items.Add("---Select State---");

            ddlCity.Items.Clear();
            ddlCity.Items.Add("---Select City---");

            TxtAddress1.Text          = "";
            TxtPinCode.Text           = "";
            TxtMobNo.Text             = "";
            TxtPhone.Text             = "";
            ddlBloodGrp.SelectedIndex = 0;
            TxtLeftDate.Text          = "";
        }
        catch (Exception ex)
        {
            Response.Write(ex.ToString());
        }
    }
Пример #3
0
        private void ShowDeptInfo()
        {
            string         strConn = ConfigurationSettings.AppSettings["strConn"];
            SqlConnection  SqlConn = new SqlConnection(strConn);
            SqlDataAdapter SqlCmd  = new SqlDataAdapter("select * from DeptInfo", SqlConn);
            DataSet        SqlDS   = new DataSet();

            SqlCmd.Fill(SqlDS, "DeptInfo");
            DDLDeptName.DataSource     = SqlDS.Tables["DeptInfo"].DefaultView;
            DDLDeptName.DataTextField  = "DeptName";
            DDLDeptName.DataValueField = "DeptID";
            DDLDeptName.DataBind();
            SqlConn.Dispose();
            ListItem objTmp = new ListItem("--全部--", "0");

            DDLDeptName.Items.Add(objTmp);
            DDLDeptName.Items.FindByText("--全部--").Selected = true;
        }
Пример #4
0
    protected void DispRecord(string pStrNavigation)
    {
        int IntId = 0;

        StrSql        = new StringBuilder();
        StrSql.Length = 0;
        if (pStrNavigation == "EXAC")
        {
            IntId = int.Parse(HidFldId.Value);
        }
        else if (pStrNavigation.Trim().ToUpper() == "FIRST")
        {
            StrSql.AppendLine("Select Top 1 Id From Emp_Mast Order By Id");
        }
        else if (pStrNavigation.Trim().ToUpper() == "NEXT")
        {
            if (HidFldId.Value == "")
            {
                LblMsg.Text = "Data not found";
                return;
            }
            StrSql.AppendLine("Select Top 1 Id From Emp_Mast Where Id > " + int.Parse(HidFldId.Value));
        }
        else if (pStrNavigation.Trim().ToUpper() == "PREV")
        {
            if (HidFldId.Value == "")
            {
                LblMsg.Text = "Data not found";
                return;
            }
            StrSql.AppendLine("Select Top 1 Id From Emp_Mast Where Id < " + int.Parse(HidFldId.Value) + " Order By Id Desc");
        }
        else if (pStrNavigation.Trim().ToUpper() == "LAST")
        {
            StrSql.AppendLine("Select Top 1 Id From Emp_Mast Order By Id Desc");
        }

        if (pStrNavigation != "EXAC")
        {
            dtTemp = new DataTable();
            dtTemp = SqlFunc.ExecuteDataTable(StrSql.ToString());
            if (dtTemp.Rows.Count != 0)
            {
                IntId = int.Parse(dtTemp.Rows[0]["Id"].ToString());
            }
        }

        StrSql        = new StringBuilder();
        StrSql.Length = 0;

        StrSql.AppendLine("Select E.Id,E.EmpName,E.EmpGroup,E.EMailId,E.MobNo,E.Password ");
        StrSql.AppendLine(",E.DeptId,E.DesigId,E.FJobTime,E.TJobTime,E.TotTime");
        StrSql.AppendLine(",E.BasicRate,Convert(Varchar(10),E.DOJ,103) As DOJ,Convert(Varchar(10),E.DOB,103) As DOB,E.Gender");
        StrSql.AppendLine(",E.CountryId,E.StateId,E.CityId");
        StrSql.AppendLine(",E.Address1,E.PinCode");
        StrSql.AppendLine(",E.Phone,E.BloodGroup,Convert(Varchar(10),E.LeftDate,103) As LeftDate");
        StrSql.AppendLine("From Emp_Mast E");
        StrSql.AppendLine("Where E.Id=" + IntId);

        dtTemp = new DataTable();
        dtTemp = SqlFunc.ExecuteDataTable(StrSql.ToString());

        if (dtTemp.Rows.Count == 0)
        {
            ClearAll();
            LblMsg.Text = "Data not found";
            return;
        }

        LblMsg.Text = "";

        HidFldId.Value  = IntId.ToString();
        TxtEmpName.Text = dtTemp.Rows[0]["EmpName"].ToString();

        //DDLDeptName.SelectedValue = dtTemp.Rows[0]["DeptId"].ToString();
        //DDLDesignation.SelectedValue = dtTemp.Rows[0]["DesigId"].ToString();

        DDLDeptName.Items.Clear();
        DDLDeptName.DataSource     = BLayer.FillDept();
        DDLDeptName.DataValueField = "DeptId";
        DDLDeptName.DataTextField  = "DeptName";
        DDLDeptName.DataBind();
        DDLDeptName.Items.Insert(0, new ListItem("--Select Department--", "0"));

        if (dtTemp.Rows[0]["DeptId"].ToString() != "")
        {
            DDLDeptName.SelectedValue = dtTemp.Rows[0]["DeptId"].ToString();
        }

        DDLDesignation.Items.Clear();
        DDLDesignation.DataSource     = BLayer.FillDesig();
        DDLDesignation.DataValueField = "DesigId";
        DDLDesignation.DataTextField  = "DesigName";
        DDLDesignation.DataBind();
        DDLDesignation.Items.Insert(0, new ListItem("--Select Designation--", "0"));

        if (dtTemp.Rows[0]["DesigId"].ToString() != "")
        {
            DDLDesignation.SelectedValue = dtTemp.Rows[0]["DesigId"].ToString();
        }

        DDLEmpGroup.SelectedValue = dtTemp.Rows[0]["EmpGroup"].ToString();

        TxtFJobTime.Text = dtTemp.Rows[0]["FJobTime"].ToString();
        TxtTJobTime.Text = dtTemp.Rows[0]["TJobTime"].ToString();
        TxtTotHours.Text = dtTemp.Rows[0]["TotTime"].ToString();

        double basicsal = ValueConvert.ValDouble(dtTemp.Rows[0]["BasicRate"].ToString());

        TxtBasicSal.Text = basicsal.ToString("00");

        TxtDOJ.Text = dtTemp.Rows[0]["DOJ"].ToString();
        TxtDOB.Text = dtTemp.Rows[0]["DOB"].ToString();

        rblGender.SelectedValue = dtTemp.Rows[0]["Gender"].ToString();

        TxtEMailId.Text = dtTemp.Rows[0]["EMailId"].ToString();

        //ddlCountry.SelectedValue = dtTemp.Rows[0]["CountryId"].ToString();
        //ddlState.SelectedValue = dtTemp.Rows[0]["StateID"].ToString();
        //ddlCity.SelectedValue = dtTemp.Rows[0]["CityId"].ToString();

        ddlCountry.Items.Clear();
        ddlCountry.DataSource     = BLayer.FillCountry();
        ddlCountry.DataValueField = "CountryId";
        ddlCountry.DataTextField  = "CountryName";
        ddlCountry.DataBind();
        ddlCountry.Items.Insert(0, new ListItem("--Select Country--", "0"));
        if (dtTemp.Rows[0]["CountryId"].ToString() != "")
        {
            ddlCountry.SelectedValue = dtTemp.Rows[0]["CountryId"].ToString();
        }

        ddlState.Items.Clear();
        ddlState.DataSource     = BLayer.FillState(int.Parse(ddlCountry.SelectedValue));
        ddlState.DataValueField = "StateId";
        ddlState.DataTextField  = "StateName";
        ddlState.DataBind();
        ddlState.Items.Insert(0, new ListItem("--Select State--", "0"));
        if (dtTemp.Rows[0]["StateID"].ToString() != "")
        {
            ddlState.SelectedValue = dtTemp.Rows[0]["StateID"].ToString();
        }

        ddlCity.Items.Clear();
        ddlCity.DataSource     = BLayer.FillCity(int.Parse(ddlState.SelectedValue));
        ddlCity.DataValueField = "CityId";
        ddlCity.DataTextField  = "CityName";
        ddlCity.DataBind();
        ddlCity.Items.Insert(0, new ListItem("--Select City--", "0"));
        if (dtTemp.Rows[0]["CityId"].ToString() != "")
        {
            ddlCity.SelectedValue = dtTemp.Rows[0]["CityId"].ToString();
        }

        TxtAddress1.Text = dtTemp.Rows[0]["Address1"].ToString();
        TxtPinCode.Text  = dtTemp.Rows[0]["PinCode"].ToString();
        TxtMobNo.Text    = dtTemp.Rows[0]["MobNo"].ToString();
        TxtPhone.Text    = dtTemp.Rows[0]["Phone"].ToString();

        if (dtTemp.Rows[0]["BloodGroup"].ToString() != "")
        {
            ddlBloodGrp.SelectedValue = dtTemp.Rows[0]["BloodGroup"].ToString();
        }
        else
        {
            ddlBloodGrp.SelectedIndex = 0;
        }

        TxtLeftDate.Text = dtTemp.Rows[0]["LeftDate"].ToString();
        TxtPassword.Text = dtTemp.Rows[0]["Password"].ToString();
    }