private void bindGrid()
    {
        if (rbtnPartII.Checked)
        {
            if (ddlCourse.SelectedValue == "Civil")
            {
                qry  = "select distinct SID from  SExamMarks where  Part='PartII' and Course='Civil' and Status='Pass'  and SID in (select SID from Student where Part!='PartII') and SID not in (select SID from Project) and SID in (select distinct(SID) from SExamMarks where ExamSeason='" + lblSessionHiddend.Text + "') group by SID having (Count(Status)>=9) ";
                qry1 = "select distinct SID from SExamMarks where  Part='PartII' and Course='Civil' and Status='Pass' and SID in (select SID from Student where Part='PartII') and SID not in (select SID from Project) and SID in (select distinct(SID) from SExamMarks where ExamSeason='" + lblSessionHiddend.Text + "') group by SID having (Count(Status)>=11)  ";
            }
            else if (ddlCourse.SelectedValue == "Architecture")
            {
                qry  = "select distinct SID from SExamMarks where  Part='PartII' and Course='Architecture' and Status='Pass' and SID in (select SID from Student where Part!='PartII') and SID not in (select SID from Project) and SID in (select distinct(SID) from SExamMarks where ExamSeason='" + lblSessionHiddend.Text + "') group by SID having (Count(Status)>=10)  ";
                qry1 = "select  distinct SID from SExamMarks where Part='PartII' and Course='Architecture' and Status='Pass'  and SID in (select SID from Student where Part='PartII') and SID not in (select SID from Project) and SID in (select distinct(SID) from SExamMarks where ExamSeason='" + lblSessionHiddend.Text + "') group by SID having (Count(Status)>=12) ";
            }
        }
        else if (rbtnSectionB.Checked)
        {
            qry  = "select distinct SID from SExamMarks where  Part='SectionB' and Course='" + ddlCourse.SelectedValue + "' and Status='Pass' and SID not in (select SID from Project) and SID in (select distinct(SID) from SExamMarks where ExamSeason='" + lblSessionHiddend.Text + "')  group by SID having (Count(Status)>=10)";
            qry1 = "select distinct SID from SExamMarks where Part='SectionB' and Course='" + ddlCourse.SelectedValue + "' and Status='Pass' and  SID not in (select SID from Project) and SID in (select distinct(SID) from SExamMarks where ExamSeason='" + lblSessionHiddend.Text + "') group by SID having (Count(Status)>=10)";
        }
        SqlDataAdapter adp  = new SqlDataAdapter(qry, con);
        SqlDataAdapter adp1 = new SqlDataAdapter(qry1, con);
        DataTable      dt   = new DataTable();

        adp.Fill(dt);
        adp1.Fill(dt);
        GridShow.DataSource = dt;
        GridShow.DataBind();
    }
Esempio n. 2
0
        protected void ddlProduct_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                string barCode   = ddlProduct.SelectedValue.ToString();
                string StoreCode = ddlStore.SelectedValue.ToString();
                hdnBarCode.Value = ddlProduct.SelectedValue.ToString();

                List <productsDetails> details = _BuyCentral.GetAllProduct_Bycentral_ChallanNo(barCode, StoreCode).ToList();
                if (details.Count > 0)
                {
                    GridShow.DataSource = details;
                    GridShow.DataBind();
                }
                else
                {
                    GridShow.DataSource = null;
                    GridShow.DataBind();
                }



                //DataTable dt = ic.GetProductByBarCodeAndStore(barCode, cmpCode);
                //foreach (DataRow dr in dt.Rows)
                //{
                //    txtBalanceQty.Text = dr["BalanceQuanity"].ToString();
                //    //txtDamageQty.Text = dr["DamageQty"].ToString();
                //}
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Esempio n. 3
0
        private void Parttime_Click(object sender, EventArgs e)
        {
            GridPart.Show();
            GridShow.Hide();
            GridFull.Hide();
            string          sql = "SELECT *,EMP_TIMEWORK * EMP_CHG_HOUR AS TOTAL FROM EMPLOYEE WHERE EMP_TYPE = 'P'";
            MySqlConnection con = new MySqlConnection("host = angsila.informatics.buu.ac.th; user = cs57160477; password = cs57160477; database = cs57160477");
            MySqlCommand    cmd = new MySqlCommand(sql, con);

            con.Open();
            GridPart.Rows.Clear();
            MySqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                string code  = reader.GetString("EMP_CODE");
                string fname = reader.GetString("EMP_FNAME");
                string lname = reader.GetString("EMP_LNAME");
                string hour  = reader.GetString("EMP_TIMEWORK");
                string chg   = reader.GetString("EMP_CHG_HOUR");
                string total = reader.GetString("TOTAL");
                GridPart.Rows.Add(code, fname, lname, hour, chg, total);
            }
            con.Close();
        }
Esempio n. 4
0
    private void bindgrid()
    {
        SqlDataAdapter adp = new SqlDataAdapter("select SID,IMID,Session,ProjectTitle from Project where Status='ProformaBsubmitted' and (SynopsisStatus='Submitted' or SynopsisStatus='Pending')  and EntryStatus='Running' and Session='" + lblSessionHiddend.Text + "'", con);
        DataTable      dt  = new DataTable();

        adp.Fill(dt);
        GridShow.DataSource = dt;
        GridShow.DataBind();
    }
Esempio n. 5
0
    protected void btnSIDView_Click(object sender, EventArgs e)
    {
        SqlDataAdapter adp = new SqlDataAdapter("select SID as Membership,IMID,Course,Part,Session from Project where Status='ProformaBsubmitted' and (SynopsisStatus='Submitted' or SynopsisStatus='Pending')  and EntryStatus='Running' and SID='" + txtSID.Text.ToString() + "'", con);
        DataTable      dt  = new DataTable();

        adp.Fill(dt);
        GridShow.DataSource = dt;
        GridShow.DataBind();
        GridShow.Focus();
    }
Esempio n. 6
0
    private void displayrecords()
    {
        string  rolename   = Session["RoleName"].ToString();
        string  sql        = "select roleid from SubMenuPermission where RoleName='" + rolename + "' ";
        int     roleid     = cc.ExecuteScalar1(sql);
        string  sqldisplay = "select Committee_url,FileName from committeedetail where roleid='" + roleid + "'";
        DataSet ds         = cc.ExecuteDataset(sqldisplay);

        GridShow.DataSource = ds.Tables[0];
        GridShow.DataBind();
    }
    protected void btnUpdateProject_Click(object sender, EventArgs e)
    {
        con.Close(); con.Open();
        int           i  = 0;
        SqlDataReader rd = null;

        try
        {
            while (i < GridShow.Rows.Count)
            {
                CheckBox rbApp = (CheckBox)GridShow.Rows[i].FindControl("chkapp");
                if (rbApp.Checked == true)
                {
                    cmd = new SqlCommand("select SName,IMID,Course,Part from ExamCurrent where SID='" + GridShow.Rows[i].Cells[1].Text + "'", con);
                    rd  = cmd.ExecuteReader();
                    if (rd.Read())
                    {
                        lblsName.Text = rd["SName"].ToString();
                        lblIM.Text    = rd["IMID"].ToString();
                        lblCouse.Text = rd["Course"].ToString();
                        lblParts.Text = rd["Part"].ToString();
                    }
                    rd.Close();
                    cmd = new SqlCommand("insert into Project(SID,StudentName,IMID,Course,Part,Status,Session,CourseStatus,SynopsisStatus) values(@SID,@Name,@IMID,@Course,@Part,@Status,@Session,@CourseStatus,@SynopsisStatus)", con);
                    cmd.Parameters.AddWithValue("@SID", GridShow.Rows[i].Cells[1].Text);
                    cmd.Parameters.AddWithValue("@Name", lblsName.Text);
                    cmd.Parameters.AddWithValue("@IMID", lblIM.Text);
                    cmd.Parameters.AddWithValue("@Course", lblCouse.Text);
                    cmd.Parameters.AddWithValue("@Part", lblParts.Text);
                    cmd.Parameters.AddWithValue("@Status", "Selected");
                    cmd.Parameters.AddWithValue("@Session", ddlsesion.SelectedValue.ToString() + txtyer.Text);
                    cmd.Parameters.AddWithValue("@CourseStatus", lblStat.Text);
                    cmd.Parameters.AddWithValue("@SynopsisStatus", "NotSubmitted");
                    cmd.ExecuteNonQuery();
                }
                i++;
            }
            rd.Dispose();
            GridShow.DataBind();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('Successfully Updated')", true);
        }
        catch (NullReferenceException ex)
        {
        }

        con.Close(); con.Dispose();
    }
        protected void ddlProduct_SelectedIndexChanged(object sender, EventArgs e)
        {
            try{
                lblMessage.Text = "";
                string barCode      = ddlProduct.SelectedValue.ToString();
                string StoreCode    = ddlStore.SelectedValue.ToString();
                string supplierCode = ddlSupplierTo.SelectedValue.ToString();
                hdnBarCode.Value = ddlProduct.SelectedValue.ToString();

                List <productsDetails> details = _BuyCentral.GetAllProduct_Bycentral_ChallanNoBySupplier(barCode, StoreCode, supplierCode).ToList();
                if (details.Count > 0)
                {
                    GridShow.DataSource = details;
                    GridShow.DataBind();
                }
                else
                {
                    GridShow.DataSource = null;
                    GridShow.DataBind();
                }



                //DataTable dt = ic.GetProductInforByBarCodeStoreWise(barCode, StoreCode, "CENTRAL");
                //foreach (DataRow dr in dt.Rows)
                //{
                //    //txtSize.Text = dr["StyleSize"].ToString();

                //    if (double.Parse(dr["BalanceQuanity"].ToString()) <= 0)
                //    {
                //        txtReturnQty.Enabled = false;
                //        txtBalanceQty.Text = "0";
                //    }
                //    else
                //    {
                //        txtReturnQty.Enabled = true;
                //        txtBalanceQty.Text = dr["BalanceQuanity"].ToString();
                //    }
                //}
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
        //public void FillCentralCompanyFrom()
        //{
        //    ddlStore.DataSource = ic.GetCentralCompanyList();
        //    ddlStore.DataValueField = "CompanyCode";
        //    ddlStore.DataTextField = "CompanyName";
        //    ddlStore.DataBind();
        //    ddlStore.Items.Insert(0, new ListItem("Select One", "0"));
        //}

        protected void ddlStore_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                lblMessage.Text = "";
                //    FillProductGroup();
                //    string supCode = ddlSupplierTo.SelectedValue.ToString();



                if (ddlProgram.SelectedValue.ToString() != "0")
                {
                    int    programCode             = Convert.ToInt32(ddlProgram.SelectedValue.ToString());
                    string storeCode               = ddlStoreName.SelectedValue.ToString();
                    List <productsDetails> details = buyBll.GetAllProductWithProgram2(programCode, storeCode).ToList();
                    if (details.Count > 0)
                    {
                        GridShow.DataSource = details;
                        GridShow.DataBind();
                    }
                    else
                    {
                        GridShow.DataSource = null;
                        GridShow.DataBind();
                    }

                    //string programCode = ddlProgram.SelectedValue.ToString();
                    //txtChalanNoReturn.Text = GetNewChallanNo(programCode, DateTime.Parse(txtDate.Text), "Store");
                    //FillProductGroup();

                    //FillSupplierToReturn(ddlStore.SelectedValue.ToString());
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Esempio n. 10
0
 private void bindgrid()
 {
     SqlDataAdapter adp = new SqlDataAdapter("select SID,IMID,Session,SynopsisStatus from Project where Status='" + ddlProfBStatus.SelectedValue.ToString() + "' and EntryStatus='Running' and Session='" + lblSessionHiddend.Text.ToString() + "'", con);
     DataTable      dt  = new DataTable(); adp.Fill(dt); GridShow.DataSource = dt; GridShow.DataBind(); clear();
 }
Esempio n. 11
0
        protected void imgSearchbooks_Click(object sender, ImageClickEventArgs e)
        {
            DataSet ds = new DataSet();

            if (txtBookname.Text == string.Empty && txtAuthorname.Text == string.Empty && dlCategory.SelectedValue == "-Select-")
            {
                Panel1.Visible   = true;
                lblmsg.Visible   = true;
                lblmsg.ForeColor = System.Drawing.Color.Red;
                gpanel.Visible   = false;
            }
            else
            {
                Panel1.Visible = false;
                gpanel.Visible = true;

                try
                {
                    con = new SqlConnection(str);
                    con.Open();

                    SqlDataAdapter adpAll = new SqlDataAdapter("select ISBN,BookName,AuthorName,Category,Book_ID from InfoBook where BookName='" + txtBookname.Text + "' and AuthorName='" + txtAuthorname.Text + "' and Category='" + dlCategory.SelectedValue + "'  ", con);

                    SqlDataAdapter adpBook = new SqlDataAdapter("select ISBN,BookName,AuthorName,Category,Book_ID from InfoBook where BookName='" + txtBookname.Text + "'", con);

                    SqlDataAdapter adpAuthor      = new SqlDataAdapter("select ISBN,BookName,AuthorName,Category,Book_ID from InfoBook where AuthorName='" + txtAuthorname.Text + "'", con);
                    SqlDataAdapter adpCat         = new SqlDataAdapter("select ISBN,BookName,AuthorName,Category,Book_ID from InfoBook where Category='" + dlCategory.SelectedValue + "'", con);
                    SqlDataAdapter adpBook_Author = new SqlDataAdapter("select ISBN,BookName,AuthorName,Category,Book_ID from InfoBook where BookName='" + txtBookname.Text + "' and AuthorName='" + txtAuthorname.Text + "'", con);
                    SqlDataAdapter adpBook_Cat    = new SqlDataAdapter("select ISBN,BookName,AuthorName,Category,Book_ID from InfoBook where BookName='" + txtBookname.Text + "' and Category='" + dlCategory.SelectedValue + "'", con);
                    SqlDataAdapter adpAuthor_Cat  = new SqlDataAdapter("select ISBN,BookName,AuthorName,Category,Book_ID from InfoBook where AuthorName='" + txtAuthorname.Text + "' and Category='" + dlCategory.SelectedValue + "'", con);
                    if (txtBookname.Text == string.Empty && txtAuthorname.Text == string.Empty && dlCategory.SelectedValue != "-Select-")
                    {
                        adpCat.Fill(ds, "InfoBook");
                        GridShow.DataSource = ds;
                        GridShow.DataBind();
                    }
                    else if (txtBookname.Text == string.Empty && dlCategory.SelectedValue == "-Select-")

                    {
                        adpAuthor.Fill(ds, "InfoBook");

                        GridShow.DataSource = ds;
                        GridShow.DataBind();
                    }
                    else if (txtAuthorname.Text == string.Empty && dlCategory.SelectedValue == "-Select")
                    {
                        adpBook.Fill(ds, "InfoBook");

                        GridShow.DataSource = ds;
                        GridShow.DataBind();
                    }
                    else if (txtBookname.Text != string.Empty && txtAuthorname.Text != string.Empty && dlCategory.SelectedValue != "-Select-")
                    {
                        adpAll.Fill(ds, "InfoBook");

                        GridShow.DataSource = ds;
                        GridShow.DataBind();
                    }
                    else if (txtBookname.Text != string.Empty && txtAuthorname.Text != string.Empty && dlCategory.SelectedValue == "-Select-")
                    {
                        adpBook_Author.Fill(ds, "InfoBook");

                        GridShow.DataSource = ds;
                        GridShow.DataBind();
                    }
                    else if (txtBookname.Text != string.Empty && txtAuthorname.Text == string.Empty && dlCategory.SelectedValue != "-Select-")

                    {
                        adpBook_Cat.Fill(ds, "InfoBook");

                        GridShow.DataSource = ds;
                        GridShow.DataBind();
                    }
                    else if (txtBookname.Text == string.Empty && txtAuthorname.Text != string.Empty & dlCategory.SelectedValue != "-Select-")
                    {
                        adpAuthor_Cat.Fill(ds, "InfoBook");

                        GridShow.DataSource = ds;
                        GridShow.DataBind();
                    }
                    con.Close();
                }
                catch (Exception ex)
                {
                }
            }
        }
Esempio n. 12
0
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                List <Inv_Damage_Temp> _Inv_Damage_Temp = new List <Inv_Damage_Temp>();
                //bool status = true;
                bool CheckStatus = false;

                foreach (GridViewRow gvRow in GridShow.Rows)
                {
                    CheckBox rowChkBox = ((CheckBox)gvRow.FindControl("rowLevelCheckBox"));

                    if (rowChkBox.Checked == true)
                    {
                        CheckStatus = true;
                    }
                }

                if (CheckStatus)
                {
                    foreach (GridViewRow gvr in GridShow.Rows)
                    {
                        CheckBox rowChkBox = ((CheckBox)gvr.FindControl("rowLevelCheckBox"));


                        if (rowChkBox.Checked == true)
                        {
                            Inv_Damage_Temp returnTemp           = new Inv_Damage_Temp();
                            Label           lblproductName       = (Label)gvr.FindControl("lblproductName");
                            Label           lblBrand             = (Label)gvr.FindControl("lblBrand");
                            Label           lblStyleAndSize      = (Label)gvr.FindControl("lblStyleAndSize");
                            Label           lblSupplierReturnQty = (Label)gvr.FindControl("lblSupplierReturnQty");
                            Label           lblCompanyId         = (Label)gvr.FindControl("lblCompanyId");
                            Label           lblCompanyName       = (Label)gvr.FindControl("lblCompanyName");
                            Label           lblproductGroup      = (Label)gvr.FindControl("lblproductGroup");
                            Label           lblReceiveQuantity   = (Label)gvr.FindControl("lblReceiveQuantity");
                            Label           lblCPU            = (Label)gvr.FindControl("lblCPU");
                            Label           lblDeliveryQty    = (Label)gvr.FindControl("lblDeliveryQty");
                            Label           lblOcode          = (Label)gvr.FindControl("lblOcode");
                            Label           lblCompanyCode    = (Label)gvr.FindControl("lblCompanyCode");
                            Label           lblPurchaseDate   = (Label)gvr.FindControl("lblPurchaseDate");
                            Label           lblBalanceQty     = (Label)gvr.FindControl("lblBalanceQty");
                            Label           lblChallanNo      = (Label)gvr.FindControl("lblChallanNo");
                            DropDownList    ddlDamageCategory = (DropDownList)gvr.FindControl("ddlDamageCategory");
                            Label           lblBarCode        = (Label)gvr.FindControl("lblBarCode");
                            Label           lblUnitName       = (Label)gvr.FindControl("lblUnitName");
                            TextBox         txtReturnQty      = (TextBox)gvr.FindControl("txtReturnQty");
                            TextBox         txtRemarks        = (TextBox)gvr.FindControl("txtRemarks");
                            if (txtRemarks.Text == "")
                            {
                                returnTemp.Remarks = "N/A";
                            }
                            else
                            {
                                returnTemp.Remarks = txtRemarks.Text;
                            }
                            int ReturnQty = int.Parse(txtReturnQty.Text);


                            returnTemp.ChallanNo     = txtChalanNo.Text;
                            returnTemp.Challan_No_To = lblChallanNo.Text;
                            if (lblBalanceQty.Text == "")
                            {
                                returnTemp.BalanceQuanity = 0;
                            }
                            else
                            {
                                returnTemp.BalanceQuanity = Convert.ToInt32(lblBalanceQty.Text);
                            }

                            returnTemp.BarCode = lblBarCode.Text;
                            returnTemp.Brand   = lblBrand.Text;
                            if (lblCPU.Text == "")
                            {
                                returnTemp.CPU = 0;
                            }
                            else
                            {
                                returnTemp.CPU = Convert.ToDecimal(lblCPU.Text);
                            }
                            returnTemp.CompanyCode = lblCompanyCode.Text;
                            if (lblDeliveryQty.Text == "")
                            {
                                returnTemp.DeliveryQty = 0;
                            }
                            else
                            {
                                returnTemp.DeliveryQty = Convert.ToDouble(lblDeliveryQty.Text);
                            }

                            returnTemp.EditDate = DateTime.Today;
                            Guid user = (((SessionUser)Session["SessionUser"]).UserId);
                            returnTemp.EditUser     = user;
                            returnTemp.OCode        = "8989";
                            returnTemp.CompanyCode  = CentralCode.ToString();
                            returnTemp.ProductGroup = lblproductGroup.Text;
                            returnTemp.ProductId    = Convert.ToInt32(lblBarCode.Text);
                            returnTemp.ProductName  = lblproductName.Text;
                            returnTemp.PurchaseDate = Convert.ToDateTime(lblPurchaseDate.Text);

                            if (lblReceiveQuantity.Text == "")
                            {
                                returnTemp.ReceiveQuantity = 0;
                            }
                            else
                            {
                                returnTemp.ReceiveQuantity = Convert.ToDouble(lblReceiveQuantity.Text);
                            }

                            returnTemp.Store_Code     = ddlStore.SelectedValue.ToString();
                            returnTemp.StyleSize      = lblStyleAndSize.Text;
                            returnTemp.DamageQty      = ReturnQty;
                            returnTemp.UnitName       = lblUnitName.Text;
                            returnTemp.DamageCategory = ddlDamageCategory.SelectedItem.Text;


                            _context.Inv_Damage_Temp.AddObject(returnTemp);
                        }
                    }
                    _context.SaveChanges();


                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Damage Process Temporary successfully')", true);
                    GridShow.DataSource = null;
                    GridShow.DataBind();
                    List <productsDetails> details = _BuyCentral.GetAllProduct_DamageTemp_ChallanNo(txtChalanNo.Text).ToList();
                    if (details.Count > 0)
                    {
                        grdDamage.DataSource = details;
                        grdDamage.DataBind();
                    }
                    else
                    {
                        grdDamage.DataSource = null;
                        grdDamage.DataBind();
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Item Selected!')", true);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
            //string BarCode = hdnBarCode.Value.ToString();

            //if (BarCode == string.Empty || ddlStore.SelectedValue == "0" || txtDamageQty.Text == string.Empty)
            //{
            //    return;
            //}
            //try
            //{
            //    //DateTime date = DateTime.Today;
            //    //try
            //    //{
            //    //    date = DateTime.Parse(txtDate.Text);
            //    //}
            //    //catch { }

            //    Hashtable ht = new Hashtable();
            //    ht.Add("ChallanNo", txtChalanNo.Text);
            //    ht.Add("BarCode", BarCode);
            //    ht.Add("Store_Code", ddlStore.SelectedValue.ToString());
            //    ht.Add("DamageDate", txtDate.Text);
            //    ht.Add("DamageQty", txtDamageQty.Text);
            //    ht.Add("CompanyCode", CentralCode.ToString());
            //    DataTable dt = damage.DamageStoreWise(ht);

            //    //if ()
            //    //{
            //    //lblMessage.Text = "<font color='green'>Product damage information inserted successfully!</font>";
            //    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Product damage information inserted successfully!')", true);
            //    grdDamage.DataSource = dt;
            //    grdDamage.DataBind();
            //    ClearForm();
            //    //}
            //    //else
            //    //{
            //    //    lblMessage.Text = "<font color='red'>Error in inserting product damage information!</font>";
            //    //}

            //}
            //catch { }
        }
Esempio n. 13
0
 protected void txtdevYearSeason_TextChanged(object sender, EventArgs e)
 {
     lblSessionHiddend.Text = ddlsession.SelectedValue.ToString() + "" + txtSession.Text.ToString();
     bindgrid();
     GridShow.Focus();
 }
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                List <Inv_Return_Temp> _Inv_Return_Temp = new List <Inv_Return_Temp>();
                //bool status = true;
                bool CheckStatus = false;

                foreach (GridViewRow gvRow in GridShow.Rows)
                {
                    CheckBox rowChkBox = ((CheckBox)gvRow.FindControl("rowLevelCheckBox"));

                    if (rowChkBox.Checked == true)
                    {
                        CheckStatus = true;
                    }
                }

                if (CheckStatus)
                {
                    Guid   user  = (((SessionUser)Session["SessionUser"]).UserId);
                    string Ocode = ((SessionUser)Session["SessionUser"]).OCode.ToString();
                    foreach (GridViewRow gvr in GridShow.Rows)
                    {
                        CheckBox rowChkBox = ((CheckBox)gvr.FindControl("rowLevelCheckBox"));


                        if (rowChkBox.Checked == true)
                        {
                            Inv_Return_Temp returnTemp           = new Inv_Return_Temp();
                            Label           lblproductName       = (Label)gvr.FindControl("lblproductName");
                            Label           lblBrand             = (Label)gvr.FindControl("lblBrand");
                            Label           lblStyleAndSize      = (Label)gvr.FindControl("lblStyleAndSize");
                            Label           lblSupplierReturnQty = (Label)gvr.FindControl("lblSupplierReturnQty");
                            // Label lblCompanyId = (Label)gvr.FindControl("lblCompanyId");
                            // Label lblCompanyName = (Label)gvr.FindControl("lblCompanyName");
                            Label   lblproductGroup    = (Label)gvr.FindControl("lblproductGroup");
                            Label   lblReceiveQuantity = (Label)gvr.FindControl("lblReceiveQuantity");
                            Label   lblCPU             = (Label)gvr.FindControl("lblCPU");
                            Label   lblDeliveryQty     = (Label)gvr.FindControl("lblDeliveryQty");
                            Label   lblOcode           = (Label)gvr.FindControl("lblOcode");
                            Label   lblCompanyCode     = (Label)gvr.FindControl("lblCompanyCode");
                            Label   lblPurchaseDate    = (Label)gvr.FindControl("lblPurchaseDate");
                            Label   lblBalanceQty      = (Label)gvr.FindControl("lblBalanceQty");
                            Label   lblChallanNo       = (Label)gvr.FindControl("lblChallanNo");
                            Label   lblBarCode         = (Label)gvr.FindControl("lblBarCode");
                            Label   lblUnitName        = (Label)gvr.FindControl("lblUnitName");
                            TextBox txtReturnQty       = (TextBox)gvr.FindControl("txtReturnQty");
                            TextBox txtRemarks         = (TextBox)gvr.FindControl("txtRemarks");
                            int     ReturnQty          = int.Parse(txtReturnQty.Text);


                            returnTemp.ChallanNo    = txtChalanNoReturn.Text;
                            returnTemp.Remarks      = txtRemarks.Text;
                            returnTemp.ChallanNo_To = lblChallanNo.Text;
                            if (lblBalanceQty.Text == "")
                            {
                                returnTemp.BalanceQuanity = 0;
                            }
                            else
                            {
                                returnTemp.BalanceQuanity = Convert.ToInt32(lblBalanceQty.Text);
                            }

                            returnTemp.BarCode = lblBarCode.Text;
                            returnTemp.Brand   = lblBrand.Text;
                            if (lblCPU.Text == "")
                            {
                                returnTemp.CPU = 0;
                            }
                            else
                            {
                                returnTemp.CPU = Convert.ToDecimal(lblCPU.Text);
                            }
                            returnTemp.CurrentCompanyCode = lblCompanyCode.Text;
                            if (lblDeliveryQty.Text == "")
                            {
                                returnTemp.DeliveryQty = 0;
                            }
                            else
                            {
                                returnTemp.DeliveryQty = Convert.ToDouble(lblDeliveryQty.Text);
                            }
                            returnTemp.DPT_CODE = "N/A";
                            returnTemp.EditDate = DateTime.Today;

                            returnTemp.EditUser       = user;
                            returnTemp.EID            = "N/A";
                            returnTemp.OCode          = Ocode;
                            returnTemp.OldCompanyCode = CentralCode.ToString();
                            returnTemp.ProductGroup   = lblproductGroup.Text;
                            returnTemp.ProductId      = Convert.ToInt32(lblBarCode.Text);
                            returnTemp.ProductName    = lblproductName.Text;

                            if (lblPurchaseDate.Text == "")
                            {
                                returnTemp.PurchaseDate = DateTime.Today;
                            }
                            else
                            {
                                returnTemp.PurchaseDate = Convert.ToDateTime(lblPurchaseDate.Text);
                            }
                            returnTemp.ProgramId = Convert.ToInt32(ddlProgram.SelectedValue);

                            if (lblReceiveQuantity.Text == "")
                            {
                                returnTemp.ReceiveQuantity = 0;
                            }
                            else
                            {
                                returnTemp.ReceiveQuantity = Convert.ToDouble(lblReceiveQuantity.Text);
                            }

                            //returnTemp.Store_Code = ddlStore.SelectedValue.ToString();
                            returnTemp.StyleSize         = lblStyleAndSize.Text;
                            returnTemp.SupplierCode      = "N/A";
                            returnTemp.SupplierReturnQty = 0;
                            returnTemp.ERetQty           = ReturnQty;
                            returnTemp.UnitName          = lblUnitName.Text;
                            returnTemp.Store_Code        = ddlStoreName.SelectedValue;

                            _context.Inv_Return_Temp.AddObject(returnTemp);
                        }
                    }
                    _context.SaveChanges();


                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Return Process Temporary successfully')", true);
                    GridShow.DataSource = null;
                    GridShow.DataBind();
                    List <productsDetails> details = _BuyCentral.GetAllProduct_ReturnTemp_ChallanNo_DPT(user, Ocode).ToList();
                    if (details.Count > 0)
                    {
                        grdTransfer.DataSource = details;
                        grdTransfer.DataBind();
                    }
                    else
                    {
                        grdTransfer.DataSource = null;
                        grdTransfer.DataBind();
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Item Selected!')", true);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                List <Inv_Return_Temp> _Inv_Return_Temp = new List <Inv_Return_Temp>();
                Guid   user  = (((SessionUser)Session["SessionUser"]).UserId);
                string Ocode = ((SessionUser)Session["SessionUser"]).OCode.ToString();
                //bool status = true;
                bool CheckStatus = false;

                foreach (GridViewRow gvRow in GridShow.Rows)
                {
                    CheckBox rowChkBox = ((CheckBox)gvRow.FindControl("rowLevelCheckBox"));

                    if (rowChkBox.Checked == true)
                    {
                        CheckStatus = true;
                    }
                }

                if (CheckStatus)
                {
                    foreach (GridViewRow gvr in GridShow.Rows)
                    {
                        CheckBox rowChkBox = ((CheckBox)gvr.FindControl("rowLevelCheckBox"));


                        if (rowChkBox.Checked == true)
                        {
                            Inv_Return_Temp returnTemp           = new Inv_Return_Temp();
                            Label           lblproductName       = (Label)gvr.FindControl("lblproductName");
                            Label           lblBrand             = (Label)gvr.FindControl("lblBrand");
                            Label           lblStyleAndSize      = (Label)gvr.FindControl("lblStyleAndSize");
                            Label           lblSupplierReturnQty = (Label)gvr.FindControl("lblSupplierReturnQty");
                            Label           lblCompanyId         = (Label)gvr.FindControl("lblCompanyId");
                            Label           lblCompanyName       = (Label)gvr.FindControl("lblCompanyName");
                            Label           lblproductGroup      = (Label)gvr.FindControl("lblproductGroup");
                            Label           lblReceiveQuantity   = (Label)gvr.FindControl("lblReceiveQuantity");
                            Label           lblCPU          = (Label)gvr.FindControl("lblCPU");
                            Label           lblDeliveryQty  = (Label)gvr.FindControl("lblDeliveryQty");
                            Label           lblOcode        = (Label)gvr.FindControl("lblOcode");
                            Label           lblCompanyCode  = (Label)gvr.FindControl("lblCompanyCode");
                            Label           lblPurchaseDate = (Label)gvr.FindControl("lblPurchaseDate");
                            Label           lblBalanceQty   = (Label)gvr.FindControl("lblBalanceQty");
                            Label           lblChallanNo    = (Label)gvr.FindControl("lblChallanNo");
                            Label           lblBarCode      = (Label)gvr.FindControl("lblBarCode");
                            Label           lblUnitName     = (Label)gvr.FindControl("lblUnitName");
                            TextBox         txtReturnQty    = (TextBox)gvr.FindControl("txtReturnQty");
                            TextBox         txtRemarks      = (TextBox)gvr.FindControl("txtRemarks");
                            int             ReturnQty       = int.Parse(txtReturnQty.Text);


                            returnTemp.ChallanNo    = txtChalanNoReturn.Text;
                            returnTemp.Remarks      = txtRemarks.Text;
                            returnTemp.ChallanNo_To = lblChallanNo.Text;
                            if (lblBalanceQty.Text == "")
                            {
                                returnTemp.BalanceQuanity = 0;
                            }
                            else
                            {
                                returnTemp.BalanceQuanity = Convert.ToInt32(lblBalanceQty.Text);
                            }

                            returnTemp.BarCode = lblBarCode.Text;
                            returnTemp.Brand   = lblBrand.Text;
                            if (lblCPU.Text == "")
                            {
                                returnTemp.CPU = 0;
                            }
                            else
                            {
                                returnTemp.CPU = Convert.ToDecimal(lblCPU.Text);
                            }
                            returnTemp.CurrentCompanyCode = lblCompanyCode.Text;
                            if (lblDeliveryQty.Text == "")
                            {
                                returnTemp.DeliveryQty = 0;
                            }
                            else
                            {
                                returnTemp.DeliveryQty = Convert.ToDouble(lblDeliveryQty.Text);
                            }
                            returnTemp.DPT_CODE = "N/A";
                            returnTemp.EditDate = DateTime.Today;
                            // Guid user = (((SessionUser)Session["SessionUser"]).UserId);
                            returnTemp.EditUser       = user;
                            returnTemp.EID            = "N/A";
                            returnTemp.OCode          = Ocode;
                            returnTemp.OldCompanyCode = CentralCode.ToString();
                            returnTemp.ProductGroup   = lblproductGroup.Text;
                            returnTemp.ProductId      = Convert.ToInt32(lblBarCode.Text);
                            returnTemp.ProductName    = lblproductName.Text;
                            returnTemp.PurchaseDate   = Convert.ToDateTime(lblPurchaseDate.Text);
                            if (lblReceiveQuantity.Text == "")
                            {
                                returnTemp.ReceiveQuantity = 0;
                            }
                            else
                            {
                                returnTemp.ReceiveQuantity = Convert.ToDouble(lblReceiveQuantity.Text);
                            }

                            returnTemp.Store_Code        = ddlStore.SelectedValue.ToString();
                            returnTemp.StyleSize         = lblStyleAndSize.Text;
                            returnTemp.SupplierCode      = ddlSupplierTo.SelectedValue.ToString();
                            returnTemp.SupplierReturnQty = ReturnQty;
                            returnTemp.UnitName          = lblUnitName.Text;
                            returnTemp.ProgramId         = 0;

                            _context.Inv_Return_Temp.AddObject(returnTemp);
                        }
                    }
                    _context.SaveChanges();


                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Return Process Temporary successfully')", true);
                    GridShow.DataSource = null;
                    GridShow.DataBind();
                    List <productsDetails> details = _BuyCentral.GetAllProduct_ReturnTemp_ChallanNo_DPT(user, Ocode).ToList();
                    if (details.Count > 0)
                    {
                        grdTransfer.DataSource = details;
                        grdTransfer.DataBind();
                    }
                    else
                    {
                        grdTransfer.DataSource = null;
                        grdTransfer.DataBind();
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Item Selected!')", true);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
            //try
            //{

            //    string BarCode = hdnBarCode.Value.ToString();
            //    if (BarCode == string.Empty || txtBalanceQty.Text == string.Empty || ddlSupplierTo.SelectedValue == "0" || ddlStore.SelectedValue == "0" || txtReturnQty.Text == "0")
            //    {
            //        //lblMessage.Text = "<font color='red'>Invalid data. Please be correct and try again!</font>";
            //        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Invalid data. Please be correct and try again!')", true);
            //        return;
            //    }
            //    if (double.Parse(txtReturnQty.Text) > double.Parse(txtBalanceQty.Text))
            //    {
            //        // lblMessage.Text = "<font color='red'>Sorry! You cannot return more then you have. Please be correct and try again!</font>";
            //        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Sorry! You cannot return more then you have. Please be correct and try again!')", true);
            //        return;
            //    }

            //    Hashtable ht = new Hashtable();
            //    ht.Add("ReturnType", "SupplierReturn"); //SupplierReturn
            //    ht.Add("BarCode", BarCode);
            //    ht.Add("ChallanNo", txtChalanNo.Text);
            //    ht.Add("ReturnChallanNo", txtChalanNoReturn.Text);
            //    ht.Add("ReturnQty", txtReturnQty.Text);
            //    ht.Add("ReturnDate", txtDate.Text);
            //    ht.Add("DPT_CODE", "NA");
            //    ht.Add("EID", "NA");
            //    ht.Add("SupplierCode", ddlSupplierTo.SelectedValue.ToString());
            //    ht.Add("CenterCode", "NA");
            //    ht.Add("StoreCode", ddlStore.SelectedValue.ToString());
            //    ht.Add("OCode", ((SessionUser)Session["SessionUser"]).OCode.ToString());
            //    ht.Add("CompanyCode", CentralCode.ToString());
            //    ht.Add("BalanceQuanity", txtRemainingQty.Text);
            //    ht.Add("EditUser", ((SessionUser)Session["SessionUser"]).UserId);

            //    //ht.Add("OCode", "8989");
            //    DataTable dt = ic.ReturnProductStoreWise(ht);
            //    // lblMessage.Text = "<font color='green'>Product has been returned successfully!</font>";
            //    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Item Returned Successfully')", true);
            //    grdTransfer.DataSource = dt;
            //    grdTransfer.DataBind();
            //    //txtBalQty.Text = txtRemainQty.Text;
            //    ClearForm();
            //}
            //catch (Exception ex)
            //{
            //    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            //}
        }
Esempio n. 16
0
        protected void ddlProduct_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                lblMessage.Text = "";
                string barCode = ddlProduct.SelectedValue.ToString();
                //string cmpCode = ddlCompanyFrom.SelectedValue.ToString();
                hdnBarCode.Value = ddlProduct.SelectedValue.ToString();
                //string EID = ddlEmployee.SelectedValue.ToString();
                string    EID = "";
                DataTable dt  = ic.GetProductInforByBarCode(barCode);
                //if (ddlStore.SelectedValue == "CNT")
                //{
                //    List<productsDetails> details = buyBll.GetAllProductBuyReturn(EID, barCode, ddlStore.SelectedValue.ToString()).ToList();
                //    if (details.Count > 0)
                //    {
                //        GridShow.DataSource = details;
                //        GridShow.DataBind();

                //    }
                //    else
                //    {
                //        GridShow.DataSource = null;
                //        GridShow.DataBind();
                //    }
                //}
                //else

                List <productsDetails> details = buyBll.GetAllProductBuyReturn(EID, barCode, ddlStore.SelectedValue.ToString()).ToList();
                if (details.Count > 0)
                {
                    GridShow.DataSource = details;
                    GridShow.DataBind();
                }
                else
                {
                    GridShow.DataSource = null;
                    GridShow.DataBind();
                }


                //int employeeStock = ic.GetEmployeeStockStoreWise(ddlEmployee.SelectedValue, barCode,ddlStore.SelectedValue.ToString());
                //foreach (DataRow dr in dt.Rows)
                //{
                //    //txtSize.Text = dr["StyleSize"].ToString();
                //    if (employeeStock <= 0)
                //    {
                //        txtReturnQty.Enabled = false;
                //        txtBalanceQty.Text = "0";
                //    }
                //    else
                //    {
                //        txtReturnQty.Enabled = true;
                //        txtBalanceQty.Text = employeeStock.ToString();
                //    }
                //    //txtCurrentLocation.Text = dr["Location"].ToString();
                //}
                //List<productsDetails> details = buyBll.GetAllProductWithChallanNoAndDPTCode(barCode, ddlStore.SelectedValue.ToString(),ddlDepartment.SelectedValue.ToString()).ToList();
                //if (details.Count > 0)
                //{
                //    GridShow.DataSource = details;
                //    GridShow.DataBind();

                //}
                //else
                //{
                //    GridShow.DataSource = null;
                //    GridShow.DataBind();
                //}
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }