示例#1
0
        public clsSizeCodePriceList GetPriceBySizeCode(string sizecode)
        {
            clsSizeCodePriceList info = new clsSizeCodePriceList();

            using (SqlConnection conn = new SqlConnection(strConn))
            {
                conn.Open();

                using (SqlCommand cmd = new SqlCommand("TMR_USP_PriceBySizeCode"))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Connection  = conn;
                    cmd.Parameters.AddWithValue("@SizeCode", sizecode);

                    SqlDataReader reader = cmd.ExecuteReader();

                    while (reader.Read())
                    {
                        info.dPrice = Convert.ToDecimal(reader["Price"]);
                    }
                    conn.Close();
                }
            }
            return(info);
        }
示例#2
0
        public clsSizeCodePriceList GetSizeCodePriceList(clsSizeCodePriceList Sinfo)
        {
            clsSizeCodePriceList lst = new clsSizeCodePriceList();

            using (SqlConnection conn = new SqlConnection(strConn))
            {
                conn.Open();

                using (SqlCommand cmd = new SqlCommand("TMR_USP_GetSizeCodePriceList"))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Connection  = conn;
                    cmd.Parameters.AddWithValue("@ProjectID", Sinfo.strProjectID);
                    cmd.Parameters.AddWithValue("@BlockID", Sinfo.strBlockID);
                    cmd.Parameters.AddWithValue("@SizeCode", Sinfo.strSizeCode);
                    SqlDataReader reader = cmd.ExecuteReader();

                    while (reader.Read())
                    {
                        if (lst.dPrice != null)
                        {
                            lst.dPrice = Convert.ToDecimal(reader["Price"].ToString());
                        }
                        else if (lst.dPrice == null || lst.dPrice == 0)
                        {
                            lst.dPrice = Convert.ToDecimal("0.00");
                        }
                    }
                    conn.Close();
                }
            }
            return(lst);
        }
        private void DataGridRefresh()
        {
            if (cmbProject.SelectedIndex == -1)
            {
                return;
            }
            if (cmbBlock.SelectedIndex == -1)
            {
                return;
            }

            dgList.Rows.Clear();

            if (id == 0)
            {
                if (cmbBlock.Text == "All")
                {
                    foreach (var sizeCode in lstSizecodes)
                    {
                        foreach (var block in lstBlocks)
                        {
                            int index = dgList.Rows.Add();
                            dgList.Rows[index].Cells["SizeCode"].Value = sizeCode.strUnitSizeCode;
                            dgList.Rows[index].Cells["RowId"].Value    = 0;
                            dgList.Rows[index].Cells["BlockID"].Value  = block.BlockNo;

                            clspricelist.strProjectID = cmbProject.Text;
                            clspricelist.strBlockID   = block.BlockNo;
                            clspricelist.strSizeCode  = sizeCode.strUnitSizeCode;

                            clsSizeCodePriceList price = da.GetSizeCodePriceList(clspricelist);
                            dgList.Rows[index].Cells["OldPrice"].Value = price.dPrice.ToString();
                        }
                    }
                }
                else
                {
                    foreach (var sizeCode in lstSizecodes)
                    {
                        int index = dgList.Rows.Add();
                        dgList.Rows[index].Cells["SizeCode"].Value = sizeCode.strUnitSizeCode;
                        dgList.Rows[index].Cells["RowId"].Value    = 0;
                        dgList.Rows[index].Cells["BlockID"].Value  = cmbBlock.Text;

                        clspricelist.strProjectID = cmbProject.Text;
                        clspricelist.strBlockID   = cmbBlock.Text;
                        clspricelist.strSizeCode  = sizeCode.strUnitSizeCode;

                        clsSizeCodePriceList price = da.GetSizeCodePriceList(clspricelist);
                        dgList.Rows[index].Cells["OldPrice"].Value = price.dPrice.ToString();
                    }
                }
            }
        }
示例#4
0
        public bool AddSizeCodePriceList(clsSizeCodePriceList info)
        {
            int st = 0;

            try
            {
                using (SqlConnection conn = new SqlConnection(strConn))
                {
                    conn.Open();

                    {
                        using (SqlCommand cmd = new SqlCommand("TMR_USP_AddSizeCodePriceList"))
                        {
                            cmd.CommandType = CommandType.StoredProcedure;
                            cmd.Connection  = conn;
                            cmd.Parameters.AddWithValue("@ProjectID", info.strProjectID);
                            cmd.Parameters.AddWithValue("@BlockID", info.strBlockID);
                            cmd.Parameters.AddWithValue("@SizeCode", info.strSizeCode);
                            cmd.Parameters.AddWithValue("@Price", info.dPrice);
                            cmd.Parameters.AddWithValue("@Fk_RevaluationID", info.Fk_RevaluationID);
                            cmd.Parameters.AddWithValue("@id", info.id);

                            st = cmd.ExecuteNonQuery();
                        }
                    }
                    conn.Close();
                }
            }
            catch (Exception ex) { }
            if (st > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }